Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
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
coco
Commits
a447a0a9
Unverified
Commit
a447a0a9
authored
Dec 26, 2018
by
老广
Committed by
GitHub
Dec 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #155 from jumpserver/bugfix
[Bugfix] 修复搜索时失败
parents
9591d717
4d393acd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
interactive.py
coco/interactive.py
+14
-13
No files found.
coco/interactive.py
View file @
a447a0a9
...
...
@@ -43,7 +43,7 @@ class InteractiveServer:
self
.
total_count
=
0
# 分页展示中的资产总数量
self
.
node_tree
=
None
# 授权节点树
self
.
load_user_assets_from_cache
()
self
.
get_user_assets_async
()
self
.
get_user_assets_a
nd_update_a
sync
()
self
.
get_user_nodes_async
()
@property
...
...
@@ -162,10 +162,16 @@ class InteractiveServer:
self
.
display_assets_paging
(
assets
)
def
refresh_assets_nodes
(
self
):
self
.
get_user_assets_async
()
self
.
get_user_assets_a
nd_update_a
sync
()
self
.
get_user_nodes_async
()
def
wait_until_assets_load
(
self
):
while
self
.
assets
is
None
and
\
self
.
get_user_assets_finished
is
False
:
time
.
sleep
(
0.2
)
def
search_assets
(
self
,
q
):
self
.
wait_until_assets_load
()
result
=
[]
# 所有的
...
...
@@ -194,10 +200,8 @@ class InteractiveServer:
#
def
display_assets
(
self
):
while
self
.
assets
is
None
and
not
self
.
get_user_assets_finished
:
time
.
sleep
(
0.5
)
if
self
.
assets
:
self
.
display_assets_paging
(
self
.
assets
)
self
.
wait_until_assets_load
()
self
.
display_assets_paging
(
self
.
assets
)
def
display_assets_paging
(
self
,
assets
):
if
len
(
assets
)
==
0
:
...
...
@@ -318,17 +322,14 @@ class InteractiveServer:
if
assets
:
self
.
total_asset_count
=
len
(
assets
)
def
set_user_assets_cache
(
self
,
assets
):
self
.
__class__
.
_user_assets_cached
[
self
.
client
.
user
.
id
]
=
assets
def
get_user_assets_async
(
self
):
thread
=
threading
.
Thread
(
target
=
self
.
get_user_assets
)
def
get_user_assets_and_update_async
(
self
):
thread
=
threading
.
Thread
(
target
=
self
.
get_user_assets_and_update
)
thread
.
start
()
def
get_user_assets
(
self
):
def
get_user_assets
_and_update
(
self
):
assets
=
app_service
.
get_user_assets
(
self
.
client
.
user
)
assets
=
self
.
filter_system_users
(
assets
)
self
.
set_user_assets_cache
(
assets
)
self
.
__class__
.
_user_assets_cached
[
self
.
client
.
user
.
id
]
=
assets
self
.
load_user_assets_from_cache
()
self
.
get_user_assets_finished
=
True
#
...
...
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