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
b5665827
Unverified
Commit
b5665827
authored
Sep 24, 2019
by
老广
Committed by
GitHub
Sep 24, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #116 from jumpserver/dev_beta
Dev beta
parents
f5f20d92
2a5e5882
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
32 deletions
+40
-32
asset-tree.component.ts
src/app/elements/asset-tree/asset-tree.component.ts
+1
-1
connect.component.ts
src/app/elements/connect/connect.component.ts
+26
-17
http.ts
src/app/services/http.ts
+8
-8
index.html
src/index.html
+5
-6
No files found.
src/app/elements/asset-tree/asset-tree.component.ts
View file @
b5665827
...
...
@@ -97,7 +97,7 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
if
(
this
.
isLoadTreeAsync
)
{
setting
[
'async'
]
=
{
enable
:
true
,
url
:
'/api/
perms/v1
/users/nodes/children-with-assets/tree/?cache_policy=1'
,
url
:
'/api/
v1/perms
/users/nodes/children-with-assets/tree/?cache_policy=1'
,
autoParam
:
[
'id=key'
,
'name=n'
,
'level=lv'
],
type
:
'get'
};
...
...
src/app/elements/connect/connect.component.ts
View file @
b5665827
...
...
@@ -41,27 +41,36 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
}
});
const
loginTo
=
this
.
_appSvc
.
getQueryString
(
'login_to'
);
if
(
loginTo
&&
!
this
.
hasLoginTo
)
{
this
.
_http
.
filterMyGrantedAssetsById
(
loginTo
).
subscribe
(
nodes
=>
{
if
(
nodes
.
length
===
1
)
{
this
.
hasLoginTo
=
true
;
const
node
=
nodes
[
0
];
this
.
Connect
(
node
);
const
tp
=
this
.
_appSvc
.
getQueryString
(
'type'
)
||
'asset'
;
if
(
this
.
hasLoginTo
||
!
loginTo
)
{
return
;
}
switch
(
tp
)
{
case
'asset'
:
this
.
_http
.
filterMyGrantedAssetsById
(
loginTo
).
subscribe
(
nodes
=>
{
if
(
nodes
.
length
===
1
)
{
this
.
hasLoginTo
=
true
;
const
node
=
nodes
[
0
];
this
.
Connect
(
node
);
}
}
}
);
this
.
_http
.
getMyGrantedRemoteApps
(
loginTo
).
subscribe
(
nodes
=>
{
if
(
nodes
.
length
===
1
)
{
this
.
hasLoginTo
=
true
;
const
node
=
nodes
[
0
];
this
.
Connect
(
node
);
);
break
;
case
'remote_app'
:
this
.
_http
.
getMyGrantedRemoteApps
(
loginTo
).
subscribe
(
nodes
=>
{
if
(
nodes
.
length
===
1
)
{
this
.
hasLoginTo
=
true
;
const
node
=
nodes
[
0
];
this
.
Connect
(
node
);
}
}
}
)
;
);
break
;
}
}
ngOnDestroy
():
void
{
connectEvt
.
unsubscribe
();
}
...
...
src/app/services/http.ts
View file @
b5665827
...
...
@@ -49,29 +49,29 @@ export class HttpService {
}
getUserProfile
()
{
return
this
.
http
.
get
<
_User
>
(
'/api/
users/v1
/profile/'
);
return
this
.
http
.
get
<
_User
>
(
'/api/
v1/users
/profile/'
);
}
getMyGrantedAssets
(
keyword
)
{
const
url
=
`/api/
perms/v1
/users/assets/tree/?search=
${
keyword
}
`
;
const
url
=
`/api/
v1/perms
/users/assets/tree/?search=
${
keyword
}
`
;
return
this
.
http
.
get
<
Array
<
TreeNode
>>
(
url
);
}
filterMyGrantedAssetsById
(
id
:
string
)
{
const
url
=
`/api/
perms/v1
/users/assets/tree/?id=
${
id
}
`
;
const
url
=
`/api/
v1/perms
/users/assets/tree/?id=
${
id
}
`
;
return
this
.
http
.
get
<
Array
<
TreeNode
>>
(
url
);
}
getMyGrantedNodes
(
async
:
boolean
,
refresh
?:
boolean
)
{
const
cachePolicy
=
refresh
?
'2'
:
'1'
;
const
syncUrl
=
`/api/
perms/v1
/users/nodes-with-assets/tree/?cache_policy=
${
cachePolicy
}
`
;
const
asyncUrl
=
`/api/
perms/v1
/users/nodes/children-with-assets/tree/?cache_policy=
${
cachePolicy
}
`
;
const
syncUrl
=
`/api/
v1/perms
/users/nodes-with-assets/tree/?cache_policy=
${
cachePolicy
}
`
;
const
asyncUrl
=
`/api/
v1/perms
/users/nodes/children-with-assets/tree/?cache_policy=
${
cachePolicy
}
`
;
const
url
=
async
?
asyncUrl
:
syncUrl
;
return
this
.
http
.
get
<
Array
<
TreeNode
>>
(
url
);
}
getMyGrantedRemoteApps
(
id
?:
string
)
{
let
url
=
'/api/
perms/v1
/user/remote-apps/tree/'
;
let
url
=
'/api/
v1/perms
/user/remote-apps/tree/'
;
if
(
id
)
{
url
+=
`?id=
${
id
}
&only=1`
;
}
...
...
@@ -189,7 +189,7 @@ export class HttpService {
}
getReplay
(
token
:
string
)
{
return
this
.
http
.
get
(
'/api/
terminal/v1
/sessions/'
+
token
+
'/replay'
);
return
this
.
http
.
get
(
'/api/
v1/terminal
/sessions/'
+
token
+
'/replay'
);
}
// get_replay_json(token: string) {
...
...
@@ -204,7 +204,7 @@ export class HttpService {
const
params
=
new
HttpParams
()
.
set
(
'user-only'
,
'1'
)
.
set
(
'token'
,
token
);
return
this
.
http
.
get
(
'/api/
users/v1
/connection-token/'
,
{
params
:
params
});
return
this
.
http
.
get
(
'/api/
v1/users
/connection-token/'
,
{
params
:
params
});
}
}
src/index.html
View file @
b5665827
...
...
@@ -9,9 +9,8 @@
<link
rel=
"icon"
type=
"image/x-icon"
href=
"favicon.ico"
>
</head>
<body>
<app-root>
Loading
...
</app-root>
<app-root>
加载中
...
</app-root>
<span
id=
"marker"
style=
"display: none;font-size: 14px"
>
marker
</span>
</body>
<script>
window
.
onload
=
function
(
ev
)
{
...
...
@@ -21,15 +20,15 @@
}
if
(
navigator
.
clipboard
&&
navigator
.
clipboard
.
readText
)
{
navigator
.
clipboard
.
readText
().
then
(
function
textRead
(
text
)
{
clipboardData
=
text
;
});
navigator
.
clipboard
.
readText
().
then
(
function
textRead
(
text
)
{
clipboardData
=
text
;
});
}
if
(
navigator
.
clipboard
&&
navigator
.
clipboard
.
writeText
)
{
navigator
.
clipboard
.
writeText
(
clipboardData
)
}
}
}
</script>
</html>
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