-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/frontend/src/app/dashboard/component/user/search-results/search-results.component.scss b/frontend/src/app/dashboard/component/user/search-results/search-results.component.scss
index 73ccb3127ae..e5e237e23a5 100644
--- a/frontend/src/app/dashboard/component/user/search-results/search-results.component.scss
+++ b/frontend/src/app/dashboard/component/user/search-results/search-results.component.scss
@@ -130,3 +130,21 @@ nz-content {
margin: 0 1rem 0 0; // add space to the right
}
}
+
+.card-scroll-container {
+ height: 100%;
+ overflow-y: auto;
+ padding: 12px;
+}
+
+.card-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
+ gap: 10px;
+ justify-content: start;
+ align-items: stretch;
+
+ * {
+ max-width: 300px;
+ }
+}
diff --git a/frontend/src/app/dashboard/component/user/search-results/search-results.component.ts b/frontend/src/app/dashboard/component/user/search-results/search-results.component.ts
index 601a6534a53..baddea9f68b 100644
--- a/frontend/src/app/dashboard/component/user/search-results/search-results.component.ts
+++ b/frontend/src/app/dashboard/component/user/search-results/search-results.component.ts
@@ -17,13 +17,13 @@
* under the License.
*/
-import { Component, EventEmitter, Input, Output } from "@angular/core";
+import { Component, EventEmitter, Input, Output, TemplateRef } from "@angular/core";
import { DashboardEntry } from "../../../type/dashboard-entry";
import { UserService } from "../../../../common/service/user/user.service";
import { NzCardComponent } from "ng-zorro-antd/card";
import { ɵɵCdkVirtualScrollViewport, ɵɵCdkFixedSizeVirtualScroll } from "@angular/cdk/overlay";
import { NzListComponent } from "ng-zorro-antd/list";
-import { NgFor, NgIf } from "@angular/common";
+import { NgFor, NgIf, NgTemplateOutlet } from "@angular/common";
import { ListItemComponent } from "../list-item/list-item.component";
import { NzSpaceCompactItemDirective } from "ng-zorro-antd/space";
import { NzButtonComponent } from "ng-zorro-antd/button";
@@ -31,6 +31,7 @@ import { NzWaveDirective } from "ng-zorro-antd/core/wave";
import { ɵNzTransitionPatchDirective } from "ng-zorro-antd/core/transition-patch";
export type LoadMoreFunction = (start: number, count: number) => Promise<{ entries: DashboardEntry[]; more: boolean }>;
+export type SearchResultsViewMode = "list" | "card";
@Component({
selector: "texera-search-results",
@@ -44,6 +45,7 @@ export type LoadMoreFunction = (start: number, count: number) => Promise<{ entri
NgFor,
ListItemComponent,
NgIf,
+ NgTemplateOutlet,
NzSpaceCompactItemDirective,
NzButtonComponent,
NzWaveDirective,
@@ -62,6 +64,11 @@ export class SearchResultsComponent {
@Input() editable = false;
@Input() searchKeywords: string[] = [];
@Input() currentUid: number | undefined;
+ @Input() viewMode: SearchResultsViewMode = "list";
+ /** Template rendered for each entry in card mode; receives the entry via $implicit. */
+ @Input() cardTemplate?: TemplateRef<{ $implicit: DashboardEntry }>;
+
+ trackByEntryId = (_: number, entry: DashboardEntry): string => `${entry.type}-${entry.id}`;
@Output() deleted = new EventEmitter
();
@Output() duplicated = new EventEmitter();
@Output() modified = new EventEmitter();
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 1ce36ff5ab3..b910262df7e 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
@@ -22,14 +22,53 @@
+