Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
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
luna
Commits
834d6a81
Commit
834d6a81
authored
Dec 09, 2017
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: python mock
parent
fca44ab8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
3 deletions
+159
-3
mock.py
mock.py
+156
-0
package-lock.json
package-lock.json
+1
-1
cleftbar.component.ts
src/app/ControlPage/cleftbar/cleftbar.component.ts
+2
-2
No files found.
mock.py
0 → 100644
View file @
834d6a81
#!/usr/bin/env python3
from
flask
import
Flask
,
send_from_directory
,
render_template
,
jsonify
from
flask_socketio
import
SocketIO
,
Namespace
,
emit
app
=
Flask
(
__name__
,
template_folder
=
'dist'
)
class
SSHws
(
Namespace
):
def
on_connect
(
self
):
pass
def
on_data
(
self
,
message
):
print
(
message
)
def
on_disconnect
(
self
):
pass
@app.route
(
'/luna/<path:path>'
)
def
send_js
(
path
):
return
send_from_directory
(
'dist'
,
path
)
@app.route
(
'/'
)
@app.route
(
'/luna/'
)
def
index
():
return
render_template
(
'index.html'
)
@app.route
(
'/api/perms/v1/user/my/asset-groups-assets/'
)
def
asset_groups_assets
():
assets
=
[
{
"id"
:
0
,
"name"
:
"ungrouped"
,
"assets"
:
[]
},
{
"id"
:
1
,
"name"
:
"Default"
,
"comment"
:
"Default asset group"
,
"assets"
:
[
{
"id"
:
2
,
"hostname"
:
"192.168.1.6"
,
"ip"
:
"192.168.2.6"
,
"port"
:
22
,
"system"
:
"windows"
,
"system_users"
:
[
{
"id"
:
1
,
"name"
:
"web"
,
"username"
:
"web"
,
"protocol"
:
"ssh"
,
"auth_method"
:
"P"
,
"auto_push"
:
True
}
]
},
{
"id"
:
4
,
"hostname"
:
"testserver123"
,
"ip"
:
"123.57.183.135"
,
"port"
:
8022
,
"system"
:
"linux"
,
"system_users"
:
[
{
"id"
:
1
,
"name"
:
"web"
,
"username"
:
"web"
,
"protocol"
:
"ssh"
,
"auth_method"
:
"P"
,
"auto_push"
:
True
}
]
}
]
},
{
"id"
:
4
,
"name"
:
"java"
,
"comment"
:
""
,
"assets"
:
[
{
"id"
:
2
,
"hostname"
:
"192.168.1.6"
,
"ip"
:
"192.168.2.6"
,
"port"
:
22
,
"system_users"
:
[
{
"id"
:
1
,
"name"
:
"web"
,
"username"
:
"web"
,
"protocol"
:
"ssh"
,
"auth_method"
:
"P"
,
"auto_push"
:
True
}
]
}
]
},
{
"id"
:
3
,
"name"
:
"数据库"
,
"comment"
:
""
,
"assets"
:
[
{
"id"
:
2
,
"hostname"
:
"192.168.1.6"
,
"ip"
:
"192.168.2.6"
,
"port"
:
22
,
"system_users"
:
[
{
"id"
:
1
,
"name"
:
"web"
,
"username"
:
"web"
,
"protocol"
:
"ssh"
,
"auth_method"
:
"P"
,
"auto_push"
:
True
}
]
}
]
},
{
"id"
:
2
,
"name"
:
"运维组"
,
"comment"
:
""
,
"assets"
:
[
{
"id"
:
2
,
"hostname"
:
"192.168.1.6"
,
"ip"
:
"192.168.2.6"
,
"port"
:
22
,
"system_users"
:
[
{
"id"
:
1
,
"name"
:
"web"
,
"username"
:
"web"
,
"protocol"
:
"ssh"
,
"auth_method"
:
"P"
,
"auto_push"
:
True
}
]
}
]
}
]
return
jsonify
(
assets
)
if
__name__
==
'__main__'
:
socketio
=
SocketIO
(
app
)
socketio
.
on_namespace
(
SSHws
(
'/ssh'
))
socketio
.
run
(
app
)
package-lock.json
View file @
834d6a81
...
...
@@ -5278,7 +5278,7 @@
"is-my-json-valid"
:
{
"version"
:
"2.16.1"
,
"resolved"
:
"https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz"
,
"integrity"
:
"sha
512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ=
="
,
"integrity"
:
"sha
1-WoRnd+LCYg0eaRBOXToDsfYIjxE
="
,
"dev"
:
true
,
"requires"
:
{
"generate-function"
:
"2.0.0"
,
...
...
src/app/ControlPage/cleftbar/cleftbar.component.ts
View file @
834d6a81
...
...
@@ -124,11 +124,11 @@ export class CleftbarComponent implements OnInit {
if
(
username
===
''
)
{
return
;
}
if
(
host
.
type
===
'ssh
'
)
{
if
(
host
.
system
===
'linux
'
)
{
jQuery
(
'app-ssh'
).
show
();
jQuery
(
'app-rdp'
).
hide
();
this
.
_term
.
TerminalConnect
(
host
,
username
);
}
else
{
}
else
if
(
host
.
system
===
'windows'
)
{
jQuery
(
'app-ssh'
).
hide
();
jQuery
(
'app-rdp'
).
show
();
this
.
_rdp
.
Connect
(
host
,
username
);
...
...
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