bug fixes
This commit is contained in:
parent
dfc9e14003
commit
846405435c
|
@ -528,7 +528,7 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
|
||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT, principal)) {
|
||||
if (newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||
checkIfUserCanEditGrant(newDmp, user);
|
||||
}
|
||||
assignGrandUserIfInternal(newDmp, user);
|
||||
|
@ -547,8 +547,10 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
|
||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT, principal)) {
|
||||
if (newDmp.getGrant() != null) {
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().createOrUpdate(newDmp.getGrant());
|
||||
}
|
||||
}
|
||||
newDmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(newDmp);
|
||||
|
||||
for(DMPDatasetProfile dmpDatasetProfile : newDmp.getAssociatedDmps()){
|
||||
|
@ -717,7 +719,7 @@ public class DataManagementPlanManager {
|
|||
newDmp.setId(null);
|
||||
|
||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT, principal)) {
|
||||
if (newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||
checkIfUserCanEditGrant(newDmp, user);
|
||||
}
|
||||
assignGrandUserIfInternal(newDmp, user);
|
||||
|
@ -729,6 +731,7 @@ public class DataManagementPlanManager {
|
|||
assignProjectUserIfInternal(newDmp, user);
|
||||
}
|
||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT, principal)) {
|
||||
if (newDmp.getGrant() != null) {
|
||||
if (newDmp.getGrant().getStartdate() == null) {
|
||||
newDmp.getGrant().setStartdate(new Date());
|
||||
}
|
||||
|
@ -737,6 +740,7 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
databaseRepository.getGrantDao().createOrUpdate(newDmp.getGrant());
|
||||
}
|
||||
}
|
||||
DMP tempDmp = databaseRepository.getDmpDao().createOrUpdate(newDmp);
|
||||
newDmp.setId(tempDmp.getId());
|
||||
for(DMPDatasetProfile dmpDatasetProfile : newDmp.getAssociatedDmps()){
|
||||
|
@ -804,7 +808,7 @@ public class DataManagementPlanManager {
|
|||
newDmp.setId(null);
|
||||
|
||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT, principal)) {
|
||||
if (newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||
if (newDmp.getGrant() != null && newDmp.getGrant().getType().equals(Grant.GrantType.INTERNAL.getValue())) {
|
||||
checkIfUserCanEditGrant(newDmp, user);
|
||||
}
|
||||
assignGrandUserIfInternal(newDmp, user);
|
||||
|
@ -816,8 +820,10 @@ public class DataManagementPlanManager {
|
|||
assignProjectUserIfInternal(newDmp, user);
|
||||
}
|
||||
if(this.dataManagementProfileManager.fieldInBlueprint(newDmp.getProfile(), SystemFieldType.GRANT, principal)) {
|
||||
if (newDmp.getGrant() != null) {
|
||||
databaseRepository.getGrantDao().createOrUpdate(newDmp.getGrant());
|
||||
}
|
||||
}
|
||||
DMP tempDmp = databaseRepository.getDmpDao().createOrUpdate(newDmp);
|
||||
newDmp.setId(tempDmp.getId());
|
||||
for(DMPDatasetProfile dmpDatasetProfile : newDmp.getAssociatedDmps()){
|
||||
|
@ -2306,19 +2312,19 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
|
||||
private void assignGrandUserIfInternal(DMP dmp, UserInfo user) {
|
||||
if (dmp.getGrant().getCreationUser() == null && (dmp.getGrant().getReference() != null && dmp.getGrant().getReference().startsWith("dmp:"))) {
|
||||
if (dmp.getGrant() != null && dmp.getGrant().getCreationUser() == null && (dmp.getGrant().getReference() != null && dmp.getGrant().getReference().startsWith("dmp:"))) {
|
||||
dmp.getGrant().setCreationUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
private void assignFunderUserIfInternal(DMP dmp, UserInfo user) {
|
||||
if (dmp.getGrant().getFunder().getCreationUser() == null && ( dmp.getGrant().getFunder().getReference() != null && dmp.getGrant().getFunder().getReference().startsWith("dmp:"))) {
|
||||
if (dmp.getGrant() != null && dmp.getGrant().getFunder() != null && dmp.getGrant().getFunder().getCreationUser() == null && ( dmp.getGrant().getFunder().getReference() != null && dmp.getGrant().getFunder().getReference().startsWith("dmp:"))) {
|
||||
dmp.getGrant().getFunder().setCreationUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
private void assignProjectUserIfInternal(DMP dmp, UserInfo user) {
|
||||
if (dmp.getProject().getCreationUser() == null && (dmp.getProject().getReference() != null && dmp.getProject().getReference().startsWith("dmp:"))) {
|
||||
if (dmp.getProject() != null && dmp.getProject().getCreationUser() == null && (dmp.getProject().getReference() != null && dmp.getProject().getReference().startsWith("dmp:"))) {
|
||||
dmp.getProject().setCreationUser(user);
|
||||
}
|
||||
}
|
||||
|
@ -2398,7 +2404,7 @@ public class DataManagementPlanManager {
|
|||
* */
|
||||
|
||||
private void checkIfUserCanEditGrant(DMP dmp, UserInfo user) throws Exception{
|
||||
if (dmp.getGrant().getId() != null) {
|
||||
if (dmp.getGrant() != null && dmp.getGrant().getId() != null) {
|
||||
Grant grant = apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().find(dmp.getGrant().getId());
|
||||
if (grant.getFunder() != null && dmp.getGrant().getFunder() != null
|
||||
&& !grant.getFunder().getId().equals(dmp.getGrant().getFunder().getId())) {
|
||||
|
|
|
@ -16,7 +16,7 @@ public class AssociatedProfileImportModels {
|
|||
public UUID getId() { return id; }
|
||||
public void setId(UUID id) { this.id = id; }
|
||||
|
||||
@XmlElement(name = "profilelabel")
|
||||
@XmlElement(name = "profileLabel")
|
||||
public String getLabel() { return label; }
|
||||
public void setLabel(String label) { this.label = label; }
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
|
|||
if (this.grant != null) {
|
||||
if (this.grant.getExistGrant() != null && this.grant.getLabel() == null && this.grant.getDescription() == null)
|
||||
dataManagementPlanEntity.setGrant(this.grant.getExistGrant().toDataModel());
|
||||
else {
|
||||
else if (this.grant.getLabel() != null) {
|
||||
Grant grant = new Grant();
|
||||
grant.setId(UUID.randomUUID());
|
||||
grant.setAbbreviation("");
|
||||
|
@ -342,7 +342,7 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
|
|||
if (this.project != null) {
|
||||
if (this.project.getExistProject() != null && this.project.getLabel() == null && this.project.getDescription() == null)
|
||||
dataManagementPlanEntity.setProject(this.project.getExistProject().toDataModel());
|
||||
else {
|
||||
else if (this.project.getLabel() != null) {
|
||||
Project project = new Project();
|
||||
project.setId(UUID.randomUUID());
|
||||
project.setAbbreviation("");
|
||||
|
|
|
@ -196,7 +196,7 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
if (this.grant != null) {
|
||||
if (this.grant.getExistGrant() != null && this.grant.getLabel() == null && this.grant.getDescription() == null)
|
||||
entity.setGrant(this.grant.getExistGrant().toDataModel());
|
||||
else {
|
||||
else if (this.grant.getLabel() != null) {
|
||||
eu.eudat.data.entities.Grant grant = new eu.eudat.data.entities.Grant();
|
||||
grant.setId(UUID.randomUUID());
|
||||
grant.setAbbreviation("");
|
||||
|
@ -236,7 +236,7 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
if (this.project != null) {
|
||||
if (this.project.getExistProject() != null && this.project.getLabel() == null && this.project.getDescription() == null)
|
||||
entity.setProject(this.project.getExistProject().toDataModel());
|
||||
else {
|
||||
else if (this.project.getLabel() != null) {
|
||||
Project project = new Project();
|
||||
project.setId(UUID.randomUUID());
|
||||
project.setAbbreviation("");
|
||||
|
|
|
@ -223,6 +223,9 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
|||
removeSection(sectionIndex: number): void {
|
||||
this.systemFieldListPerSection.splice(sectionIndex, 1);
|
||||
this.sectionsArray().removeAt(sectionIndex);
|
||||
this.sectionsArray().controls.forEach((section, index) => {
|
||||
section.get('ordinal').setValue(index + 1);
|
||||
});
|
||||
}
|
||||
|
||||
fieldsArray(sectionIndex: number): FormArray {
|
||||
|
|
|
@ -199,6 +199,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
|||
this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => {
|
||||
this.lockStatus = lockStatus;
|
||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
||||
this.dmpSectionIndex = this.datasetWizardModel.dmpSectionIndex;
|
||||
this.needsUpdate();
|
||||
this.breadCrumbs = observableOf([
|
||||
{
|
||||
|
@ -337,6 +338,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
|||
this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => {
|
||||
this.lockStatus = lockStatus;
|
||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
||||
this.dmpSectionIndex = this.datasetWizardModel.dmpSectionIndex;
|
||||
this.datasetWizardModel.status = 0;
|
||||
this.formGroup = this.datasetWizardModel.buildForm();
|
||||
this.formGroup.get('id').setValue(null);
|
||||
|
|
|
@ -56,6 +56,7 @@ import { PopupNotificationDialogComponent } from '@app/library/notification/popu
|
|||
import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model';
|
||||
import { CheckDeactivateBaseComponent } from '@app/library/deactivate/deactivate.component';
|
||||
import { DmpProfileStatus } from '@app/core/common/enum/dmp-profile-status';
|
||||
import { DatasetService } from '@app/core/services/dataset/dataset.service';
|
||||
|
||||
interface Visible {
|
||||
value: boolean;
|
||||
|
@ -132,6 +133,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
|||
|
||||
constructor(
|
||||
private dmpProfileService: DmpProfileService,
|
||||
private datasetService: DatasetService,
|
||||
private authService: AuthService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
|
@ -658,6 +660,44 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
|||
|
||||
}
|
||||
|
||||
public removeDataset(datasetId: string, index: number) {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
maxWidth: '300px',
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
||||
isDeleteConfirmation: true
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (result) {
|
||||
if (datasetId) {
|
||||
this.datasetService.delete(datasetId)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => {
|
||||
this.onDeleteCallbackSuccess();
|
||||
},
|
||||
error => this.onDeleteCallbackError(error)
|
||||
);
|
||||
}
|
||||
this.formGroup.get('datasets')['controls'].splice(index, 1);
|
||||
this.step = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onDeleteCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
|
||||
this.dmp.id != null ? this.router.navigate(['/reload']).then(() => this.router.navigate(['/plans', 'edit', this.dmp.id])) : this.router.navigate(['/plans']);
|
||||
}
|
||||
|
||||
onDeleteCallbackError(error) {
|
||||
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
|
||||
//checks if the dpm is valid not taking into account the datasets validity
|
||||
private _isDMPDescriptionValid():boolean{
|
||||
|
||||
|
@ -933,6 +973,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
|||
let fields: Array<string> = new Array();
|
||||
var request = new DataTableRequest<DmpBlueprintCriteria>(0, 20, { fields: fields });
|
||||
request.criteria = new DmpBlueprintCriteria();
|
||||
request.criteria.like = query;
|
||||
request.criteria.status = DmpProfileStatus.Finalized;
|
||||
return this.dmpProfileService.getPagedBlueprint(request).pipe(map(x => x.data));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue