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
3e73dbdb
Commit
3e73dbdb
authored
Jun 21, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改小问题
parent
04655b90
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
27 deletions
+2
-27
asset.py
apps/assets/models/asset.py
+0
-21
system_user_asset.html
apps/assets/templates/assets/system_user_asset.html
+2
-2
utils.py
apps/assets/utils.py
+0
-4
No files found.
apps/assets/models/asset.py
View file @
3e73dbdb
...
...
@@ -134,13 +134,6 @@ class Asset(OrgModelMixin):
comment
=
models
.
TextField
(
max_length
=
128
,
default
=
''
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
))
objects
=
AssetManager
.
from_queryset
(
AssetQuerySet
)()
CONNECTIVITY_CACHE_KEY
=
'_JMS_ASSET_CONNECTIVITY_{}'
UNREACHABLE
,
REACHABLE
,
UNKNOWN
=
range
(
0
,
3
)
CONNECTIVITY_CHOICES
=
(
(
UNREACHABLE
,
_
(
"Unreachable"
)),
(
REACHABLE
,
_
(
'Reachable'
)),
(
UNKNOWN
,
_
(
"Unknown"
)),
)
def
__str__
(
self
):
return
'{0.hostname}({0.ip})'
.
format
(
self
)
...
...
@@ -215,20 +208,6 @@ class Asset(OrgModelMixin):
nodes
=
list
(
reduce
(
lambda
x
,
y
:
set
(
x
)
|
set
(
y
),
nodes
))
return
nodes
@classmethod
def
get_queryset_by_fullname_list
(
cls
,
fullname_list
):
org_fullname_map
=
defaultdict
(
list
)
for
fullname
in
fullname_list
:
hostname
,
org
=
cls
.
split_fullname
(
fullname
)
org_fullname_map
[
org
]
.
append
(
hostname
)
filter_arg
=
Q
()
for
org
,
hosts
in
org_fullname_map
.
items
():
if
org
.
is_real
():
filter_arg
|=
Q
(
hostname__in
=
hosts
,
org_id
=
org
.
id
)
else
:
filter_arg
|=
Q
(
Q
(
org_id__isnull
=
True
)
|
Q
(
org_id
=
''
),
hostname__in
=
hosts
)
return
Asset
.
objects
.
filter
(
filter_arg
)
@property
def
cpu_info
(
self
):
info
=
""
...
...
apps/assets/templates/assets/system_user_asset.html
View file @
3e73dbdb
...
...
@@ -25,7 +25,7 @@
</ul>
</div>
<div
class=
"tab-content"
>
<div
class=
"col-sm-
8
"
style=
"padding-left: 0;"
>
<div
class=
"col-sm-
9
"
style=
"padding-left: 0;"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<span
style=
"float: left"
>
{% trans 'Assets of ' %}
<b>
{{ system_user.name }}
</b><span
class=
"badge"
>
{{ paginator.count }}
</span></span>
...
...
@@ -48,7 +48,7 @@
</div>
</div>
</div>
<div
class=
"col-sm-
4
"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"col-sm-
3
"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick update' %}
...
...
apps/assets/utils.py
View file @
3e73dbdb
...
...
@@ -16,10 +16,6 @@ def get_system_users_by_id_list(id_list):
return
SystemUser
.
objects
.
filter
(
id__in
=
id_list
)
def
get_assets_by_fullname_list
(
hostname_list
):
return
Asset
.
get_queryset_by_fullname_list
(
hostname_list
)
def
get_system_user_by_name
(
name
):
system_user
=
get_object_or_none
(
SystemUser
,
name
=
name
)
return
system_user
...
...
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