build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
+2
-3
@@ -8,9 +8,8 @@ describe('AccountNumberPreferencesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AccountNumberPreferencesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AccountNumberPreferencesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./account-number-preferences.component.scss']
|
||||
})
|
||||
export class AccountNumberPreferencesComponent implements OnInit {
|
||||
|
||||
/** Account Number Preferences data. */
|
||||
accountNumberPreferencesData: any;
|
||||
/** Columns to be displayed in account number preferences table. */
|
||||
@@ -54,7 +53,8 @@ export class AccountNumberPreferencesComponent implements OnInit {
|
||||
return accountNumberPreference.accountType.value;
|
||||
};
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource.filterPredicate = (data: any, filter: string) => data.accountType.value.toLowerCase().indexOf(filter) !== -1;
|
||||
this.dataSource.filterPredicate = (data: any, filter: string) =>
|
||||
data.accountType.value.toLowerCase().indexOf(filter) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AccountNumberPreferencesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class AccountNumberPreferencesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getAccountNumberPreferences();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AccountNumberPreferencesTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class AccountNumberPreferencesTemplateResolver implements Resolve<Object>
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getAccountNumberPreferencesTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateAccountNumberPreferenceComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateAccountNumberPreferenceComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateAccountNumberPreferenceComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+26
-16
@@ -15,7 +15,6 @@ import { SystemService } from '../../system.service';
|
||||
styleUrls: ['./create-account-number-preference.component.scss']
|
||||
})
|
||||
export class CreateAccountNumberPreferenceComponent implements OnInit {
|
||||
|
||||
/** Account Number Preferences Form */
|
||||
accountNumberPreferenceForm: UntypedFormGroup;
|
||||
/** Account Number Preferences Template Data */
|
||||
@@ -30,10 +29,12 @@ export class CreateAccountNumberPreferenceComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { accountNumberPreferencesTemplate: any }) => {
|
||||
this.accountNumberPreferencesTemplateData = data.accountNumberPreferencesTemplate;
|
||||
});
|
||||
@@ -52,10 +53,12 @@ export class CreateAccountNumberPreferenceComponent implements OnInit {
|
||||
* Subscribes on Form Controls to change Prefix Type data.
|
||||
*/
|
||||
getPrefixTypeValue() {
|
||||
this.accountNumberPreferenceForm.get('accountType').valueChanges
|
||||
.subscribe(accountId => {
|
||||
this.prefixTypeData = this.accountNumberPreferencesTemplateData.prefixTypeOptions[`accountType.${this.accountNumberPreferencesTemplateData.accountTypeOptions.find((accountType: any) => accountType.id === accountId).value.toLowerCase()}`];
|
||||
});
|
||||
this.accountNumberPreferenceForm.get('accountType').valueChanges.subscribe((accountId) => {
|
||||
this.prefixTypeData =
|
||||
this.accountNumberPreferencesTemplateData.prefixTypeOptions[
|
||||
`accountType.${this.accountNumberPreferencesTemplateData.accountTypeOptions.find((accountType: any) => accountType.id === accountId).value.toLowerCase()}`
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,8 +66,11 @@ export class CreateAccountNumberPreferenceComponent implements OnInit {
|
||||
*/
|
||||
createAccountNumberPreferenceForm() {
|
||||
this.accountNumberPreferenceForm = this.formBuilder.group({
|
||||
'accountType': ['', Validators.required],
|
||||
'prefixType': ['']
|
||||
accountType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
prefixType: ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -77,10 +83,14 @@ export class CreateAccountNumberPreferenceComponent implements OnInit {
|
||||
if (accountNumberPreference.prefixType === '') {
|
||||
accountNumberPreference.prefixType = undefined;
|
||||
}
|
||||
this.systemService.createAccountNumberPreference(accountNumberPreference)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.systemService.createAccountNumberPreference(accountNumberPreference).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditAccountNumberPreferenceComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditAccountNumberPreferenceComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditAccountNumberPreferenceComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+16
-11
@@ -15,7 +15,6 @@ import { SystemService } from 'app/system/system.service';
|
||||
styleUrls: ['./edit-account-number-preference.component.scss']
|
||||
})
|
||||
export class EditAccountNumberPreferenceComponent implements OnInit {
|
||||
|
||||
/** Account Number Preference Form */
|
||||
accountNumberPreferenceForm: UntypedFormGroup;
|
||||
/** Account Number Preference Data */
|
||||
@@ -32,11 +31,13 @@ export class EditAccountNumberPreferenceComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { accountNumberPreference: any, accountNumberPreferencesTemplate: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { accountNumberPreference: any; accountNumberPreferencesTemplate: any }) => {
|
||||
this.accountNumberPreferenceData = data.accountNumberPreference;
|
||||
this.accountNumberPreferencesTemplateData = data.accountNumberPreferencesTemplate;
|
||||
});
|
||||
@@ -47,7 +48,8 @@ export class EditAccountNumberPreferenceComponent implements OnInit {
|
||||
* Creates and sets account number preference form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.prefixTypeData = this.accountNumberPreferencesTemplateData.prefixTypeOptions[this.accountNumberPreferenceData.accountType.code];
|
||||
this.prefixTypeData =
|
||||
this.accountNumberPreferencesTemplateData.prefixTypeOptions[this.accountNumberPreferenceData.accountType.code];
|
||||
this.createAccountNumberPreferenceForm();
|
||||
}
|
||||
|
||||
@@ -56,8 +58,11 @@ export class EditAccountNumberPreferenceComponent implements OnInit {
|
||||
*/
|
||||
createAccountNumberPreferenceForm() {
|
||||
this.accountNumberPreferenceForm = this.formBuilder.group({
|
||||
'accountType': [{ value: this.accountNumberPreferenceData.accountType.id, disabled: true }, Validators.required],
|
||||
'prefixType': [this.accountNumberPreferenceData.prefixType ? this.accountNumberPreferenceData.prefixType.id : 0]
|
||||
accountType: [
|
||||
{ value: this.accountNumberPreferenceData.accountType.id, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
prefixType: [this.accountNumberPreferenceData.prefixType ? this.accountNumberPreferenceData.prefixType.id : 0]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,10 +75,10 @@ export class EditAccountNumberPreferenceComponent implements OnInit {
|
||||
if (accountNumberPreferenceValue.prefixType === '') {
|
||||
accountNumberPreferenceValue.prefixType = undefined;
|
||||
}
|
||||
this.systemService.updateAccountNumberPreference(this.accountNumberPreferenceData.id, accountNumberPreferenceValue)
|
||||
this.systemService
|
||||
.updateAccountNumberPreference(this.accountNumberPreferenceData.id, accountNumberPreferenceValue)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AccountNumberPreferenceResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class AccountNumberPreferenceResolver implements Resolve<Object> {
|
||||
const accountNumberPreferenceId = route.paramMap.get('id');
|
||||
return this.systemService.getAccountNumberPreference(accountNumberPreferenceId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewAccountNumberPreferenceComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewAccountNumberPreferenceComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewAccountNumberPreferenceComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+16
-12
@@ -19,7 +19,6 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
|
||||
styleUrls: ['./view-account-number-preference.component.scss']
|
||||
})
|
||||
export class ViewAccountNumberPreferenceComponent {
|
||||
|
||||
/** Account Number Preference Data */
|
||||
accountNumberPreferenceData: any;
|
||||
|
||||
@@ -31,11 +30,13 @@ export class ViewAccountNumberPreferenceComponent {
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { accountNumberPreference: any }) => {
|
||||
this.accountNumberPreferenceData = data.accountNumberPreference;
|
||||
});
|
||||
@@ -46,16 +47,19 @@ export class ViewAccountNumberPreferenceComponent {
|
||||
*/
|
||||
delete() {
|
||||
const deleteAccountNumberPreferenceDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.heading.Account Number Preferences') + ' ' + this.accountNumberPreferenceData.id}
|
||||
data: {
|
||||
deleteContext:
|
||||
this.translateService.instant('labels.heading.Account Number Preferences') +
|
||||
' ' +
|
||||
this.accountNumberPreferenceData.id
|
||||
}
|
||||
});
|
||||
deleteAccountNumberPreferenceDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteAccountNumberPreference(this.accountNumberPreferenceData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/system/account-number-preferences']);
|
||||
});
|
||||
this.systemService.deleteAccountNumberPreference(this.accountNumberPreferenceData.id).subscribe(() => {
|
||||
this.router.navigate(['/system/account-number-preferences']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AuditTrailSearchTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class AuditTrailSearchTemplateResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getAuditTrailSearchTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import { SystemService } from '../system.service';
|
||||
* Audit Trails custom data source to implement server side filtering, pagination and sorting.
|
||||
*/
|
||||
export class AuditTrailsDataSource implements DataSource<any> {
|
||||
|
||||
/** Audit Trails behavior subject to represent loaded audit trails page. */
|
||||
private auditTrailsSubject = new BehaviorSubject<any[]>([]);
|
||||
/** Records subject to represent total number of filtered audit trail records. */
|
||||
@@ -23,7 +22,7 @@ export class AuditTrailsDataSource implements DataSource<any> {
|
||||
/**
|
||||
* @param {SystemService} systemService System Service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) { }
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Gets audit trails on the basis of provided parameters and emits the value.
|
||||
@@ -33,9 +32,16 @@ export class AuditTrailsDataSource implements DataSource<any> {
|
||||
* @param {number} pageIndex Page number.
|
||||
* @param {number} limit Number of entries within the page.
|
||||
*/
|
||||
getAuditTrails(filterBy: any, orderBy: string = '', sortOrder: string = '', pageIndex: number = 0, limit: number = 10) {
|
||||
getAuditTrails(
|
||||
filterBy: any,
|
||||
orderBy: string = '',
|
||||
sortOrder: string = '',
|
||||
pageIndex: number = 0,
|
||||
limit: number = 10
|
||||
) {
|
||||
this.auditTrailsSubject.next([]);
|
||||
this.systemService.getAuditTrails(filterBy, orderBy, sortOrder, pageIndex * limit, limit)
|
||||
this.systemService
|
||||
.getAuditTrails(filterBy, orderBy, sortOrder, pageIndex * limit, limit)
|
||||
.subscribe((auditTrails: any) => {
|
||||
this.recordsSubject.next(auditTrails.totalFilteredRecords);
|
||||
this.auditTrailsSubject.next(auditTrails.pageItems);
|
||||
@@ -56,5 +62,4 @@ export class AuditTrailsDataSource implements DataSource<any> {
|
||||
this.auditTrailsSubject.complete();
|
||||
this.recordsSubject.complete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('AuditTrailsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AuditTrailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AuditTrailsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -26,7 +26,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./audit-trails.component.scss']
|
||||
})
|
||||
export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -44,7 +43,18 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
/** Audit Trail Search Template Data. */
|
||||
auditTrailSearchTemplateData: any;
|
||||
/** Columns to be displayed in audit trails table. */
|
||||
displayedColumns: string[] = ['id', 'resourceId', 'processingResult', 'maker', 'actionName', 'entityName', 'officeName', 'madeOnDate', 'checker', 'checkedOnDate'];
|
||||
displayedColumns: string[] = [
|
||||
'id',
|
||||
'resourceId',
|
||||
'processingResult',
|
||||
'maker',
|
||||
'actionName',
|
||||
'entityName',
|
||||
'officeName',
|
||||
'madeOnDate',
|
||||
'checker',
|
||||
'checkedOnDate'
|
||||
];
|
||||
/** Data source for audit trails table. */
|
||||
dataSource: AuditTrailsDataSource;
|
||||
/** Audit Trails filter. */
|
||||
@@ -131,10 +141,12 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
* @param {Dates} dateUtils Dates utils
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { auditTrailSearchTemplate: any }) => {
|
||||
this.auditTrailSearchTemplateData = data.auditTrailSearchTemplate;
|
||||
});
|
||||
@@ -160,13 +172,14 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
this.user.valueChanges
|
||||
.pipe(
|
||||
map(value => value.id ? value.id : ''),
|
||||
map((value) => (value.id ? value.id : '')),
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(filterValue, 'makerId');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.fromDate.valueChanges
|
||||
.pipe(
|
||||
@@ -175,7 +188,8 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(this.getDate(filterValue), 'makerDateTimeFrom');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.toDate.valueChanges
|
||||
.pipe(
|
||||
@@ -184,7 +198,8 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(this.getDate(filterValue), 'makerDateTimeTo');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.checkedFromDate.valueChanges
|
||||
.pipe(
|
||||
@@ -193,7 +208,8 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(this.getDate(filterValue), 'checkerDateTimeFrom');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.checkedToDate.valueChanges
|
||||
.pipe(
|
||||
@@ -202,7 +218,8 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(this.getDate(filterValue), 'checkerDateTimeTo');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.resourceId.valueChanges
|
||||
.pipe(
|
||||
@@ -211,44 +228,47 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(filterValue, 'resourceId');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.actionName.valueChanges
|
||||
.pipe(
|
||||
map(value => value ? value : ''),
|
||||
map((value) => (value ? value : '')),
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(filterValue, 'actionName');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.entityName.valueChanges
|
||||
.pipe(
|
||||
map(value => value ? value : ''),
|
||||
map((value) => (value ? value : '')),
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(filterValue, 'entityName');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.checker.valueChanges
|
||||
.pipe(
|
||||
map(value => value ? value : ''),
|
||||
map((value) => (value ? value : '')),
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
this.applyFilter(filterValue, 'checkerId');
|
||||
})
|
||||
).subscribe();
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
|
||||
this.sort.sortChange.subscribe(() => (this.paginator.pageIndex = 0));
|
||||
|
||||
merge(this.sort.sortChange, this.paginator.page)
|
||||
.pipe(
|
||||
tap(() => this.loadAuditTrailsPage())
|
||||
).subscribe();
|
||||
.pipe(tap(() => this.loadAuditTrailsPage()))
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,7 +276,13 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
getAuditTrails() {
|
||||
this.dataSource = new AuditTrailsDataSource(this.systemService);
|
||||
this.dataSource.getAuditTrails(this.filterAuditTrailsBy, this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize);
|
||||
this.dataSource.getAuditTrails(
|
||||
this.filterAuditTrailsBy,
|
||||
this.sort.active,
|
||||
this.sort.direction,
|
||||
this.paginator.pageIndex,
|
||||
this.paginator.pageSize
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,7 +292,13 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
if (!this.sort.direction) {
|
||||
delete this.sort.active;
|
||||
}
|
||||
this.dataSource.getAuditTrails(this.filterAuditTrailsBy, this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize);
|
||||
this.dataSource.getAuditTrails(
|
||||
this.filterAuditTrailsBy,
|
||||
this.sort.active,
|
||||
this.sort.direction,
|
||||
this.paginator.pageIndex,
|
||||
this.paginator.pageSize
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,7 +308,7 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
applyFilter(filterValue: string, property: string) {
|
||||
this.paginator.pageIndex = 0;
|
||||
const findIndex = this.filterAuditTrailsBy.findIndex(filter => filter.type === property);
|
||||
const findIndex = this.filterAuditTrailsBy.findIndex((filter) => filter.type === property);
|
||||
this.filterAuditTrailsBy[findIndex].value = filterValue;
|
||||
this.loadAuditTrailsPage();
|
||||
}
|
||||
@@ -312,48 +344,52 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
* Sets filtered users for autocomplete.
|
||||
*/
|
||||
setFilteredUsers() {
|
||||
this.filteredUserData = this.user.valueChanges
|
||||
.pipe(
|
||||
startWith(''),
|
||||
map((user: any) => typeof user === 'string' ? user : user.name),
|
||||
map((userName: string) => userName ? this.filterUserAutocompleteData(userName) : this.auditTrailSearchTemplateData.appUsers)
|
||||
);
|
||||
this.filteredUserData = this.user.valueChanges.pipe(
|
||||
startWith(''),
|
||||
map((user: any) => (typeof user === 'string' ? user : user.name)),
|
||||
map((userName: string) =>
|
||||
userName ? this.filterUserAutocompleteData(userName) : this.auditTrailSearchTemplateData.appUsers
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets filtered checkers for autocomplete.
|
||||
*/
|
||||
setFilteredCheckers() {
|
||||
this.filteredCheckerData = this.checker.valueChanges
|
||||
.pipe(
|
||||
startWith(''),
|
||||
map((user: any) => typeof user === 'string' ? user : user.name),
|
||||
map((userName: string) => userName ? this.filterUserAutocompleteData(userName) : this.auditTrailSearchTemplateData.appUsers)
|
||||
);
|
||||
this.filteredCheckerData = this.checker.valueChanges.pipe(
|
||||
startWith(''),
|
||||
map((user: any) => (typeof user === 'string' ? user : user.name)),
|
||||
map((userName: string) =>
|
||||
userName ? this.filterUserAutocompleteData(userName) : this.auditTrailSearchTemplateData.appUsers
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets filtered actions for autocomplete.
|
||||
*/
|
||||
setFilteredActions() {
|
||||
this.filteredActionData = this.actionName.valueChanges
|
||||
.pipe(
|
||||
startWith(''),
|
||||
map((action: any) => typeof action === 'string' ? action : ''),
|
||||
map((actionName: string) => actionName ? this.filterActionAutocompleteData(actionName) : this.auditTrailSearchTemplateData.actionNames)
|
||||
);
|
||||
this.filteredActionData = this.actionName.valueChanges.pipe(
|
||||
startWith(''),
|
||||
map((action: any) => (typeof action === 'string' ? action : '')),
|
||||
map((actionName: string) =>
|
||||
actionName ? this.filterActionAutocompleteData(actionName) : this.auditTrailSearchTemplateData.actionNames
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets filtered entities for autocomplete.
|
||||
*/
|
||||
setFilteredEntities() {
|
||||
this.filteredEntityData = this.entityName.valueChanges
|
||||
.pipe(
|
||||
startWith(''),
|
||||
map((entity: any) => typeof entity === 'string' ? entity : ''),
|
||||
map((entityName: string) => entityName ? this.filterEntityAutocompleteData(entityName) : this.auditTrailSearchTemplateData.entityNames)
|
||||
);
|
||||
this.filteredEntityData = this.entityName.valueChanges.pipe(
|
||||
startWith(''),
|
||||
map((entity: any) => (typeof entity === 'string' ? entity : '')),
|
||||
map((entityName: string) =>
|
||||
entityName ? this.filterEntityAutocompleteData(entityName) : this.auditTrailSearchTemplateData.entityNames
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,7 +398,9 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
* @returns {any} Filtered users.
|
||||
*/
|
||||
private filterUserAutocompleteData(userName: string): any {
|
||||
return this.auditTrailSearchTemplateData.appUsers.filter((user: any) => user.username.toLowerCase().includes(userName.toLowerCase()));
|
||||
return this.auditTrailSearchTemplateData.appUsers.filter((user: any) =>
|
||||
user.username.toLowerCase().includes(userName.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,7 +409,9 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
* @returns {any} Filtered actions.
|
||||
*/
|
||||
private filterActionAutocompleteData(actionName: string): any {
|
||||
return this.auditTrailSearchTemplateData.actionNames.filter((action: any) => action.toLowerCase().includes(actionName.toLowerCase()));
|
||||
return this.auditTrailSearchTemplateData.actionNames.filter((action: any) =>
|
||||
action.toLowerCase().includes(actionName.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,7 +420,9 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
* @returns {any} Filtered entities.
|
||||
*/
|
||||
private filterEntityAutocompleteData(entityName: string): any {
|
||||
return this.auditTrailSearchTemplateData.entityNames.filter((entity: any) => entity.toLowerCase().includes(entityName.toLowerCase()));
|
||||
return this.auditTrailSearchTemplateData.entityNames.filter((entity: any) =>
|
||||
entity.toLowerCase().includes(entityName.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,24 +430,55 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
downloadCSV() {
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const replacer = (key: any, value: any) => value === undefined ? '' : value;
|
||||
const header = ['ID', 'Resource ID', 'Status', 'Office', 'Made On', 'Maker', 'Checked On', 'Checker', 'Entity', 'Action', 'Client'];
|
||||
const headerCode = ['id', 'resourceId', 'processingResult', 'officeName', 'madeOnDate', 'maker', 'checkedOnDate', 'checker', 'entityName', 'actionName', 'clientName'];
|
||||
this.systemService.getAuditTrails(this.filterAuditTrailsBy, this.sort.active ? this.sort.active : '', this.sort.direction, 0, -1).subscribe((response: any) => {
|
||||
if (response !== undefined) {
|
||||
let csv = response.pageItems.map((row: any) => headerCode.map(fieldName => (fieldName === 'madeOnDate' || fieldName === 'checkedOnDate') && (JSON.stringify(row[fieldName], replacer) !== '""')
|
||||
? this.dateUtils.formatDate(JSON.stringify(row[fieldName], replacer), dateFormat)
|
||||
: JSON.stringify(row[fieldName], replacer)));
|
||||
csv.unshift(`data:text/csv;charset=utf-8,${header.join()}`);
|
||||
csv = csv.join('\r\n');
|
||||
const link = document.createElement('a');
|
||||
link.setAttribute('href', encodeURI(csv));
|
||||
link.setAttribute('download', 'Audit Trails.csv');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
});
|
||||
const replacer = (key: any, value: any) => (value === undefined ? '' : value);
|
||||
const header = [
|
||||
'ID',
|
||||
'Resource ID',
|
||||
'Status',
|
||||
'Office',
|
||||
'Made On',
|
||||
'Maker',
|
||||
'Checked On',
|
||||
'Checker',
|
||||
'Entity',
|
||||
'Action',
|
||||
'Client'
|
||||
];
|
||||
const headerCode = [
|
||||
'id',
|
||||
'resourceId',
|
||||
'processingResult',
|
||||
'officeName',
|
||||
'madeOnDate',
|
||||
'maker',
|
||||
'checkedOnDate',
|
||||
'checker',
|
||||
'entityName',
|
||||
'actionName',
|
||||
'clientName'
|
||||
];
|
||||
this.systemService
|
||||
.getAuditTrails(this.filterAuditTrailsBy, this.sort.active ? this.sort.active : '', this.sort.direction, 0, -1)
|
||||
.subscribe((response: any) => {
|
||||
if (response !== undefined) {
|
||||
let csv = response.pageItems.map((row: any) =>
|
||||
headerCode.map((fieldName) =>
|
||||
(fieldName === 'madeOnDate' || fieldName === 'checkedOnDate') &&
|
||||
JSON.stringify(row[fieldName], replacer) !== '""'
|
||||
? this.dateUtils.formatDate(JSON.stringify(row[fieldName], replacer), dateFormat)
|
||||
: JSON.stringify(row[fieldName], replacer)
|
||||
)
|
||||
);
|
||||
csv.unshift(`data:text/csv;charset=utf-8,${header.join()}`);
|
||||
csv = csv.join('\r\n');
|
||||
const link = document.createElement('a');
|
||||
link.setAttribute('href', encodeURI(csv));
|
||||
link.setAttribute('download', 'Audit Trails.csv');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,5 +492,4 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
return this.dateUtils.formatDate(timestamp, dateFormat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AuditTrailResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class AuditTrailResolver implements Resolve<Object> {
|
||||
const auditTrailId = route.paramMap.get('id');
|
||||
return this.systemService.getAuditTrail(auditTrailId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewAuditComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewAuditComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewAuditComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,11 +14,13 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
styleUrls: ['./view-audit.component.scss']
|
||||
})
|
||||
export class ViewAuditComponent implements OnInit {
|
||||
|
||||
/** Audit Trail Data. */
|
||||
auditTrailData: any;
|
||||
/** Columns to be displayed in audit trail table. */
|
||||
displayedColumns: string[] = ['command', 'commandValue'];
|
||||
displayedColumns: string[] = [
|
||||
'command',
|
||||
'commandValue'
|
||||
];
|
||||
/** Data source for audit trail table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -48,10 +50,12 @@ export class ViewAuditComponent implements OnInit {
|
||||
* Initalizes Audit Trail Commands Data.
|
||||
*/
|
||||
get auditTrailCommandsData() {
|
||||
return Object.entries(JSON.parse(this.auditTrailData.commandAsJson))
|
||||
.map(
|
||||
([key, value]) => ({ command: key, commandValue: value })
|
||||
);
|
||||
return Object.entries(JSON.parse(this.auditTrailData.commandAsJson)).map(
|
||||
([
|
||||
key,
|
||||
value
|
||||
]) => ({ command: key, commandValue: value })
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,5 +66,4 @@ export class ViewAuditComponent implements OnInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CodeResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class CodeResolver implements Resolve<Object> {
|
||||
const id = route.paramMap.get('id');
|
||||
return this.systemService.getCode(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CodesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CodesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CodesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -15,11 +15,13 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
|
||||
styleUrls: ['./codes.component.scss']
|
||||
})
|
||||
export class CodesComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Codes data. */
|
||||
codesData: any;
|
||||
/** Columns to be displayed in codes table. */
|
||||
displayedColumns: string[] = ['name', 'systemDefined'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'systemDefined'
|
||||
];
|
||||
/** Data source for codes table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -44,11 +46,13 @@ export class CodesComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { codes: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { codes: any }) => {
|
||||
this.codesData = data.codes;
|
||||
});
|
||||
}
|
||||
@@ -84,7 +88,12 @@ export class CodesComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -123,5 +132,4 @@ export class CodesComponent implements OnInit, AfterViewInit {
|
||||
this.configurationWizardService.showSystemCodes = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CodesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class CodesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getCodes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateCodeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateCodeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateCodeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
@@ -15,7 +15,6 @@ import { ConfigurationWizardService } from '../../../configuration-wizard/config
|
||||
styleUrls: ['./create-code.component.scss']
|
||||
})
|
||||
export class CreateCodeComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Code form. */
|
||||
codeForm: UntypedFormGroup;
|
||||
|
||||
@@ -32,12 +31,14 @@ export class CreateCodeComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) { }
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Creates the code form.
|
||||
@@ -51,7 +52,10 @@ export class CreateCodeComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
createCodeForm() {
|
||||
this.codeForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required]
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,15 +64,20 @@ export class CreateCodeComponent implements OnInit, AfterViewInit {
|
||||
* if successful redirects to view created code.
|
||||
*/
|
||||
submit() {
|
||||
this.systemService.createCode(this.codeForm.value)
|
||||
.subscribe((response: any) => {
|
||||
if (this.configurationWizardService.showSystemCodesForm === true) {
|
||||
this.configurationWizardService.showSystemCodesForm = false;
|
||||
this.configurationWizardService.showRolesandPermission = true;
|
||||
this.router.navigate(['/system']);
|
||||
} else {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
}
|
||||
this.systemService.createCode(this.codeForm.value).subscribe((response: any) => {
|
||||
if (this.configurationWizardService.showSystemCodesForm === true) {
|
||||
this.configurationWizardService.showSystemCodesForm = false;
|
||||
this.configurationWizardService.showRolesandPermission = true;
|
||||
this.router.navigate(['/system']);
|
||||
} else {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -79,7 +88,12 @@ export class CreateCodeComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditCodeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditCodeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditCodeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -15,7 +15,6 @@ import { SystemService } from '../../system.service';
|
||||
styleUrls: ['./edit-code.component.scss']
|
||||
})
|
||||
export class EditCodeComponent implements OnInit {
|
||||
|
||||
/** Code Form */
|
||||
codeForm: UntypedFormGroup;
|
||||
/** Code Data */
|
||||
@@ -28,10 +27,12 @@ export class EditCodeComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { code: any }) => {
|
||||
this.codeData = data.code;
|
||||
});
|
||||
@@ -49,7 +50,10 @@ export class EditCodeComponent implements OnInit {
|
||||
*/
|
||||
createCodeForm() {
|
||||
this.codeForm = this.formBuilder.group({
|
||||
'name': [this.codeData.name, Validators.required]
|
||||
name: [
|
||||
this.codeData.name,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,10 +62,14 @@ export class EditCodeComponent implements OnInit {
|
||||
* if successful redirects to view updated code.
|
||||
*/
|
||||
submit() {
|
||||
this.systemService.updateCode(this.codeForm.value, this.codeData.id)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.systemService.updateCode(this.codeForm.value, this.codeData.id).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CodeValuesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class CodeValuesResolver implements Resolve<Object> {
|
||||
const codeId = route.paramMap.get('id');
|
||||
return this.systemService.getCodeValues(codeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewCodeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewCodeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewCodeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -20,7 +20,6 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
|
||||
styleUrls: ['./view-code.component.scss']
|
||||
})
|
||||
export class ViewCodeComponent implements OnInit {
|
||||
|
||||
/** Code Data */
|
||||
codeData: any;
|
||||
/** Code Values Data */
|
||||
@@ -39,13 +38,15 @@ export class ViewCodeComponent implements OnInit {
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
this.route.data.subscribe((data: { code: any, codeValues: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { code: any; codeValues: any }) => {
|
||||
this.codeData = data.code;
|
||||
this.codeValuesData = data.codeValues;
|
||||
});
|
||||
@@ -82,7 +83,7 @@ export class ViewCodeComponent implements OnInit {
|
||||
*/
|
||||
createCodeValuesForm() {
|
||||
this.codeValuesForm = this.formBuilder.group({
|
||||
'codeValues': this.formBuilder.array([])
|
||||
codeValues: this.formBuilder.array([])
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,10 +102,16 @@ export class ViewCodeComponent implements OnInit {
|
||||
*/
|
||||
createCodeValuesRow(codeValue?: any): UntypedFormGroup {
|
||||
return this.formBuilder.group({
|
||||
'name': [{ value: codeValue ? codeValue.name : '', disabled: true }, Validators.required],
|
||||
'description': [{ value: codeValue ? codeValue.description : '', disabled: true }],
|
||||
'position': [{ value: codeValue ? codeValue.position : 0, disabled: true }, Validators.required],
|
||||
'isActive': [{ value: codeValue ? codeValue.active : false, disabled: true }]
|
||||
name: [
|
||||
{ value: codeValue ? codeValue.name : '', disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
description: [{ value: codeValue ? codeValue.description : '', disabled: true }],
|
||||
position: [
|
||||
{ value: codeValue ? codeValue.position : 0, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
isActive: [{ value: codeValue ? codeValue.active : false, disabled: true }]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -114,12 +121,11 @@ export class ViewCodeComponent implements OnInit {
|
||||
*/
|
||||
deleteCodeValue(index: number) {
|
||||
const codeValueId = this.codeValuesData[index].id;
|
||||
this.systemService.deleteCodeValue(this.codeData.id, codeValueId)
|
||||
.subscribe((response: any) => {
|
||||
this.codeValuesData.splice(index, 1);
|
||||
this.codeValues.removeAt(index);
|
||||
this.codeValueRowStatus.splice(index, 1);
|
||||
});
|
||||
this.systemService.deleteCodeValue(this.codeData.id, codeValueId).subscribe((response: any) => {
|
||||
this.codeValuesData.splice(index, 1);
|
||||
this.codeValues.removeAt(index);
|
||||
this.codeValueRowStatus.splice(index, 1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,8 +142,10 @@ export class ViewCodeComponent implements OnInit {
|
||||
* @param {number} index Index of the row.
|
||||
*/
|
||||
updateCodeValue(index: number) {
|
||||
const updatedCodeValue: { name: string, description: string, position: number, isActive: boolean } = this.codeValues.at(index).value;
|
||||
this.systemService.updateCodeValue(this.codeData.id, this.codeValuesData[index].id, updatedCodeValue)
|
||||
const updatedCodeValue: { name: string; description: string; position: number; isActive: boolean } =
|
||||
this.codeValues.at(index).value;
|
||||
this.systemService
|
||||
.updateCodeValue(this.codeData.id, this.codeValuesData[index].id, updatedCodeValue)
|
||||
.subscribe((response: any) => {
|
||||
this.codeValues.at(index).disable();
|
||||
this.codeValueRowStatus[index] = 'disabled';
|
||||
@@ -150,14 +158,13 @@ export class ViewCodeComponent implements OnInit {
|
||||
*/
|
||||
delete() {
|
||||
const deleteCodeDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Code') + ' ' + this.codeData.name}
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Code') + ' ' + this.codeData.name }
|
||||
});
|
||||
deleteCodeDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteCode(this.codeData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/system/codes']);
|
||||
});
|
||||
this.systemService.deleteCode(this.codeData.id).subscribe(() => {
|
||||
this.router.navigate(['/system/codes']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -181,20 +188,20 @@ export class ViewCodeComponent implements OnInit {
|
||||
* @param {number} index Index of the row.
|
||||
*/
|
||||
addCodeValue(index: number) {
|
||||
const newCodeValue: { name: string, description: string, position: string, isActive: boolean } = this.codeValues.at(index).value;
|
||||
this.systemService.createCodeValue(this.codeData.id, newCodeValue)
|
||||
.subscribe((response: any) => {
|
||||
this.codeValues.at(index).disable();
|
||||
this.codeValueRowStatus[index] = 'disabled';
|
||||
this.codeValuesData.push({
|
||||
id: response.subResourceId,
|
||||
name: this.codeValues.at(index).get('name').value,
|
||||
description: this.codeValues.at(index).get('description').value,
|
||||
position: this.codeValues.at(index).get('position').value,
|
||||
isActive: this.codeValues.at(index).get('isActive').value
|
||||
});
|
||||
this.codeValues.at(index).markAsPristine();
|
||||
const newCodeValue: { name: string; description: string; position: string; isActive: boolean } =
|
||||
this.codeValues.at(index).value;
|
||||
this.systemService.createCodeValue(this.codeData.id, newCodeValue).subscribe((response: any) => {
|
||||
this.codeValues.at(index).disable();
|
||||
this.codeValueRowStatus[index] = 'disabled';
|
||||
this.codeValuesData.push({
|
||||
id: response.subResourceId,
|
||||
name: this.codeValues.at(index).get('name').value,
|
||||
description: this.codeValues.at(index).get('description').value,
|
||||
position: this.codeValues.at(index).get('position').value,
|
||||
isActive: this.codeValues.at(index).get('isActive').value
|
||||
});
|
||||
this.codeValues.at(index).markAsPristine();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,5 +212,4 @@ export class ViewCodeComponent implements OnInit {
|
||||
this.codeValues.at(index).enable();
|
||||
this.codeValueRowStatus[index] = 'edit';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('BusinessDateTabComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BusinessDateTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [BusinessDateTabComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -50,13 +50,14 @@ export class BusinessDateTabComponent implements OnInit {
|
||||
private settingsService: SettingsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private dateUtils: Dates,
|
||||
private alertService: AlertService) {}
|
||||
private alertService: AlertService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.alert$ = this.alertService.alertEvent.subscribe((alertEvent: Alert) => {
|
||||
const alertType = alertEvent.type;
|
||||
if (alertType === SettingsService.businessDateType + ' Set Config') {
|
||||
this.isBusinessDateEnabled = (alertEvent.message === 'enabled') ? true : false;
|
||||
this.isBusinessDateEnabled = alertEvent.message === 'enabled' ? true : false;
|
||||
if (this.isBusinessDateEnabled) {
|
||||
this.setBusinessDates();
|
||||
this.createBusinessDateForm();
|
||||
@@ -71,19 +72,19 @@ export class BusinessDateTabComponent implements OnInit {
|
||||
/**
|
||||
* Get the Configuration and the Business Date data
|
||||
*/
|
||||
getConfigurations(): void {
|
||||
this.systemService.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||
.subscribe((configurationData: any) => {
|
||||
this.isBusinessDateEnabled = configurationData.enabled;
|
||||
if (this.isBusinessDateEnabled) {
|
||||
this.setBusinessDates();
|
||||
}
|
||||
});
|
||||
getConfigurations(): void {
|
||||
this.systemService
|
||||
.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||
.subscribe((configurationData: any) => {
|
||||
this.isBusinessDateEnabled = configurationData.enabled;
|
||||
if (this.isBusinessDateEnabled) {
|
||||
this.setBusinessDates();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setBusinessDates(): void {
|
||||
this.systemService.getBusinessDates()
|
||||
.subscribe((businessDateData: any) => {
|
||||
this.systemService.getBusinessDates().subscribe((businessDateData: any) => {
|
||||
businessDateData.forEach((data: any) => {
|
||||
if (data.type === SettingsService.businessDateType) {
|
||||
this.businessDate = new Date(data.date);
|
||||
@@ -105,15 +106,21 @@ export class BusinessDateTabComponent implements OnInit {
|
||||
*/
|
||||
createBusinessDateForm(): void {
|
||||
this.businessDateForm = this.formBuilder.group({
|
||||
'businessDate': [new Date(), Validators.required],
|
||||
'cobDate': [new Date(), Validators.required],
|
||||
businessDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
],
|
||||
cobDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag to display or not the datepicker control to set the Business Date value
|
||||
*/
|
||||
editInProgressToggle(index: any): void {
|
||||
editInProgressToggle(index: any): void {
|
||||
this.dateIndex = index;
|
||||
this.isEditInProgress = !this.isEditInProgress;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ConfigurationsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ConfigurationsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ConfigurationsComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,14 +16,16 @@ export class ConfigurationsComponent implements OnInit {
|
||||
|
||||
isBusinessDateEnabled = false;
|
||||
|
||||
constructor(private alertService: AlertService,
|
||||
private systemService: SystemService) { }
|
||||
constructor(
|
||||
private alertService: AlertService,
|
||||
private systemService: SystemService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.alert$ = this.alertService.alertEvent.subscribe((alertEvent: Alert) => {
|
||||
const alertType = alertEvent.type;
|
||||
if (alertType === SettingsService.businessDateType + ' Set Config') {
|
||||
this.isBusinessDateEnabled = (alertEvent.message === 'enabled') ? true : false;
|
||||
this.isBusinessDateEnabled = alertEvent.message === 'enabled' ? true : false;
|
||||
}
|
||||
});
|
||||
this.getConfigurations();
|
||||
@@ -32,10 +34,11 @@ export class ConfigurationsComponent implements OnInit {
|
||||
/**
|
||||
* Get the Configuration and the Business Date data
|
||||
*/
|
||||
getConfigurations(): void {
|
||||
this.systemService.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||
.subscribe((configurationData: any) => {
|
||||
this.isBusinessDateEnabled = configurationData.enabled;
|
||||
});
|
||||
getConfigurations(): void {
|
||||
this.systemService
|
||||
.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||
.subscribe((configurationData: any) => {
|
||||
this.isBusinessDateEnabled = configurationData.enabled;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditConfigurationComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditConfigurationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditConfigurationComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+23
-18
@@ -16,7 +16,6 @@ import { SystemService } from '../../../system.service';
|
||||
styleUrls: ['./edit-configuration.component.scss']
|
||||
})
|
||||
export class EditConfigurationComponent implements OnInit {
|
||||
|
||||
/** Minimum transaction date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum transaction date allowed. */
|
||||
@@ -35,11 +34,13 @@ export class EditConfigurationComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { configuration: any }) => {
|
||||
this.configuration = data.configuration;
|
||||
});
|
||||
@@ -58,11 +59,14 @@ export class EditConfigurationComponent implements OnInit {
|
||||
*/
|
||||
createConfigurationForm() {
|
||||
this.configurationForm = this.formBuilder.group({
|
||||
'name': [{ value: this.configuration.name, disabled: true }, Validators.required],
|
||||
'description': [{ value: this.configuration.description, disabled: true }],
|
||||
'value': [this.configuration.value],
|
||||
'stringValue': [this.configuration.stringValue],
|
||||
'dateValue': [this.configuration.dateValue]
|
||||
name: [
|
||||
{ value: this.configuration.name, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
description: [{ value: this.configuration.description, disabled: true }],
|
||||
value: [this.configuration.value],
|
||||
stringValue: [this.configuration.stringValue],
|
||||
dateValue: [this.configuration.dateValue]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,7 +75,11 @@ export class EditConfigurationComponent implements OnInit {
|
||||
* if successful redirects to view all global configurations.
|
||||
*/
|
||||
submit() {
|
||||
if (this.configurationForm.value.value != null || this.configurationForm.value.stringValue != null || this.configurationForm.value.dateValue != null) {
|
||||
if (
|
||||
this.configurationForm.value.value != null ||
|
||||
this.configurationForm.value.stringValue != null ||
|
||||
this.configurationForm.value.dateValue != null
|
||||
) {
|
||||
const payload = {
|
||||
...this.configurationForm.value
|
||||
};
|
||||
@@ -85,12 +93,9 @@ export class EditConfigurationComponent implements OnInit {
|
||||
delete payload.dateValue;
|
||||
}
|
||||
|
||||
this.systemService
|
||||
.updateConfiguration(this.configuration.id, payload)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
this.systemService.updateConfiguration(this.configuration.id, payload).subscribe((response: any) => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-11
@@ -13,19 +13,17 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class GlobalConfigurationResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Configuration data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const configurationId = route.paramMap.get('id');
|
||||
return this.systemService.getConfiguration(configurationId);
|
||||
}
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Configuration data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const configurationId = route.paramMap.get('id');
|
||||
return this.systemService.getConfiguration(configurationId);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('GlobalConfigurationsTabComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GlobalConfigurationsTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [GlobalConfigurationsTabComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+27
-15
@@ -18,11 +18,17 @@ import { ConfigurationWizardService } from '../../../configuration-wizard/config
|
||||
styleUrls: ['./global-configurations-tab.component.scss']
|
||||
})
|
||||
export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Configuration data. */
|
||||
configurationData: any;
|
||||
/** Columns to be displayed in configurations table. */
|
||||
displayedColumns: string[] = ['name', 'enabled', 'value', 'stringValue', 'dateValue', 'edit'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'enabled',
|
||||
'value',
|
||||
'stringValue',
|
||||
'dateValue',
|
||||
'edit'
|
||||
];
|
||||
/** Data source for configurations table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -48,12 +54,14 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private alertService: AlertService,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private alertService: AlertService,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { configurations: any }) => {
|
||||
this.configurationData = data.configurations;
|
||||
});
|
||||
@@ -69,9 +77,8 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for configurations table.
|
||||
*/
|
||||
setConfigurationData(): void {
|
||||
this.systemService.getConfigurations()
|
||||
.subscribe((configurationData: any) => {
|
||||
setConfigurationData(): void {
|
||||
this.systemService.getConfigurations().subscribe((configurationData: any) => {
|
||||
this.configurationData = configurationData.globalConfiguration;
|
||||
this.dataSource = new MatTableDataSource(this.configurationData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
@@ -91,12 +98,13 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
|
||||
* Enables/Disables respective configuration
|
||||
*/
|
||||
toggleStatus(configuration: any) {
|
||||
this.systemService.updateConfiguration(configuration.id, { enabled: !configuration.enabled })
|
||||
this.systemService
|
||||
.updateConfiguration(configuration.id, { enabled: !configuration.enabled })
|
||||
.subscribe((response: any) => {
|
||||
configuration.enabled = response.changes.enabled;
|
||||
if (configuration.name === SettingsService.businessDateConfigName) {
|
||||
const msg = configuration.enabled ? 'enabled' : 'disabled';
|
||||
this.alertService.alert({type: SettingsService.businessDateType + ' Set Config', message: msg});
|
||||
this.alertService.alert({ type: SettingsService.businessDateType + ' Set Config', message: msg });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -108,7 +116,12 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -148,5 +161,4 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
|
||||
this.configurationWizardService.showConfigurations = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class GlobalConfigurationsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class GlobalConfigurationsResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getConfigurations();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ConfigureMakerCheckerTasksComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ConfigureMakerCheckerTasksComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ConfigureMakerCheckerTasksComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+29
-17
@@ -14,7 +14,6 @@ import { SystemService } from '../system.service';
|
||||
styleUrls: ['./configure-maker-checker-tasks.component.scss']
|
||||
})
|
||||
export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewInit {
|
||||
|
||||
permissionsData: any;
|
||||
groupings: string[] = [];
|
||||
formData = {};
|
||||
@@ -28,10 +27,10 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
backupform: UntypedFormGroup;
|
||||
|
||||
permissions: {
|
||||
permissions: { code: string, id: number }[]
|
||||
permissions: { code: string; id: number }[];
|
||||
};
|
||||
tempPermissionUIData: {
|
||||
permissions: { code: string }[]
|
||||
permissions: { code: string }[];
|
||||
}[];
|
||||
|
||||
/* Reference of edit button */
|
||||
@@ -51,12 +50,14 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService ) {
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { permissions: any }) => {
|
||||
this.permissionsData = data.permissions;
|
||||
});
|
||||
@@ -82,16 +83,24 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
return this.formBuilder.group({
|
||||
...permission,
|
||||
...{
|
||||
code: [permission.code, Validators.required],
|
||||
selected: [{ value: permission.selected, disabled: true }, Validators.required]
|
||||
code: [
|
||||
permission.code,
|
||||
Validators.required
|
||||
],
|
||||
selected: [
|
||||
{ value: permission.selected, disabled: true },
|
||||
Validators.required
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setMakerCheckerTask() {
|
||||
this.tempPermissionUIData = [{
|
||||
permissions: []
|
||||
}];
|
||||
this.tempPermissionUIData = [
|
||||
{
|
||||
permissions: []
|
||||
}
|
||||
];
|
||||
for (const i in this.permissionsData) {
|
||||
if (this.permissionsData[i]) {
|
||||
if (this.permissionsData[i].grouping !== this.currentGrouping) {
|
||||
@@ -111,7 +120,6 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
this.previousGrouping = grouping;
|
||||
}
|
||||
|
||||
|
||||
permissionName = function (name: any) {
|
||||
name = name || '';
|
||||
// replace '_' with ' '
|
||||
@@ -173,15 +181,14 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
const permissionData = {
|
||||
permissions: {}
|
||||
};
|
||||
for (let i = 0; i < value.length; i++ ) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
data[value[i].code] = value[i].selected;
|
||||
}
|
||||
permissionData.permissions = data;
|
||||
this.formGroup.controls.roster.disable();
|
||||
this.checkboxesChanged = false;
|
||||
this.isDisabled = true;
|
||||
this.systemService.updateMakerCheckerPermission(permissionData).subscribe((response: any) => {
|
||||
});
|
||||
this.systemService.updateMakerCheckerPermission(permissionData).subscribe((response: any) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +198,12 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -201,12 +213,12 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showMakerCheckerTablePage === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonEdit, this.buttonEdit.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateButtonEdit, this.buttonEdit.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
if (this.configurationWizardService.showMakerCheckerTableList === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateMcTable, this.mcTable.nativeElement, 'top', true);
|
||||
this.showPopover(this.templateMcTable, this.mcTable.nativeElement, 'top', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+11
-13
@@ -13,18 +13,16 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class MakerCheckerTasksResolver implements Resolve<Object> {
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) { }
|
||||
|
||||
/**
|
||||
* Returns all the Configurable Maker Checker Tasks.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getMakerCheckerPermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the Configurable Maker Checker Tasks.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getMakerCheckerPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EntityToEntityMappingComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EntityToEntityMappingComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EntityToEntityMappingComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -29,7 +29,6 @@ import { DeleteDialogComponent } from '../../shared/delete-dialog/delete-dialog.
|
||||
styleUrls: ['./entity-to-entity-mapping.component.scss']
|
||||
})
|
||||
export class EntityToEntityMappingComponent implements OnInit {
|
||||
|
||||
/** Stores entity to entity mapping data */
|
||||
entityMappings: string[] = [];
|
||||
/** Stores Id of selected mapping type */
|
||||
@@ -68,26 +67,34 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
/** List of Entity to Entity Mapping */
|
||||
displayedColumns: string[] = ['entitymapping'];
|
||||
/** Columns for details of a chosen mapping */
|
||||
entityMappingListColumns: string[] = ['fromentity', 'toentity', 'startdate', 'enddate', 'edit', 'delete'];
|
||||
entityMappingListColumns: string[] = [
|
||||
'fromentity',
|
||||
'toentity',
|
||||
'startdate',
|
||||
'enddate',
|
||||
'edit',
|
||||
'delete'
|
||||
];
|
||||
|
||||
/** Paginator for entity table. */
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
/** Sorter for entity table. */
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the codes data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { entityMappings: any }) => {
|
||||
this.entityMappings = data.entityMappings;
|
||||
});
|
||||
@@ -98,8 +105,14 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
*/
|
||||
createFilterPreferenceForm() {
|
||||
this.filterPreferenceForm = this.formBuilder.group({
|
||||
'mappingFirstParamId': ['', Validators.required],
|
||||
'mappingSecondParamId': ['', Validators.required]
|
||||
mappingFirstParamId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
mappingSecondParamId: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -131,7 +144,6 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
this.retrieveById = id;
|
||||
this.createFilterPreferenceForm();
|
||||
switch (this.retrieveById) {
|
||||
|
||||
case 1:
|
||||
this.systemService.getOffices().subscribe((response: any) => {
|
||||
this.firstEntityData = response;
|
||||
@@ -183,7 +195,6 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,11 +212,13 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
|
||||
this.selectedFromId = this.filterPreference.mappingFirstParamId;
|
||||
this.selectedToId = this.filterPreference.mappingSecondParamId;
|
||||
this.systemService.getEntitytoEntityData(this.retrieveById, this.selectedFromId, this.selectedToId).subscribe((response: any) => {
|
||||
this.entityMappingsListData = new MatTableDataSource(response);
|
||||
this.entityMappingsListData.paginator = this.paginator;
|
||||
this.entityMappingsListData.sort = this.sort;
|
||||
});
|
||||
this.systemService
|
||||
.getEntitytoEntityData(this.retrieveById, this.selectedFromId, this.selectedToId)
|
||||
.subscribe((response: any) => {
|
||||
this.entityMappingsListData = new MatTableDataSource(response);
|
||||
this.entityMappingsListData.paginator = this.paginator;
|
||||
this.entityMappingsListData.sort = this.sort;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,7 +231,7 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
const formfields: FormfieldBase[] = [
|
||||
new SelectBase({
|
||||
controlName: 'fromId',
|
||||
label: this.translateService.instant(`labels.inputs.${this.firstMappingEntity}`),
|
||||
label: this.translateService.instant(`labels.inputs.${this.firstMappingEntity}`),
|
||||
options: { label: 'name', value: 'id', data: this.firstEntityData },
|
||||
required: true
|
||||
}),
|
||||
@@ -240,9 +253,13 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
type: 'date',
|
||||
required: false
|
||||
})
|
||||
|
||||
];
|
||||
const data = {
|
||||
title: this.translateService.instant('labels.buttons.Add') + ' ' + this.translateService.instant('labels.heading.Entity to Entity Mapping'),
|
||||
title:
|
||||
this.translateService.instant('labels.buttons.Add') +
|
||||
' ' +
|
||||
this.translateService.instant('labels.heading.Entity to Entity Mapping'),
|
||||
layout: { addButtonText: 'Confirm' },
|
||||
formfields: formfields
|
||||
};
|
||||
@@ -291,9 +308,13 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
type: 'date',
|
||||
required: false
|
||||
})
|
||||
|
||||
];
|
||||
const data = {
|
||||
title: this.translateService.instant('labels.buttons.Edit') + ' ' + this.translateService.instant('labels.heading.Entity to Entity Mapping'),
|
||||
title:
|
||||
this.translateService.instant('labels.buttons.Edit') +
|
||||
' ' +
|
||||
this.translateService.instant('labels.heading.Entity to Entity Mapping'),
|
||||
layout: { addButtonText: 'Confirm' },
|
||||
formfields: formfields
|
||||
};
|
||||
@@ -305,13 +326,11 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Submits the new mapping
|
||||
* @param addMappingForm Add Mapping Form Data
|
||||
*/
|
||||
submitNew(addMappingForm: any) {
|
||||
|
||||
if (addMappingForm.value.fromId === '') {
|
||||
addMappingForm.value.fromId = undefined;
|
||||
}
|
||||
@@ -365,12 +384,10 @@ export class EntityToEntityMappingComponent implements OnInit {
|
||||
});
|
||||
deleteNoteDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteMapping(id)
|
||||
.subscribe(() => {
|
||||
this.showFilteredData();
|
||||
});
|
||||
this.systemService.deleteMapping(id).subscribe(() => {
|
||||
this.showFilteredData();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,18 +13,16 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EntityToEntityMappingResolver implements Resolve<Object> {
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) { }
|
||||
|
||||
/**
|
||||
* Returns the Mapping data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getEntityMappings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Mapping data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getEntityMappings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('AmazonS3Component', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AmazonS3Component ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AmazonS3Component]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -13,11 +13,13 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./amazon-s3.component.scss']
|
||||
})
|
||||
export class AmazonS3Component implements OnInit {
|
||||
|
||||
/** Amazon S3 configuration data. */
|
||||
amazonS3ConfigurationData: any;
|
||||
/** Columns to be displayed in Amazon S3 configuration table. */
|
||||
displayedColumns: string[] = ['name', 'value'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'value'
|
||||
];
|
||||
/** Data source for Amazon S3 configuration table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -56,5 +58,4 @@ export class AmazonS3Component implements OnInit {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class AmazonS3ConfigurationResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class AmazonS3ConfigurationResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getExternalConfiguration('S3');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditAmazonS3Component', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditAmazonS3Component ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditAmazonS3Component]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+18
-9
@@ -15,7 +15,6 @@ import { SystemService } from 'app/system/system.service';
|
||||
styleUrls: ['./edit-amazon-s3.component.scss']
|
||||
})
|
||||
export class EditAmazonS3Component implements OnInit {
|
||||
|
||||
/** Amazon S3 Configuration data */
|
||||
amazonS3ConfigurationData: any;
|
||||
/** Amazon S3 Configuration Form */
|
||||
@@ -32,10 +31,12 @@ export class EditAmazonS3Component implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { amazonS3Configuration: any }) => {
|
||||
this.amazonS3ConfigurationData = data.amazonS3Configuration;
|
||||
});
|
||||
@@ -55,9 +56,18 @@ export class EditAmazonS3Component implements OnInit {
|
||||
*/
|
||||
createAmazonS3ConfigurationForm() {
|
||||
this.amazonS3ConfigurationForm = this.formBuilder.group({
|
||||
's3_bucket_name': [this.amazonS3ConfigurationData[1].value, Validators.required],
|
||||
's3_access_key': [this.amazonS3ConfigurationData[0].value, Validators.required],
|
||||
's3_secret_key': [this.amazonS3ConfigurationData[2].value, Validators.required]
|
||||
s3_bucket_name: [
|
||||
this.amazonS3ConfigurationData[1].value,
|
||||
Validators.required
|
||||
],
|
||||
s3_access_key: [
|
||||
this.amazonS3ConfigurationData[0].value,
|
||||
Validators.required
|
||||
],
|
||||
s3_secret_key: [
|
||||
this.amazonS3ConfigurationData[2].value,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -72,5 +82,4 @@ export class EditAmazonS3Component implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditEmailComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditEmailComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditEmailComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -15,7 +15,6 @@ import { SystemService } from 'app/system/system.service';
|
||||
styleUrls: ['./edit-email.component.scss']
|
||||
})
|
||||
export class EditEmailComponent implements OnInit {
|
||||
|
||||
/** Password input field type. */
|
||||
passwordInputType: string;
|
||||
/** Email Configuration data */
|
||||
@@ -30,10 +29,12 @@ export class EditEmailComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { emailConfiguration: any }) => {
|
||||
this.emailConfigurationData = data.emailConfiguration;
|
||||
});
|
||||
@@ -52,13 +53,34 @@ export class EditEmailComponent implements OnInit {
|
||||
*/
|
||||
setEmailConfigurationForm() {
|
||||
this.emailConfigurationForm = this.formBuilder.group({
|
||||
'username': [this.emailConfigurationData[0].value, Validators.required],
|
||||
'password': [this.emailConfigurationData[1].value, Validators.required],
|
||||
'host': [this.emailConfigurationData[2].value, Validators.required],
|
||||
'port': [this.emailConfigurationData[3].value, Validators.required],
|
||||
'useTLS': [this.emailConfigurationData[4].value, Validators.required],
|
||||
'fromEmail': [this.emailConfigurationData[5].value, Validators.required],
|
||||
'fromName': [this.emailConfigurationData[6].value, Validators.required]
|
||||
username: [
|
||||
this.emailConfigurationData[0].value,
|
||||
Validators.required
|
||||
],
|
||||
password: [
|
||||
this.emailConfigurationData[1].value,
|
||||
Validators.required
|
||||
],
|
||||
host: [
|
||||
this.emailConfigurationData[2].value,
|
||||
Validators.required
|
||||
],
|
||||
port: [
|
||||
this.emailConfigurationData[3].value,
|
||||
Validators.required
|
||||
],
|
||||
useTLS: [
|
||||
this.emailConfigurationData[4].value,
|
||||
Validators.required
|
||||
],
|
||||
fromEmail: [
|
||||
this.emailConfigurationData[5].value,
|
||||
Validators.required
|
||||
],
|
||||
fromName: [
|
||||
this.emailConfigurationData[6].value,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,5 +95,4 @@ export class EditEmailComponent implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EmailComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EmailComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EmailComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -13,11 +13,13 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
styleUrls: ['./email.component.scss']
|
||||
})
|
||||
export class EmailComponent implements OnInit {
|
||||
|
||||
/** Email configuration data. */
|
||||
emailConfigurationData: any;
|
||||
/** Columns to be displayed in Email configuration table. */
|
||||
displayedColumns: string[] = ['name', 'value'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'value'
|
||||
];
|
||||
/** Data source for Email configuration table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -48,5 +50,4 @@ export class EmailComponent implements OnInit {
|
||||
this.dataSource = new MatTableDataSource(this.emailConfigurationData);
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EmailConfigurationResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class EmailConfigurationResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getExternalConfiguration('SMTP');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ExternalServicesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ExternalServicesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ExternalServicesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -6,22 +6,21 @@ import { Component } from '@angular/core';
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-external-services',
|
||||
templateUrl: './external-services.component.html',
|
||||
templateUrl: './external-services.component.html'
|
||||
})
|
||||
export class ExternalServicesComponent {
|
||||
// Initialize an array of 4 boolean values, all set to false
|
||||
arrowBooleans: boolean[] = new Array(4).fill(false);
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Popover function
|
||||
* @param arrowNumber - The index of the boolean value to toggle.
|
||||
*/
|
||||
|
||||
arrowBooleansToggle(arrowNumber: number) {
|
||||
arrowBooleansToggle(arrowNumber: number) {
|
||||
// Toggle the boolean value at the given index
|
||||
this.arrowBooleans[arrowNumber] = !this.arrowBooleans[arrowNumber];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditNotificationComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditNotificationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditNotificationComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+18
-9
@@ -15,7 +15,6 @@ import { SystemService } from 'app/system/system.service';
|
||||
styleUrls: ['./edit-notification.component.scss']
|
||||
})
|
||||
export class EditNotificationComponent implements OnInit {
|
||||
|
||||
/** Notification Configuration data */
|
||||
notificationConfigurationData: any;
|
||||
/** Notification Configuration Form */
|
||||
@@ -28,10 +27,12 @@ export class EditNotificationComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { notificationConfiguration: any }) => {
|
||||
this.notificationConfigurationData = data.notificationConfiguration;
|
||||
});
|
||||
@@ -49,9 +50,18 @@ export class EditNotificationComponent implements OnInit {
|
||||
*/
|
||||
setNotificationConfigurationForm() {
|
||||
this.notificationConfigurationForm = this.formBuilder.group({
|
||||
'server_key': [this.notificationConfigurationData[0].value, Validators.required],
|
||||
'gcm_end_point': [this.notificationConfigurationData[1].value, Validators.required],
|
||||
'fcm_end_point': [this.notificationConfigurationData[2].value, Validators.required]
|
||||
server_key: [
|
||||
this.notificationConfigurationData[0].value,
|
||||
Validators.required
|
||||
],
|
||||
gcm_end_point: [
|
||||
this.notificationConfigurationData[1].value,
|
||||
Validators.required
|
||||
],
|
||||
fcm_end_point: [
|
||||
this.notificationConfigurationData[2].value,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -66,5 +76,4 @@ export class EditNotificationComponent implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('NotificationComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NotificationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [NotificationComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -13,11 +13,13 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
styleUrls: ['./notification.component.scss']
|
||||
})
|
||||
export class NotificationComponent implements OnInit {
|
||||
|
||||
/** Notification configuration data. */
|
||||
notificationConfigurationData: any;
|
||||
/** Columns to be displayed in Notification configuration table. */
|
||||
displayedColumns: string[] = ['name', 'value'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'value'
|
||||
];
|
||||
/** Data source for Notification configuration table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -56,5 +58,4 @@ export class NotificationComponent implements OnInit {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class NotificationConfigurationResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class NotificationConfigurationResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getExternalConfiguration('NOTIFICATION');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditSmsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditSMSComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditSMSComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -15,7 +15,6 @@ import { SystemService } from 'app/system/system.service';
|
||||
styleUrls: ['./edit-sms.component.scss']
|
||||
})
|
||||
export class EditSMSComponent implements OnInit {
|
||||
|
||||
/** SMS Configuration data */
|
||||
smsConfigurationData: any;
|
||||
/** SMS Configuration Form */
|
||||
@@ -28,10 +27,12 @@ export class EditSMSComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { smsConfiguration: any }) => {
|
||||
this.smsConfigurationData = data.smsConfiguration;
|
||||
});
|
||||
@@ -49,10 +50,22 @@ export class EditSMSComponent implements OnInit {
|
||||
*/
|
||||
setSMSConfigurationForm() {
|
||||
this.smsConfigurationForm = this.formBuilder.group({
|
||||
'host_name': [this.smsConfigurationData[0].value, Validators.required],
|
||||
'port_number': [this.smsConfigurationData[1].value, Validators.required],
|
||||
'end_point': [this.smsConfigurationData[2].value, Validators.required],
|
||||
'tenant_app_key': [this.smsConfigurationData[3].value, Validators.required]
|
||||
host_name: [
|
||||
this.smsConfigurationData[0].value,
|
||||
Validators.required
|
||||
],
|
||||
port_number: [
|
||||
this.smsConfigurationData[1].value,
|
||||
Validators.required
|
||||
],
|
||||
end_point: [
|
||||
this.smsConfigurationData[2].value,
|
||||
Validators.required
|
||||
],
|
||||
tenant_app_key: [
|
||||
this.smsConfigurationData[3].value,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,5 +80,4 @@ export class EditSMSComponent implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('SmsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SMSComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [SMSComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -13,11 +13,13 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
styleUrls: ['./sms.component.scss']
|
||||
})
|
||||
export class SMSComponent implements OnInit {
|
||||
|
||||
/** SMS configuration data. */
|
||||
smsConfigurationData: any;
|
||||
/** Columns to be displayed in SMS configuration table. */
|
||||
displayedColumns: string[] = ['name', 'value'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'value'
|
||||
];
|
||||
/** Data source for SMS configuration table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -29,10 +31,10 @@ export class SMSComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: {smsConfiguration: any}) => {
|
||||
this.route.data.subscribe((data: { smsConfiguration: any }) => {
|
||||
this.smsConfigurationData = data.smsConfiguration;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the SMS Configuration table.
|
||||
@@ -48,5 +50,4 @@ export class SMSComponent implements OnInit {
|
||||
this.dataSource = new MatTableDataSource(this.smsConfigurationData);
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class SMSConfigurationResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class SMSConfigurationResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getExternalConfiguration('SMS');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const appTableData: { displayValue: string, value: string }[] = [
|
||||
export const appTableData: { displayValue: string; value: string }[] = [
|
||||
{ displayValue: 'Client', value: 'm_client' },
|
||||
{ displayValue: 'Group', value: 'm_group' },
|
||||
{ displayValue: 'Center', value: 'm_center' },
|
||||
@@ -11,13 +11,13 @@ export const appTableData: { displayValue: string, value: string }[] = [
|
||||
{ displayValue: 'Share Product', value: 'm_share_product' }
|
||||
];
|
||||
|
||||
export const entitySubTypeData: { displayValue: string, value: string }[] = [
|
||||
export const entitySubTypeData: { displayValue: string; value: string }[] = [
|
||||
{ displayValue: 'Person', value: 'Person' },
|
||||
{ displayValue: 'Entity', value: 'Entity' },
|
||||
{ displayValue: 'Entity', value: 'Entity' }
|
||||
];
|
||||
|
||||
export const savingsSubTypeData: { displayValue: string, value: string }[] = [
|
||||
export const savingsSubTypeData: { displayValue: string; value: string }[] = [
|
||||
{ displayValue: 'Savings Product', value: 'Savings Product' },
|
||||
{ displayValue: 'Fixed Deposit', value: 'Fixed Deposit' },
|
||||
{ displayValue: 'Recurring Deposit', value: 'Recurring Deposit' },
|
||||
{ displayValue: 'Recurring Deposit', value: 'Recurring Deposit' }
|
||||
];
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ColumnDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ColumnDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ColumnDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -15,7 +15,6 @@ import { columnTypeData } from '../column-type-data';
|
||||
styleUrls: ['./column-dialog.component.scss']
|
||||
})
|
||||
export class ColumnDialogComponent implements OnInit {
|
||||
|
||||
/** Column Form. */
|
||||
columnForm: UntypedFormGroup;
|
||||
/** Column Type Data */
|
||||
@@ -26,22 +25,53 @@ export class ColumnDialogComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {any} data Provides the column codes and values for the form (if available).
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ColumnDialogComponent>,
|
||||
public formBuilder: UntypedFormBuilder,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ColumnDialogComponent>,
|
||||
public formBuilder: UntypedFormBuilder,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Creates the add column form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.columnForm = this.formBuilder.group({
|
||||
'name': [this.data ? this.data.columnName : '', Validators.required],
|
||||
'type': [{ value: this.data ? (this.data.columnDisplayType === '' ? '' : this.getColumnType(this.data.columnDisplayType)) : '', disabled: this.data.type === 'existing' }, Validators.required],
|
||||
'length': [{ value: this.data ? + this.data.columnLength : '', disabled: this.getColumnType(this.data.columnDisplayType) !== 'String' || this.data.type === 'existing' }, Validators.required],
|
||||
'mandatory': [{ value: this.data.isColumnNullable, disabled: this.data.type === 'existing' }],
|
||||
'unique': [{ value: this.data.isColumnUnique, disabled: this.data.isColumnNullable || this.data.type === 'existing' }],
|
||||
'indexed': [{ value: this.data.isColumnIndexed, disabled: this.data.type === 'existing' }],
|
||||
'code': [{ value: this.data ? this.data.columnCode : '', disabled: this.getColumnType(this.data.columnDisplayType) !== 'Dropdown' || this.data.type === 'existing' }, Validators.required],
|
||||
name: [
|
||||
this.data ? this.data.columnName : '',
|
||||
Validators.required
|
||||
],
|
||||
type: [
|
||||
{
|
||||
value: this.data
|
||||
? this.data.columnDisplayType === ''
|
||||
? ''
|
||||
: this.getColumnType(this.data.columnDisplayType)
|
||||
: '',
|
||||
disabled: this.data.type === 'existing'
|
||||
},
|
||||
Validators.required
|
||||
|
||||
],
|
||||
length: [
|
||||
{
|
||||
value: this.data ? +this.data.columnLength : '',
|
||||
disabled: this.getColumnType(this.data.columnDisplayType) !== 'String' || this.data.type === 'existing'
|
||||
},
|
||||
Validators.required
|
||||
|
||||
],
|
||||
mandatory: [{ value: this.data.isColumnNullable, disabled: this.data.type === 'existing' }],
|
||||
unique: [
|
||||
{ value: this.data.isColumnUnique, disabled: this.data.isColumnNullable || this.data.type === 'existing' }],
|
||||
indexed: [{ value: this.data.isColumnIndexed, disabled: this.data.type === 'existing' }],
|
||||
code: [
|
||||
{
|
||||
value: this.data ? this.data.columnCode : '',
|
||||
disabled: this.getColumnType(this.data.columnDisplayType) !== 'Dropdown' || this.data.type === 'existing'
|
||||
},
|
||||
Validators.required
|
||||
|
||||
]
|
||||
});
|
||||
this.onColumnTypeChanges();
|
||||
}
|
||||
@@ -72,25 +102,24 @@ export class ColumnDialogComponent implements OnInit {
|
||||
* Watches on Column Type field to enable/diable certain fields.
|
||||
*/
|
||||
onColumnTypeChanges() {
|
||||
this.columnForm.get('type').valueChanges
|
||||
.subscribe(type => {
|
||||
switch (type) {
|
||||
case 'String': {
|
||||
this.columnForm.get('length').enable();
|
||||
this.columnForm.get('code').disable();
|
||||
break;
|
||||
}
|
||||
case 'Dropdown': {
|
||||
this.columnForm.get('code').enable();
|
||||
this.columnForm.get('length').disable();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.columnForm.get('code').disable();
|
||||
this.columnForm.get('length').disable();
|
||||
}
|
||||
this.columnForm.get('type').valueChanges.subscribe((type) => {
|
||||
switch (type) {
|
||||
case 'String': {
|
||||
this.columnForm.get('length').enable();
|
||||
this.columnForm.get('code').disable();
|
||||
break;
|
||||
}
|
||||
});
|
||||
case 'Dropdown': {
|
||||
this.columnForm.get('code').enable();
|
||||
this.columnForm.get('length').disable();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.columnForm.get('code').disable();
|
||||
this.columnForm.get('length').disable();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,5 +128,4 @@ export class ColumnDialogComponent implements OnInit {
|
||||
submit() {
|
||||
this.dialogRef.close(this.columnForm.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export const columnTypeData: { displayValue: string, value: string }[] = [
|
||||
{ displayValue: 'Boolean', value: 'Boolean' },
|
||||
{ displayValue: 'Date', value: 'Date' },
|
||||
{ displayValue: 'Date and Time', value: 'Datetime' },
|
||||
{ displayValue: 'Decimal', value: 'Decimal' },
|
||||
{ displayValue: 'Dropdown', value: 'Dropdown' },
|
||||
{ displayValue: 'Number', value: 'Number' },
|
||||
{ displayValue: 'String', value: 'String' },
|
||||
{ displayValue: 'Text', value: 'Text' }
|
||||
];
|
||||
export const columnTypeData: { displayValue: string; value: string }[] = [
|
||||
{ displayValue: 'Boolean', value: 'Boolean' },
|
||||
{ displayValue: 'Date', value: 'Date' },
|
||||
{ displayValue: 'Date and Time', value: 'Datetime' },
|
||||
{ displayValue: 'Decimal', value: 'Decimal' },
|
||||
{ displayValue: 'Dropdown', value: 'Dropdown' },
|
||||
{ displayValue: 'Number', value: 'Number' },
|
||||
{ displayValue: 'String', value: 'String' },
|
||||
{ displayValue: 'Text', value: 'Text' }
|
||||
];
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateDataTableComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateDataTableComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateDataTableComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+73
-46
@@ -33,7 +33,6 @@ import { DatatableColumn } from '../datatable-column.model';
|
||||
styleUrls: ['./create-data-table.component.scss']
|
||||
})
|
||||
export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Data Table Form */
|
||||
dataTableForm: UntypedFormGroup;
|
||||
/** Application Table Data */
|
||||
@@ -46,18 +45,27 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
columnData: DatatableColumn[] = [];
|
||||
/** Data passed to dialog. */
|
||||
dataForDialog: DatatableColumn = {
|
||||
columnName: undefined,
|
||||
columnDisplayType: undefined,
|
||||
isColumnNullable: undefined,
|
||||
columnLength: undefined,
|
||||
columnCode: undefined,
|
||||
columnCodes: undefined,
|
||||
type: undefined,
|
||||
isColumnUnique: undefined,
|
||||
isColumnIndexed: undefined
|
||||
};
|
||||
columnName: undefined,
|
||||
columnDisplayType: undefined,
|
||||
isColumnNullable: undefined,
|
||||
columnLength: undefined,
|
||||
columnCode: undefined,
|
||||
columnCodes: undefined,
|
||||
type: undefined,
|
||||
isColumnUnique: undefined,
|
||||
isColumnIndexed: undefined
|
||||
};
|
||||
/** Columns to be displayed in columns table. */
|
||||
displayedColumns: string[] = ['name', 'type', 'length', 'code', 'mandatory', 'unique', 'indexed', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'type',
|
||||
'length',
|
||||
'code',
|
||||
'mandatory',
|
||||
'unique',
|
||||
'indexed',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for columns table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Paginator for columns table. */
|
||||
@@ -81,14 +89,16 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private systemService: SystemService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { columnCodes: any }) => {
|
||||
this.dataForDialog.columnCodes = data.columnCodes;
|
||||
});
|
||||
@@ -101,8 +111,8 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
this.createDataTableForm();
|
||||
this.setColumns();
|
||||
this.dataTableForm.controls.apptableName.valueChanges.subscribe((value: any) => {
|
||||
this.showEntitySubType = (value === 'm_client');
|
||||
this.showSavingsSubType = (value === 'm_savings_product');
|
||||
this.showEntitySubType = value === 'm_client';
|
||||
this.showSavingsSubType = value === 'm_savings_product';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -120,10 +130,16 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
createDataTableForm() {
|
||||
this.dataTableForm = this.formBuilder.group({
|
||||
'datatableName': ['', Validators.required],
|
||||
'apptableName': ['', Validators.required],
|
||||
'multiRow': [false],
|
||||
'entitySubType': ['']
|
||||
datatableName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
apptableName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
multiRow: [false],
|
||||
entitySubType: ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -181,7 +197,7 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
});
|
||||
editColumnDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response !== '') {
|
||||
this.columnData[this.columnData.findIndex(newColumn => newColumn.columnName === column.name)] = {
|
||||
this.columnData[this.columnData.findIndex((newColumn) => newColumn.columnName === column.name)] = {
|
||||
columnName: response.name,
|
||||
columnDisplayType: response.type,
|
||||
isColumnNullable: !response.mandatory,
|
||||
@@ -202,7 +218,7 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
deleteColumn(column: any) {
|
||||
const deleteColumnDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Column') + ' ' + column.name}
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Column') + ' ' + column.name }
|
||||
});
|
||||
deleteColumnDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -236,10 +252,16 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
this.systemService.createDataTable(payload).subscribe((response: any) => {
|
||||
if (this.configurationWizardService.showDatatablesForm === true) {
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.openDialog();
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.openDialog();
|
||||
} else {
|
||||
this.router.navigate(['../', response.resourceIdentifier], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceIdentifier
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -251,7 +273,12 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -261,7 +288,7 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showDatatablesForm === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateDataTableFormRef, this.dataTableFormRef.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateDataTableFormRef, this.dataTableFormRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -291,22 +318,22 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
|
||||
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
|
||||
data: {
|
||||
stepName: 'data table'
|
||||
},
|
||||
}
|
||||
});
|
||||
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
|
||||
if (response.step === 1) {
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
this.configurationWizardService.showDatatablesForm = true;
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/organization/data-tables/create']);
|
||||
} else if (response.step === 3) {
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.configurationWizardService.showSystemCodes = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
this.configurationWizardService.showDatatablesForm = true;
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/organization/data-tables/create']);
|
||||
} else if (response.step === 3) {
|
||||
this.configurationWizardService.showDatatablesForm = false;
|
||||
this.configurationWizardService.showSystemCodes = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class DataTableResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -28,6 +27,4 @@ export class DataTableResolver implements Resolve<Object> {
|
||||
const dataTableName = route.paramMap.get('datatableName');
|
||||
return this.systemService.getDataTable(dataTableName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
export interface DatatableColumn {
|
||||
|
||||
columnName: string;
|
||||
columnDisplayType: string;
|
||||
isColumnNullable: boolean;
|
||||
@@ -10,5 +8,4 @@ export interface DatatableColumn {
|
||||
type: string;
|
||||
isColumnUnique: boolean;
|
||||
isColumnIndexed: boolean;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditDataTableComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditDataTableComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditDataTableComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -28,7 +28,6 @@ import { DatatableColumn } from '../datatable-column.model';
|
||||
styleUrls: ['./edit-data-table.component.scss']
|
||||
})
|
||||
export class EditDataTableComponent implements OnInit {
|
||||
|
||||
/** Data Table Form. */
|
||||
dataTableForm: UntypedFormGroup;
|
||||
/** Data Table Data. */
|
||||
@@ -43,29 +42,58 @@ export class EditDataTableComponent implements OnInit {
|
||||
isFormEdited = false;
|
||||
/** Data Table Changes Data. */
|
||||
dataTableChangesData: {
|
||||
apptableName: string,
|
||||
entitySubType: string,
|
||||
dropColumns?: { name: string }[],
|
||||
changeColumns: { name: string, newName?: string, code?: string, newCode?: string, mandatory: boolean, length?: number, unique?: boolean, indexed?: boolean }[],
|
||||
addColumns?: { name?: string, type?: string, code?: string, mandatory?: boolean, length?: number, unique?: boolean, indexed?: boolean }[]
|
||||
apptableName: string;
|
||||
entitySubType: string;
|
||||
dropColumns?: { name: string }[];
|
||||
changeColumns: {
|
||||
name: string;
|
||||
newName?: string;
|
||||
code?: string;
|
||||
newCode?: string;
|
||||
mandatory: boolean;
|
||||
length?: number;
|
||||
unique?: boolean;
|
||||
indexed?: boolean;
|
||||
}[];
|
||||
addColumns?: {
|
||||
name?: string;
|
||||
type?: string;
|
||||
code?: string;
|
||||
mandatory?: boolean;
|
||||
length?: number;
|
||||
unique?: boolean;
|
||||
indexed?: boolean;
|
||||
}[];
|
||||
} = {
|
||||
apptableName: '', changeColumns: [], addColumns: [], dropColumns: [],
|
||||
apptableName: '',
|
||||
changeColumns: [],
|
||||
addColumns: [],
|
||||
dropColumns: [],
|
||||
entitySubType: ''
|
||||
};
|
||||
/** Data passed to dialog. */
|
||||
dataForDialog: DatatableColumn = {
|
||||
columnName: undefined,
|
||||
columnDisplayType: undefined,
|
||||
isColumnNullable: undefined,
|
||||
columnLength: undefined,
|
||||
columnCode: undefined,
|
||||
columnCodes: undefined,
|
||||
type: undefined,
|
||||
isColumnUnique: undefined,
|
||||
isColumnIndexed: undefined
|
||||
};
|
||||
columnName: undefined,
|
||||
columnDisplayType: undefined,
|
||||
isColumnNullable: undefined,
|
||||
columnLength: undefined,
|
||||
columnCode: undefined,
|
||||
columnCodes: undefined,
|
||||
type: undefined,
|
||||
isColumnUnique: undefined,
|
||||
isColumnIndexed: undefined
|
||||
};
|
||||
/** Columns to be displayed in columns table. */
|
||||
displayedColumns: string[] = ['name', 'type', 'length', 'code', 'mandatory', 'unique', 'indexed', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'type',
|
||||
'length',
|
||||
'code',
|
||||
'mandatory',
|
||||
'unique',
|
||||
'indexed',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for columns table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Paginator for columns table. */
|
||||
@@ -81,16 +109,21 @@ export class EditDataTableComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {MatDialog} dialog Dialog Reference.
|
||||
*/
|
||||
constructor(private systemService: SystemService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
this.route.data.subscribe((data: { dataTable: any, columnCodes: any }) => {
|
||||
constructor(
|
||||
private systemService: SystemService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { dataTable: any; columnCodes: any }) => {
|
||||
this.dataTableData = data.dataTable;
|
||||
this.dataTableData.columnHeaderData.forEach((item: any) => {
|
||||
item.system = ['created_at', 'updated_at'].includes(item.columnName);
|
||||
item.system = [
|
||||
'created_at',
|
||||
'updated_at'
|
||||
].includes(item.columnName);
|
||||
});
|
||||
this.columnData = this.dataTableData.columnHeaderData;
|
||||
this.dataForDialog.columnCodes = data.columnCodes;
|
||||
@@ -105,7 +138,7 @@ export class EditDataTableComponent implements OnInit {
|
||||
this.createDataTableForm();
|
||||
this.setColumns();
|
||||
this.dataTableForm.controls.apptableName.valueChanges.subscribe((value: any) => {
|
||||
this.showEntitySubType = (value === 'm_client');
|
||||
this.showEntitySubType = value === 'm_client';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -129,7 +162,7 @@ export class EditDataTableComponent implements OnInit {
|
||||
this.columnData[index].columnDisplayType = this.getColumnType(this.columnData[index].columnDisplayType);
|
||||
this.columnData[index].type = 'existing';
|
||||
}
|
||||
this.showEntitySubType = (this.dataTableData.applicationTableName === 'm_client');
|
||||
this.showEntitySubType = this.dataTableData.applicationTableName === 'm_client';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,9 +170,15 @@ export class EditDataTableComponent implements OnInit {
|
||||
*/
|
||||
createDataTableForm() {
|
||||
this.dataTableForm = this.formBuilder.group({
|
||||
'datatableName': [{ value: this.dataTableData.registeredTableName, disabled: true }, Validators.required],
|
||||
'apptableName': [{ value: this.dataTableData.applicationTableName, disabled: true }, Validators.required],
|
||||
'entitySubType': [{ value: this.dataTableData.entitySubType, disabled: true }]
|
||||
datatableName: [
|
||||
{ value: this.dataTableData.registeredTableName, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
apptableName: [
|
||||
{ value: this.dataTableData.applicationTableName, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
entitySubType: [{ value: this.dataTableData.entitySubType, disabled: true }]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -175,11 +214,14 @@ export class EditDataTableComponent implements OnInit {
|
||||
};
|
||||
let alreadyExist = false;
|
||||
this.columnData.forEach((column: DatatableColumn) => {
|
||||
if ((newColumn.columnName === column.columnName) || (newColumn.columnName === column.columnName
|
||||
&& newColumn.columnDisplayType === column.columnDisplayType
|
||||
&& newColumn.isColumnNullable === column.isColumnNullable)) {
|
||||
alreadyExist = true;
|
||||
}
|
||||
if (
|
||||
newColumn.columnName === column.columnName ||
|
||||
(newColumn.columnName === column.columnName &&
|
||||
newColumn.columnDisplayType === column.columnDisplayType &&
|
||||
newColumn.isColumnNullable === column.isColumnNullable)
|
||||
) {
|
||||
alreadyExist = true;
|
||||
}
|
||||
});
|
||||
if (!alreadyExist) {
|
||||
this.dataTableChangesData.addColumns.push({
|
||||
@@ -220,10 +262,14 @@ export class EditDataTableComponent implements OnInit {
|
||||
if (response !== '') {
|
||||
this.isFormEdited = true;
|
||||
if (column.type === 'new') {
|
||||
this.dataTableChangesData.addColumns[this.dataTableChangesData.addColumns
|
||||
.findIndex(newColumn => newColumn.name === column.columnName
|
||||
&& newColumn.type === column.columnDisplayType
|
||||
&& newColumn.mandatory === column.isColumnNullable)] = {
|
||||
this.dataTableChangesData.addColumns[
|
||||
this.dataTableChangesData.addColumns.findIndex(
|
||||
(newColumn) =>
|
||||
newColumn.name === column.columnName &&
|
||||
newColumn.type === column.columnDisplayType &&
|
||||
newColumn.mandatory === column.isColumnNullable
|
||||
)
|
||||
] = {
|
||||
name: response.name,
|
||||
type: response.type,
|
||||
code: response.code,
|
||||
@@ -252,7 +298,9 @@ export class EditDataTableComponent implements OnInit {
|
||||
type: 'existing'
|
||||
};
|
||||
|
||||
const index = this.dataTableChangesData.changeColumns.findIndex(newColumn => newColumn.newName === column.columnName);
|
||||
const index = this.dataTableChangesData.changeColumns.findIndex(
|
||||
(newColumn) => newColumn.newName === column.columnName
|
||||
);
|
||||
if (index === -1) {
|
||||
this.dataTableChangesData.changeColumns.push({
|
||||
name: column.columnName,
|
||||
@@ -284,7 +332,7 @@ export class EditDataTableComponent implements OnInit {
|
||||
*/
|
||||
deleteColumn(column: any) {
|
||||
const deleteColumnDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Column') + ' ' + column.columnName}
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Column') + ' ' + column.columnName }
|
||||
});
|
||||
deleteColumnDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -296,10 +344,15 @@ export class EditDataTableComponent implements OnInit {
|
||||
name: column.columnName
|
||||
});
|
||||
} else if (column.type === 'new') {
|
||||
this.dataTableChangesData.addColumns.splice(this.dataTableChangesData.addColumns
|
||||
.findIndex(newColumn => newColumn.name === column.columnName
|
||||
&& newColumn.type === column.columnDisplayType
|
||||
&& newColumn.mandatory === column.isColumnNullable), 1);
|
||||
this.dataTableChangesData.addColumns.splice(
|
||||
this.dataTableChangesData.addColumns.findIndex(
|
||||
(newColumn) =>
|
||||
newColumn.name === column.columnName &&
|
||||
newColumn.type === column.columnDisplayType &&
|
||||
newColumn.mandatory === column.isColumnNullable
|
||||
),
|
||||
1
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -338,10 +391,10 @@ export class EditDataTableComponent implements OnInit {
|
||||
if (!this.dataTableChangesData.dropColumns || this.dataTableChangesData.dropColumns.length === 0) {
|
||||
this.dataTableChangesData.dropColumns = undefined;
|
||||
}
|
||||
this.systemService.updateDataTable(this.dataTableChangesData, this.dataTableData.registeredTableName)
|
||||
this.systemService
|
||||
.updateDataTable(this.dataTableChangesData, this.dataTableData.registeredTableName)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ManageDataTablesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageDataTablesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ManageDataTablesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -21,11 +21,14 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
|
||||
styleUrls: ['./manage-data-tables.component.scss']
|
||||
})
|
||||
export class ManageDataTablesComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Data table data. */
|
||||
dataTableData: any;
|
||||
/** Columns to be displayed in manage data tables table. */
|
||||
displayedColumns: string[] = ['registeredTableName', 'applicationTableName', 'entitySubType'];
|
||||
displayedColumns: string[] = [
|
||||
'registeredTableName',
|
||||
'applicationTableName',
|
||||
'entitySubType'
|
||||
];
|
||||
/** Data source for manage data tables table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -50,11 +53,13 @@ export class ManageDataTablesComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { dataTables: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { dataTables: any }) => {
|
||||
this.dataTableData = data.dataTables;
|
||||
});
|
||||
}
|
||||
@@ -90,7 +95,12 @@ export class ManageDataTablesComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -100,12 +110,12 @@ export class ManageDataTablesComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showDatatablesPage === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateCreateDatatableRef, this.createDatatableRef.nativeElement, 'bottom', true);
|
||||
this.showPopover(this.templateCreateDatatableRef, this.createDatatableRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
if (this.configurationWizardService.showDatatablesList === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateDatatablesList, this.datatablesList.nativeElement, 'top', true);
|
||||
this.showPopover(this.templateDatatablesList, this.datatablesList.nativeElement, 'top', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ManageDataTablesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class ManageDataTablesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getDataTables();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewDataTableComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewDataTableComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewDataTableComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -22,13 +22,20 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
|
||||
styleUrls: ['./view-data-table.component.scss']
|
||||
})
|
||||
export class ViewDataTableComponent implements OnInit {
|
||||
|
||||
/** Data Table Data */
|
||||
dataTableData: any;
|
||||
/** Column Data */
|
||||
columnsData: any;
|
||||
/** Columns to be displayed in columns table. */
|
||||
displayedColumns: string[] = ['columnName', 'columnDisplayType', 'columnLength', 'columnCode', 'isColumnNullable', 'isColumnUnique', 'isColumnIndexed'];
|
||||
displayedColumns: string[] = [
|
||||
'columnName',
|
||||
'columnDisplayType',
|
||||
'columnLength',
|
||||
'columnCode',
|
||||
'isColumnNullable',
|
||||
'isColumnUnique',
|
||||
'isColumnIndexed'
|
||||
];
|
||||
/** Data source for columns table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -45,11 +52,13 @@ export class ViewDataTableComponent implements OnInit {
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { dataTable: any }) => {
|
||||
this.dataTableData = data.dataTable;
|
||||
this.columnsData = this.dataTableData.columnHeaderData;
|
||||
@@ -79,16 +88,17 @@ export class ViewDataTableComponent implements OnInit {
|
||||
*/
|
||||
delete() {
|
||||
const deleteDataTableDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Data Table') + ' ' + this.dataTableData.registeredTableName}
|
||||
data: {
|
||||
deleteContext:
|
||||
this.translateService.instant('labels.inputs.Data Table') + ' ' + this.dataTableData.registeredTableName
|
||||
}
|
||||
});
|
||||
deleteDataTableDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteDataTable(this.dataTableData.registeredTableName)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/system/data-tables'], { relativeTo: this.route });
|
||||
});
|
||||
this.systemService.deleteDataTable(this.dataTableData.registeredTableName).subscribe(() => {
|
||||
this.router.navigate(['/system/data-tables'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ManageExternalEventsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ManageExternalEventsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ManageExternalEventsComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,7 +11,6 @@ import { SystemService } from '../system.service';
|
||||
styleUrls: ['./manage-external-events.component.scss']
|
||||
})
|
||||
export class ManageExternalEventsComponent implements OnInit {
|
||||
|
||||
/** Events Data. */
|
||||
eventsData: any;
|
||||
externalEventConfigurations: any = {};
|
||||
@@ -19,17 +18,22 @@ export class ManageExternalEventsComponent implements OnInit {
|
||||
existAnyUpdate = false;
|
||||
|
||||
/** Columns to be displayed in events table. */
|
||||
displayedColumns: string[] = ['eventType', 'status'];
|
||||
displayedColumns: string[] = [
|
||||
'eventType',
|
||||
'status'
|
||||
];
|
||||
/** Data source for reports table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
/** Paginator for reports table. */
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
/** Sorter for reports table. */
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
/** Paginator for reports table. */
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
/** Sorter for reports table. */
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private systemService: SystemService) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService
|
||||
) {
|
||||
this.route.data.subscribe((data: { events: any }) => {
|
||||
this.eventsData = data.events.externalEventConfiguration;
|
||||
});
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
Router, Resolve,
|
||||
RouterStateSnapshot,
|
||||
ActivatedRouteSnapshot
|
||||
} from '@angular/router';
|
||||
import { Router, Resolve, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { SystemService } from '../system.service';
|
||||
|
||||
@@ -11,17 +7,16 @@ import { SystemService } from '../system.service';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ManageExternalEventsResolver implements Resolve<boolean> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Configuration data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
return this.systemService.getExternalEventConfiguration();
|
||||
}
|
||||
/**
|
||||
* Returns the Configuration data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
return this.systemService.getExternalEventConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CobWorkflowComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CobWorkflowComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CobWorkflowComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -15,7 +15,7 @@ export class CobWorkflowComponent implements OnInit, OnDestroy {
|
||||
/** Timer to refetch COB Catch-Up status every 5 seconds */
|
||||
timer: any;
|
||||
|
||||
constructor(private systemService: SystemService) { }
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getCOBCatchUpStatus();
|
||||
@@ -29,7 +29,9 @@ export class CobWorkflowComponent implements OnInit, OnDestroy {
|
||||
this.systemService.getCOBCatchUpStatus().subscribe((response: any) => {
|
||||
this.isCatchUpRunning = response.isCatchUpRunning;
|
||||
});
|
||||
this.timer = setTimeout(() => { this.getCOBCatchUpStatus(); }, this.waitTime * 1000);
|
||||
this.timer = setTimeout(() => {
|
||||
this.getCOBCatchUpStatus();
|
||||
}, this.waitTime * 1000);
|
||||
}
|
||||
|
||||
runCatchUp(): void {
|
||||
@@ -38,5 +40,4 @@ export class CobWorkflowComponent implements OnInit, OnDestroy {
|
||||
this.waitTime = 5000;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user