From 389c41fedc2188888819a34431ce5fa98579b4e6 Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Fri, 13 Mar 2020 18:37:40 +0200 Subject: [PATCH] Remove lock requests from published datasets --- .../dataset-wizard.component.ts | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts index f7832f157..8358d4c41 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts @@ -147,7 +147,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr this.formGroup.disable(); this.viewOnly = true; } - if (!lockStatus) { + if (!lockStatus && !isNullOrUndefined(this.authService.current())) { this.lock = new LockModel(data.id, this.authService.current()); this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => { @@ -254,7 +254,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr this.formGroup.disable(); this.viewOnly = true; } - if (!lockStatus) { + if (!lockStatus && !isNullOrUndefined(this.authService.current())) { this.lock = new LockModel(data.id, this.authService.current()); this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => { @@ -278,30 +278,16 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr })) .subscribe(data => { if (data) { - this.lockService.checkLockStatus(data.id).pipe(takeUntil(this._destroyed)).subscribe(lockStatus => { - this.lockStatus = lockStatus; this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data); this.formGroup = this.datasetWizardModel.buildForm(); + this.formGroup.disable(); + this.viewOnly = true; this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft; - if (this.datasetWizardModel.status === DatasetStatus.Finalized || lockStatus) { - this.formGroup.disable(); - this.viewOnly = true; - } - if (!lockStatus) { - this.lock = new LockModel(data.id, this.authService.current()); - - this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => { - this.lock.id = Guid.parse(result); - interval(environment.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock()); - }); - } this.formGroup.get('dmp').setValue(this.datasetWizardModel.dmp); - this.loadDatasetProfiles(); const breadcrumbs = []; breadcrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DATASETS'), url: '/explore' }); breadcrumbs.push({ parentComponentName: null, label: this.datasetWizardModel.label, url: '/datasets/publicEdit/' + this.datasetWizardModel.id }); this.breadCrumbs = observableOf(breadcrumbs); - }) } }); this.publicMode = true;