diff --git a/dmp-frontend/src/app/ui/dataset/overview/dataset-overview.component.ts b/dmp-frontend/src/app/ui/dataset/overview/dataset-overview.component.ts index 7832d54cb..a892f24bc 100644 --- a/dmp-frontend/src/app/ui/dataset/overview/dataset-overview.component.ts +++ b/dmp-frontend/src/app/ui/dataset/overview/dataset-overview.component.ts @@ -90,9 +90,6 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit { this.dataset = data; this.researchers = this.dataset.dmp.researchers; this.users = this.dataset.dmp.users; - // this.getDmpResearchers(); - // this.getDmpUsers(); - // this.getDatasetWizardModel(this.dataset.id); this.checkLockStatus(this.dataset.id); this.setIsUserOwner(); const breadCrumbs = []; @@ -118,10 +115,6 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit { this.dataset = data; this.researchers = this.dataset.dmp.researchers; this.users = this.dataset.dmp.users; - // this.getDmpResearchers(); - // this.getDmpUsers(); - // this.getDatasetWizardModel(this.dataset.id); - // this.checkLockStatus(this.dataset.id); const breadCrumbs = []; breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DATASETS'), url: "/explore" }); breadCrumbs.push({ parentComponentName: 'DatasetListingComponent', label: this.dataset.label, url: '/datasets/publicOverview/' + this.dataset.id }); @@ -138,14 +131,6 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit { }); } - getDatasetWizardModel(id: string) { - this.datasetWizardService.getSingle(id) - .pipe(takeUntil(this._destroyed)) - .subscribe(data => { - this.datasetWizardModel = data; - }); - } - checkLockStatus(id: string) { this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed)) .subscribe(lockStatus => this.lockStatus = lockStatus); @@ -170,20 +155,6 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit { this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => this.router.navigate([path])); } - // getDmpResearchers() { - // this.dmpService.getSingle(this.dataset.dmp.id).pipe(takeUntil(this._destroyed)) - // .subscribe(data => { - // this.researchers = data.researchers; - // }); - // } - - // getDmpUsers() { - // this.dmpService.getSingle(this.dataset.dmp.id).pipe(takeUntil(this._destroyed)) - // .subscribe(data => { - // this.users = data.users; - // }); - // } - setIsUserOwner() { if (this.dataset) { const principal: Principal = this.authentication.current(); @@ -487,14 +458,19 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit { }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - this.getDatasetWizardModel(this.dataset.id); - this.datasetWizardModel.status = DatasetStatus.Finalized; - this.datasetWizardService.createDataset(this.datasetWizardModel) + dataset.status = DatasetStatus.Finalized; + this.datasetWizardService.getSingle(dataset.id) + .pipe(takeUntil(this._destroyed)) + .subscribe(data => { + this.datasetWizardModel = data; + this.datasetWizardModel.status = DatasetStatus.Finalized; + this.datasetWizardService.createDataset(this.datasetWizardModel) .pipe(takeUntil(this._destroyed)) .subscribe( data => this.onUpdateCallbackSuccess(), error => this.onUpdateCallbackError(error) ); + }); } }); } @@ -515,14 +491,18 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit { }); 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) + this.datasetWizardService.getSingle(dataset.id) + .pipe(takeUntil(this._destroyed)) + .subscribe(data => { + this.datasetWizardModel = data; + this.datasetWizardModel.status = DatasetStatus.Draft; + this.datasetWizardService.createDataset(this.datasetWizardModel) .pipe(takeUntil(this._destroyed)) .subscribe( data => this.onUpdateCallbackSuccess(), error => this.onUpdateCallbackError(error) ); + }); } }); }