Add UNFINALIZE button (dmp&dataset overview) & DEPOSIT button hidden after doi creation (dmp overview)

This commit is contained in:
gpapavgeri 2020-07-20 12:16:23 +03:00
parent 578093a53c
commit 04f09ef578
7 changed files with 140 additions and 55 deletions

View File

@ -49,8 +49,8 @@
matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>
<button *ngIf="isDraftDataset(dataset) && isUserOwner && !lockStatus" (click)="editClicked(dataset)"
mat-mini-fab class="mr-3 actions-btn"
<button *ngIf="isDraftDataset(dataset) && isUserOwner && !lockStatus"
(click)="editClicked(dataset)" mat-mini-fab class="mr-3 actions-btn"
matTooltip="{{'DMP-LISTING.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
@ -76,7 +76,8 @@
<div class="row header">{{'DMP-OVERVIEW.RESEARCHERS' | translate}}</div>
<div class="row">
<div *ngFor="let researcher of researchers; let last = last">
<a href="{{ getOrcidPathForResearcher(researcher.reference) }}" target="blank" class="researcher">
<a href="{{ getOrcidPathForResearcher(researcher.reference) }}" target="blank"
class="researcher">
<div class="id-btn">&nbsp;</div>
<div *ngIf="!last">{{ researcher.name }}, </div>
<div *ngIf="last">{{ researcher.name }}</div>
@ -102,6 +103,12 @@
<hr class="hr-line">
</div>
</div>
<div *ngIf="hasReversableStatus(dataset) && !lockStatus" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="reverse(dataset)">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">unarchive</mat-icon>
</button>
<p class="mb-0 mr-0 pl-2 frame-txt">{{ 'DATASET-WIZARD.ACTIONS.REVERSE' | translate }}</p>
</div>
<div class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<button mat-mini-fab class="frame-btn" [matMenuTriggerFor]="exportMenu">
<mat-icon class="mat-mini-fab-icon">open_in_new</mat-icon>
@ -153,7 +160,8 @@
<p class="authors-role">{{ roleDisplay(user) }}</p>
</div>
</div>
<button *ngIf="isUserOwner && !dataset.status && user.role" (click)="removeUserFromDmp(user)"
<button *ngIf="isUserOwner && !dataset.status && user.role"
(click)="removeUserFromDmp(user)"
class="remove-btn">{{ 'GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE' | translate}}</button>
</div>
</div>
@ -169,4 +177,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -31,6 +31,7 @@ import { LockService } from '@app/core/services/lock/lock.service';
import { DatasetsToBeFinalized } from '@app/core/model/dataset/datasets-toBeFinalized';
import { DatasetModel } from '@app/core/model/dataset/dataset';
import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
@Component({
@ -301,15 +302,15 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
this.router.navigate(['/datasets']);
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
onUpdateCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
onUpdateCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Error);
}
@ -358,15 +359,15 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
}
//GK: NO
// downloadJson(id: string) {
// this.datasetService.downloadJson(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(response => {
// const blob = new Blob([response.body], { type: 'application/json' });
// const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
// FileSaver.saveAs(blob, filename);
// })
// }
// downloadJson(id: string) {
// this.datasetService.downloadJson(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(response => {
// const blob = new Blob([response.body], { type: 'application/json' });
// const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
// FileSaver.saveAs(blob, filename);
// })
// }
getFilenameFromContentDispositionHeader(header: string): string {
const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g);
@ -492,4 +493,32 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
});
}
hasReversableStatus(dataset: DatasetOverviewModel): boolean {
return dataset.dmp.status == DmpStatus.Draft && dataset.status == DatasetStatus.Finalized
}
reverse(dataset: DatasetOverviewModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.UNFINALIZE-ITEM'),
confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'),
cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.getDatasetWizardModel(this.dataset.id);
this.datasetWizardModel.status = DatasetStatus.Draft;
this.datasetWizardService.createDataset(this.datasetWizardModel)
.pipe(takeUntil(this._destroyed))
.subscribe(
data => this.onUpdateCallbackSuccess(),
error => this.onUpdateCallbackError(error)
);
}
});
}
}

