From 59e3af2fa043112178fe3640981dd16ea0ef8df4 Mon Sep 17 00:00:00 2001 From: Kristan Ntavidi Date: Fri, 23 Jul 2021 12:05:07 +0300 Subject: [PATCH] Fix adding dataset dropdown on datasets listing * Get timecreated from backend * Protect front from crashing when creationTime is not provided --- .../DataManagementPlanListingModel.java | 14 +++++++------- .../start-new-dataset-dialog.component.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java index ad8bcda51..dd5c82499 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java @@ -25,7 +25,7 @@ public class DataManagementPlanListingModel implements DataModel new AssociatedProfile().fromData(item)).collect(Collectors.toList()); return this; } @@ -196,7 +196,7 @@ public class DataManagementPlanListingModel implements DataModel new Organisation().fromDataModel(item)).collect(Collectors.toList())); this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList()); diff --git a/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.ts index 0d4d119d4..8a86bc52b 100644 --- a/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.ts +++ b/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.ts @@ -27,7 +27,7 @@ export class StartNewDatasetDialogComponent extends BaseComponent { initialItems: (extraData) => this.searchDmp(''), displayFn: (item) => this.getDatasetDisplay(item), titleFn: (item) => item['label'], - subtitleFn: (item) => this.language.instant('DATASET-WIZARD.FIRST-STEP.SUB-TITLE') + new Date(item['creationTime']).toISOString() + subtitleFn: (item) => {try{return this.language.instant('DATASET-WIZARD.FIRST-STEP.SUB-TITLE') + new Date(item['creationTime']).toISOString();}catch{return '-';}} }; constructor(