Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nmaas Portal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nmaas
nmaas Portal
Commits
081939b7
Commit
081939b7
authored
1 year ago
by
pgiertych
Browse files
Options
Downloads
Patches
Plain Diff
add searching on domain switcher
parent
029b03de
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/shared/common/domainfilter/domainfilter.component.html
+2
-1
2 additions, 1 deletion
...pp/shared/common/domainfilter/domainfilter.component.html
src/app/shared/common/domainfilter/domainfilter.component.ts
+15
-1
15 additions, 1 deletion
src/app/shared/common/domainfilter/domainfilter.component.ts
with
17 additions
and
2 deletions
src/app/shared/common/domainfilter/domainfilter.component.html
+
2
−
1
View file @
081939b7
...
...
@@ -3,7 +3,8 @@
<span
style=
"color: gray;"
>
{{ "FILTER.DOMAIN" | translate }}: {{ getCurrent() }}
<span
class=
"caret"
></span></span>
</a>
<ul
class=
"dropdown-menu"
>
<li
*ngFor=
"let domain of domains | async; let last = isLast"
[ngClass]=
"{'active': getCurrent() == domain?.name}"
>
<input
type=
"text"
[(ngModel)]=
"searchTerm"
placeholder=
"Search by name"
(input)=
"updateFilter()"
>
<li
*ngFor=
"let domain of filteredDomains | async; let last = isLast"
[ngClass]=
"{'active': getCurrent() == domain?.name}"
>
<a
(click)=
"changeDomain(domain?.id, domain?.name)"
>
<span>
{{domain?.name}}
</span>
</a>
...
...
This diff is collapsed.
Click to expand it.
src/app/shared/common/domainfilter/domainfilter.component.ts
+
15
−
1
View file @
081939b7
...
...
@@ -3,7 +3,7 @@ import {Domain} from '../../../model/domain';
import
{
DomainService
}
from
'
../../../service
'
;
import
{
UserDataService
}
from
'
../../../service/userdata.service
'
;
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Subscription
,
Observable
,
of
,
interval
}
from
'
rxjs
'
;
import
{
BehaviorSubject
,
interval
,
Observable
,
of
,
Subscription
}
from
'
rxjs
'
;
import
{
map
}
from
'
rxjs/operators
'
;
import
{
ProfileService
}
from
'
../../../service/profile.service
'
;
...
...
@@ -26,6 +26,12 @@ export class DomainFilterComponent implements OnInit {
public
profile
:
User
;
public
searchTerm
=
''
;
private
filteredDomainsSub
=
new
BehaviorSubject
<
any
[]
>
([]);
public
filteredDomains
=
this
.
filteredDomainsSub
.
asObservable
();
constructor
(
private
authService
:
AuthService
,
private
domainService
:
DomainService
,
private
userData
:
UserDataService
,
...
...
@@ -49,6 +55,7 @@ export class DomainFilterComponent implements OnInit {
this
.
domains
.
subscribe
(
domain
=>
{
this
.
domainName
=
domain
[
0
].
name
;
this
.
userData
.
selectDomainId
(
domain
[
0
].
id
)
this
.
filteredDomainsSub
.
next
(
domain
);
});
}
);
...
...
@@ -56,6 +63,13 @@ export class DomainFilterComponent implements OnInit {
this
.
userData
.
selectedDomainId
.
subscribe
(
id
=>
this
.
domainId
=
id
);
}
public
updateFilter
()
{
this
.
domains
.
subscribe
(
data
=>
{
const
filtered
=
data
.
filter
(
obj
=>
obj
.
name
.
toLowerCase
().
includes
(
this
.
searchTerm
.
toLowerCase
()));
this
.
filteredDomainsSub
.
next
(
filtered
);
});
}
public
updateDomains
():
void
{
if
(
this
.
authService
.
hasRole
(
'
ROLE_SYSTEM_ADMIN
'
))
{
this
.
domains
=
this
.
domainService
.
getAll
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment