Unverified Commit 68f5b566 authored by 老广's avatar 老广 Committed by GitHub

Merge pull request #55 from jumpserver/hide

[Update] Hide bar
parents c49d8020 022c37c9
#!/usr/bin/env python3 #!/usr/bin/env python3
# coding: utf-8
import eventlet import eventlet
...@@ -41,138 +40,61 @@ app = Flask(__name__, template_folder='dist') ...@@ -41,138 +40,61 @@ app = Flask(__name__, template_folder='dist')
socketio = None socketio = None
nodes = [{'id': '6353b2d3-54f1-4354-bede-fe8d8eebfe0c', nodes = [{'iconSkin': '',
'key': '4', 'id': '0',
'name': '开发部', 'isParent': True,
'value': '开发部', 'meta': {'node': {'id': '08a2ba4c-238a-4e01-9f07-eb82b8e3377b',
'parent': '6353b2d3-54f1-4354-bede-fe8d8eebfe0c', 'key': '0',
'assets_granted': [{'id': '9e911ac3-7231-441b-9123-e1945e93c0b0', 'name': 'ROOT',
'hostname': 'Test-48', 'value': 'ROOT'},
'ip': '172.15.1.48', 'type': 'node'},
'port': 22, 'name': 'ROOT (2)',
'system_users_granted': [{'id': '859274bb-dc6e-4890-87dc-eefddf0ea8c1', 'open': True,
'name': '111', 'pId': '',
'username': '1', 'title': 'ROOT (2)'},
'priority': 20, {'iconSkin': 'linux',
'protocol': 'ssh', 'id': 'f4d3b256-c19b-4472-9a53-b9f48e51f311',
'comment': '', 'isParent': False,
'login_mode': 'auto'}], 'meta': {'asset': {'comment': '',
'is_active': True,
'system_users_join': '1',
'os': None,
'domain': None, 'domain': None,
'platform': 'Linux', 'hostname': 'centos',
'comment': '', 'id': 'f4d3b256-c19b-4472-9a53-b9f48e51f311',
'protocol': 'ssh', 'ip': '192.168.244.142',
'org_id': 'e338bd97-bdb1-47b1-95f7-4994776488b5',
'org_name': '开发部'}],
'assets_amount': 1,
'org_id': 'e338bd97-bdb1-47b1-95f7-4994776488b5'},
{'id': 'cd3c1d48-4bf0-43e1-bca1-0817a1295e22',
'key': '5:23:0:1',
'name': '新节点 2',
'value': '新节点 2',
'parent': 'a3852030-eeb5-4c0f-ba57-32cce42c8333',
'assets_granted': [{'id': '9590ebfa-5720-461d-835f-fecfe6245c67',
'hostname': 'Test-48',
'ip': '172.15.1.48',
'port': 22,
'system_users_granted': [{'id': 'e2b1900f-b0e6-4813-b90a-7216d670a1cd',
'name': 'test_SSH',
'username': 'test',
'priority': 10,
'protocol': 'ssh',
'comment': '',
'login_mode': 'auto'}],
'is_active': True, 'is_active': True,
'system_users_join': 'test',
'os': None,
'domain': None,
'platform': 'Linux', 'platform': 'Linux',
'comment': '',
'protocol': 'ssh',
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248',
'org_name': '测试部'}],
'assets_amount': 1,
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248'},
{'id': 'a3852030-eeb5-4c0f-ba57-32cce42c8333',
'key': '5:23:0',
'name': '新节点 1',
'value': '新节点 1',
'parent': '39c0f461-e9c2-4ef5-926d-3308ae9c43d8',
'assets_granted': [],
'assets_amount': 0,
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248'},
{'id': '39c0f461-e9c2-4ef5-926d-3308ae9c43d8',
'key': '5:23',
'name': 'hbase',
'value': 'hbase',
'parent': 'd49f0fb2-ad3e-4f13-835f-12c13329f3be',
'assets_granted': [],
'assets_amount': 0,
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248'},
{'id': 'd49f0fb2-ad3e-4f13-835f-12c13329f3be',
'key': '5',
'name': '测试部',
'value': '测试部',
'parent': 'd49f0fb2-ad3e-4f13-835f-12c13329f3be',
'assets_granted': [],
'assets_amount': 0,
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248'},
{'id': 'c10cb68a-816d-4030-9a7b-e9a22a83818a',
'key': '5:12',
'name': '测试资产666',
'value': '测试资产666',
'parent': 'd49f0fb2-ad3e-4f13-835f-12c13329f3be',
'assets_granted': [{'id': '9590ebfa-5720-461d-835f-fecfe6245c67',
'hostname': 'Test-48',
'ip': '172.15.1.48',
'port': 22, 'port': 22,
'system_users_granted': [{'id': 'e2b1900f-b0e6-4813-b90a-7216d670a1cd', 'protocol': 'ssh'},
'name': 'test_SSH', 'system_users': [{'comment': '',
'username': 'test', 'id': '2fb10ed2-db03-4c69-9fc1-aacbb2a9cc75',
'priority': 10, 'login_mode': 'auto',
'name': 'web',
'priority': 20,
'protocol': 'ssh', 'protocol': 'ssh',
'comment': '', 'username': 'web'}],
'login_mode': 'auto'}], 'type': 'asset'},
'is_active': True, 'name': 'centos',
'system_users_join': 'test', 'open': False,
'os': None, 'pId': '0',
'title': '192.168.244.142'},
{'iconSkin': 'windows',
'id': '741127ed-1e51-46c0-8d3d-f8a7d215b70d',
'isParent': False,
'meta': {'asset': {'comment': '',
'domain': None, 'domain': None,
'platform': 'Linux', 'hostname': 'windows',
'comment': '', 'id': '741127ed-1e51-46c0-8d3d-f8a7d215b70d',
'protocol': 'ssh', 'ip': '192.168.244.142',
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248',
'org_name': '测试部'}],
'assets_amount': 1,
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248'},
{'id': 'c57099a1-f1fc-48d2-9d0c-611ed65560b2',
'key': '5:3',
'name': '测试资产265465',
'value': '测试资产265465',
'parent': 'd49f0fb2-ad3e-4f13-835f-12c13329f3be',
'assets_granted': [{'id': '965e86b1-b09a-4c1e-8b6c-784803fdeeaf',
'hostname': 'Test01-22',
'ip': '172.15.2.22',
'port': 22,
'system_users_granted': [{'id': 'e2b1900f-b0e6-4813-b90a-7216d670a1cd',
'name': 'test_SSH',
'username': 'test',
'priority': 10,
'protocol': 'ssh',
'comment': '',
'login_mode': 'auto'}],
'is_active': True, 'is_active': True,
'system_users_join': 'test', 'platform': 'Windows',
'os': None, 'port': 3389,
'domain': None, 'protocol': 'rdp'},
'platform': 'Linux', 'system_users': [],
'comment': '', 'type': 'asset'},
'protocol': 'ssh', 'name': 'windows',
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248', 'open': False,
'org_name': '测试部'}], 'pId': '0',
'assets_amount': 1, 'title': '192.168.244.142'}]
'org_id': '8eb2637c-e14f-41f1-b1b1-00a2dfa20248'}]
class ProxyServer: class ProxyServer:
def __init__(self, client, asset, system_user): def __init__(self, client, asset, system_user):
...@@ -195,6 +117,7 @@ class ProxyServer: ...@@ -195,6 +117,7 @@ class ProxyServer:
break break
self.server.send(data) self.server.send(data)
elif self.client.change_size_evt in r: elif self.client.change_size_evt in r:
self.client.change_size_evt.recv(1)
self.resize_win_size() self.resize_win_size()
def resize_win_size(self): def resize_win_size(self):
...@@ -206,7 +129,7 @@ class ProxyServer: ...@@ -206,7 +129,7 @@ class ProxyServer:
def ssh_with_password(self, width=80, height=24): def ssh_with_password(self, width=80, height=24):
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("192.168.244.177", 22, "root", "redhat123") ssh.connect("192.168.244.142", 22, "root", "redhat")
chan = ssh.invoke_shell(term='xterm', width=width, height=height) chan = ssh.invoke_shell(term='xterm', width=width, height=height)
return chan return chan
...@@ -271,10 +194,9 @@ def send_js(path): ...@@ -271,10 +194,9 @@ def send_js(path):
return send_from_directory('dist', path) return send_from_directory('dist', path)
@app.route('/api/perms/v1/user/nodes-assets/') @app.route('/api/perms/v1/user/nodes-assets/tree/')
def asset_groups_assets(): def asset_groups_assets():
# node = json.loads(nodes) return jsonify(nodes)
return jsonify([])
@app.route('/api/terminal/v1/sessions/test/replay/') @app.route('/api/terminal/v1/sessions/test/replay/')
...@@ -297,15 +219,6 @@ def get_session_replay(pk): ...@@ -297,15 +219,6 @@ def get_session_replay(pk):
}) })
@app.route('/api/perms/v1/user/nodes/children/')
def get_nodes_children():
data1 = nodes
if request.args.get('id'):
return jsonify(data2)
else:
return jsonify(data1)
@app.route('/luna/i18n/<i18n>') @app.route('/luna/i18n/<i18n>')
def i18n(i18n): def i18n(i18n):
return send_file('./i18n/' + i18n) return send_file('./i18n/' + i18n)
......
{ {
"/api/perms/v1/user/nodes/children/": {
"target": "http://127.0.0.1:8080",
"secure": false
},
"/api": { "/api": {
"target": "http://127.0.0.1:8080", "target": "http://127.0.0.1:5001",
"secure": false "secure": false
}, },
"/luna/i18n": { "/luna/i18n": {
...@@ -12,7 +8,7 @@ ...@@ -12,7 +8,7 @@
"secure": false "secure": false
}, },
"/socket.io/": { "/socket.io/": {
"target": "http://127.0.0.1:5000", "target": "http://127.0.0.1:5001",
"secure": false, "secure": false,
"ws": true "ws": true
}, },
......
...@@ -92,6 +92,7 @@ export class CleftbarComponent implements OnInit { ...@@ -92,6 +92,7 @@ export class CleftbarComponent implements OnInit {
} }
}); });
}); });
window.dispatchEvent(new Event('resize'));
} }
constructor(private _appService: AppService, constructor(private _appService: AppService,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment