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
1cc8c3e6
Unverified
Commit
1cc8c3e6
authored
Dec 12, 2018
by
老广
Committed by
GitHub
Dec 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #50 from jumpserver/dev
Dev
parents
2ba57398
3c619311
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
234 additions
and
131 deletions
+234
-131
cn.json
i18n/cn.json
+7
-4
zh-CN.json
i18n/zh-CN.json
+5
-1
zh.json
i18n/zh.json
+7
-4
mock.py
mock.py
+0
-0
proxy.conf.json
proxy.conf.json
+4
-0
app.module.ts
src/app/app.module.ts
+2
-1
app.service.ts
src/app/app.service.ts
+18
-5
asset-tree.component.ts
src/app/elements/asset-tree/asset-tree.component.ts
+94
-77
elements.component.ts
src/app/elements/elements.component.ts
+3
-1
nav.component.ts
src/app/elements/nav/nav.component.ts
+56
-35
rdpSolutionDialog.html
src/app/elements/nav/rdpSolutionDialog.html
+12
-0
app.component.ts
src/app/pages/app.component.ts
+12
-1
cleftbar.component.ts
src/app/pages/control/cleftbar/cleftbar.component.ts
+13
-1
environment.prod.ts
src/environments/environment.prod.ts
+1
-1
No files found.
i18n/cn.json
View file @
1cc8c3e6
...
@@ -50,8 +50,11 @@
...
@@ -50,8 +50,11 @@
"document"
:
"文档"
,
"document"
:
"文档"
,
"support"
:
"商业支持"
,
"support"
:
"商业支持"
,
"speed"
:
"速度"
,
"speed"
:
"速度"
,
"File Manager"
:
"文件管理"
,
"file manager"
:
"文件管理"
,
"File"
:
"文件管理"
,
"file"
:
"文件管理"
,
"New Connection"
:
"连接"
,
"new connection"
:
"连接"
,
"Connect"
:
"连接"
"connect"
:
"连接"
,
"rdp resolution"
:
"RDP分辨率"
,
"set rdp solution"
:
"设置分辨率"
,
"select a solution"
:
"选择分辨率"
}
}
i18n/zh-CN.json
View file @
1cc8c3e6
...
@@ -51,6 +51,10 @@
...
@@ -51,6 +51,10 @@
"support"
:
"商业支持"
,
"support"
:
"商业支持"
,
"speed"
:
"速度"
,
"speed"
:
"速度"
,
"file manager"
:
"文件管理"
,
"file manager"
:
"文件管理"
,
"file"
:
"文件管理"
,
"new connection"
:
"连接"
,
"new connection"
:
"连接"
,
"connect"
:
"连接"
"connect"
:
"连接"
,
"rdp resolution"
:
"RDP分辨率"
,
"set rdp solution"
:
"设置分辨率"
,
"select a solution"
:
"选择分辨率"
}
}
i18n/zh.json
View file @
1cc8c3e6
...
@@ -50,8 +50,11 @@
...
@@ -50,8 +50,11 @@
"document"
:
"文档"
,
"document"
:
"文档"
,
"support"
:
"商业支持"
,
"support"
:
"商业支持"
,
"speed"
:
"速度"
,
"speed"
:
"速度"
,
"File Manager"
:
"文件管理"
,
"file manager"
:
"文件管理"
,
"File"
:
"文件管理"
,
"file"
:
"文件管理"
,
"New Connection"
:
"连接"
,
"new connection"
:
"连接"
,
"Connect"
:
"连接"
"connect"
:
"连接"
,
"rdp resolution"
:
"RDP分辨率"
,
"set rdp solution"
:
"设置分辨率"
,
"select a solution"
:
"选择分辨率"
}
}
mock.py
View file @
1cc8c3e6
This diff is collapsed.
Click to expand it.
proxy.conf.json
View file @
1cc8c3e6
{
{
"/api/perms/v1/user/nodes/children/"
:
{
"target"
:
"http://127.0.0.1:8080"
,
"secure"
:
false
},
"/api"
:
{
"/api"
:
{
"target"
:
"http://127.0.0.1:5001"
,
"target"
:
"http://127.0.0.1:5001"
,
"secure"
:
false
"secure"
:
false
...
...
src/app/app.module.ts
View file @
1cc8c3e6
...
@@ -26,7 +26,7 @@ import {MAT_LABEL_GLOBAL_OPTIONS} from '@angular/material';
...
@@ -26,7 +26,7 @@ import {MAT_LABEL_GLOBAL_OPTIONS} from '@angular/material';
import
{
Pipes
}
from
'./pipes/pipes'
;
import
{
Pipes
}
from
'./pipes/pipes'
;
import
{
PagesComponents
}
from
'./pages/pages.component'
;
import
{
PagesComponents
}
from
'./pages/pages.component'
;
import
{
ElementComponents
}
from
'./elements/elements.component'
;
import
{
ElementComponents
}
from
'./elements/elements.component'
;
import
{
ChangLanWarningDialogComponent
}
from
'./elements/nav/nav.component'
;
import
{
ChangLanWarningDialogComponent
,
RDPSolutionDialogComponent
}
from
'./elements/nav/nav.component'
;
import
{
DialogService
,
ElementDialogAlertComponent
}
from
'./elements/dialog/dialog.service'
;
import
{
DialogService
,
ElementDialogAlertComponent
}
from
'./elements/dialog/dialog.service'
;
import
{
PluginModules
}
from
'./plugins/plugins'
;
import
{
PluginModules
}
from
'./plugins/plugins'
;
import
{
TestPageComponent
}
from
'./test-page/test-page.component'
;
import
{
TestPageComponent
}
from
'./test-page/test-page.component'
;
...
@@ -55,6 +55,7 @@ import {SftpComponent} from './elements/sftp/sftp.component';
...
@@ -55,6 +55,7 @@ import {SftpComponent} from './elements/sftp/sftp.component';
AssetTreeDialogComponent
,
AssetTreeDialogComponent
,
ElementDialogAlertComponent
,
ElementDialogAlertComponent
,
ChangLanWarningDialogComponent
,
ChangLanWarningDialogComponent
,
RDPSolutionDialogComponent
,
],
],
bootstrap
:
[
AppComponent
],
bootstrap
:
[
AppComponent
],
providers
:
[
providers
:
[
...
...
src/app/app.service.ts
View file @
1cc8c3e6
...
@@ -14,7 +14,7 @@ import {DataStore, User, Browser, i18n} from './globals';
...
@@ -14,7 +14,7 @@ import {DataStore, User, Browser, i18n} from './globals';
import
{
environment
}
from
'../environments/environment'
;
import
{
environment
}
from
'../environments/environment'
;
import
{
HttpClient
,
HttpHeaders
,
HttpParams
}
from
'@angular/common/http'
;
import
{
HttpClient
,
HttpHeaders
,
HttpParams
}
from
'@angular/common/http'
;
import
{
NGXLogger
}
from
'ngx-logger'
;
import
{
NGXLogger
}
from
'ngx-logger'
;
import
{
HostGroup
}
from
'./pages/control/cleftbar/cleftbar.component'
;
import
{
HostGroup
,
Node
}
from
'./pages/control/cleftbar/cleftbar.component'
;
import
*
as
UUID
from
'uuid-js/lib/uuid.js'
;
import
*
as
UUID
from
'uuid-js/lib/uuid.js'
;
declare
function
unescape
(
s
:
string
):
string
;
declare
function
unescape
(
s
:
string
):
string
;
...
@@ -66,8 +66,8 @@ export class HttpService {
...
@@ -66,8 +66,8 @@ export class HttpService {
return
this
.
http
.
get
(
'/api/users/v1/profile/'
);
return
this
.
http
.
get
(
'/api/users/v1/profile/'
);
}
}
get_my_
asset_groups_asset
s
()
{
get_my_
granted_node
s
()
{
return
this
.
http
.
get
<
Array
<
HostGroup
>>
(
'/api/perms/v1/user/nodes-assets
/'
);
return
this
.
http
.
get
<
Array
<
Node
>>
(
'/api/perms/v1/user/nodes-assets/tree
/'
);
}
}
get_guacamole_token
(
user_id
:
string
,
authToken
:
string
)
{
get_guacamole_token
(
user_id
:
string
,
authToken
:
string
)
{
...
@@ -89,11 +89,18 @@ export class HttpService {
...
@@ -89,11 +89,18 @@ export class HttpService {
}
}
guacamole_add_asset
(
user_id
:
string
,
asset_id
:
string
,
system_user_id
:
string
)
{
guacamole_add_asset
(
user_id
:
string
,
asset_id
:
string
,
system_user_id
:
string
)
{
cons
t
params
=
new
HttpParams
()
le
t
params
=
new
HttpParams
()
.
set
(
'user_id'
,
user_id
)
.
set
(
'user_id'
,
user_id
)
.
set
(
'asset_id'
,
asset_id
)
.
set
(
'asset_id'
,
asset_id
)
.
set
(
'system_user_id'
,
system_user_id
)
.
set
(
'system_user_id'
,
system_user_id
)
.
set
(
'token'
,
DataStore
.
guacamole_token
);
.
set
(
'token'
,
DataStore
.
guacamole_token
);
const
solution
=
localStorage
.
getItem
(
'rdpSolution'
)
||
'Auto'
;
if
(
solution
!==
'Auto'
)
{
const
width
=
solution
.
split
(
'x'
)[
0
];
const
height
=
solution
.
split
(
'x'
)[
1
];
params
=
params
.
set
(
'width'
,
width
).
set
(
'height'
,
height
);
}
return
this
.
http
.
get
(
return
this
.
http
.
get
(
'/guacamole/api/session/ext/jumpserver/asset/add'
,
'/guacamole/api/session/ext/jumpserver/asset/add'
,
{
{
...
@@ -104,9 +111,15 @@ export class HttpService {
...
@@ -104,9 +111,15 @@ export class HttpService {
}
}
guacamole_token_add_asset
(
assetToken
:
string
,
token
:
string
)
{
guacamole_token_add_asset
(
assetToken
:
string
,
token
:
string
)
{
cons
t
params
=
new
HttpParams
()
le
t
params
=
new
HttpParams
()
.
set
(
'asset_token'
,
assetToken
)
.
set
(
'asset_token'
,
assetToken
)
.
set
(
'token'
,
token
);
.
set
(
'token'
,
token
);
const
solution
=
localStorage
.
getItem
(
'rdpSolution'
)
||
'Auto'
;
if
(
solution
!==
'Auto'
)
{
const
width
=
solution
.
split
(
'x'
)[
0
];
const
height
=
solution
.
split
(
'x'
)[
1
];
params
=
params
.
set
(
'width'
,
width
).
set
(
'height'
,
height
);
}
return
this
.
http
.
get
(
return
this
.
http
.
get
(
'/guacamole/api/ext/jumpserver/asset/token/add'
,
'/guacamole/api/ext/jumpserver/asset/token/add'
,
{
{
...
...
src/app/elements/asset-tree/asset-tree.component.ts
View file @
1cc8c3e6
...
@@ -33,25 +33,25 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -33,25 +33,25 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
},
},
callback
:
{
callback
:
{
onClick
:
this
.
onCzTreeOnClick
.
bind
(
this
),
onClick
:
this
.
onCzTreeOnClick
.
bind
(
this
),
onRightClick
:
this
.
onRightClick
.
bind
(
this
),
onRightClick
:
this
.
onRightClick
.
bind
(
this
)
onAsyncSuccess
:
this
.
onzTreeAsyncSuccess
.
bind
(
this
)
},
},
async
:
{
enable
:
true
,
url
:
'/api/perms/v1/user/nodes/children/'
,
autoParam
:
[
'node_id=id'
,
'name=n'
,
'level=lv'
],
type
:
'get'
,
dataFilter
:
this
.
nodeFilter
}
};
};
pos
=
{
left
:
'100px'
,
top
:
'200px'
};
pos
=
{
left
:
'100px'
,
top
:
'200px'
};
hiddenNodes
:
any
;
hiddenNodes
:
any
;
expandNodes
:
any
;
expandNodes
:
any
;
zTree
:
any
;
zTree
:
any
;
searching
=
false
;
isShowRMenu
=
false
;
isShowRMenu
=
false
;
rightClickSelectNode
:
any
;
rightClickSelectNode
:
any
;
onCzTreeOnClick
(
event
,
treeId
,
treeNode
,
clickFlag
)
{
if
(
treeNode
.
isParent
)
{
const
zTreeObj
=
$
.
fn
.
zTree
.
getZTreeObj
(
'ztree'
);
zTreeObj
.
expandNode
(
treeNode
);
}
else
{
this
.
Connect
(
treeNode
);
}
}
constructor
(
private
_appService
:
AppService
,
constructor
(
private
_appService
:
AppService
,
public
_dialog
:
MatDialog
,
public
_dialog
:
MatDialog
,
public
_logger
:
LogService
)
{
public
_logger
:
LogService
)
{
...
@@ -67,7 +67,7 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -67,7 +67,7 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
.
debounceTime
(
300
)
.
debounceTime
(
300
)
.
distinctUntilChanged
()
.
distinctUntilChanged
()
.
subscribe
((
n
)
=>
{
.
subscribe
((
n
)
=>
{
this
.
searchNode
();
this
.
filter
();
});
});
}
}
...
@@ -80,53 +80,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -80,53 +80,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
}
}
}
nodeFilter
(
treeId
,
parentNode
,
childNodes
)
{
$
.
each
(
childNodes
,
function
(
index
,
value
)
{
value
[
'node_id'
]
=
value
[
'id'
];
value
[
'id'
]
=
value
[
'tree_id'
];
if
(
value
[
'tree_id'
]
!==
value
[
'tree_parent'
])
{
value
[
'pId'
]
=
value
[
'tree_parent'
];
}
else
{
value
[
'isParent'
]
=
true
;
}
value
[
'name'
]
=
value
[
'value'
];
if
(
!
value
[
'is_node'
])
{
const
platform
=
value
[
'asset'
][
'platform'
].
toLowerCase
().
indexOf
(
'win'
)
===
0
?
'windows'
:
'linux'
;
value
[
'title'
]
=
value
[
'asset'
][
'ip'
]
||
value
[
'name'
];
value
[
'iconSkin'
]
=
platform
;
}
value
[
'isParent'
]
=
value
[
'is_node'
];
});
return
childNodes
;
}
onzTreeAsyncSuccess
(
event
,
treeId
,
treeNode
,
msg
)
{
// 代表第一次加载
if
(
!
treeNode
)
{
this
.
zTree
=
$
.
fn
.
zTree
.
getZTreeObj
(
treeId
);
if
(
this
.
searching
)
{
this
.
zTree
.
expandAll
(
true
);
}
else
{
const
root
=
this
.
zTree
.
getNodes
()[
0
];
this
.
zTree
.
expandNode
(
root
,
true
);
}
}
}
onCzTreeOnClick
(
event
,
treeId
,
treeNode
,
clickFlag
)
{
if
(
treeNode
.
isParent
)
{
const
zTreeObj
=
$
.
fn
.
zTree
.
getZTreeObj
(
'ztree'
);
zTreeObj
.
expandNode
(
treeNode
);
}
else
{
this
.
Connect
(
treeNode
.
asset
);
}
}
draw
()
{
draw
()
{
$
.
fn
.
zTree
.
init
(
$
(
'#ztree'
),
this
.
setting
,
this
.
nodes
);
$
.
fn
.
zTree
.
init
(
$
(
'#ztree'
),
this
.
setting
,
this
.
Data
);
// this.zTree = $.fn.zTree.getZTreeObj('ztree');
this
.
zTree
=
$
.
fn
.
zTree
.
getZTreeObj
(
'ztree'
);
// const root = this.zTree.getNodes()[0];
// this.zTree.expandNode(root, true);
}
}
showRMenu
(
left
,
top
)
{
showRMenu
(
left
,
top
)
{
...
@@ -140,9 +96,13 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -140,9 +96,13 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
}
onRightClick
(
event
,
treeId
,
treeNode
)
{
onRightClick
(
event
,
treeId
,
treeNode
)
{
if
(
!
treeNode
||
treeNode
.
isParent
||
treeNode
.
asset
.
platform
.
toLowerCase
()
===
'windows'
)
{
if
(
!
treeNode
||
treeNode
.
isParent
)
{
return
null
;
return
null
;
}
}
const
host
=
treeNode
.
meta
.
asset
;
if
(
host
.
protocol
.
toLowerCase
()
===
'rdp'
)
{
alert
(
'Windows 请使用Ctrl+Shift+Alt呼出侧边栏上传下载'
);
}
if
(
!
treeNode
&&
event
.
target
.
tagName
.
toLowerCase
()
!==
'button'
&&
$
(
event
.
target
).
parents
(
'a'
).
length
===
0
)
{
if
(
!
treeNode
&&
event
.
target
.
tagName
.
toLowerCase
()
!==
'button'
&&
$
(
event
.
target
).
parents
(
'a'
).
length
===
0
)
{
this
.
zTree
.
cancelSelectedNode
();
this
.
zTree
.
cancelSelectedNode
();
this
.
showRMenu
(
event
.
clientX
,
event
.
clientY
);
this
.
showRMenu
(
event
.
clientX
,
event
.
clientY
);
...
@@ -153,22 +113,24 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -153,22 +113,24 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
}
}
}
Connect
(
host
)
{
Connect
(
node
)
{
const
system_users
=
node
.
meta
.
system_users
;
const
host
=
node
.
meta
.
asset
;
let
user
:
any
;
let
user
:
any
;
if
(
host
.
system_users_granted
.
length
>
1
)
{
if
(
system_users
.
length
>
1
)
{
user
=
this
.
checkPriority
(
host
.
system_users_granted
);
user
=
this
.
checkPriority
(
system_users
);
if
(
user
)
{
if
(
user
)
{
this
.
login
(
host
,
user
);
this
.
login
(
host
,
user
);
}
else
{
}
else
{
const
dialogRef
=
this
.
_dialog
.
open
(
AssetTreeDialogComponent
,
{
const
dialogRef
=
this
.
_dialog
.
open
(
AssetTreeDialogComponent
,
{
height
:
'200px'
,
height
:
'200px'
,
width
:
'300px'
,
width
:
'300px'
,
data
:
{
users
:
host
.
system_users_granted
}
data
:
{
users
:
system_users
}
});
});
dialogRef
.
afterClosed
().
subscribe
(
result
=>
{
dialogRef
.
afterClosed
().
subscribe
(
result
=>
{
if
(
result
)
{
if
(
result
)
{
for
(
const
i
of
host
.
system_users_granted
)
{
for
(
const
i
of
system_users
)
{
if
(
i
.
id
.
toString
()
===
result
.
toString
())
{
if
(
i
.
id
.
toString
()
===
result
.
toString
())
{
user
=
i
;
user
=
i
;
break
;
break
;
...
@@ -178,8 +140,8 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -178,8 +140,8 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
}
});
});
}
}
}
else
if
(
host
.
system_users_granted
.
length
===
1
)
{
}
else
if
(
system_users
.
length
===
1
)
{
user
=
host
.
system_users_granted
[
0
];
user
=
system_users
[
0
];
this
.
login
(
host
,
user
);
this
.
login
(
host
,
user
);
}
else
{
}
else
{
alert
(
'该主机没有授权登录用户'
);
alert
(
'该主机没有授权登录用户'
);
...
@@ -187,7 +149,7 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -187,7 +149,7 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
}
connectFileManager
()
{
connectFileManager
()
{
const
host
=
this
.
rightClickSelectNode
.
asset
;
const
host
=
this
.
rightClickSelectNode
.
meta
.
asset
;
const
id
=
NavList
.
List
.
length
-
1
;
const
id
=
NavList
.
List
.
length
-
1
;
if
(
host
)
{
if
(
host
)
{
NavList
.
List
[
id
].
nick
=
'[FILE]'
+
host
.
hostname
;
NavList
.
List
[
id
].
nick
=
'[FILE]'
+
host
.
hostname
;
...
@@ -209,6 +171,8 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -209,6 +171,8 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
login
(
host
,
user
)
{
login
(
host
,
user
)
{
const
id
=
NavList
.
List
.
length
-
1
;
const
id
=
NavList
.
List
.
length
-
1
;
this
.
_logger
.
debug
(
NavList
);
this
.
_logger
.
debug
(
host
);
if
(
user
)
{
if
(
user
)
{
NavList
.
List
[
id
].
nick
=
host
.
hostname
;
NavList
.
List
[
id
].
nick
=
host
.
hostname
;
NavList
.
List
[
id
].
connected
=
true
;
NavList
.
List
[
id
].
connected
=
true
;
...
@@ -241,25 +205,78 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -241,25 +205,78 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
return
user
;
return
user
;
}
}
searchNode
()
{
recurseParent
(
node
)
{
const
parentNode
=
node
.
getParentNode
();
if
(
parentNode
&&
parentNode
.
pId
)
{
return
[
parentNode
,
...
this
.
recurseParent
(
parentNode
)];
}
else
if
(
parentNode
)
{
return
[
parentNode
];
}
else
{
return
[];
}
}
recurseChildren
(
node
)
{
if
(
!
node
.
isParent
)
{
return
[];
}
const
children
=
node
.
children
;
if
(
!
children
)
{
return
[];
}
let
all_children
=
[];
children
.
forEach
((
n
)
=>
{
all_children
=
[...
children
,
...
this
.
recurseChildren
(
n
)];
});
return
all_children
;
}
filter
()
{
const
zTreeObj
=
$
.
fn
.
zTree
.
getZTreeObj
(
'ztree'
);
const
zTreeObj
=
$
.
fn
.
zTree
.
getZTreeObj
(
'ztree'
);
if
(
!
zTreeObj
)
{
if
(
!
zTreeObj
)
{
return
null
;
return
null
;
}
}
const
_keywords
=
this
.
query
;
const
_keywords
=
this
.
query
;
const
nodes
=
zTreeObj
.
transformToArray
(
zTreeObj
.
getNodes
());
if
(
!
_keywords
)
{
if
(
!
_keywords
)
{
// 第一次刷新
if
(
this
.
hiddenNodes
)
{
if
(
!
this
.
searching
)
{
zTreeObj
.
showNodes
(
this
.
hiddenNodes
);
return
null
;
this
.
hiddenNodes
=
null
;
}
}
// 以后搜索后回来
if
(
this
.
expandNodes
)
{
this
.
searching
=
false
;
this
.
expandNodes
.
forEach
((
node
)
=>
{
zTreeObj
.
setting
.
async
.
url
=
'/api/perms/v1/user/nodes/children/'
;
if
(
node
.
id
!==
nodes
[
0
].
id
)
{
}
else
{
zTreeObj
.
expandNode
(
node
,
false
);
this
.
searching
=
true
;
}
zTreeObj
.
setting
.
async
.
url
=
`/api/perms/v1/user/nodes/children/?search=
${
_keywords
}
`
;
});
this
.
expandNodes
=
null
;
}
return
null
;
}
}
zTreeObj
.
reAsyncChildNodes
(
null
,
'refresh'
);
let
shouldShow
=
[];
const
matchedNodes
=
zTreeObj
.
getNodesByFilter
(
function
(
node
)
{
if
(
node
.
meta
.
type
===
'asset'
)
{
const
host
=
node
.
meta
.
asset
;
return
host
.
hostname
.
indexOf
(
_keywords
)
!==
-
1
||
host
.
ip
.
indexOf
(
_keywords
)
!==
-
1
;
}
else
{
return
node
.
name
.
indexOf
(
_keywords
)
!==
-
1
;
}
});
matchedNodes
.
forEach
((
node
)
=>
{
const
parents
=
this
.
recurseParent
(
node
);
const
children
=
this
.
recurseChildren
(
node
);
shouldShow
=
[...
shouldShow
,
...
parents
,
...
children
,
node
];
});
this
.
hiddenNodes
=
nodes
;
this
.
expandNodes
=
shouldShow
;
zTreeObj
.
hideNodes
(
nodes
);
zTreeObj
.
showNodes
(
shouldShow
);
shouldShow
.
forEach
((
node
)
=>
{
if
(
node
.
isParent
)
{
zTreeObj
.
expandNode
(
node
,
true
);
}
});
// zTreeObj.expandAll(true);
}
}
}
}
...
...
src/app/elements/elements.component.ts
View file @
1cc8c3e6
...
@@ -14,6 +14,7 @@ import {ElementDialogAlertComponent} from './dialog/dialog.service';
...
@@ -14,6 +14,7 @@ import {ElementDialogAlertComponent} from './dialog/dialog.service';
import
{
ElementGuacamoleComponent
}
from
'./guacamole/guacamole.component'
;
import
{
ElementGuacamoleComponent
}
from
'./guacamole/guacamole.component'
;
import
{
ElementSshTermComponent
}
from
'./ssh-term/ssh-term.component'
;
import
{
ElementSshTermComponent
}
from
'./ssh-term/ssh-term.component'
;
import
{
AssetTreeDialogComponent
,
ElementAssetTreeComponent
}
from
'./asset-tree/asset-tree.component'
;
import
{
AssetTreeDialogComponent
,
ElementAssetTreeComponent
}
from
'./asset-tree/asset-tree.component'
;
import
{
RDPSolutionDialogComponent
}
from
'./nav/nav.component'
;
export
const
ElementComponents
=
[
export
const
ElementComponents
=
[
ElementLeftbarComponent
,
ElementLeftbarComponent
,
...
@@ -31,5 +32,6 @@ export const ElementComponents = [
...
@@ -31,5 +32,6 @@ export const ElementComponents = [
ElementGuacamoleComponent
,
ElementGuacamoleComponent
,
ElementAssetTreeComponent
,
ElementAssetTreeComponent
,
ElementSshTermComponent
,
ElementSshTermComponent
,
AssetTreeDialogComponent
AssetTreeDialogComponent
,
RDPSolutionDialogComponent
];
];
src/app/elements/nav/nav.component.ts
View file @
1cc8c3e6
...
@@ -106,6 +106,26 @@ export class ElementNavComponent implements OnInit {
...
@@ -106,6 +106,26 @@ export class ElementNavComponent implements OnInit {
window
.
open
(
'https://market.aliyun.com/products/53690006/cmgj026011.html?spm=5176.730005.0.0.cY2io1'
);
window
.
open
(
'https://market.aliyun.com/products/53690006/cmgj026011.html?spm=5176.730005.0.0.cY2io1'
);
break
;
break
;
}
}
case
'SetResolution'
:
{
const
dialog
=
this
.
_dialog
.
open
(
RDPSolutionDialogComponent
,
{
height
:
'200px'
,
width
:
'300px'
,
data
:
{
title
:
'Warning'
,
note
:
'The page will be reload, can you acceptable?'
,
cancel
:
'Cancel'
,
confirm
:
'Confirm'
,
},
});
dialog
.
afterClosed
().
subscribe
(
result
=>
{
if
(
result
)
{
console
.
log
(
result
);
}
});
break
;
}
case
'EnterLicense'
:
{
case
'EnterLicense'
:
{
this
.
EnterLicense
();
this
.
EnterLicense
();
break
;
break
;
...
@@ -175,12 +195,6 @@ export class ElementNavComponent implements OnInit {
...
@@ -175,12 +195,6 @@ export class ElementNavComponent implements OnInit {
}
}
getnav
()
{
getnav
()
{
this
.
_logger
.
log
(
'getnav'
);
// this._http.get('/api/nav')
// .map(res => res.json())
// .subscribe(response => {
// DataStore.Nav = response;
// });
DataStore
.
Nav
=
[{
DataStore
.
Nav
=
[{
'id'
:
'File'
,
'id'
:
'File'
,
'name'
:
'Server'
,
'name'
:
'Server'
,
...
@@ -195,35 +209,6 @@ export class ElementNavComponent implements OnInit {
...
@@ -195,35 +209,6 @@ export class ElementNavComponent implements OnInit {
'click'
:
'DisconnectAll'
,
'click'
:
'DisconnectAll'
,
'name'
:
'Disconnect all'
'name'
:
'Disconnect all'
},
},
// {
// 'id': 'Duplicate',
// 'href': '',
// 'name': 'Duplicate',
// 'disable': true
// },
// {
// 'id': 'Upload',
// 'href': '',
// 'name': 'Upload',
// 'disable': true
// },
// {
// 'id': 'Download',
// 'href': '',
// 'name': 'Download',
// 'disable': true
// },
// {
// 'id': ' Search',
// 'href': '',
// 'name': 'Search',
// 'disable': true
// },
// {
// 'id': 'Reload',
// 'click': 'ReloadLeftbar',
// 'name': 'Reload'
// }
]
]
},
{
},
{
'id'
:
'FileManager'
,
'id'
:
'FileManager'
,
...
@@ -245,6 +230,11 @@ export class ElementNavComponent implements OnInit {
...
@@ -245,6 +230,11 @@ export class ElementNavComponent implements OnInit {
'click'
:
'HideLeft'
,
'click'
:
'HideLeft'
,
'name'
:
'Hide left manager'
'name'
:
'Hide left manager'
},
},
{
'id'
:
'RDPResolution'
,
'click'
:
'SetResolution'
,
'name'
:
'RDP Resolution'
},
{
{
'id'
:
'SplitVertical'
,
'id'
:
'SplitVertical'
,
'href'
:
''
,
'href'
:
''
,
...
@@ -369,3 +359,34 @@ export class ChangLanWarningDialogComponent implements OnInit {
...
@@ -369,3 +359,34 @@ export class ChangLanWarningDialogComponent implements OnInit {
this
.
dialogRef
.
close
();
this
.
dialogRef
.
close
();
}
}
}
}
@
Component
({
selector
:
'elements-rdp-solution-dialog'
,
templateUrl
:
'rdpSolutionDialog.html'
,
})
export
class
RDPSolutionDialogComponent
implements
OnInit
{
solutions
=
[
'Auto'
,
'1024x768'
,
'1366x768'
,
'1400x900'
];
solution
:
string
;
cacheKey
=
'rdpSolution'
;
constructor
(
public
dialogRef
:
MatDialogRef
<
RDPSolutionDialogComponent
>
,
@
Inject
(
MAT_DIALOG_DATA
)
public
data
:
any
)
{
}
ngOnInit
()
{
this
.
solution
=
localStorage
.
getItem
(
this
.
cacheKey
)
||
'Auto'
;
}
setSolution
(
value
:
string
)
{
localStorage
.
setItem
(
this
.
cacheKey
,
value
);
}
onSubmit
()
{
this
.
setSolution
(
this
.
solution
);
this
.
dialogRef
.
close
();
}
onNoClick
():
void
{
this
.
dialogRef
.
close
();
}
}
src/app/elements/nav/rdpSolutionDialog.html
0 → 100644
View file @
1cc8c3e6
<h1
mat-dialog-title
>
{{"Set RDP solution"|trans}}
</h1>
<mat-form-field>
<mat-select
[(
value
)]="
solution
"
placeholder=
"{{'Select a solution'|trans}}"
>
<mat-option
*
ngFor=
"let s of solutions"
value=
"{{s}}"
>
{{s}}
</mat-option>
</mat-select>
</mat-form-field>
<div
style=
"float: right"
>
<button
mat-raised-button
(
click
)="
onNoClick
()"
>
{{"Cancel"|trans}}
</button>
<button
mat-raised-button
color=
"primary"
(
click
)="
onSubmit
()"
>
{{"Confirm"|trans}}
</button>
</div>
src/app/pages/app.component.ts
View file @
1cc8c3e6
...
@@ -5,8 +5,9 @@
...
@@ -5,8 +5,9 @@
* @date 2017-11-07
* @date 2017-11-07
* @author liuzheng <liuzheng712@gmail.com>
* @author liuzheng <liuzheng712@gmail.com>
*/
*/
import
{
Component
}
from
'@angular/core'
;
import
{
Component
,
HostListener
}
from
'@angular/core'
;
import
{
DataStore
}
from
'../globals'
;
import
{
DataStore
}
from
'../globals'
;
import
{
environment
}
from
'../../environments/environment'
;
@
Component
({
@
Component
({
selector
:
'app-root'
,
selector
:
'app-root'
,
...
@@ -16,4 +17,14 @@ import {DataStore} from '../globals';
...
@@ -16,4 +17,14 @@ import {DataStore} from '../globals';
export
class
AppComponent
{
export
class
AppComponent
{
DataStore
=
DataStore
;
DataStore
=
DataStore
;
constructor
()
{}
@
HostListener
(
'window:beforeunload'
,
[
'$event'
])
unloadNotification
(
$event
:
any
)
{
if
(
environment
.
production
)
{
$event
.
returnValue
=
true
;
}
}
}
}
src/app/pages/control/cleftbar/cleftbar.component.ts
View file @
1cc8c3e6
...
@@ -25,6 +25,18 @@ export interface HostGroup {
...
@@ -25,6 +25,18 @@ export interface HostGroup {
children
:
Array
<
Host
>
;
children
:
Array
<
Host
>
;
}
}
export
interface
Node
{
id
:
string
;
name
:
string
;
comment
:
string
;
title
:
string
;
isParent
:
boolean
;
pId
:
string
;
open
:
boolean
;
iconSkin
:
string
;
meta
:
object
;
}
export
class
Host
{
export
class
Host
{
name
:
string
;
name
:
string
;
id
:
string
;
id
:
string
;
...
@@ -93,7 +105,7 @@ export class CleftbarComponent implements OnInit {
...
@@ -93,7 +105,7 @@ export class CleftbarComponent implements OnInit {
}
}
ngOnInit
()
{
ngOnInit
()
{
this
.
_http
.
get_my_
asset_groups_asset
s
()
this
.
_http
.
get_my_
granted_node
s
()
.
subscribe
(
response
=>
{
.
subscribe
(
response
=>
{
this
.
zNodes
=
response
;
this
.
zNodes
=
response
;
// this.HostGroups = response;
// this.HostGroups = response;
...
...
src/environments/environment.prod.ts
View file @
1cc8c3e6
...
@@ -2,5 +2,5 @@ export const environment = {
...
@@ -2,5 +2,5 @@ export const environment = {
production
:
true
production
:
true
};
};
// export const version = '1.3.0-{{BUILD_NUMBER}} GPLv2.';
// export const version = '1.3.0-{{BUILD_NUMBER}} GPLv2.';
export
const
version
=
'1.4.
4
-101 GPLv2.'
;
export
const
version
=
'1.4.
5
-101 GPLv2.'
;
// export const version = '1.4.1-{{BUILD_NUMBER}} GPLv2.';
// export const version = '1.4.1-{{BUILD_NUMBER}} GPLv2.';
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