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
bbcd3353
Commit
bbcd3353
authored
Nov 23, 2017
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: fit to jms api
parent
f637f7eb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
12 deletions
+129
-12
app.js
app.js
+118
-1
cleftbar.component.html
src/app/ControlPage/cleftbar/cleftbar.component.html
+1
-1
cleftbar.component.ts
src/app/ControlPage/cleftbar/cleftbar.component.ts
+6
-6
ssh.component.ts
src/app/ControlPage/control/ssh/ssh.component.ts
+1
-1
search.component.ts
src/app/ControlPage/search/search.component.ts
+1
-1
app-routing.module.ts
src/app/app-routing.module.ts
+2
-2
No files found.
app.js
View file @
bbcd3353
...
...
@@ -170,8 +170,125 @@ server.run = function (options) {
}]
}])
});
apis
.
route
(
'/
hostlist
'
)
apis
.
route
(
'/
perms/v1/user/my/asset-groups-assets/
'
)
.
get
(
function
(
req
,
res
)
{
res
.
json
([
{
"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_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_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
}
]
}
]
}
]);
res
.
json
([{
"name"
:
"测试服务器组1"
,
"id"
:
1
,
...
...
src/app/ControlPage/cleftbar/cleftbar.component.html
View file @
bbcd3353
...
...
@@ -9,7 +9,7 @@
<input
type=
"checkbox"
id=
"hostgroup-{{i}}"
>
<label
for=
"hostgroup-{{i}}"
>
{{hostGroup.name}}
</label>
<ul>
<li
*
ngFor=
"let host of hostGroup.
children | SearchFilter: q"
(
click
)="
Connect
(
host
)"
>
{{host.
name}}
</li>
<li
*
ngFor=
"let host of hostGroup.
assets | SearchFilter: q"
(
click
)="
Connect
(
host
)"
>
{{host.host
name}}
</li>
</ul>
</li>
</ul>
...
...
src/app/ControlPage/cleftbar/cleftbar.component.ts
View file @
bbcd3353
...
...
@@ -85,7 +85,7 @@ export class CleftbarComponent implements OnInit {
}
ngOnInit
()
{
this
.
_http
.
get
(
'/api/
hostlist
'
)
this
.
_http
.
get
(
'/api/
perms/v1/user/my/asset-groups-assets/
'
)
.
map
(
res
=>
res
.
json
())
.
subscribe
(
response
=>
{
this
.
HostGroups
=
response
;
...
...
@@ -95,10 +95,10 @@ export class CleftbarComponent implements OnInit {
Connect
(
host
)
{
console
.
log
(
host
);
let
username
:
string
;
if
(
host
.
users
.
length
>
1
)
{
if
(
host
.
system_
users
.
length
>
1
)
{
let
options
=
""
;
for
(
let
u
of
host
.
users
)
{
options
+=
"<option value='"
+
u
+
"'>"
+
u
+
"</option>"
for
(
let
u
of
host
.
system_
users
)
{
options
+=
"<option value='"
+
u
.
username
+
"'>"
+
u
.
username
+
"</option>"
}
layer
.
open
({
title
:
'Please Choose a User'
,
...
...
@@ -118,8 +118,8 @@ export class CleftbarComponent implements OnInit {
//return false 开启该代码可禁止点击该按钮关闭
}
});
}
else
if
(
host
.
users
.
length
===
1
)
{
username
=
host
.
users
[
0
]
}
else
if
(
host
.
system_
users
.
length
===
1
)
{
username
=
host
.
system_users
[
0
].
username
}
if
(
username
===
""
)
{
return
...
...
src/app/ControlPage/control/ssh/ssh.component.ts
View file @
bbcd3353
...
...
@@ -47,7 +47,7 @@ export class SshComponent implements OnInit {
let
id
=
NavList
.
List
.
length
-
1
;
NavList
.
List
[
id
].
nick
=
host
.
name
;
NavList
.
List
[
id
].
nick
=
host
.
host
name
;
NavList
.
List
[
id
].
connected
=
true
;
NavList
.
List
[
id
].
edit
=
false
;
NavList
.
List
[
id
].
closed
=
false
;
...
...
src/app/ControlPage/search/search.component.ts
View file @
bbcd3353
...
...
@@ -64,7 +64,7 @@ export class SearchFilter implements PipeTransform {
if
(
input
)
{
input
=
input
.
toLowerCase
();
return
value
.
filter
(
function
(
el
:
any
)
{
return
el
.
name
.
toLowerCase
().
indexOf
(
input
)
>
-
1
;
return
el
.
name
.
toLowerCase
().
indexOf
(
input
)
>
-
1
||
el
.
comment
.
toLocaleLowerCase
().
indexOf
(
input
)
>
-
1
;
})
}
return
value
;
...
...
src/app/app-routing.module.ts
View file @
bbcd3353
...
...
@@ -16,10 +16,10 @@ import {ControlPageComponent} from './ControlPage/controlpage.component';
const
appRoutes
:
Routes
=
[
// { path: 'crisis-center', component: CrisisListComponent },
{
path
:
'welcome'
,
component
:
IndexPageComponent
},
// <-- delete this line
//
{path: 'welcome', component: IndexPageComponent}, // <-- delete this line
{
path
:
'login'
,
component
:
LoginComponent
},
{
path
:
'control'
,
component
:
ControlPageComponent
},
{
path
:
''
,
redirectTo
:
'/
welcome
'
,
pathMatch
:
'full'
},
{
path
:
''
,
redirectTo
:
'/
control
'
,
pathMatch
:
'full'
},
{
path
:
'**'
,
component
:
NotFoundComponent
}
];
...
...
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