build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -8,9 +8,8 @@ describe('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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user