Adds information dialogue on DMP Wizard Save button when list of datasets is empty. (Issue #189)

This commit is contained in:
apapachristou 2019-10-08 17:44:18 +03:00
parent 9bdeaa6375
commit 27ddc0a184
3 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<h2 mat-dialog-title>{{notification.title}}</h2> <h2 mat-dialog-title>{{notification.title}}</h2>
<mat-dialog-content>{{notification.message}}</mat-dialog-content> <mat-dialog-content>{{notification.message}}</mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions class="d-flex">
<button mat-button mat-dialog-close>{{'NOTIFICATION-COMPONENT.POPUP.CLOSE-BUTTON' | translate}}</button> <button class="ml-auto" mat-button mat-dialog-close>{{'GENERAL.NOTIFICATION-DIALOG.POPUP.CLOSE' | translate}}</button>
</mat-dialog-actions> </mat-dialog-actions>

View File

@ -13,7 +13,7 @@ import { BaseComponent } from "../../../core/common/base/base.component";
import { DatasetStatus } from '../../../core/common/enum/dataset-status'; import { DatasetStatus } from '../../../core/common/enum/dataset-status';
import { DmpStatus } from '../../../core/common/enum/dmp-status'; import { DmpStatus } from '../../../core/common/enum/dmp-status';
import { DatasetService } from '../../../core/services/dataset/dataset.service'; import { DatasetService } from '../../../core/services/dataset/dataset.service';
import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service'; import { SnackBarNotificationLevel, UiNotificationService, PopupNotification } from '../../../core/services/notification/ui-notification-service';
import { QuickWizardService } from '../../../core/services/quick-wizard/quick-wizard.service'; import { QuickWizardService } from '../../../core/services/quick-wizard/quick-wizard.service';
import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component';
import { DmpFinalizeDialogComponent, DmpFinalizeDialogDataset, DmpFinalizeDialogInput } from '../../dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component'; import { DmpFinalizeDialogComponent, DmpFinalizeDialogDataset, DmpFinalizeDialogInput } from '../../dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component';
@ -25,6 +25,7 @@ import { QuickWizardEditorWizardModel } from './quick-wizard-editor.model';
import { FunderFormModel } from '../../dmp/editor/grant-tab/funder-form-model'; import { FunderFormModel } from '../../dmp/editor/grant-tab/funder-form-model';
import { ProjectFormModel } from '../../dmp/editor/grant-tab/project-form-model'; import { ProjectFormModel } from '../../dmp/editor/grant-tab/project-form-model';
import { CheckDeactivateBaseComponent } from '../../../library/deactivate/deactivate.component'; import { CheckDeactivateBaseComponent } from '../../../library/deactivate/deactivate.component';
import { PopupNotificationDialogComponent } from '../../../library/notification/popup/popup-notification.component';
@Component({ @Component({
selector: 'app-quick-wizard-editor-component', selector: 'app-quick-wizard-editor-component',
@ -91,6 +92,7 @@ export class QuickWizardEditorComponent extends CheckDeactivateBaseComponent imp
} }
this.onSubmitSave(); this.onSubmitSave();
} else { } else {
this.uiNotificationService.popupNotification(this.language.instant('GENERAL.NOTIFICATION-DIALOG.POPUP.TITLE'), this.language.instant('GENERAL.NOTIFICATION-DIALOG.POPUP.MESSAGE'));
return; return;
} }
} }
@ -123,6 +125,8 @@ export class QuickWizardEditorComponent extends CheckDeactivateBaseComponent imp
} }
this.formGroup.get('dmp').get('status').setValue(DmpStatus.Finalized); this.formGroup.get('dmp').get('status').setValue(DmpStatus.Finalized);
this.onSubmitSaveAndFinalize(); this.onSubmitSaveAndFinalize();
} else {
this.uiNotificationService.popupNotification(this.language.instant('GENERAL.NOTIFICATION-DIALOG.POPUP.TITLE'), this.language.instant('GENERAL.NOTIFICATION-DIALOG.POPUP.MESSAGE'));
} }
} }
}); });
@ -133,7 +137,7 @@ export class QuickWizardEditorComponent extends CheckDeactivateBaseComponent imp
} }
public isFormValid() { public isFormValid() {
return this.formGroup.get('grant').valid && this.formGroup.get('funder').valid; return this.formGroup.get('grant').valid && this.formGroup.get('funder').valid;
} }
public touchAllFormFields(formControl: AbstractControl) { public touchAllFormFields(formControl: AbstractControl) {

View File

@ -52,6 +52,13 @@
"LEAVE": "Leave" "LEAVE": "Leave"
} }
}, },
"NOTIFICATION-DIALOG": {
"POPUP": {
"TITLE": "Missing Dataset",
"MESSAGE": "At least one dataset has to be created to proceed on saving DMP.",
"CLOSE": "Close"
}
},
"ACTIONS": { "ACTIONS": {
"VIEW-ALL": "View All", "VIEW-ALL": "View All",
"SHOW-MORE": "Show more", "SHOW-MORE": "Show more",