+
@@ -126,9 +128,13 @@
+ [disabled]="serviceForm.invalid || !validConfigurationForm"
+ [appDisableUntilResponse]="reenableButton">Next
-
\ No newline at end of file
+
+
+
+
diff --git a/src/app/components/core/south/add-service-wizard/add-service-wizard.component.ts b/src/app/components/core/south/add-service-wizard/add-service-wizard.component.ts
index 9d2e0f787..e6f0fe956 100644
--- a/src/app/components/core/south/add-service-wizard/add-service-wizard.component.ts
+++ b/src/app/components/core/south/add-service-wizard/add-service-wizard.component.ts
@@ -1,7 +1,7 @@
import { Component, Input, OnInit, ViewChild, OnDestroy, ChangeDetectorRef, EventEmitter } from '@angular/core';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { Subscription } from 'rxjs';
+import { Observable, Subscription } from 'rxjs';
import { cloneDeep, sortBy } from 'lodash';
import {
@@ -13,6 +13,7 @@ import { ViewLogsComponent } from '../../logs/packages-log/view-logs/view-logs.c
import { DocService } from '../../../../services/doc.service';
import { CustomValidator } from '../../../../directives/custom-validator';
import { QUOTATION_VALIDATION_PATTERN } from '../../../../utils';
+import { DialogService } from '../../../common/confirmation-dialog/dialog.service';
@Component({
selector: 'app-add-service-wizard',
@@ -61,7 +62,8 @@ export class AddServiceWizardComponent implements OnInit, OnDestroy {
private docService: DocService,
private configurationControlService: ConfigurationControlService,
private fileUploaderService: FileUploaderService,
- private cdRef: ChangeDetectorRef
+ private cdRef: ChangeDetectorRef,
+ private dialogService: DialogService
) {
this.route.queryParams.subscribe(params => {
if (params['source']) {
@@ -70,6 +72,10 @@ export class AddServiceWizardComponent implements OnInit, OnDestroy {
});
}
+ canDeactivate(): Observable
| boolean {
+ return this.dialogService.confirm({ id: 'unsaved-changes-dialog', changeExist: this.serviceForm.dirty });
+ }
+
ngOnInit() {
this.getSchedules();
this.serviceForm = this.formBuilder.group({
diff --git a/src/app/components/core/south/south-service-modal/south-service-modal.component.html b/src/app/components/core/south/south-service-modal/south-service-modal.component.html
index 593b0919e..679325d79 100644
--- a/src/app/components/core/south/south-service-modal/south-service-modal.component.html
+++ b/src/app/components/core/south/south-service-modal/south-service-modal.component.html
@@ -133,4 +133,7 @@
-
\ No newline at end of file
+
+
+
+
diff --git a/src/app/components/core/south/south-service-modal/south-service-modal.component.ts b/src/app/components/core/south/south-service-modal/south-service-modal.component.ts
index 791bfc2a5..056c853d6 100644
--- a/src/app/components/core/south/south-service-modal/south-service-modal.component.ts
+++ b/src/app/components/core/south/south-service-modal/south-service-modal.component.ts
@@ -22,7 +22,7 @@ import { MAX_INT_SIZE } from '../../../../utils';
import { DialogService } from '../../../common/confirmation-dialog/dialog.service';
import { FilterAlertComponent } from '../../filter/filter-alert/filter-alert.component';
import { ConfigurationGroupComponent } from '../../configuration-manager/configuration-group/configuration-group.component';
-import { Subject, forkJoin, of } from 'rxjs';
+import { Observable, Subject, forkJoin, of } from 'rxjs';
import { catchError, map, takeUntil } from 'rxjs/operators';
import { Service } from '../south-service';
import { FilterListComponent } from '../../filter/filter-list/filter-list.component';
@@ -107,6 +107,10 @@ export class SouthServiceModalComponent implements OnInit {
}
}
+ canDeactivate(): Observable | boolean {
+ return this.dialogService.confirm({ id: 'unsaved-changes-dialog', changeExist: !isEmpty(this.changedConfig) });
+ }
+
ngOnInit() { }
public getSouthboundServices(caching: boolean) {
diff --git a/src/app/components/core/south/south.module.ts b/src/app/components/core/south/south.module.ts
index 603d5a09e..80a05940d 100644
--- a/src/app/components/core/south/south.module.ts
+++ b/src/app/components/core/south/south.module.ts
@@ -13,6 +13,7 @@ import { AddServiceWizardComponent } from './add-service-wizard/add-service-wiza
import { SouthServiceModalComponent } from './south-service-modal/south-service-modal.component';
import { SouthComponent } from './south.component';
import { FlowEditorModule } from '../../common/node-editor/flow-editor.module';
+import { canDeactivateGuard } from '../../../guards/can-deactivate/can-deactivate.guard';
const routes: Routes = [
{
@@ -22,11 +23,13 @@ const routes: Routes = [
{
path: 'add',
component: AddServiceWizardComponent,
- canActivate: [RolesGuard]
+ canActivate: [RolesGuard],
+ canDeactivate: [canDeactivateGuard]
},
{
path: ':name/details',
- component: SouthServiceModalComponent
+ component: SouthServiceModalComponent,
+ canDeactivate: [canDeactivateGuard]
},
];
diff --git a/src/app/shared.module.ts b/src/app/shared.module.ts
index 1146f82a4..31bf8db71 100644
--- a/src/app/shared.module.ts
+++ b/src/app/shared.module.ts
@@ -24,6 +24,7 @@ import { ServiceConfigComponent } from './components/core/notifications/service-
import { ListTypeConfigurationComponent } from './components/core/configuration-manager/list-type-configuration/list-type-configuration.component';
import { KvListTypeConfigurationComponent } from './components/core/configuration-manager/kv-list-type-configuration/kv-list-type-configuration.component';
+import { UnsavedChangesDialogComponent } from './components/common/unsaved-changes-dialog/unsaved-changes-dialog.component';
@NgModule({
imports: [
@@ -51,6 +52,7 @@ import { KvListTypeConfigurationComponent } from './components/core/configuratio
AddServiceWizardComponent,
AddTaskWizardComponent,
TaskScheduleComponent,
+ UnsavedChangesDialogComponent,
NotificationServiceWarningComponent,
ServiceConfigComponent
],
@@ -67,6 +69,7 @@ import { KvListTypeConfigurationComponent } from './components/core/configuratio
AddServiceWizardComponent,
AddTaskWizardComponent,
TaskScheduleComponent,
+ UnsavedChangesDialogComponent,
NotificationServiceWarningComponent,
ServiceConfigComponent
]