View File

@ -33,8 +33,10 @@
</div>
<span>.</span>
<mat-form-field appearance="outline" class="versions-select ml-2 mr-4">
<mat-select placeholder="{{'DMP-LISTING.VERSION' | translate}} {{dmp.version}}" [(ngModel)]="version" (ngModelChange)="versionChanged(version.id)">
<mat-option *ngFor="let version of versions" [value]="version">{{'DMP-LISTING.VERSION' | translate}} {{version.version}}</mat-option>
<mat-select placeholder="{{'DMP-LISTING.VERSION' | translate}} {{dmp.version}}"
[(ngModel)]="version" (ngModelChange)="versionChanged(version.id)">
<mat-option *ngFor="let version of versions" [value]="version">
{{'DMP-LISTING.VERSION' | translate}} {{version.version}}</mat-option>
</mat-select>
</mat-form-field>
<div class="d-flex mr-4">{{'GENERAL.STATUSES.EDIT' | translate}} :
@ -48,13 +50,19 @@
</div>
</div>
<div class="row">
<button *ngIf="isAuthenticated()" (click)="cloneClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<button *ngIf="isAuthenticated()" (click)="cloneClicked(dmp)" mat-mini-fab
class="mr-3 d-flex justify-content-center align-items-center"
matTooltip="{{'DMP-LISTING.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>
<button *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<button *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus" (click)="editClicked(dmp)"
mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center"
matTooltip="{{'DMP-LISTING.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
<button *ngIf="isUserOwner && !lockStatus" (click)="deleteClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<button *ngIf="isUserOwner && !lockStatus" (click)="deleteClicked()" mat-mini-fab
class="mr-3 d-flex justify-content-center align-items-center"
matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">delete</mat-icon>
</button>
</div>
@ -63,7 +71,8 @@
<div class="row header">{{'DMP-OVERVIEW.RESEARCHERS' | translate}}</div>
<div class="row">
<div *ngFor="let researcher of dmp.researchers; let last = last">
<a href="{{ getOrcidPathForResearcher(researcher.reference) }}" target="blank" class="researcher">
<a href="{{ getOrcidPathForResearcher(researcher.reference) }}" target="blank"
class="researcher">
<div class="id-btn">&nbsp;</div>
<div *ngIf="!last">{{ researcher.name }}, </div>
<div *ngIf="last">{{ researcher.name }}</div>
@ -79,7 +88,8 @@
<div *ngFor="let dataset of dmp.datasets; let i=index">
<div class="row" *ngIf="i < 3" (click)="datasetClicked(dataset.id)">
<button mat-raised-button class="mb-2 mr-2 pl-0 pr-0">
<div matTooltip="{{ dataset.label }} : {{ dataset.datasetTemplate.label }}" class="col-auto dataset-btn">
<div matTooltip="{{ dataset.label }} : {{ dataset.datasetTemplate.label }}"
class="col-auto dataset-btn">
<div class="dataset-btn-label">{{ dataset.label }}:
{{ dataset.datasetTemplate.label }}</div>
<mat-icon>launch</mat-icon>
@ -95,7 +105,8 @@
</div>
</div>
<div class="row mt-2 add-dataset-txt">
<button class="add-dataset-btn" *ngIf="isDraftDmp(dmp) && isUserOwner" (click)="addDataset(dmp.id)">
<button class="add-dataset-btn" *ngIf="isDraftDmp(dmp) && isUserOwner"
(click)="addDataset(dmp.id)">
<mat-icon>add</mat-icon>
{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}
</button>
@ -109,10 +120,14 @@
<textarea #doi class="doi-txt">{{ dmp.doi }}</textarea>
</p>
<div class="d-flex justify-content-end">
<button (click)="copyDoi(doi)" mat-mini-fab class="mr-2 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-LISTING.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<button (click)="copyDoi(doi)" mat-mini-fab
class="mr-2 d-flex justify-content-center align-items-center"
matTooltip="{{'DMP-LISTING.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>
<button mat-mini-fab class="mr-2 d-flex justify-content-center align-items-center" matTooltip="{{'GRANT-EDITOR.ACTIONS.VISIT-WEBSITE' | translate}}" matTooltipPosition="above">
<button mat-mini-fab class="mr-2 d-flex justify-content-center align-items-center"
matTooltip="{{'GRANT-EDITOR.ACTIONS.VISIT-WEBSITE' | translate}}"
matTooltipPosition="above">
<a [href]="createDoiLink(dmp.doi)" class="doi-link" target="_blank">
<mat-icon class="mat-mini-fab-icon">launch</mat-icon>
</a>
@ -132,12 +147,20 @@
<hr class="hr-line">
</div>
</div>
<div *ngIf="isFinalizedDmp(dmp) && !this.isPublicView && isUserOwner" (click)="getDoi(dmp)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<div *ngIf="hasDoi(dmp) && isFinalizedDmp(dmp) && !this.isPublicView && isUserOwner"
(click)="getDoi(dmp)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">archive</mat-icon>
</button>
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.DEPOSIT' | translate }}</p>
</div>
<div *ngIf="(isFinalizedDmp(dmp) && hasDoi(dmp) && !isPublishedDMP(dmp)) && isUserOwner"
(click)="reverse(dmp)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">unarchive</mat-icon>
</button>
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.UNFINALIZE' | translate }}</p>
</div>
<div class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<button mat-mini-fab class="frame-btn" [matMenuTriggerFor]="exportMenu">
<mat-icon class="mat-mini-fab-icon">open_in_new</mat-icon>
@ -145,14 +168,16 @@
<p class="mb-0 mr-0 pl-2 frame-txt" [matMenuTriggerFor]="exportMenu">
{{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}</p>
</div>
<div *ngIf="isUserOwner" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="newVersion(dmp.id, dmp.label)">
<div *ngIf="isUserOwner" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center"
(click)="newVersion(dmp.id, dmp.label)">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">add_to_photos</mat-icon>
</button>
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.START-NEW-VERSION' | translate }}
</p>
</div>
<div *ngIf="!dmp.isPublic && showPublishButton(dmp) && isUserOwner" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="publish(dmp.id)">
<div *ngIf="!dmp.isPublic && showPublishButton(dmp) && isUserOwner"
class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="publish(dmp.id)">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">public</mat-icon>
</button>
@ -195,10 +220,13 @@
<p class="authors-role">{{ roleDisplay(user) }}</p>
</div>
</div>
<button *ngIf="isUserOwner && !dmp.status && user.role" (click)="removeUserFromDmp(user)" class="remove-btn">{{ 'GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE' | translate}}</button>
<button *ngIf="isUserOwner && !dmp.status && user.role"
(click)="removeUserFromDmp(user)"
class="remove-btn">{{ 'GENERAL.CONFIRMATION-DIALOG.ACTIONS.REMOVE' | translate}}</button>
</div>
</div>
<div *ngIf="isUserOwner" (click)="openShareDialog(dmp.id,dmp.label)" class="row mt-3 mb-3 d-flex align-items-center justify-content-center">
<div *ngIf="isUserOwner" (click)="openShareDialog(dmp.id,dmp.label)"
class="row mt-3 mb-3 d-flex align-items-center justify-content-center">
<button mat-raised-button class="invite-btn">
<mat-icon>group_add</mat-icon>
{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}
@ -413,4 +441,4 @@
</div>
</div>
</div>
-->
-->

View File

@ -221,15 +221,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.dmpService.delete(this.dmp.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => { this.onCallbackSuccess() },
complete => { this.onDeleteCallbackSuccess() },
error => this.onDeleteCallbackError(error)
);
}
});
}
onCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/plans']);
}
@ -237,6 +237,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
onUpdateCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onUpdateCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Error);
}
downloadXml(id: string) {
this.dmpService.downloadXML(id)
.pipe(takeUntil(this._destroyed))
@ -478,7 +487,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
if (result) {
this.dmpService.publish(dmpId)
.pipe(takeUntil(this._destroyed))
.subscribe(() => {
.subscribe(() => {
this.hasPublishButton = false;
this.reloadPage();
});
@ -516,18 +525,14 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
.subscribe(
complete => {
this.dmp.status = DmpStatus.Finalized;
this.onCallbackSuccess()
this.onUpdateCallbackSuccess();
},
error => this.onFinalizeCallbackError(error)
error => this.onUpdateCallbackError(error)
);
}
});
}
onFinalizeCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DMP-EDITOR.SNACK-BAR.UNSUCCESSFUL-FINALIZE'), SnackBarNotificationLevel.Error);
}
newVersion(id: String, label: String) {
this.router.navigate(['/plans/new_version/' + id, { dmpLabel: label }]);
}
@ -571,14 +576,27 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
}
reverse() {
this.dmpService.unfinalize(this.dmp.id).pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.dmp.status = DmpStatus.Draft;
this.onCallbackSuccess()
},
error => this.onFinalizeCallbackError(error)
);
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.UNFINALIZE-ITEM'),
confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'),
cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'),
isDeleteConfirmation: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.dmpService.unfinalize(this.dmp.id).pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.dmp.status = DmpStatus.Draft;
this.onUpdateCallbackSuccess()
},
error => this.onUpdateCallbackError(error)
);
}
});
}
goBack(): void {
@ -595,10 +613,9 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
return this.dmpService.updateUsers(this.dmp.id, this.dmp.users).pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.onCallbackSuccess();
this.reloadPage();
this.onUpdateCallbackSuccess();
},
error => this.onDeleteCallbackError(error)
error => this.onUpdateCallbackError(error)
);
}

