Popup dialog on locked DMP/Datasets overview / editors

This commit is contained in:
Kristian Ntavidi 2021-06-22 14:12:58 +03:00
parent c9b376f76c
commit e2f262b385
14 changed files with 136 additions and 31 deletions

View File

@ -26,16 +26,16 @@
</div>
</div>
</div>
<div class="row" *ngIf="!viewOnly">
<div class="col-auto d-flex align-items-center p-0">
<div class="row">
<div class="col-auto d-flex align-items-center p-0" *ngIf="!viewOnly">
<button *ngIf="isDirty()" type="button" mat-raised-button class="dataset-discard-btn" (click)="discardChanges()">
{{'DMP-EDITOR.ACTIONS.DISCARD' | translate}}
</button>
</div>
<div class="col-auto d-flex align-items-center">
<button *ngIf="!lockStatus" mat-raised-button class="dataset-save-btn mr-2" (click)="save()" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
<button *ngIf="!lockStatus" mat-raised-button class="dataset-save-btn mr-2" (click)="save(saveAnd.close)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button *ngIf="!lockStatus" mat-raised-button class="dataset-save-btn mr-2" (click)="save(saveAnd.addNew)">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}</button>
<button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="dataset-save-btn mr-2" (click)="save()" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
<button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="dataset-save-btn mr-2" (click)="save(saveAnd.close)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button *ngIf="!lockStatus && !viewOnly" mat-raised-button class="dataset-save-btn mr-2" (click)="save(saveAnd.addNew)">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}</button>
<button *ngIf="lockStatus" mat-raised-button disabled class="dataset-save-btn cursor-default" type="button">{{ 'DMP-OVERVIEW.LOCKED' | translate}}</button>
<!-- <button *ngIf="!lockStatus" mat-raised-button class="dataset-save-btn mr-2" (click)="touchForm()" type="button">{{ 'DATASET-WIZARD.ACTIONS.VALIDATE' | translate }}</button> -->
</div>

View File

@ -31,7 +31,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { TranslateService } from '@ngx-translate/core';
import * as FileSaver from 'file-saver';
import { Observable, of as observableOf, interval, Subscription } from 'rxjs';
import { Observable, of as observableOf, interval} from 'rxjs';
import { catchError, debounceTime, map, takeUntil } from 'rxjs/operators';
import { LockService } from '@app/core/services/lock/lock.service';
import { Location } from '@angular/common';
@ -39,14 +39,13 @@ import { LockModel } from '@app/core/model/lock/lock.model';
import { Guid } from '@common/types/guid';
import { isNullOrUndefined } from 'util';
import { AuthService } from '@app/core/services/auth/auth.service';
import { environment } from 'environments/environment';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { SaveType } from '@app/core/common/enum/save-type';
import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard';
import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { HttpClient } from '@angular/common/http';
import { ToCEntry, ToCEntryType } from '@app/ui/misc/dataset-description-form/dataset-description.component';
import { VisibilityRulesService } from '@app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
@Component({
selector: 'app-dataset-wizard-component',
@ -193,6 +192,13 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
// if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
this.loadDatasetProfiles();
this.registerFormListeners();
if(lockStatus){
this.dialog.open(PopupNotificationDialogComponent,{data:{
title:this.language.instant('DATASET-WIZARD.LOCKED.TITLE'),
message:this.language.instant('DATASET-WIZARD.LOCKED.MESSAGE')
}, maxWidth:'30em'});
}
// this.availableProfiles = this.datasetWizardModel.dmp.profiles;
})
},

View File

