build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -8,9 +8,8 @@ describe('AddEventDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AddEventDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AddEventDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -12,7 +12,6 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms
|
||||
styleUrls: ['./add-event-dialog.component.scss']
|
||||
})
|
||||
export class AddEventDialogComponent implements OnInit {
|
||||
|
||||
/** Event Form. */
|
||||
eventForm: UntypedFormGroup;
|
||||
/** Entity Data. */
|
||||
@@ -25,19 +24,29 @@ export class AddEventDialogComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {any} data Provides grouping, entities and actions data to fill dropdowns.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<AddEventDialogComponent>,
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<AddEventDialogComponent>,
|
||||
public formBuilder: UntypedFormBuilder,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
}
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Creates add event form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.eventForm = this.formBuilder.group({
|
||||
'grouping': ['', Validators.required],
|
||||
'entity': ['', Validators.required],
|
||||
'action': ['', Validators.required]
|
||||
grouping: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
entity: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
action: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
this.setGroupingListener();
|
||||
this.setEntityListener();
|
||||
@@ -47,20 +56,18 @@ export class AddEventDialogComponent implements OnInit {
|
||||
* Subscribes to the grouping dropdown to set entity data for that row accordingly.
|
||||
*/
|
||||
setGroupingListener() {
|
||||
this.eventForm.get('grouping').valueChanges
|
||||
.subscribe(changedGrouping => {
|
||||
this.entityData = this.data.groupings.find((grouping: any) => grouping.name === changedGrouping).entities;
|
||||
});
|
||||
this.eventForm.get('grouping').valueChanges.subscribe((changedGrouping) => {
|
||||
this.entityData = this.data.groupings.find((grouping: any) => grouping.name === changedGrouping).entities;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes to the entity dropdown to set entity data for that row accordingly.
|
||||
*/
|
||||
setEntityListener() {
|
||||
this.eventForm.get('entity').valueChanges
|
||||
.subscribe(changedEntity => {
|
||||
this.actionData = this.entityData.find((entity: any) => entity.name === changedEntity).actions;
|
||||
});
|
||||
this.eventForm.get('entity').valueChanges.subscribe((changedEntity) => {
|
||||
this.actionData = this.entityData.find((entity: any) => entity.name === changedEntity).actions;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,5 +76,4 @@ export class AddEventDialogComponent implements OnInit {
|
||||
submit() {
|
||||
this.dialogRef.close(this.eventForm.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateHookComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateHookComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateHookComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -23,13 +23,16 @@ import { AddEventDialogComponent } from '../add-event-dialog/add-event-dialog.co
|
||||
styleUrls: ['./create-hook.component.scss']
|
||||
})
|
||||
export class CreateHookComponent implements OnInit {
|
||||
|
||||
/** Hooks Template Data. */
|
||||
hooksTemplateData: any;
|
||||
/** Hook Form. */
|
||||
hookForm: UntypedFormGroup;
|
||||
/** Columns to be displayed in events table. */
|
||||
displayedColumns: string[] = ['entityName', 'actionName', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'entityName',
|
||||
'actionName',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for events table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Events Data. */
|
||||
@@ -46,12 +49,14 @@ export class CreateHookComponent implements OnInit {
|
||||
* @param {MatDialog} dialog Dialog Reference.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { hooksTemplate: any }) => {
|
||||
this.hooksTemplateData = data.hooksTemplate;
|
||||
});
|
||||
@@ -62,7 +67,7 @@ export class CreateHookComponent implements OnInit {
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createHookForm();
|
||||
this.hookForm.get('name').valueChanges.subscribe(name => {
|
||||
this.hookForm.get('name').valueChanges.subscribe((name) => {
|
||||
if (name === 'Web') {
|
||||
this.hookForm.get('contentType').enable();
|
||||
this.hookForm.get('phoneNumber').disable();
|
||||
@@ -93,15 +98,39 @@ export class CreateHookComponent implements OnInit {
|
||||
*/
|
||||
createHookForm() {
|
||||
this.hookForm = this.formBuilder.group({
|
||||
'name': ['Web', Validators.required],
|
||||
'displayName': ['', Validators.required],
|
||||
'isActive': [''],
|
||||
'phoneNumber': [{ value: '', disabled: true }, Validators.required],
|
||||
'smsProvider': [{ value: '', disabled: true }, Validators.required],
|
||||
'smsProviderAccountId': [{ value: '', disabled: true }, Validators.required],
|
||||
'smsProviderToken': [{ value: '', disabled: true }, Validators.required],
|
||||
'contentType': ['', Validators.required],
|
||||
'payloadUrl': ['', Validators.required]
|
||||
name: [
|
||||
'Web',
|
||||
Validators.required
|
||||
],
|
||||
displayName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
isActive: [''],
|
||||
phoneNumber: [
|
||||
{ value: '', disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
smsProvider: [
|
||||
{ value: '', disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
smsProviderAccountId: [
|
||||
{ value: '', disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
smsProviderToken: [
|
||||
{ value: '', disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
contentType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
payloadUrl: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -131,7 +160,12 @@ export class CreateHookComponent implements OnInit {
|
||||
*/
|
||||
deleteEvent(index: number) {
|
||||
const deleteEventDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.event with entity name of') + ' ' + this.eventsData[index].entityName }
|
||||
data: {
|
||||
deleteContext:
|
||||
this.translateService.instant('labels.inputs.event with entity name of') +
|
||||
' ' +
|
||||
this.eventsData[index].entityName
|
||||
}
|
||||
});
|
||||
deleteEventDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -147,11 +181,17 @@ export class CreateHookComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
const hook: {
|
||||
name: string, isActive: boolean, displayName: string, events: any,
|
||||
name: string;
|
||||
isActive: boolean;
|
||||
displayName: string;
|
||||
events: any;
|
||||
config: {
|
||||
'Payload URL': string, 'Content Type'?: string, 'SMS Provider'?: string,
|
||||
'SMS Provider Account Id'?: string, 'SMS Provider Token'?: string
|
||||
}
|
||||
'Payload URL': string;
|
||||
'Content Type'?: string;
|
||||
'SMS Provider'?: string;
|
||||
'SMS Provider Account Id'?: string;
|
||||
'SMS Provider Token'?: string;
|
||||
};
|
||||
} = {
|
||||
name: this.hookForm.get('name').value,
|
||||
isActive: this.hookForm.get('isActive').value,
|
||||
@@ -161,13 +201,22 @@ export class CreateHookComponent implements OnInit {
|
||||
'Payload URL': this.hookForm.get('payloadUrl').value,
|
||||
'Content Type': this.hookForm.get('contentType').enabled ? this.hookForm.get('contentType').value : undefined,
|
||||
'SMS Provider': this.hookForm.get('smsProvider').enabled ? this.hookForm.get('smsProvider').value : undefined,
|
||||
'SMS Provider Account Id': this.hookForm.get('smsProviderAccountId').enabled ? this.hookForm.get('smsProviderAccountId').value : undefined,
|
||||
'SMS Provider Token': this.hookForm.get('smsProviderToken').enabled ? this.hookForm.get('smsProviderToken').value : undefined
|
||||
'SMS Provider Account Id': this.hookForm.get('smsProviderAccountId').enabled
|
||||
? this.hookForm.get('smsProviderAccountId').value
|
||||
: undefined,
|
||||
'SMS Provider Token': this.hookForm.get('smsProviderToken').enabled
|
||||
? this.hookForm.get('smsProviderToken').value
|
||||
: undefined
|
||||
}
|
||||
};
|
||||
this.systemService.createHook(hook)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.systemService.createHook(hook).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditHookComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditHookComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditHookComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -23,7 +23,6 @@ import { AddEventDialogComponent } from '../add-event-dialog/add-event-dialog.co
|
||||
styleUrls: ['./edit-hook.component.scss']
|
||||
})
|
||||
export class EditHookComponent implements OnInit {
|
||||
|
||||
/** Hooks Template Data. */
|
||||
hooksTemplateData: any;
|
||||
/** Hook Data. */
|
||||
@@ -31,7 +30,11 @@ export class EditHookComponent implements OnInit {
|
||||
/** Hook Form. */
|
||||
hookForm: UntypedFormGroup;
|
||||
/** Columns to be displayed in events table. */
|
||||
displayedColumns: string[] = ['entityName', 'actionName', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'entityName',
|
||||
'actionName',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for events table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Events Data. */
|
||||
@@ -50,13 +53,15 @@ export class EditHookComponent implements OnInit {
|
||||
* @param {MatDialog} dialog Dialog Reference.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
this.route.data.subscribe((data: { hooksTemplate: any, hook: any }) => {
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { hooksTemplate: any; hook: any }) => {
|
||||
this.hooksTemplateData = data.hooksTemplate;
|
||||
this.hookData = data.hook;
|
||||
this.eventsData = data.hook.events ? data.hook.events : [];
|
||||
@@ -84,15 +89,59 @@ export class EditHookComponent implements OnInit {
|
||||
*/
|
||||
createHookForm() {
|
||||
this.hookForm = this.formBuilder.group({
|
||||
'name': [{ value: this.hookData.name, disabled: true }, Validators.required],
|
||||
'displayName': [this.hookData.displayName, Validators.required],
|
||||
'isActive': [this.hookData.isActive],
|
||||
'phoneNumber': [{ value: this.hookData.name === 'SMS Bridge' ? this.hookData.config[1].fieldValue : '', disabled: this.hookData.name !== 'SMS Bridge' }, Validators.required],
|
||||
'smsProvider': [{ value: this.hookData.name === 'SMS Bridge' ? this.hookData.config[2].fieldValue : '', disabled: this.hookData.name !== 'SMS Bridge' }, Validators.required],
|
||||
'smsProviderAccountId': [{ value: this.hookData.name === 'SMS Bridge' ? this.hookData.config[3].fieldValue : '', disabled: this.hookData.name !== 'SMS Bridge' }, Validators.required],
|
||||
'smsProviderToken': [{ value: this.hookData.name === 'SMS Bridge' ? this.hookData.config[4].fieldValue : '', disabled: this.hookData.name !== 'SMS Bridge' }, Validators.required],
|
||||
'contentType': [{ value: this.hookData.name === 'Web' ? this.hookData.config[0].fieldValue : '', disabled: this.hookData.name !== 'Web' }, Validators.required],
|
||||
'payloadUrl': [this.hookData.name === 'Web' ? this.hookData.config[1].fieldValue : this.hookData.config[0].fieldValue, Validators.required]
|
||||
name: [
|
||||
{ value: this.hookData.name, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
displayName: [
|
||||
this.hookData.displayName,
|
||||
Validators.required
|
||||
],
|
||||
isActive: [this.hookData.isActive],
|
||||
phoneNumber: [
|
||||
{
|
||||
value: this.hookData.name === 'SMS Bridge' ? this.hookData.config[1].fieldValue : '',
|
||||
disabled: this.hookData.name !== 'SMS Bridge'
|
||||
},
|
||||
Validators.required
|
||||
|
||||
],
|
||||
smsProvider: [
|
||||
{
|
||||
value: this.hookData.name === 'SMS Bridge' ? this.hookData.config[2].fieldValue : '',
|
||||
disabled: this.hookData.name !== 'SMS Bridge'
|
||||
},
|
||||
Validators.required
|
||||
|
||||
],
|
||||
smsProviderAccountId: [
|
||||
{
|
||||
value: this.hookData.name === 'SMS Bridge' ? this.hookData.config[3].fieldValue : '',
|
||||
disabled: this.hookData.name !== 'SMS Bridge'
|
||||
},
|
||||
Validators.required
|
||||
|
||||
],
|
||||
smsProviderToken: [
|
||||
{
|
||||
value: this.hookData.name === 'SMS Bridge' ? this.hookData.config[4].fieldValue : '',
|
||||
disabled: this.hookData.name !== 'SMS Bridge'
|
||||
},
|
||||
Validators.required
|
||||
|
||||
],
|
||||
contentType: [
|
||||
{
|
||||
value: this.hookData.name === 'Web' ? this.hookData.config[0].fieldValue : '',
|
||||
disabled: this.hookData.name !== 'Web'
|
||||
},
|
||||
Validators.required
|
||||
|
||||
],
|
||||
payloadUrl: [
|
||||
this.hookData.name === 'Web' ? this.hookData.config[1].fieldValue : this.hookData.config[0].fieldValue,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -121,7 +170,12 @@ export class EditHookComponent implements OnInit {
|
||||
*/
|
||||
deleteEvent(index: number) {
|
||||
const deleteEventDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.event with entity name of') + ' ' + this.eventsData[index].entityName }
|
||||
data: {
|
||||
deleteContext:
|
||||
this.translateService.instant('labels.inputs.event with entity name of') +
|
||||
' ' +
|
||||
this.eventsData[index].entityName
|
||||
}
|
||||
});
|
||||
deleteEventDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -138,11 +192,17 @@ export class EditHookComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
const hook: {
|
||||
name: string, isActive: boolean, displayName: string, events: any,
|
||||
name: string;
|
||||
isActive: boolean;
|
||||
displayName: string;
|
||||
events: any;
|
||||
config: {
|
||||
'Payload URL': string, 'Content Type'?: string, 'SMS Provider'?: string,
|
||||
'SMS Provider Account Id'?: string, 'SMS Provider Token'?: string
|
||||
}
|
||||
'Payload URL': string;
|
||||
'Content Type'?: string;
|
||||
'SMS Provider'?: string;
|
||||
'SMS Provider Account Id'?: string;
|
||||
'SMS Provider Token'?: string;
|
||||
};
|
||||
} = {
|
||||
name: this.hookForm.get('name').value,
|
||||
isActive: this.hookForm.get('isActive').value,
|
||||
@@ -152,14 +212,16 @@ export class EditHookComponent implements OnInit {
|
||||
'Payload URL': this.hookForm.get('payloadUrl').value,
|
||||
'Content Type': this.hookForm.get('contentType').enabled ? this.hookForm.get('contentType').value : undefined,
|
||||
'SMS Provider': this.hookForm.get('smsProvider').enabled ? this.hookForm.get('smsProvider').value : undefined,
|
||||
'SMS Provider Account Id': this.hookForm.get('smsProviderAccountId').enabled ? this.hookForm.get('smsProviderAccountId').value : undefined,
|
||||
'SMS Provider Token': this.hookForm.get('smsProviderToken').enabled ? this.hookForm.get('smsProviderToken').value : undefined
|
||||
'SMS Provider Account Id': this.hookForm.get('smsProviderAccountId').enabled
|
||||
? this.hookForm.get('smsProviderAccountId').value
|
||||
: undefined,
|
||||
'SMS Provider Token': this.hookForm.get('smsProviderToken').enabled
|
||||
? this.hookForm.get('smsProviderToken').value
|
||||
: undefined
|
||||
}
|
||||
};
|
||||
this.systemService.updateHook(this.hookData.id, hook)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.systemService.updateHook(this.hookData.id, hook).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class HooksTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class HooksTemplateResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getHooksTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ManageHooksComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageHooksComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ManageHooksComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,11 +14,14 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./manage-hooks.component.scss']
|
||||
})
|
||||
export class ManageHooksComponent implements OnInit {
|
||||
|
||||
/** Hook data. */
|
||||
hookData: any;
|
||||
/** Columns to be displayed in manage hooks table. */
|
||||
displayedColumns: string[] = ['name', 'displayName', 'isActive'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'displayName',
|
||||
'isActive'
|
||||
];
|
||||
/** Data source for manage hooks table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -32,7 +35,7 @@ export class ManageHooksComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { hooks: any }) => {
|
||||
this.route.data.subscribe((data: { hooks: any }) => {
|
||||
this.hookData = data.hooks;
|
||||
});
|
||||
}
|
||||
@@ -60,5 +63,4 @@ export class ManageHooksComponent implements OnInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ManageHooksResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class ManageHooksResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getHooks();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve} from '@angular/router';
|
||||
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class HookResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class HookResolver implements Resolve<Object> {
|
||||
const hookId = route.paramMap.get('id');
|
||||
return this.systemService.getHook(hookId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewHookComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewHookComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewHookComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -19,7 +19,6 @@ import { SystemService } from '../../system.service';
|
||||
styleUrls: ['./view-hook.component.scss']
|
||||
})
|
||||
export class ViewHookComponent {
|
||||
|
||||
/** Hook Data. */
|
||||
hookData: any;
|
||||
|
||||
@@ -31,11 +30,13 @@ export class ViewHookComponent {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private dialog: MatDialog,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private translateService: TranslateService) {
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { hook: any }) => {
|
||||
this.hookData = data.hook;
|
||||
});
|
||||
@@ -50,12 +51,10 @@ export class ViewHookComponent {
|
||||
});
|
||||
deleteHookDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteHook(this.hookData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/system/hooks']);
|
||||
});
|
||||
this.systemService.deleteHook(this.hookData.id).subscribe(() => {
|
||||
this.router.navigate(['/system/hooks']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user