Remove lock requests from published datasets

This commit is contained in:
George Kalampokis 2020-03-13 18:37:40 +02:00
parent 3eb323ba4b
commit 389c41fedc
1 changed files with 4 additions and 18 deletions

View File

@ -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;