Merge branch 'dmp-refactoring' of code-repo.d4science.org:MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
c28c700eff
File diff suppressed because one or more lines are too long
|
@ -41,7 +41,7 @@
|
||||||
<mat-form-field class="col-md-12">
|
<mat-form-field class="col-md-12">
|
||||||
<app-single-auto-complete [required]="true" [formControl]="prefillForm.get('prefillingSourceId')"
|
<app-single-auto-complete [required]="true" [formControl]="prefillForm.get('prefillingSourceId')"
|
||||||
placeholder="{{'PREFILL-DESCRIPTION-DIALOG.PREFILLING-SOURCE' | translate}}"
|
placeholder="{{'PREFILL-DESCRIPTION-DIALOG.PREFILLING-SOURCE' | translate}}"
|
||||||
[configuration]="prefillingSourceService.singleAutocompleteConfiguration">
|
[configuration]="prefillingSourceService.singleAutocompleteConfiguration" (optionSelected)="changePreffillingSource($event)">
|
||||||
</app-single-auto-complete>
|
</app-single-auto-complete>
|
||||||
<mat-error *ngIf="prefillForm.get('prefillingSourceId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="prefillForm.get('prefillingSourceId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -77,6 +77,10 @@ export class PrefillDescriptionDialogComponent extends BaseComponent implements
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changePreffillingSource(){
|
||||||
|
this.prefillForm.get('prefillId').setValue(null);
|
||||||
|
}
|
||||||
|
|
||||||
// addProfileIfUsedLessThanMax(profile: DescriptionProfileModel) {
|
// addProfileIfUsedLessThanMax(profile: DescriptionProfileModel) {
|
||||||
// const dmpSectionIndex = this.data.datasetFormGroup.get('dmpSectionIndex').value;
|
// const dmpSectionIndex = this.data.datasetFormGroup.get('dmpSectionIndex').value;
|
||||||
// const blueprintId = this.data.datasetFormGroup.get('dmp').value.profile.id;
|
// const blueprintId = this.data.datasetFormGroup.get('dmp').value.profile.id;
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-auto d-flex flex-row">
|
<div class="ml-auto d-flex flex-row">
|
||||||
<div class="col-auto d-flex align-items-center">
|
<div class="col-auto d-flex align-items-center">
|
||||||
<button [disabled]="saving" *ngIf="isDirty()" type="button" mat-raised-button class="discard-btn mr-3" (click)="discard()">
|
<button [disabled]="saving" *ngIf="isDirty()" type="button" mat-raised-button class="discard-btn mr-3" (click)="discardChanges()">
|
||||||
{{'DMP-EDITOR.ACTIONS.DISCARD' | translate}}
|
{{'DMP-EDITOR.ACTIONS.DISCARD.DISCARD' | translate}}
|
||||||
</button>
|
</button>
|
||||||
<button [disabled]="saving" *ngIf="isNew" mat-raised-button type="button" (click)="formSubmit()" class="save-btn">
|
<button [disabled]="saving" *ngIf="isNew" mat-raised-button type="button" (click)="formSubmit()" class="save-btn">
|
||||||
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
|
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
|
||||||
|
|
|
@ -271,6 +271,47 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
discardChanges() {
|
||||||
|
let messageText = "";
|
||||||
|
let confirmButtonText = "";
|
||||||
|
let cancelButtonText = "";
|
||||||
|
let isDeleteConfirmation = false;
|
||||||
|
|
||||||
|
if (this.isNew) {
|
||||||
|
|
||||||
|
messageText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-MESSAGE');
|
||||||
|
confirmButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-CONFIRM');
|
||||||
|
cancelButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-DENY');
|
||||||
|
isDeleteConfirmation = true;
|
||||||
|
} else {
|
||||||
|
messageText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-MESSAGE');
|
||||||
|
confirmButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-CONFIRM');
|
||||||
|
cancelButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-DENY');
|
||||||
|
isDeleteConfirmation = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||||
|
restoreFocus: false,
|
||||||
|
data: {
|
||||||
|
message: messageText,
|
||||||
|
confirmButton: confirmButtonText,
|
||||||
|
cancelButton: cancelButtonText,
|
||||||
|
isDeleteConfirmation: true
|
||||||
|
},
|
||||||
|
maxWidth: '40em'
|
||||||
|
});
|
||||||
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||||
|
if (result) {
|
||||||
|
setTimeout(x => {
|
||||||
|
this.step = this.step > 0 ? this.step - 1 : 0;
|
||||||
|
this.ngOnInit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public delete() {
|
public delete() {
|
||||||
const value = this.formGroup.value;
|
const value = this.formGroup.value;
|
||||||
if (value.id) {
|
if (value.id) {
|
||||||
|
|
|
@ -1412,7 +1412,15 @@
|
||||||
"DMP-BLUEPRINT-VERSION": "Version"
|
"DMP-BLUEPRINT-VERSION": "Version"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
"DISCARD": {
|
||||||
"DISCARD": "Discard",
|
"DISCARD": "Discard",
|
||||||
|
"DISCARD-NEW-MESSAGE": "All unsaved changes will be lost. Would you like to proceed?",
|
||||||
|
"DISCARD-NEW-CONFIRM": "Yes, revert changes.",
|
||||||
|
"DISCARD-NEW-DENY": "No.",
|
||||||
|
"DISCARD-EDITED-MESSAGE": "All unsaved changes will be lost. Would you like to proceed?",
|
||||||
|
"DISCARD-EDITED-CONFIRM": "Yes, revert changes.",
|
||||||
|
"DISCARD-EDITED-DENY": "No."
|
||||||
|
},
|
||||||
"SAVE": "Save",
|
"SAVE": "Save",
|
||||||
"DELETE": "Delete",
|
"DELETE": "Delete",
|
||||||
"ADD-DESCRIPTION-IN-SECTION": "Add Description",
|
"ADD-DESCRIPTION-IN-SECTION": "Add Description",
|
||||||
|
|
Loading…
Reference in New Issue