Fix adding dataset dropdown on datasets listing

* Get timecreated from backend
* Protect front from crashing when creationTime is not provided
This commit is contained in:
Kristian Ntavidi 2021-07-23 12:05:07 +03:00
parent 4c22799f91
commit 59e3af2fa0
2 changed files with 8 additions and 8 deletions

View File

@ -25,7 +25,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
private String label; private String label;
private String grant; private String grant;
// private String profile; // private String profile;
// private Date creationTime; private Date creationTime;
private Date modifiedTime; private Date modifiedTime;
//private String organisations; //private String organisations;
private int version; private int version;
@ -70,12 +70,12 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.profile = profile; this.profile = profile;
}*/ }*/
/*public Date getCreationTime() { public Date getCreationTime() {
return creationTime; return creationTime;
} }
public void setCreationTime(Date creationTime) { public void setCreationTime(Date creationTime) {
this.creationTime = creationTime; this.creationTime = creationTime;
}*/ }
public Date getModifiedTime() { public Date getModifiedTime() {
return modifiedTime; return modifiedTime;
@ -187,7 +187,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.id = entity.getId().toString(); this.id = entity.getId().toString();
this.label = entity.getLabel(); this.label = entity.getLabel();
this.groupId = entity.getGroupId(); this.groupId = entity.getGroupId();
// this.creationTime = entity.getCreated(); this.creationTime = entity.getCreated();
// this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList()); // this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
return this; return this;
} }
@ -196,7 +196,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.id = entity.getId().toString(); this.id = entity.getId().toString();
this.label = entity.getLabel(); this.label = entity.getLabel();
this.groupId = entity.getGroupId(); this.groupId = entity.getGroupId();
// this.creationTime = entity.getCreated(); this.creationTime = entity.getCreated();
return this; return this;
} }
@ -205,8 +205,8 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.status = entity.getStatus(); this.status = entity.getStatus();
this.version = entity.getVersion(); this.version = entity.getVersion();
this.grant = entity.getGrant().getLabel(); this.grant = entity.getGrant().getLabel();
/*if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel(); /*if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel(); */
this.creationTime = entity.getCreated();*/ this.creationTime = entity.getCreated();
this.modifiedTime = entity.getModified(); this.modifiedTime = entity.getModified();
// this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList())); // this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList()); this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());

View File

@ -27,7 +27,7 @@ export class StartNewDatasetDialogComponent extends BaseComponent {
initialItems: (extraData) => this.searchDmp(''), initialItems: (extraData) => this.searchDmp(''),
displayFn: (item) => this.getDatasetDisplay(item), displayFn: (item) => this.getDatasetDisplay(item),
titleFn: (item) => item['label'], 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( constructor(