From 6e4e31a2784486d505bb92b51e66484a5625b416 Mon Sep 17 00:00:00 2001 From: Xuan Gu <162244362+xuang7@users.noreply.github.com> Date: Thu, 30 Apr 2026 14:52:06 -0700 Subject: [PATCH] update. --- .../hub-search-result.component.html | 2 +- .../hub-search-result.component.ts | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.html b/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.html index 7767eb24d5b..1ce36ff5ab3 100644 --- a/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.html +++ b/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.html @@ -28,7 +28,7 @@
diff --git a/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.ts b/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.ts index 2ff1e4ffb21..16f84492c6e 100644 --- a/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.ts +++ b/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.ts @@ -38,26 +38,21 @@ import { map } from "rxjs/operators"; }) export class HubSearchResultComponent implements OnInit, AfterViewInit { public searchType: "dataset" | "workflow" = "workflow"; + public searchKeywords: string[] = []; currentUid = this.userService.getCurrentUser()?.uid; private isLogin = false; private includePublic = true; private _searchResultsComponent?: SearchResultsComponent; - @ViewChild(SearchResultsComponent) get searchResultsComponent(): SearchResultsComponent { - if (this._searchResultsComponent) { - return this._searchResultsComponent; - } - throw new Error("Property cannot be accessed before it is initialized."); + @ViewChild(SearchResultsComponent) get searchResultsComponent(): SearchResultsComponent | undefined { + return this._searchResultsComponent; } set searchResultsComponent(value: SearchResultsComponent) { this._searchResultsComponent = value; } private _filters?: FiltersComponent; - @ViewChild(FiltersComponent) get filters(): FiltersComponent { - if (this._filters) { - return this._filters; - } - throw new Error("Property cannot be accessed before it is initialized."); + @ViewChild(FiltersComponent) get filters(): FiltersComponent | undefined { + return this._filters; } set filters(value: FiltersComponent) { value.masterFilterListChange.pipe(untilDestroyed(this)).subscribe({ next: () => this.search() }); @@ -106,6 +101,9 @@ export class HubSearchResultComponent implements OnInit, AfterViewInit { * todo: Integrate the search functions from different interfaces into a single method. */ async search(forced: boolean = false): Promise { + if (!this.filters || !this.searchResultsComponent) { + return; + } const sameList = this.masterFilterList !== null && this.filters.masterFilterList.length === this.masterFilterList.length && @@ -116,6 +114,7 @@ export class HubSearchResultComponent implements OnInit, AfterViewInit { } this.lastSortMethod = this.sortMethod; this.masterFilterList = this.filters.masterFilterList; + this.searchKeywords = this.filters.getSearchKeywords(); let filterParams = this.filters.getSearchFilterParameters(); if (isDefined(this.pid)) { // force the project id in the search query to be the current pid.