Fix various issues with adding/removing Dataset Templates
This commit is contained in:
parent
83342f5afa
commit
87758c3e9a
|
@ -544,6 +544,14 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
|
||||
if(newDmp.getId() != null){
|
||||
UUID dmpId = newDmp.getId();
|
||||
List<DMPDatasetProfile> dmpDatasetProfiles = apiContext.getOperationsContext().getDatabaseRepository().getDmpDatasetProfileDao().asQueryable()
|
||||
.where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList();
|
||||
for (DMPDatasetProfile dmpDatasetProfile : dmpDatasetProfiles) {
|
||||
if (newDmp.getAssociatedDmps().stream().filter(dmpDatasetProfile1 -> dmpDatasetProfile1.getId() != null).noneMatch(dmpDatasetProfile1 -> dmpDatasetProfile1.getId().equals(dmpDatasetProfile.getId()))) {
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDatasetProfileDao().delete(dmpDatasetProfile);
|
||||
}
|
||||
}
|
||||
for(DMPDatasetProfile dmpDatasetProfile : newDmp.getAssociatedDmps()){
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDatasetProfileDao().createOrUpdate(dmpDatasetProfile);
|
||||
}
|
||||
|
|
|
@ -1111,7 +1111,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
|||
}
|
||||
else {
|
||||
this.sectionTemplates[sectionIndex] = this.sectionTemplates[sectionIndex].filter(sectionProfile => sectionProfile.id !== event.id);
|
||||
profiles = profiles.filter(sectionProfile => sectionProfile.descriptionTemplateId !== event.id);
|
||||
profiles = profiles.filter(sectionProfile => sectionProfile.descriptionTemplateId !== event.id || !sectionProfile.data.dmpSectionIndex.includes(sectionIndex));
|
||||
this.formGroup.get('profiles').setValue(profiles);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue