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
565e6648
Unverified
Commit
565e6648
authored
Oct 22, 2019
by
BaiJiangJie
Committed by
GitHub
Oct 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #122 from jumpserver/dev
Dev
parents
76928733
76e97f41
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
8 deletions
+133
-8
asset-tree.component.ts
src/app/elements/asset-tree/asset-tree.component.ts
+17
-7
common.ts
src/app/utils/common.ts
+11
-0
index.html
src/index.html
+105
-1
No files found.
src/app/elements/asset-tree/asset-tree.component.ts
View file @
565e6648
...
@@ -4,6 +4,7 @@ import {BehaviorSubject, Subject} from 'rxjs';
...
@@ -4,6 +4,7 @@ import {BehaviorSubject, Subject} from 'rxjs';
import
{
takeUntil
}
from
'rxjs/operators'
;
import
{
takeUntil
}
from
'rxjs/operators'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
groupBy
}
from
'@app/utils/common'
;
import
{
AppService
,
HttpService
,
LogService
,
NavService
,
SettingService
,
TreeFilterService
}
from
'@app/services'
;
import
{
AppService
,
HttpService
,
LogService
,
NavService
,
SettingService
,
TreeFilterService
}
from
'@app/services'
;
import
{
connectEvt
,
translate
}
from
'@app/globals'
;
import
{
connectEvt
,
translate
}
from
'@app/globals'
;
import
{
TreeNode
,
ConnectEvt
}
from
'@app/model'
;
import
{
TreeNode
,
ConnectEvt
}
from
'@app/model'
;
...
@@ -323,7 +324,7 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
...
@@ -323,7 +324,7 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
if
(
!
this
.
assetsTree
)
{
if
(
!
this
.
assetsTree
)
{
return
;
return
;
}
}
cons
t
searchNode
=
this
.
assetsTree
.
getNodesByFilter
((
node
)
=>
node
.
id
===
'search'
);
le
t
searchNode
=
this
.
assetsTree
.
getNodesByFilter
((
node
)
=>
node
.
id
===
'search'
);
if
(
searchNode
)
{
if
(
searchNode
)
{
this
.
assetsTree
.
removeChildNodes
(
searchNode
[
0
]);
this
.
assetsTree
.
removeChildNodes
(
searchNode
[
0
]);
this
.
assetsTree
.
removeNode
(
searchNode
[
0
]);
this
.
assetsTree
.
removeNode
(
searchNode
[
0
]);
...
@@ -331,13 +332,13 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
...
@@ -331,13 +332,13 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
const
treeNodes
=
this
.
assetsTree
.
getNodes
();
const
treeNodes
=
this
.
assetsTree
.
getNodes
();
if
(
!
keyword
)
{
if
(
!
keyword
)
{
if
(
treeNodes
.
length
!==
0
)
{
if
(
treeNodes
.
length
!==
0
)
{
this
.
assetsTree
.
showNode
(
treeNodes
[
0
]
);
this
.
assetsTree
.
showNode
s
(
treeNodes
);
}
}
return
;
return
;
}
}
this
.
filterAssetCancel$
.
next
(
true
);
this
.
filterAssetCancel$
.
next
(
true
);
if
(
treeNodes
.
length
!==
0
)
{
if
(
treeNodes
.
length
!==
0
)
{
this
.
assetsTree
.
hideNode
(
treeNodes
[
0
]
);
this
.
assetsTree
.
hideNode
s
(
treeNodes
);
}
}
this
.
loading
=
true
;
this
.
loading
=
true
;
this
.
_http
.
getMyGrantedAssets
(
keyword
)
this
.
_http
.
getMyGrantedAssets
(
keyword
)
...
@@ -348,10 +349,19 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
...
@@ -348,10 +349,19 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
const
assetsAmount
=
nodes
.
length
;
const
assetsAmount
=
nodes
.
length
;
name
=
`
${
name
}
(
${
assetsAmount
}
)`
;
name
=
`
${
name
}
(
${
assetsAmount
}
)`
;
const
newNode
=
{
id
:
'search'
,
name
:
name
,
isParent
:
true
,
open
:
true
,
zAsync
:
true
};
const
newNode
=
{
id
:
'search'
,
name
:
name
,
isParent
:
true
,
open
:
true
,
zAsync
:
true
};
const
parentNode
=
this
.
assetsTree
.
addNodes
(
null
,
newNode
)[
0
];
searchNode
=
this
.
assetsTree
.
addNodes
(
null
,
newNode
)[
0
];
parentNode
.
zAsync
=
true
;
searchNode
.
zAsync
=
true
;
this
.
assetsTree
.
addNodes
(
parentNode
,
nodes
);
const
nodesGroupByOrg
=
groupBy
(
nodes
,
(
node
)
=>
{
parentNode
.
open
=
true
;
return
node
.
meta
.
asset
.
org_name
;
});
nodesGroupByOrg
.
forEach
((
item
)
=>
{
const
orgName
=
item
[
0
].
meta
.
asset
.
org_name
;
const
orgNodeData
=
{
id
:
orgName
,
name
:
orgName
,
isParent
:
true
,
open
:
true
,
zAsync
:
true
};
const
orgNode
=
this
.
assetsTree
.
addNodes
(
searchNode
,
orgNodeData
)[
0
];
orgNode
.
zAsync
=
true
;
this
.
assetsTree
.
addNodes
(
orgNode
,
item
);
});
searchNode
.
open
=
true
;
});
});
return
;
return
;
}
}
...
...
src/app/utils/common.ts
0 → 100644
View file @
565e6648
export
function
groupBy
(
array
,
f
)
{
const
groups
=
{};
array
.
forEach
(
function
(
o
)
{
const
group
=
JSON
.
stringify
(
f
(
o
)
);
groups
[
group
]
=
groups
[
group
]
||
[];
groups
[
group
].
push
(
o
);
});
return
Object
.
keys
(
groups
).
map
(
function
(
group
)
{
return
groups
[
group
];
});
}
src/index.html
View file @
565e6648
...
@@ -7,9 +7,113 @@
...
@@ -7,9 +7,113 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"icon"
type=
"image/x-icon"
href=
"favicon.ico"
>
<link
rel=
"icon"
type=
"image/x-icon"
href=
"favicon.ico"
>
<style>
.lds-spinner
{
display
:
inline-block
;
position
:
relative
;
width
:
64px
;
height
:
64px
;
}
.lds-spinner
div
{
transform-origin
:
32px
32px
;
animation
:
lds-spinner
1.2s
linear
infinite
;
}
.lds-spinner
div
:after
{
content
:
" "
;
display
:
block
;
position
:
absolute
;
top
:
3px
;
left
:
29px
;
width
:
5px
;
height
:
14px
;
border-radius
:
20%
;
background
:
#000
;
}
.lds-spinner
div
:nth-child
(
1
)
{
transform
:
rotate
(
0deg
);
animation-delay
:
-1.1s
;
}
.lds-spinner
div
:nth-child
(
2
)
{
transform
:
rotate
(
30deg
);
animation-delay
:
-1s
;
}
.lds-spinner
div
:nth-child
(
3
)
{
transform
:
rotate
(
60deg
);
animation-delay
:
-0.9s
;
}
.lds-spinner
div
:nth-child
(
4
)
{
transform
:
rotate
(
90deg
);
animation-delay
:
-0.8s
;
}
.lds-spinner
div
:nth-child
(
5
)
{
transform
:
rotate
(
120deg
);
animation-delay
:
-0.7s
;
}
.lds-spinner
div
:nth-child
(
6
)
{
transform
:
rotate
(
150deg
);
animation-delay
:
-0.6s
;
}
.lds-spinner
div
:nth-child
(
7
)
{
transform
:
rotate
(
180deg
);
animation-delay
:
-0.5s
;
}
.lds-spinner
div
:nth-child
(
8
)
{
transform
:
rotate
(
210deg
);
animation-delay
:
-0.4s
;
}
.lds-spinner
div
:nth-child
(
9
)
{
transform
:
rotate
(
240deg
);
animation-delay
:
-0.3s
;
}
.lds-spinner
div
:nth-child
(
10
)
{
transform
:
rotate
(
270deg
);
animation-delay
:
-0.2s
;
}
.lds-spinner
div
:nth-child
(
11
)
{
transform
:
rotate
(
300deg
);
animation-delay
:
-0.1s
;
}
.lds-spinner
div
:nth-child
(
12
)
{
transform
:
rotate
(
330deg
);
animation-delay
:
0s
;
}
@keyframes
lds-spinner
{
0
%
{
opacity
:
1
;
}
100
%
{
opacity
:
0
;
}
}
#loading
{
position
:
fixed
;
top
:
calc
(
50%
-
32px
);
left
:
calc
(
50%
-
32px
);
}
</style>
</head>
</head>
<body>
<body>
<app-root>
加载中...
</app-root>
<app-root>
<div
id=
"loading"
>
<div
class=
"lds-spinner"
><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
</div>
</app-root>
<span
id=
"marker"
style=
"display: none;font-size: 14px"
>
marker
</span>
<span
id=
"marker"
style=
"display: none;font-size: 14px"
>
marker
</span>
</body>
</body>
<script>
<script>
...
...
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