Add deactivate guards in dataset editor and dmp editor.
This commit is contained in:
parent
25286603c8
commit
1a6df44eeb
|
@ -46,13 +46,17 @@ import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { VisibilityRulesService } from '@app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service';
|
||||
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
|
||||
import { CheckDeactivateBaseComponent } from '@app/library/deactivate/deactivate.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-wizard-component',
|
||||
templateUrl: 'dataset-wizard.component.html',
|
||||
styleUrls: ['./dataset-wizard.component.scss']
|
||||
})
|
||||
export class DatasetWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
||||
export class DatasetWizardComponent extends CheckDeactivateBaseComponent implements OnInit, IBreadCrumbComponent {
|
||||
canDeactivate(): boolean {
|
||||
return !this.isDirty();
|
||||
}
|
||||
|
||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||
viewOnly = false;
|
||||
|
@ -619,8 +623,9 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
data => {
|
||||
this.onCallbackSuccess(data, saveType);
|
||||
this.hasChanges = false;
|
||||
this.datasetIsOnceSaved = true;
|
||||
this.onCallbackSuccess(data, saveType);
|
||||
},
|
||||
error => this.onCallbackError(error));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { CanDeactivateGuard } from '@app/library/deactivate/can-deactivate.guard';
|
||||
import { AuthGuard } from '../../core/auth-guard.service';
|
||||
import { DatasetWizardComponent } from './dataset-wizard/dataset-wizard.component';
|
||||
import { DatasetListingComponent } from './listing/dataset-listing.component';
|
||||
|
@ -14,6 +15,7 @@ const routes: Routes = [
|
|||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.DATASET-NEW'
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
{
|
||||
path: 'edit/:id',
|
||||
|
@ -24,6 +26,7 @@ const routes: Routes = [
|
|||
public: false,
|
||||
title: 'GENERAL.TITLES.DATASET-EDIT'
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
{
|
||||
path: 'publicEdit/:publicId',
|
||||
|
@ -32,7 +35,8 @@ const routes: Routes = [
|
|||
data: {
|
||||
public: true,
|
||||
title: 'GENERAL.TITLES.DATASET-PUBLIC-EDIT'
|
||||
}
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
|
@ -42,6 +46,7 @@ const routes: Routes = [
|
|||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.DATASET-NEW'
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
|
@ -67,6 +72,7 @@ const routes: Routes = [
|
|||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.DATASET-COPY'
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
{
|
||||
path: 'profileupdate/:updateId',
|
||||
|
@ -76,6 +82,7 @@ const routes: Routes = [
|
|||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.DATASET-UPDATE'
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
{
|
||||
path: 'overview/:id',
|
||||
|
|
|
@ -7,6 +7,7 @@ import { DmpWizardComponent } from './wizard/dmp-wizard.component';
|
|||
import { DmpOverviewComponent } from './overview/dmp-overview.component';
|
||||
import { DmpCloneComponent } from './clone/dmp-clone.component';
|
||||
import { AuthGuard } from '@app/core/auth-guard.service';
|
||||
import { CanDeactivateGuard } from '@app/library/deactivate/can-deactivate.guard';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
|
@ -38,6 +39,7 @@ const routes: Routes = [
|
|||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.DMP-EDIT'
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
{
|
||||
path: 'publicEdit/:publicId',
|
||||
|
@ -46,6 +48,7 @@ const routes: Routes = [
|
|||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.DMP-PUBLIC-EDIT'
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
{
|
||||
path: 'overview/:id',
|
||||
|
@ -78,7 +81,8 @@ const routes: Routes = [
|
|||
data: {
|
||||
breadcrumbs: 'new',
|
||||
title: 'GENERAL.TITLES.DMP-NEW'
|
||||
}
|
||||
},
|
||||
canDeactivate:[CanDeactivateGuard]
|
||||
},
|
||||
// {
|
||||
// path: 'new/dataset',
|
||||
|
|
|
@ -49,13 +49,17 @@ import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model';
|
|||
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';
|
||||
import { CheckDeactivateBaseComponent } from '@app/library/deactivate/deactivate.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-editor-component',
|
||||
templateUrl: 'dmp-editor.component.html',
|
||||
styleUrls: ['./dmp-editor.component.scss']
|
||||
})
|
||||
export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
||||
export class DmpEditorComponent extends CheckDeactivateBaseComponent implements OnInit, IBreadCrumbComponent {
|
||||
canDeactivate(): boolean {
|
||||
return !this.isDirty();
|
||||
}
|
||||
|
||||
editMode = true;
|
||||
// editMode = false;
|
||||
|
@ -491,6 +495,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
complete => {
|
||||
this.formGroup.get('id').setValue(complete.id);
|
||||
this.formGroup.get('modified').setValue(complete.modified);
|
||||
this.hasChanges = false;
|
||||
if (showAddDatasetDialog) {
|
||||
this.addDatasetOpenDialog(complete);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue