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
cd12feb0
Commit
cd12feb0
authored
Jul 26, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改asset tree支持搜索ip和显示ip作为tittle
parent
516e9bf2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
asset-tree.component.ts
src/app/elements/asset-tree/asset-tree.component.ts
+16
-5
No files found.
src/app/elements/asset-tree/asset-tree.component.ts
View file @
cd12feb0
...
@@ -25,6 +25,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -25,6 +25,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
data
:
{
data
:
{
simpleData
:
{
simpleData
:
{
enable
:
true
enable
:
true
},
key
:
{
title
:
'title'
}
}
},
},
callback
:
{
callback
:
{
...
@@ -81,8 +84,10 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -81,8 +84,10 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
'id'
:
node
[
'id'
],
'id'
:
node
[
'id'
],
'key'
:
node
[
'key'
],
'key'
:
node
[
'key'
],
'name'
:
node
[
'name'
],
'name'
:
node
[
'name'
],
'title'
:
node
[
'name'
],
'value'
:
node
[
'value'
],
'value'
:
node
[
'value'
],
'pId'
:
node
[
'parent'
],
'pId'
:
node
[
'parent'
],
'ip'
:
''
,
'assets_amount'
:
node
[
'assets_amount'
],
'assets_amount'
:
node
[
'assets_amount'
],
'isParent'
:
true
,
'isParent'
:
true
,
'open'
:
node
[
'key'
]
===
'0'
'open'
:
node
[
'key'
]
===
'0'
...
@@ -91,16 +96,18 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -91,16 +96,18 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
node
[
'assets_granted'
].
forEach
(
asset
=>
{
node
[
'assets_granted'
].
forEach
(
asset
=>
{
if
(
!
assets
[
asset
[
'id'
]])
{
if
(
!
assets
[
asset
[
'id'
]])
{
const
platform
=
asset
[
'platform'
].
toLowerCase
().
indexOf
(
'win'
)
===
0
?
'windows'
:
'linux'
;
this
.
nodes
.
push
({
this
.
nodes
.
push
({
'id'
:
asset
[
'id'
],
'id'
:
asset
[
'id'
],
'name'
:
asset
[
'hostname'
],
'name'
:
asset
[
'hostname'
],
'value'
:
asset
[
'hostname'
],
'value'
:
asset
[
'hostname'
],
'system_users_granted'
:
asset
[
'system_users_granted'
],
'system_users_granted'
:
asset
[
'system_users_granted'
],
'platform'
:
asset
[
'platform'
],
'platform'
:
asset
[
'platform'
],
'comment'
:
asset
[
'comment'
],
'ip'
:
asset
[
'ip'
],
'title'
:
asset
[
'ip'
],
'isParent'
:
false
,
'isParent'
:
false
,
'pId'
:
node
[
'id'
],
'pId'
:
node
[
'id'
],
'iconSkin'
:
asset
[
'platform'
].
toLowerCase
()
'iconSkin'
:
platform
});
});
assets
[
asset
[
'id'
]
+
'@'
+
node
[
'id'
]]
=
true
;
assets
[
asset
[
'id'
]
+
'@'
+
node
[
'id'
]]
=
true
;
}
}
...
@@ -116,6 +123,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -116,6 +123,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
}
});
});
$
.
fn
.
zTree
.
init
(
$
(
'#ztree'
),
this
.
setting
,
this
.
nodes
);
$
.
fn
.
zTree
.
init
(
$
(
'#ztree'
),
this
.
setting
,
this
.
nodes
);
const
zTree
=
$
.
fn
.
zTree
.
getZTreeObj
(
'ztree'
);
const
root
=
zTree
.
getNodes
()[
0
];
zTree
.
expandNode
(
root
);
}
}
Connect
(
host
)
{
Connect
(
host
)
{
...
@@ -237,12 +247,13 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
...
@@ -237,12 +247,13 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
return
null
;
return
null
;
}
}
let
shouldShow
=
[];
let
shouldShow
=
[];
nodes
.
forEach
((
node
)
=>
{
const
matchedNodes
=
zTreeObj
.
getNodesByFilter
(
function
(
node
){
if
(
shouldShow
.
indexOf
(
node
)
===
-
1
&&
node
.
name
.
indexOf
(
_keywords
)
!==
-
1
)
{
return
node
.
name
.
indexOf
(
_keywords
)
!==
-
1
||
node
.
ip
.
indexOf
(
_keywords
)
!==
-
1
;
});
matchedNodes
.
forEach
((
node
)
=>
{
const
parents
=
this
.
recurseParent
(
node
);
const
parents
=
this
.
recurseParent
(
node
);
const
children
=
this
.
recurseChildren
(
node
);
const
children
=
this
.
recurseChildren
(
node
);
shouldShow
=
[...
shouldShow
,
...
parents
,
...
children
,
node
];
shouldShow
=
[...
shouldShow
,
...
parents
,
...
children
,
node
];
}
});
});
this
.
hiddenNodes
=
nodes
;
this
.
hiddenNodes
=
nodes
;
this
.
expandNodes
=
shouldShow
;
this
.
expandNodes
=
shouldShow
;
...
...
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