Browse Source
Fixed the Go to search showing the previous user's menu items after Login as or menu changes (#16840)
* Fixed Go to menu search crashing after selecting a link
* PR comments fixes
pull/16142/merge
Maksym Tsymbarov
1 week ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
7 deletions
-
ui-ngx/src/app/modules/home/menu/goto-menu.component.html
-
ui-ngx/src/app/modules/home/menu/goto-menu.component.ts
|
|
|
@ -45,7 +45,7 @@ |
|
|
|
@if (gotoMenuResult.hasMatches) { |
|
|
|
@if (gotoMenuResult.nameMatches.length) { |
|
|
|
@for (link of gotoMenuResult.nameMatches; track link) { |
|
|
|
<mat-option class="tb-goto-menu-link" [value]="null" (onSelectionChange)="gotoLink(link)"> |
|
|
|
<mat-option class="tb-goto-menu-link" [value]="''" (onSelectionChange)="$event.isUserInput && gotoLink(link)"> |
|
|
|
<ng-container *ngTemplateOutlet="linkOption; context:{link: link}"></ng-container> |
|
|
|
</mat-option> |
|
|
|
} |
|
|
|
@ -55,7 +55,7 @@ |
|
|
|
} |
|
|
|
@if (gotoMenuResult.crumbMatches.length) { |
|
|
|
@for (link of gotoMenuResult.crumbMatches; track link) { |
|
|
|
<mat-option class="tb-goto-menu-link" [value]="null" (onSelectionChange)="gotoLink(link)"> |
|
|
|
<mat-option class="tb-goto-menu-link" [value]="''" (onSelectionChange)="$event.isUserInput && gotoLink(link)"> |
|
|
|
<ng-container *ngTemplateOutlet="linkOption; context:{link: link}"></ng-container> |
|
|
|
</mat-option> |
|
|
|
} |
|
|
|
|
|
|
|
@ -116,10 +116,10 @@ export class GotoMenuComponent implements OnInit, OnDestroy { |
|
|
|
this.router.navigate([link.path], { queryParams: link.queryParams }).then(); |
|
|
|
} |
|
|
|
|
|
|
|
private fetchLinks(searchText?: string): Observable<GotoMenuResult> { |
|
|
|
this.searchText = searchText; |
|
|
|
private fetchLinks(searchText: string): Observable<GotoMenuResult> { |
|
|
|
const query = (searchText ?? '').trim().toLowerCase(); |
|
|
|
return this.allLinks().pipe( |
|
|
|
map((links) => this.filterLinks(links)) |
|
|
|
map((links) => this.filterLinks(links, query)) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@ -140,8 +140,7 @@ export class GotoMenuComponent implements OnInit, OnDestroy { |
|
|
|
return this.allLinksObservable$; |
|
|
|
} |
|
|
|
|
|
|
|
private filterLinks(links: GotoMenuLink[]): GotoMenuResult { |
|
|
|
const query = this.searchText.trim().toLowerCase(); |
|
|
|
private filterLinks(links: GotoMenuLink[], query: string): GotoMenuResult { |
|
|
|
const nameMatches: GotoMenuLink[] = []; |
|
|
|
let crumbMatches: GotoMenuLink[] = []; |
|
|
|
for (const link of links) { |
|
|
|
|