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
97865db8
Commit
97865db8
authored
Mar 06, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 支持缓存
parent
56630b9e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
28 deletions
+35
-28
interactive.py
coco/interactive.py
+8
-10
coco.mo
locale/en/LC_MESSAGES/coco.mo
+0
-0
coco.po
locale/en/LC_MESSAGES/coco.po
+13
-9
coco.mo
locale/zh_CN/LC_MESSAGES/coco.mo
+0
-0
coco.po
locale/zh_CN/LC_MESSAGES/coco.po
+14
-9
No files found.
coco/interactive.py
View file @
97865db8
...
@@ -135,7 +135,6 @@ class InteractiveServer:
...
@@ -135,7 +135,6 @@ class InteractiveServer:
self
.
display_banner
()
self
.
display_banner
()
elif
opt
in
[
'r'
,
'R'
]:
elif
opt
in
[
'r'
,
'R'
]:
self
.
refresh_assets_nodes
()
self
.
refresh_assets_nodes
()
self
.
display_banner
()
elif
opt
in
[
'h'
,
'H'
]:
elif
opt
in
[
'h'
,
'H'
]:
self
.
display_banner
()
self
.
display_banner
()
else
:
else
:
...
@@ -165,8 +164,9 @@ class InteractiveServer:
...
@@ -165,8 +164,9 @@ class InteractiveServer:
self
.
display_assets_paging
(
assets
)
self
.
display_assets_paging
(
assets
)
def
refresh_assets_nodes
(
self
):
def
refresh_assets_nodes
(
self
):
self
.
get_user_assets_and_update_async
()
self
.
get_user_assets_and_update
(
cache_policy
=
'2'
)
self
.
get_user_nodes_async
()
self
.
get_user_nodes
(
cache_policy
=
'2'
)
self
.
client
.
send_unicode
(
_
(
"Refresh done"
))
def
wait_until_assets_load
(
self
):
def
wait_until_assets_load
(
self
):
while
self
.
assets
is
None
and
\
while
self
.
assets
is
None
and
\
...
@@ -319,9 +319,7 @@ class InteractiveServer:
...
@@ -319,9 +319,7 @@ class InteractiveServer:
#
#
def
load_user_assets_from_cache
(
self
):
def
load_user_assets_from_cache
(
self
):
assets
=
self
.
__class__
.
_user_assets_cached
.
get
(
assets
=
self
.
__class__
.
_user_assets_cached
.
get
(
self
.
client
.
user
.
id
)
self
.
client
.
user
.
id
)
self
.
assets
=
assets
self
.
assets
=
assets
if
assets
:
if
assets
:
self
.
total_asset_count
=
len
(
assets
)
self
.
total_asset_count
=
len
(
assets
)
...
@@ -330,8 +328,8 @@ class InteractiveServer:
...
@@ -330,8 +328,8 @@ class InteractiveServer:
thread
=
threading
.
Thread
(
target
=
self
.
get_user_assets_and_update
)
thread
=
threading
.
Thread
(
target
=
self
.
get_user_assets_and_update
)
thread
.
start
()
thread
.
start
()
def
get_user_assets_and_update
(
self
):
def
get_user_assets_and_update
(
self
,
cache_policy
=
'1'
):
assets
=
app_service
.
get_user_assets
(
self
.
client
.
user
)
assets
=
app_service
.
get_user_assets
(
self
.
client
.
user
,
cache_policy
=
cache_policy
)
assets
=
self
.
filter_system_users
(
assets
)
assets
=
self
.
filter_system_users
(
assets
)
self
.
__class__
.
_user_assets_cached
[
self
.
client
.
user
.
id
]
=
assets
self
.
__class__
.
_user_assets_cached
[
self
.
client
.
user
.
id
]
=
assets
self
.
load_user_assets_from_cache
()
self
.
load_user_assets_from_cache
()
...
@@ -344,8 +342,8 @@ class InteractiveServer:
...
@@ -344,8 +342,8 @@ class InteractiveServer:
thread
=
threading
.
Thread
(
target
=
self
.
get_user_nodes
)
thread
=
threading
.
Thread
(
target
=
self
.
get_user_nodes
)
thread
.
start
()
thread
.
start
()
def
get_user_nodes
(
self
):
def
get_user_nodes
(
self
,
cache_policy
=
'1'
):
nodes
=
app_service
.
get_user_asset_groups
(
self
.
client
.
user
)
nodes
=
app_service
.
get_user_asset_groups
(
self
.
client
.
user
,
cache_policy
=
cache_policy
)
nodes
=
sorted
(
nodes
,
key
=
lambda
node
:
node
.
key
)
nodes
=
sorted
(
nodes
,
key
=
lambda
node
:
node
.
key
)
self
.
nodes
=
self
.
filter_system_users_of_assets_under_nodes
(
nodes
)
self
.
nodes
=
self
.
filter_system_users_of_assets_under_nodes
(
nodes
)
self
.
_construct_node_tree
()
self
.
_construct_node_tree
()
...
...
locale/en/LC_MESSAGES/coco.mo
View file @
97865db8
No preview for this file type
locale/en/LC_MESSAGES/coco.po
View file @
97865db8
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-0
2-21 20:00
+0800\n"
"POT-Creation-Date: 2019-0
3-06 14:51
+0800\n"
"PO-Revision-Date: 2018-08-10 10:42+0800\n"
"PO-Revision-Date: 2018-08-10 10:42+0800\n"
"Last-Translator: BaiJiangjie <bugatti_it@163.com>\n"
"Last-Translator: BaiJiangjie <bugatti_it@163.com>\n"
"Language-Team: Language locale/en/LC\n"
"Language-Team: Language locale/en/LC\n"
...
@@ -16,7 +16,7 @@ msgstr ""
...
@@ -16,7 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
#: coco/app.py:18
0
#: coco/app.py:18
2
msgid "Connect idle more than {} minutes, disconnect"
msgid "Connect idle more than {} minutes, disconnect"
msgstr ""
msgstr ""
...
@@ -83,10 +83,14 @@ msgstr ""
...
@@ -83,10 +83,14 @@ msgstr ""
msgid "{T}0) Enter {green}q{end} exit.{R}"
msgid "{T}0) Enter {green}q{end} exit.{R}"
msgstr ""
msgstr ""
#: coco/interactive.py:15
9
#: coco/interactive.py:15
8
msgid "Terminal does not support login rdp, please use web terminal to access"
msgid "Terminal does not support login rdp, please use web terminal to access"
msgstr ""
msgstr ""
#: coco/interactive.py:169
msgid "Refresh done"
msgstr ""
#: coco/interactive.py:211
#: coco/interactive.py:211
msgid "No Assets"
msgid "No Assets"
msgstr ""
msgstr ""
...
@@ -131,27 +135,27 @@ msgstr ""
...
@@ -131,27 +135,27 @@ msgstr ""
msgid "BACK: b/q"
msgid "BACK: b/q"
msgstr ""
msgstr ""
#: coco/interactive.py:37
3
#: coco/interactive.py:37
1
msgid "No Nodes"
msgid "No Nodes"
msgstr ""
msgstr ""
#: coco/interactive.py:37
7
#: coco/interactive.py:37
5
msgid "Node: [ ID.Name(Asset amount) ]"
msgid "Node: [ ID.Name(Asset amount) ]"
msgstr ""
msgstr ""
#: coco/interactive.py:37
9
#: coco/interactive.py:37
7
msgid "Tips: Enter g+NodeID to display the host under the node, such as g1"
msgid "Tips: Enter g+NodeID to display the host under the node, such as g1"
msgstr ""
msgstr ""
#: coco/interactive.py:38
7
#: coco/interactive.py:38
5
msgid "There is no matched node, please re-enter"
msgid "There is no matched node, please re-enter"
msgstr ""
msgstr ""
#: coco/interactive.py:41
7
#: coco/interactive.py:41
5
msgid "Select a login:: "
msgid "Select a login:: "
msgstr ""
msgstr ""
#: coco/interactive.py:4
40
#: coco/interactive.py:4
38
msgid "No system user"
msgid "No system user"
msgstr ""
msgstr ""
...
...
locale/zh_CN/LC_MESSAGES/coco.mo
View file @
97865db8
No preview for this file type
locale/zh_CN/LC_MESSAGES/coco.po
View file @
97865db8
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-0
2-21 20:00
+0800\n"
"POT-Creation-Date: 2019-0
3-06 14:51
+0800\n"
"PO-Revision-Date: 2018-08-10 10:42+0800\n"
"PO-Revision-Date: 2018-08-10 10:42+0800\n"
"Last-Translator: BaiJiangjie <bugatti_it@163.com>\n"
"Last-Translator: BaiJiangjie <bugatti_it@163.com>\n"
"Language-Team: Language locale/zh\n"
"Language-Team: Language locale/zh\n"
...
@@ -16,7 +16,7 @@ msgstr ""
...
@@ -16,7 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
#: coco/app.py:18
0
#: coco/app.py:18
2
msgid "Connect idle more than {} minutes, disconnect"
msgid "Connect idle more than {} minutes, disconnect"
msgstr "空闲时间超过 {} 分钟,断开连接"
msgstr "空闲时间超过 {} 分钟,断开连接"
...
@@ -25,6 +25,7 @@ msgid "Welcome to use Jumpserver open source fortress system"
...
@@ -25,6 +25,7 @@ msgid "Welcome to use Jumpserver open source fortress system"
msgstr "欢迎使用Jumpserver开源跳板机系统"
msgstr "欢迎使用Jumpserver开源跳板机系统"
#: coco/interactive.py:87
#: coco/interactive.py:87
#, python-brace-format
msgid ""
msgid ""
"\n"
"\n"
"{T}{T}{title} {user}, {header_title} {end}{R}{R}"
"{T}{T}{title} {user}, {header_title} {end}{R}{R}"
...
@@ -89,10 +90,14 @@ msgstr "{T}0) 输入 {green}r{end} 刷新最新的机器和节点信息.{R}"
...
@@ -89,10 +90,14 @@ msgstr "{T}0) 输入 {green}r{end} 刷新最新的机器和节点信息.{R}"
msgid "{T}0) Enter {green}q{end} exit.{R}"
msgid "{T}0) Enter {green}q{end} exit.{R}"
msgstr "{T}0) 输入 {green}q{end} 退出.{R}"
msgstr "{T}0) 输入 {green}q{end} 退出.{R}"
#: coco/interactive.py:15
9
#: coco/interactive.py:15
8
msgid "Terminal does not support login rdp, please use web terminal to access"
msgid "Terminal does not support login rdp, please use web terminal to access"
msgstr "终端不支持登录windows, 请使用web terminal访问"
msgstr "终端不支持登录windows, 请使用web terminal访问"
#: coco/interactive.py:169
msgid "Refresh done"
msgstr "刷新完成"
#: coco/interactive.py:211
#: coco/interactive.py:211
msgid "No Assets"
msgid "No Assets"
msgstr "没有资产"
msgstr "没有资产"
...
@@ -137,27 +142,27 @@ msgstr "下一页: Enter|N/n"
...
@@ -137,27 +142,27 @@ msgstr "下一页: Enter|N/n"
msgid "BACK: b/q"
msgid "BACK: b/q"
msgstr "返回: B/b"
msgstr "返回: B/b"
#: coco/interactive.py:37
3
#: coco/interactive.py:37
1
msgid "No Nodes"
msgid "No Nodes"
msgstr "没有节点"
msgstr "没有节点"
#: coco/interactive.py:37
7
#: coco/interactive.py:37
5
msgid "Node: [ ID.Name(Asset amount) ]"
msgid "Node: [ ID.Name(Asset amount) ]"
msgstr "节点: [ ID.名称(资产数量) ]"
msgstr "节点: [ ID.名称(资产数量) ]"
#: coco/interactive.py:37
9
#: coco/interactive.py:37
7
msgid "Tips: Enter g+NodeID to display the host under the node, such as g1"
msgid "Tips: Enter g+NodeID to display the host under the node, such as g1"
msgstr "提示: 输入 g+节点ID 显示节点下主机. 如: g1"
msgstr "提示: 输入 g+节点ID 显示节点下主机. 如: g1"
#: coco/interactive.py:38
7
#: coco/interactive.py:38
5
msgid "There is no matched node, please re-enter"
msgid "There is no matched node, please re-enter"
msgstr "没有匹配分组,请重新输入"
msgstr "没有匹配分组,请重新输入"
#: coco/interactive.py:41
7
#: coco/interactive.py:41
5
msgid "Select a login:: "
msgid "Select a login:: "
msgstr "选择一个登录:"
msgstr "选择一个登录:"
#: coco/interactive.py:4
40
#: coco/interactive.py:4
38
msgid "No system user"
msgid "No system user"
msgstr "没有系统用户"
msgstr "没有系统用户"
...
...
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