@ -33,6 +33,7 @@ import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DmpOverviewModel } from '@app/core/model/dmp/dmp-overview';
import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { HttpClient } from '@angular/common/http';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
@Component({
@ -139,7 +140,15 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
checkLockStatus(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => this.lockStatus = lockStatus);
.subscribe(lockStatus => {
this.lockStatus = lockStatus
if(lockStatus){
this.dialog.open(PopupNotificationDialogComponent,{data:{
title:this.language.instant('DATASET-OVERVIEW.LOCKED.TITLE'),
message:this.language.instant('DATASET-OVERVIEW.LOCKED.MESSAGE')
}, maxWidth:'30em'});
}
});
}
onFetchingDeletedCallbackError(redirectRoot: string) {

View File

@ -1,11 +1,11 @@
import { Component, OnInit, SimpleChanges } from '@angular/core';
import { FormGroup, AbstractControl, FormControl, FormArray, FormBuilder } from '@angular/forms';
import { Component, OnInit} from '@angular/core';
import { FormGroup, AbstractControl, FormControl, FormArray} from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
import { DmpProfileDefinition, DmpProfile } from '@app/core/model/dmp-profile/dmp-profile';
import { DmpProfileDefinition } from '@app/core/model/dmp-profile/dmp-profile';
import { DmpProfileListing } from '@app/core/model/dmp-profile/dmp-profile-listing';
import { DmpModel } from '@app/core/model/dmp/dmp';
import { UserModel } from '@app/core/model/user/user';
@ -33,7 +33,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid
import { TranslateService } from '@ngx-translate/core';
import * as FileSaver from 'file-saver';
import { Observable, of as observableOf, interval } from 'rxjs';
import { catchError, delay, map, takeUntil } from 'rxjs/operators';
import { map, takeUntil } from 'rxjs/operators';
import { Principal } from "@app/core/model/auth/principal";
import { Role } from "@app/core/common/enum/role";
import { LockService } from '@app/core/services/lock/lock.service';
@ -42,13 +42,7 @@ import { Guid } from '@common/types/guid';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { ExtraPropertiesFormModel } from './general-tab/extra-properties-form.model';
import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { DmpListingModel } from '@app/core/model/dmp/dmp-listing';
import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria';
import { DatasetDescriptionFormEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service';
import { CloneDialogComponent } from '../clone/clone-dialog/clone-dialog.component';
import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard';
import { DatasetService } from '@app/core/services/dataset/dataset.service';
import { DmpToDatasetDialogComponent } from '../dmp-to-dataset/dmp-to-dataset-dialog.component';
import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model';
@ -117,7 +111,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
private formService: FormService,
private lockService: LockService,
private configurationService: ConfigurationService,
private httpClient: HttpClient,
private matomoService: MatomoService
) {
super();

View File

@ -103,7 +103,7 @@
<span class="material-icons">horizontal_rule</span>
</div>
</div>
<div class="row mt-2 add-dataset-txt">
<div class="row mt-2 add-dataset-txt" *ngIf="!lockStatus">
<a class="add-dataset-btn" *ngIf="isDraftDmp(dmp)" [routerLink]="['/datasets/new/' + dmp.id]" target="_blank">
<mat-icon>add</mat-icon>
{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}

View File

@ -1,5 +1,5 @@
import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core';
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { DatasetStatus } from '@app/core/common/enum/dataset-status';
@ -22,19 +22,13 @@ import { Observable, of as observableOf, interval } from 'rxjs';
import { takeUntil, map } from 'rxjs/operators';
import { Role } from "@app/core/common/enum/role";
import { DmpInvitationDialogComponent } from '../invitation/dmp-invitation-dialog.component';
import { MultipleChoiceDialogModule } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.module';
import { MultipleChoiceDialogComponent } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.component';
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
import { Oauth2DialogComponent } from '@app/ui/misc/oauth2-dialog/oauth2-dialog.component';
import { Oauth2DialogService } from '@app/ui/misc/oauth2-dialog/service/oauth2-dialog.service';
import { isNullOrUndefined } from 'util';
import { UserService } from '@app/core/services/user/user.service';
import { Location } from '@angular/common';
import { FormGroup, FormArray, FormControl } from '@angular/forms';
import { LockService } from '@app/core/services/lock/lock.service';
import { ReturnStatement, ConditionalExpr } from '@angular/compiler';
import { LockModel } from '@app/core/model/lock/lock.model';
import { Guid } from '@common/types/guid';
import { VersionListingModel } from '@app/core/model/version/version-listing.model';
import { CloneDialogComponent } from '../clone/clone-dialog/clone-dialog.component';
import { DmpModel } from '@app/core/model/dmp/dmp';
@ -43,11 +37,10 @@ import { FunderFormModel } from '../editor/grant-tab/funder-form-model';
import { ProjectFormModel } from '../editor/grant-tab/project-form-model';
import { GrantTabModel } from '../editor/grant-tab/grant-tab-model';
import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties-form.model';
import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
import { StartNewDatasetDialogComponent } from '../start-new-dataset-dialogue/start-new-dataset-dialog.component';
import { StartNewDmpDialogComponent } from '../start-new-dmp-dialogue/start-new-dmp-dialog.component';
import { HttpClient } from '@angular/common/http';
import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
@Component({
selector: 'app-dmp-overview',
@ -781,7 +774,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
checkLockStatus(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => this.lockStatus = lockStatus);
.subscribe(lockStatus => {
this.lockStatus = lockStatus
if(lockStatus){
this.dialog.open(PopupNotificationDialogComponent,{data:{
title:this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.TITLE'),
message:this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.MESSAGE')
}, maxWidth:'30em'});
}
});
}
getUserFromDMP(): any {

View File

@ -718,6 +718,10 @@
"CANCEL": "Abbrechen",
"NEXT": "Next",
"ERROR-MESSAGE": "Diese Vorlage der Datensatzbeschreibung ist nicht enthalten"
},
"LOCKED":{
"TITLE":"Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DMP-OVERVIEW": {
@ -744,6 +748,10 @@
"MULTIPLE-DIALOG": {
"ZENODO-LOGIN": "Login with Zenodo",
"USE-DEFAULT": "Use Default Token"
},
"LOCKED-DIALOG":{
"TITLE": "DMP is locked",
"MESSAGE":"Somebody else is modifying the DMP at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-OVERVIEW": {
@ -751,6 +759,10 @@
"ERROR": {
"DELETED-DATASET": "The requested dataset is deleted",
"FORBIDEN-DATASET": "You are not allowed to access this dataset"
},
"LOCKED":{
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-LISTING": {

View File

@ -718,6 +718,10 @@
"CANCEL": "Cancel",
"NEXT": "Next",
"ERROR-MESSAGE": "Does not contain this Dataset Template"
},
"LOCKED":{
"TITLE":"Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DMP-OVERVIEW": {
@ -744,6 +748,10 @@
"MULTIPLE-DIALOG": {
"ZENODO-LOGIN": "Login with Zenodo",
"USE-DEFAULT": "Use Default Token"
},
"LOCKED-DIALOG":{
"TITLE": "DMP is locked",
"MESSAGE":"Somebody else is modifying the DMP at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-OVERVIEW": {
@ -751,6 +759,10 @@
"ERROR": {
"DELETED-DATASET": "The requested dataset is deleted",
"FORBIDEN-DATASET": "You are not allowed to access this dataset"
},
"LOCKED":{
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-LISTING": {

View File

@ -718,6 +718,10 @@
"CANCEL": "Cancelar",
"NEXT": "Next",
"ERROR-MESSAGE": "No contiene esta plantilla de descripción del dataset"
},
"LOCKED":{
"TITLE":"Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DMP-OVERVIEW": {
@ -744,6 +748,10 @@
"MULTIPLE-DIALOG": {
"ZENODO-LOGIN": "Identificarse con Zenodo",
"USE-DEFAULT": "Usar el token por defecto"
},
"LOCKED-DIALOG":{
"TITLE": "DMP is locked",
"MESSAGE":"Somebody else is modifying the DMP at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-OVERVIEW": {
@ -751,6 +759,10 @@
"ERROR": {
"DELETED-DATASET": "El dataset pedido ha sido eliminado",
"FORBIDEN-DATASET": "No tiene permisos para acceder a este Dataset"
},
"LOCKED":{
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-LISTING": {

View File

@ -718,6 +718,10 @@
"CANCEL": "Ακύρωση",
"NEXT": "Επόμενο",
"ERROR-MESSAGE": "Αυτο το Template Περιγραφής Συνόλου Δεδομένων δεν περιέχεται"
},
"LOCKED":{
"TITLE":"Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DMP-OVERVIEW": {
@ -744,6 +748,10 @@
"MULTIPLE-DIALOG": {
"ZENODO-LOGIN": "Σύνδεση με Zenodo",
"USE-DEFAULT": "Χρήση Προκαθορισμένου Token"
},
"LOCKED-DIALOG":{
"TITLE": "DMP is locked",
"MESSAGE":"Somebody else is modifying the DMP at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-OVERVIEW": {
@ -751,6 +759,10 @@
"ERROR": {
"DELETED-DATASET": "H επιλεγμένη Περιγραφή Δεδομένων θα διαγραφεί",
"FORBIDEN-DATASET": "Δεν επιτρέπεται η πρόσβαση σε αυτή την Περιγραφή Δεδομένων"
},
"LOCKED":{
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-LISTING": {

View File

@ -718,6 +718,10 @@
"CANCEL": "Cancelar",
"NEXT": "Seguinte",
"ERROR-MESSAGE": "Não contém este Modelo de Dados"
},
"LOCKED":{
"TITLE":"Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DMP-OVERVIEW": {
@ -744,6 +748,10 @@
"MULTIPLE-DIALOG": {
"ZENODO-LOGIN": "Entre com o Zenodo",
"USE-DEFAULT": "Use o Token"
},
"LOCKED-DIALOG":{
"TITLE": "DMP is locked",
"MESSAGE":"Somebody else is modifying the DMP at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-OVERVIEW": {
@ -751,6 +759,10 @@
"ERROR": {
"DELETED-DATASET": "O Dataset requerido foi eliminado",
"FORBIDEN-DATASET": "Não está autorizado o acesso a este Dataset"
},
"LOCKED":{
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-LISTING": {

View File

@ -718,6 +718,10 @@
"CANCEL": "Zrušiť",
"NEXT": "Ďalej",
"ERROR-MESSAGE": "Neobsahuje túto šablónu súboru dát"
},
"LOCKED":{
"TITLE":"Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DMP-OVERVIEW": {
@ -744,6 +748,10 @@
"MULTIPLE-DIALOG": {
"ZENODO-LOGIN": "Prihlásiť sa do Zenodo",
"USE-DEFAULT": "Použite predvolený token"
},
"LOCKED-DIALOG":{
"TITLE": "DMP is locked",
"MESSAGE":"Somebody else is modifying the DMP at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-OVERVIEW": {
@ -751,6 +759,10 @@
"ERROR": {
"DELETED-DATASET": "Požadovaný DMP je vymazaný",
"FORBIDEN-DATASET": "K tomuto DMP nemáte povolený prístup"
},
"LOCKED":{
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-LISTING": {

View File

@ -718,6 +718,10 @@
"CANCEL": "Otkažite",
"NEXT": "Sledeće",
"ERROR-MESSAGE": "Ne sadrži obrazac za podatke"
},
"LOCKED":{
"TITLE":"Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DMP-OVERVIEW": {
@ -744,6 +748,10 @@
"MULTIPLE-DIALOG": {
"ZENODO-LOGIN": "Prijavite se pomoću Zenodo naloga",
"USE-DEFAULT": "Koristite podrazumevani znak"
},
"LOCKED-DIALOG":{
"TITLE": "DMP is locked",
"MESSAGE":"Somebody else is modifying the DMP at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-OVERVIEW": {
@ -751,6 +759,10 @@
"ERROR": {
"DELETED-DATASET": "Traženi skup podataka je obrisan",
"FORBIDEN-DATASET": "Nije Vam dozvoljeno da pristupite ovom skupu podataka"
},
"LOCKED":{
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-LISTING": {

View File

@ -718,6 +718,10 @@
"CANCEL": "İptal",
"NEXT": "İleri",
"ERROR-MESSAGE": "Bu Veri Seti Şablonunu İçermiyor"
},
"LOCKED":{
"TITLE":"Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DMP-OVERVIEW": {
@ -744,6 +748,10 @@
"MULTIPLE-DIALOG": {
"ZENODO-LOGIN": "Zenodo ile oturum aç",
"USE-DEFAULT": "Mevcut Jetonu Kullan"
},
"LOCKED-DIALOG":{
"TITLE": "DMP is locked",
"MESSAGE":"Somebody else is modifying the DMP at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-OVERVIEW": {
@ -751,6 +759,10 @@
"ERROR": {
"DELETED-DATASET": "Seçili Veri Seti silindi",
"FORBIDEN-DATASET": "Bu veri setine erişim izniniz yok"
},
"LOCKED":{
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
}
},
"DATASET-LISTING": {