Unverified Commit b5665827 authored by 老广's avatar 老广 Committed by GitHub

Merge pull request #116 from jumpserver/dev_beta

Dev beta
parents f5f20d92 2a5e5882
......@@ -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'
};
......
......@@ -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();
}
......
......@@ -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});
}
}
......@@ -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>
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