Add confirmation dialogue on DMP's overview "Publish" button. - (Issue #158)

This commit is contained in:
apapachristou 2019-09-20 18:27:54 +03:00
parent 68cb9846bb
commit 0bf062292d
5 changed files with 34 additions and 20 deletions

View File

@ -44,7 +44,7 @@
<button mat-raised-button color="primary" (click)="downloadPDF(dmp.id)" class="lightblue-btn ml-2"> <button mat-raised-button color="primary" (click)="downloadPDF(dmp.id)" class="lightblue-btn ml-2">
<mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }} <mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}
</button> </button>
<button *ngIf="showPublishButton(dmp)" mat-raised-button color="primary" (click)="publish(dmp.id)" class="lightblue-btn ml-2"> <button *ngIf="showPublishButton(dmp)" mat-raised-button (click)="publish(dmp.id)" class="lightblue-btn ml-2">
<mat-icon>public</mat-icon> {{ 'DMP-LISTING.ACTIONS.PUBLISH' | translate }} <mat-icon>public</mat-icon> {{ 'DMP-LISTING.ACTIONS.PUBLISH' | translate }}
</button> </button>
<button *ngIf="isDraftDmp(dmp)" mat-raised-button color="primary" (click)="finalize(dmp)" class="lightblue-btn ml-2"> <button *ngIf="isDraftDmp(dmp)" mat-raised-button color="primary" (click)="finalize(dmp)" class="lightblue-btn ml-2">

View File

@ -124,7 +124,8 @@
} }
.finalized-bookmark { .finalized-bookmark {
color: #92d050; color: #08bd63;
// color: #92d050;
display: inline; display: inline;
position: absolute; position: absolute;
margin-top: 0.5em; margin-top: 0.5em;

View File

@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog';
import { MatDialog } from '@angular/material';
import { ActivatedRoute, Params, Router } from '@angular/router'; import { ActivatedRoute, Params, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import * as FileSaver from 'file-saver'; import * as FileSaver from 'file-saver';
@ -20,7 +19,6 @@ import { ConfirmationDialogComponent } from '../../../library/confirmation-dialo
import { ExportMethodDialogComponent } from '../../../library/export-method-dialog/export-method-dialog.component'; import { ExportMethodDialogComponent } from '../../../library/export-method-dialog/export-method-dialog.component';
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item'; import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
import { DmpFinalizeDialogComponent, DmpFinalizeDialogInput, DmpFinalizeDialogOutput } from '../editor/dmp-finalize-dialog/dmp-finalize-dialog.component'; import { DmpFinalizeDialogComponent, DmpFinalizeDialogInput, DmpFinalizeDialogOutput } from '../editor/dmp-finalize-dialog/dmp-finalize-dialog.component';
import { ValidationErrorModel } from '../../../common/forms/validation/error-model/validation-error-model';
import { DatasetsToBeFinalized } from '../../../core/model/dataset/datasets-toBeFinalized'; import { DatasetsToBeFinalized } from '../../../core/model/dataset/datasets-toBeFinalized';
@Component({ @Component({
@ -331,10 +329,23 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
} }
publish(dmpId: String) { publish(dmpId: String) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.PUBLISH-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.dmpService.publish(dmpId) this.dmpService.publish(dmpId)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(() => { this.hasPublishButton = false }); .subscribe(() => { this.hasPublishButton = false });
} }
});
}
finalize(dmp: DmpOverviewModel) { finalize(dmp: DmpOverviewModel) {

View File

@ -38,6 +38,7 @@
"DELETE-ITEM": "Delete this item?", "DELETE-ITEM": "Delete this item?",
"DELETE-USER": "Remove this collaborator?", "DELETE-USER": "Remove this collaborator?",
"FINALIZE-ITEM": "Finalize this item?", "FINALIZE-ITEM": "Finalize this item?",
"PUBLISH-ITEM": "Publish this item?",
"ADD-DATASET": "Do you want to continue by adding a Dataset Description to your DMP? You can always add more Dataset Descriptions using \"Add Dataset Description (Wizard)\" menu.", "ADD-DATASET": "Do you want to continue by adding a Dataset Description to your DMP? You can always add more Dataset Descriptions using \"Add Dataset Description (Wizard)\" menu.",
"ZENODO-DOI": "Would you like to create digital object identifier (DOI) for the DMP?", "ZENODO-DOI": "Would you like to create digital object identifier (DOI) for the DMP?",
"ACTIONS": { "ACTIONS": {

View File

@ -34,6 +34,7 @@
.lightblue-btn { .lightblue-btn {
background-color: rgb(0, 178, 159) !important; background-color: rgb(0, 178, 159) !important;
color: white !important;
// background-color: rgba(0, 112, 192, 1) !important; // background-color: rgba(0, 112, 192, 1) !important;
} }