From 8950031d88090680b73ead016724acd0c7ef025f Mon Sep 17 00:00:00 2001
From: Xuan Gu <162244362+xuang7@users.noreply.github.com>
Date: Thu, 25 Jun 2026 00:06:09 -0700
Subject: [PATCH 1/3] update.
---
.../card-item/card-item.component.html | 1 +
.../card-item/card-item.component.ts | 31 +++++++++++++++-
.../user-dataset/user-dataset.component.html | 35 +++++++++++++++++++
.../user-dataset/user-dataset.component.ts | 13 +++++++
4 files changed, 79 insertions(+), 1 deletion(-)
diff --git a/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.html b/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.html
index 43b965f5bcc..ef7ae349844 100644
--- a/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.html
+++ b/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.html
@@ -40,6 +40,7 @@
diff --git a/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.ts b/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.ts
index ffba9fb9abb..44925da678e 100644
--- a/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.ts
+++ b/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.ts
@@ -105,6 +105,8 @@ export class CardItemComponent implements OnChanges {
hovering: boolean = false;
/** The default top image, used when the user has not uploaded a custom one. */
static readonly DEFAULT_PREVIEW_IMAGE = "assets/card_background.jpg";
+ /** Resolved preview/cover image; stays the placeholder until a dataset cover loads. */
+ coverImageSrc: string = CardItemComponent.DEFAULT_PREVIEW_IMAGE;
@Input()
get entry(): DashboardEntry {
@@ -136,10 +138,11 @@ export class CardItemComponent implements OnChanges {
/** The top image src for the card preview. */
get previewImage(): string {
- return CardItemComponent.DEFAULT_PREVIEW_IMAGE;
+ return this.coverImageSrc;
}
initializeEntry() {
+ this.coverImageSrc = CardItemComponent.DEFAULT_PREVIEW_IMAGE;
if (this.entry.type === "workflow") {
if (typeof this.entry.id === "number") {
this.disableDelete = !this.entry.workflow.isOwner;
@@ -166,6 +169,7 @@ export class CardItemComponent implements OnChanges {
}
this.iconType = "database";
this.size = this.entry.size;
+ this.loadDatasetCover(this.entry.id);
}
} else if (this.entry.type === "file") {
// not sure where to redirect
@@ -184,6 +188,31 @@ export class CardItemComponent implements OnChanges {
}
}
+ /** Loads the dataset cover into the preview slot, falling back to the placeholder. */
+ private loadDatasetCover(did: number): void {
+ if (!this.entry.coverImageUrl) {
+ return;
+ }
+ this.datasetService
+ .getDatasetCoverUrl(did)
+ .pipe(untilDestroyed(this))
+ .subscribe({
+ next: ({ url }) => {
+ this.coverImageSrc = url ?? CardItemComponent.DEFAULT_PREVIEW_IMAGE;
+ this.cdr.markForCheck();
+ },
+ error: () => {
+ this.coverImageSrc = CardItemComponent.DEFAULT_PREVIEW_IMAGE;
+ this.cdr.markForCheck();
+ },
+ });
+ }
+
+ /** Falls the preview back to the placeholder if the cover image fails to load. */
+ onCoverError(): void {
+ this.coverImageSrc = CardItemComponent.DEFAULT_PREVIEW_IMAGE;
+ }
+
onCheckboxChange(entry: DashboardEntry): void {
entry.checked = !entry.checked;
this.cdr.markForCheck();
diff --git a/frontend/src/app/dashboard/component/user/user-dataset/user-dataset.component.html b/frontend/src/app/dashboard/component/user/user-dataset/user-dataset.component.html
index 08ce28eac60..1c08a580e4a 100644
--- a/frontend/src/app/dashboard/component/user/user-dataset/user-dataset.component.html
+++ b/frontend/src/app/dashboard/component/user/user-dataset/user-dataset.component.html
@@ -32,6 +32,26 @@