Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
158678c2
Commit
158678c2
authored
Dec 28, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修改bug,显示cluster
parent
2cceb281
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
10 deletions
+17
-10
serializers.py
apps/assets/serializers.py
+6
-0
asset_list.html
apps/assets/templates/assets/asset_list.html
+5
-4
cluster_assets.html
apps/assets/templates/assets/cluster_assets.html
+1
-1
system_user_asset.html
apps/assets/templates/assets/system_user_asset.html
+1
-1
system_user_detail.html
apps/assets/templates/assets/system_user_detail.html
+1
-1
asset_permission_detail.html
apps/perms/templates/perms/asset_permission_detail.html
+1
-1
user_detail.html
apps/users/templates/users/user_detail.html
+1
-1
user_group_detail.html
apps/users/templates/users/user_group_detail.html
+1
-1
No files found.
apps/assets/serializers.py
View file @
158678c2
...
@@ -151,6 +151,8 @@ class AssetSerializer(BulkSerializerMixin, serializers.ModelSerializer):
...
@@ -151,6 +151,8 @@ class AssetSerializer(BulkSerializerMixin, serializers.ModelSerializer):
"""
"""
资产的数据结构
资产的数据结构
"""
"""
cluster_name
=
serializers
.
SerializerMethodField
()
class
Meta
(
object
):
class
Meta
(
object
):
model
=
Asset
model
=
Asset
list_serializer_class
=
BulkListSerializer
list_serializer_class
=
BulkListSerializer
...
@@ -165,6 +167,10 @@ class AssetSerializer(BulkSerializerMixin, serializers.ModelSerializer):
...
@@ -165,6 +167,10 @@ class AssetSerializer(BulkSerializerMixin, serializers.ModelSerializer):
])
])
return
fields
return
fields
@staticmethod
def
get_cluster_name
(
obj
):
return
obj
.
cluster
.
name
class
AssetGrantedSerializer
(
serializers
.
ModelSerializer
):
class
AssetGrantedSerializer
(
serializers
.
ModelSerializer
):
"""
"""
...
...
apps/assets/templates/assets/asset_list.html
View file @
158678c2
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
<th
class=
"text-center"
>
{% trans 'Hostname' %}
</th>
<th
class=
"text-center"
>
{% trans 'Hostname' %}
</th>
<th
class=
"text-center"
>
{% trans 'IP' %}
</th>
<th
class=
"text-center"
>
{% trans 'IP' %}
</th>
<th
class=
"text-center"
>
{% trans 'Port' %}
</th>
<th
class=
"text-center"
>
{% trans 'Port' %}
</th>
<th
class=
"text-center"
>
{% trans 'Cluster' %}
</th>
<th
class=
"text-center"
>
{% trans 'Type' %}
</th>
<th
class=
"text-center"
>
{% trans 'Type' %}
</th>
<th
class=
"text-center"
>
{% trans 'Env' %}
</th>
<th
class=
"text-center"
>
{% trans 'Env' %}
</th>
<th
class=
"text-center"
>
{% trans 'Hardware' %}
</th>
<th
class=
"text-center"
>
{% trans 'Hardware' %}
</th>
...
@@ -74,14 +75,14 @@ function initTable() {
...
@@ -74,14 +75,14 @@ function initTable() {
var
detail_btn
=
'<a href="{{ the_url }}">'
+
cellData
+
'</a>'
;
var
detail_btn
=
'<a href="{{ the_url }}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'{{ DEFAULT_PK }}'
,
rowData
.
id
));
$
(
td
).
html
(
detail_btn
.
replace
(
'{{ DEFAULT_PK }}'
,
rowData
.
id
));
}},
}},
{
targets
:
7
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
8
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'<i class="fa fa-times text-danger"></i>'
)
$
(
td
).
html
(
'<i class="fa fa-times text-danger"></i>'
)
}
else
{
}
else
{
$
(
td
).
html
(
'<i class="fa fa-check text-navy"></i>'
)
$
(
td
).
html
(
'<i class="fa fa-check text-navy"></i>'
)
}
}
}},
}},
{
targets
:
8
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
9
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
cellData
==
'Unknown'
){
if
(
cellData
==
'Unknown'
){
$
(
td
).
html
(
'<i class="fa fa-circle text-warning"></i>'
)
$
(
td
).
html
(
'<i class="fa fa-circle text-warning"></i>'
)
}
else
if
(
!
cellData
)
{
}
else
if
(
!
cellData
)
{
...
@@ -90,14 +91,14 @@ function initTable() {
...
@@ -90,14 +91,14 @@ function initTable() {
$
(
td
).
html
(
'<i class="fa fa-circle text-navy"></i>'
)
$
(
td
).
html
(
'<i class="fa fa-circle text-navy"></i>'
)
}
}
}},
}},
{
targets
:
9
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
targets
:
10
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "assets:asset-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
"{{ DEFAULT_PK }}"
,
cellData
);
var
update_btn
=
'<a href="{% url "assets:asset-update" pk=DEFAULT_PK %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
"{{ DEFAULT_PK }}"
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_asset_delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_asset_delete" data-uid="{{ DEFAULT_PK }}">{% trans "Delete" %}</a>'
.
replace
(
'{{ DEFAULT_PK }}'
,
cellData
);
$
(
td
).
html
(
update_btn
+
del_btn
)
$
(
td
).
html
(
update_btn
+
del_btn
)
}}
}}
],
],
ajax_url
:
'{% url "api-assets:asset-list" %}'
,
ajax_url
:
'{% url "api-assets:asset-list" %}'
,
columns
:
[{
data
:
"id"
},
{
data
:
"hostname"
},
{
data
:
"ip"
},
{
data
:
"port"
},
columns
:
[{
data
:
"id"
},
{
data
:
"hostname"
},
{
data
:
"ip"
},
{
data
:
"port"
},
{
data
:
"cluster_name"
},
{
data
:
"get_type_display"
},
{
data
:
"get_env_display"
},
{
data
:
"hardware_info"
},
{
data
:
"get_type_display"
},
{
data
:
"get_env_display"
},
{
data
:
"hardware_info"
},
{
data
:
"is_active"
},
{
data
:
"is_connective"
},
{
data
:
"id"
}],
{
data
:
"is_active"
},
{
data
:
"is_connective"
},
{
data
:
"id"
}],
op_html
:
$
(
'#actions'
).
html
()
op_html
:
$
(
'#actions'
).
html
()
...
...
apps/assets/templates/assets/cluster_assets.html
View file @
158678c2
...
@@ -181,7 +181,7 @@ function initTable() {
...
@@ -181,7 +181,7 @@ function initTable() {
}
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
()
;
$
(
'.select2'
).
select2
()
.
on
(
"select2:select"
,
function
(
evt
)
{
.
on
(
"select2:select"
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
jumpserver
.
assets_selected
[
data
.
id
]
=
data
.
text
;
jumpserver
.
assets_selected
[
data
.
id
]
=
data
.
text
;
...
...
apps/assets/templates/assets/system_user_asset.html
View file @
158678c2
...
@@ -125,7 +125,7 @@ function initAssetsTable() {
...
@@ -125,7 +125,7 @@ function initAssetsTable() {
}
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
()
;
$
(
'.select2'
).
select2
()
.
on
(
"select2:select"
,
function
(
evt
)
{
.
on
(
"select2:select"
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
jumpserver
.
assets_selected
[
data
.
id
]
=
data
.
text
;
jumpserver
.
assets_selected
[
data
.
id
]
=
data
.
text
;
...
...
apps/assets/templates/assets/system_user_detail.html
View file @
158678c2
...
@@ -212,7 +212,7 @@ function updateSystemUserCluster(clusters) {
...
@@ -212,7 +212,7 @@ function updateSystemUserCluster(clusters) {
}
}
jumpserver
.
cluster_selected
=
{};
jumpserver
.
cluster_selected
=
{};
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
()
;
$
(
'.select2'
).
select2
()
.
on
(
'select2:select'
,
function
(
evt
)
{
.
on
(
'select2:select'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
jumpserver
.
cluster_selected
[
data
.
id
]
=
data
.
text
;
jumpserver
.
cluster_selected
[
data
.
id
]
=
data
.
text
;
...
...
apps/perms/templates/perms/asset_permission_detail.html
View file @
158678c2
...
@@ -190,7 +190,7 @@ function updateSystemUser(system_users) {
...
@@ -190,7 +190,7 @@ function updateSystemUser(system_users) {
}
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
()
;
$
(
'.select2'
).
select2
()
.
on
(
'select2:select'
,
function
(
evt
)
{
.
on
(
'select2:select'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
jumpserver
.
system_users_selected
[
data
.
id
]
=
data
.
text
;
jumpserver
.
system_users_selected
[
data
.
id
]
=
data
.
text
;
...
...
apps/users/templates/users/user_detail.html
View file @
158678c2
...
@@ -253,7 +253,7 @@ function updateUserGroups(groups) {
...
@@ -253,7 +253,7 @@ function updateUserGroups(groups) {
}
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
()
;
$
(
'.select2'
).
select2
()
.
on
(
'select2:select'
,
function
(
evt
)
{
.
on
(
'select2:select'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
jumpserver
.
groups_selected
[
data
.
id
]
=
data
.
text
;
jumpserver
.
groups_selected
[
data
.
id
]
=
data
.
text
;
...
...
apps/users/templates/users/user_group_detail.html
View file @
158678c2
...
@@ -150,7 +150,7 @@ function updateGroupMember(users) {
...
@@ -150,7 +150,7 @@ function updateGroupMember(users) {
}
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
()
;
$
(
'.select2'
).
select2
()
.
on
(
'select2:select'
,
function
(
evt
)
{
.
on
(
'select2:select'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
jumpserver
.
users_selected
[
data
.
id
]
=
data
.
text
;
jumpserver
.
users_selected
[
data
.
id
]
=
data
.
text
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment