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
7b4b6630
Unverified
Commit
7b4b6630
authored
Sep 17, 2019
by
老广
Committed by
GitHub
Sep 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #112 from jumpserver/dev_beta
[Update] 避免搜索多次
parents
ec8a866f
907384a3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
asset-tree.component.ts
src/app/elements/asset-tree/asset-tree.component.ts
+11
-3
connect.component.ts
src/app/elements/connect/connect.component.ts
+4
-6
No files found.
src/app/elements/asset-tree/asset-tree.component.ts
View file @
7b4b6630
import
{
Component
,
Input
,
OnInit
,
OnDestroy
,
ElementRef
,
ViewChild
}
from
'@angular/core'
;
import
{
MatDialog
}
from
'@angular/material'
;
import
{
BehaviorSubject
}
from
'rxjs'
;
import
{
BehaviorSubject
,
Subject
}
from
'rxjs'
;
import
{
takeUntil
}
from
'rxjs/operators'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
AppService
,
HttpService
,
LogService
,
NavService
,
SettingService
,
TreeFilterService
}
from
'@app/services'
;
...
...
@@ -44,6 +45,7 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
hasLoginTo
=
false
;
treeFilterSubscription
:
any
;
isLoadTreeAsync
:
boolean
;
filterAssetCancel
$
:
Subject
<
boolean
>
=
new
Subject
();
constructor
(
private
_appSvc
:
AppService
,
private
_treeFilterSvc
:
TreeFilterService
,
...
...
@@ -330,12 +332,18 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
}
return
;
}
this
.
_http
.
getMyGrantedAssets
(
keyword
).
subscribe
(
nodes
=>
{
this
.
filterAssetCancel$
.
next
(
true
);
this
.
_http
.
getMyGrantedAssets
(
keyword
)
.
pipe
(
takeUntil
(
this
.
filterAssetCancel$
))
.
subscribe
(
nodes
=>
{
const
treeNodes
=
this
.
assetsTree
.
getNodes
();
if
(
treeNodes
.
length
!==
0
)
{
this
.
assetsTree
.
hideNode
(
treeNodes
[
0
]);
}
const
newNode
=
{
id
:
'search'
,
name
:
translate
(
'Search'
),
isParent
:
true
,
open
:
true
,
zAsync
:
true
};
let
name
=
translate
(
'Search'
);
const
assetsAmount
=
nodes
.
length
;
name
=
`
${
name
}
(
${
assetsAmount
}
)`
;
const
newNode
=
{
id
:
'search'
,
name
:
name
,
isParent
:
true
,
open
:
true
,
zAsync
:
true
};
const
parentNode
=
this
.
assetsTree
.
addNodes
(
null
,
newNode
)[
0
];
parentNode
.
zAsync
=
true
;
this
.
assetsTree
.
addNodes
(
parentNode
,
nodes
);
...
...
src/app/elements/connect/connect.component.ts
View file @
7b4b6630
...
...
@@ -40,10 +40,9 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
}
}
});
this
.
activatedRoute
.
queryParams
.
subscribe
(
params
=>
{
const
login_to
=
params
[
'login_to'
];
if
(
login_to
&&
!
this
.
hasLoginTo
)
{
this
.
_http
.
filterMyGrantedAssetsById
(
login_to
).
subscribe
(
const
loginTo
=
this
.
_appSvc
.
getQueryString
(
'login_to'
);
if
(
loginTo
&&
!
this
.
hasLoginTo
)
{
this
.
_http
.
filterMyGrantedAssetsById
(
loginTo
).
subscribe
(
nodes
=>
{
if
(
nodes
.
length
===
1
)
{
this
.
hasLoginTo
=
true
;
...
...
@@ -52,7 +51,7 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
}
}
);
this
.
_http
.
getMyGrantedRemoteApps
(
login_t
o
).
subscribe
(
this
.
_http
.
getMyGrantedRemoteApps
(
loginT
o
).
subscribe
(
nodes
=>
{
if
(
nodes
.
length
===
1
)
{
this
.
hasLoginTo
=
true
;
...
...
@@ -62,7 +61,6 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
}
);
}
});
}
ngOnDestroy
():
void
{
connectEvt
.
unsubscribe
();
...
...
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