View File

@ -50,6 +50,7 @@
"DELETE-ITEM": "Delete this item?",
"DELETE-USER": "Remove this collaborator?",
"FINALIZE-ITEM": "Finalize this item?",
"UNFINALIZE-ITEM": "Undo Finalization?",
"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.",
"ZENODO-DOI": "Would you like to create digital object identifier (DOI) with {{username}} account for the DMP?",

View File

@ -50,6 +50,7 @@
"DELETE-ITEM": "¿Borrar este item?",
"DELETE-USER": "¿Borrar este colaborador?",
"FINALIZE-ITEM": "¿Finalizar este item?",
"UNFINALIZE-ITEM": "Undo Finalization?",
"PUBLISH-ITEM": "¿Publicar este item?",
"ADD-DATASET": "¿Quiere continuar añadiendo una descripción al Dataset de su PGD? Siempre puede añadir más descripciones al Dataset utilizado el menú\"(Asistente) Añadir una decripción del Dataset\".",
"ZENODO-DOI": "¿Quiere crear un Identificación de Objeto Digital (DOI) para el PGD?",

View File

@ -50,6 +50,7 @@
"DELETE-ITEM": "Διαγραφή αυτού του στοιχείου;",
"DELETE-USER": "Αφαίρεση αυτού του συνεργάτη;",
"FINALIZE-ITEM": "Ολοκλήρωση αυτού του στοιχείου;",
"UNFINALIZE-ITEM": "Undo Finalization?",
"PUBLISH-ITEM": "Δημοσίευση αυτού του στοιχείου;",
"ADD-DATASET": "Θέλετε να συνεχίσετε προσθέτοντας μια Περιγραφή Συνόλου Δεδομένων στο Σχέδιο Διαχείρισης Δεδομένων σας; Μπορείτε πάντα να προσθέσετε περισσότερες Περιγραφές Συνόλων Δεδομένων χρησιμοποιώντας \"Add Dataset Description (Wizard)\" menu.",
"ZENODO-DOI": "Θέλετε να δημιουργήσετε μονοσήμαντο αναγνωριστικό ψηφιακού αντικειμένου (DOI) για το Σχέδιο Διαχείρισης Δεδομένων σας;",