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
975e6184
Unverified
Commit
975e6184
authored
Jan 09, 2018
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 直接登陆
parent
02a2d7f1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
4 deletions
+32
-4
mock.py
mock.py
+1
-1
cleftbar.component.ts
src/app/ControlPage/cleftbar/cleftbar.component.ts
+19
-0
ssh.component.ts
src/app/ControlPage/control/ssh/ssh.component.ts
+3
-3
app.service.ts
src/app/app.service.ts
+9
-0
No files found.
mock.py
View file @
975e6184
...
@@ -104,7 +104,7 @@ def asset_groups_assets():
...
@@ -104,7 +104,7 @@ def asset_groups_assets():
"comment"
:
"Default asset group"
,
"comment"
:
"Default asset group"
,
"assets_granted"
:
[
"assets_granted"
:
[
{
{
"id"
:
2
,
"id"
:
1
,
"hostname"
:
"192.168.1.6"
,
"hostname"
:
"192.168.1.6"
,
"ip"
:
"192.168.2.6"
,
"ip"
:
"192.168.2.6"
,
"port"
:
22
,
"port"
:
22
,
...
...
src/app/ControlPage/cleftbar/cleftbar.component.ts
View file @
975e6184
...
@@ -92,9 +92,28 @@ export class CleftbarComponent implements OnInit {
...
@@ -92,9 +92,28 @@ export class CleftbarComponent implements OnInit {
.
map
(
res
=>
res
.
json
())
.
map
(
res
=>
res
.
json
())
.
subscribe
(
response
=>
{
.
subscribe
(
response
=>
{
this
.
HostGroups
=
response
;
this
.
HostGroups
=
response
;
this
.
autologin
();
});
});
}
}
autologin
()
{
const
id
=
this
.
_appService
.
getQueryString
(
'id'
);
if
(
id
)
{
for
(
let
g
of
this
.
HostGroups
)
{
if
(
g
[
'assets_granted'
])
{
for
(
let
u
of
g
[
'assets_granted'
])
{
if
(
u
.
id
.
toString
()
===
id
.
toString
())
{
this
.
Connect
(
u
);
return
;
}
}
}
}
}
}
Connect
(
host
)
{
Connect
(
host
)
{
// console.log(host);
// console.log(host);
let
userid
:
string
;
let
userid
:
string
;
...
...
src/app/ControlPage/control/ssh/ssh.component.ts
View file @
975e6184
...
@@ -77,11 +77,11 @@ export class SshComponent implements OnInit {
...
@@ -77,11 +77,11 @@ export class SshComponent implements OnInit {
screenKeys
:
true
,
screenKeys
:
true
,
});
});
NavList
.
List
.
push
(
new
View
());
NavList
.
List
.
push
(
new
View
());
for
(
let
_i
=
0
;
_i
<
NavList
.
List
.
length
;
_
i
++
)
{
for
(
let
i
=
0
;
i
<
NavList
.
List
.
length
;
i
++
)
{
if
(
id
===
_
i
)
{
if
(
id
===
i
)
{
NavList
.
List
[
id
].
hide
=
false
;
NavList
.
List
[
id
].
hide
=
false
;
}
else
{
}
else
{
NavList
.
List
[
_
i
].
hide
=
true
;
NavList
.
List
[
i
].
hide
=
true
;
}
}
}
}
...
...
src/app/app.service.ts
View file @
975e6184
...
@@ -13,6 +13,7 @@ import {Logger} from 'angular2-logger/core';
...
@@ -13,6 +13,7 @@ import {Logger} from 'angular2-logger/core';
import
'rxjs/add/operator/map'
;
import
'rxjs/add/operator/map'
;
import
'rxjs/add/operator/catch'
;
import
'rxjs/add/operator/catch'
;
import
{
DataStore
,
User
,
Browser
}
from
'./globals'
;
import
{
DataStore
,
User
,
Browser
}
from
'./globals'
;
declare
function
unescape
(
s
:
string
):
string
;
@
Injectable
()
@
Injectable
()
export
class
HttpService
{
export
class
HttpService
{
...
@@ -174,6 +175,14 @@ export class AppService implements OnInit {
...
@@ -174,6 +175,14 @@ export class AppService implements OnInit {
this
.
_http
.
post
(
'/api/browser'
,
JSON
.
stringify
(
Browser
)).
map
(
res
=>
res
.
json
()).
subscribe
();
this
.
_http
.
post
(
'/api/browser'
,
JSON
.
stringify
(
Browser
)).
map
(
res
=>
res
.
json
()).
subscribe
();
}
}
getQueryString
(
name
)
{
const
reg
=
new
RegExp
(
'(^|&)'
+
name
+
'=([^&]*)(&|$)'
,
'i'
);
const
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
{
return
unescape
(
r
[
2
]);
}
return
null
;
}
//
//
//
//
...
...
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