Finilize from dataset overview will redirect the editor and then trigger Finalize button.

This commit is contained in:
Konstantinos Triantafyllou 2023-03-30 12:19:09 +03:00
parent 8c708f470d
commit fbaa175436
3 changed files with 22 additions and 3 deletions

View File

@ -92,6 +92,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
datasetProfileDefinitionModel: DatasetDescriptionFormEditorModel; datasetProfileDefinitionModel: DatasetDescriptionFormEditorModel;
availableProfiles: DatasetProfileModel[] = []; availableProfiles: DatasetProfileModel[] = [];
finalize: boolean = false;
itemId: string; itemId: string;
dmpId: string; dmpId: string;
newDmpId: string; newDmpId: string;
@ -167,12 +168,13 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
const params = this.route.snapshot.params; const params = this.route.snapshot.params;
const queryParams = this.route.snapshot.queryParams; const queryParams = this.route.snapshot.queryParams;
const data: any = this.route.snapshot.data;
this.itemId = params['id']; this.itemId = params['id'];
this.dmpId = params['dmpId']; this.dmpId = params['dmpId'];
this.newDmpId = queryParams['newDmpId']; this.newDmpId = queryParams['newDmpId'];
this.publicId = params['publicId']; this.publicId = params['publicId'];
this.profileUpdateId = params['updateId']; this.profileUpdateId = params['updateId'];
this.finalize = data.finalize;
this.itemId ? this.downloadDocumentId = this.itemId : this.downloadDocumentId = this.publicId this.itemId ? this.downloadDocumentId = this.itemId : this.downloadDocumentId = this.publicId
this.init(); this.init();
@ -234,8 +236,13 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
}, maxWidth: '30em' }, maxWidth: '30em'
}); });
} }
if(this.finalize && !this.lockStatus && !this.viewOnly) {
setTimeout(() => {
this.saveFinalize();
}, 0);
}
// this.availableProfiles = this.datasetWizardModel.dmp.profiles; // this.availableProfiles = this.datasetWizardModel.dmp.profiles;
}) });
}, },
error => { error => {
switch (error.status) { switch (error.status) {

View File

@ -28,6 +28,18 @@ const routes: Routes = [
}, },
canDeactivate:[CanDeactivateGuard] canDeactivate:[CanDeactivateGuard]
}, },
{
path: 'edit/:id/finalize',
component: DatasetWizardComponent,
canActivate: [AuthGuard],
data: {
breadcrumb: true,
public: false,
title: 'GENERAL.TITLES.DATASET-EDIT',
finalize: true
},
canDeactivate:[CanDeactivateGuard]
},
{ {
path: 'publicEdit/:publicId', path: 'publicEdit/:publicId',
component: DatasetWizardComponent, component: DatasetWizardComponent,

View File

@ -498,7 +498,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
takeUntil(this._destroyed) takeUntil(this._destroyed)
) )
.subscribe( _ =>{ .subscribe( _ =>{
this.router.navigate(['datasets','edit',dataset.id]); this.router.navigate(['datasets','edit',dataset.id, 'finalize']);
}) })