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('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;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('LoanLockedComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ LoanLockedComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanLockedComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,7 +16,6 @@ import { TasksService } from 'app/tasks/tasks.service';
|
||||
styleUrls: ['./loan-locked.component.scss']
|
||||
})
|
||||
export class LoanLockedComponent implements OnInit {
|
||||
|
||||
/** Loans Data */
|
||||
loans: any[] = [];
|
||||
/** Batch Requests */
|
||||
@@ -26,10 +25,17 @@ export class LoanLockedComponent implements OnInit {
|
||||
/** Row Selection */
|
||||
selection: SelectionModel<any>;
|
||||
/** Displayed Columns for loan disbursal data */
|
||||
displayedColumns: string[] = ['select', 'loanId', 'lockPlacedOn', 'lockOwner', 'error', 'details'];
|
||||
displayedColumns: string[] = [
|
||||
'select',
|
||||
'loanId',
|
||||
'lockPlacedOn',
|
||||
'lockOwner',
|
||||
'error',
|
||||
'details'
|
||||
];
|
||||
|
||||
/** Paginator for the table */
|
||||
@ViewChild(MatPaginator, {static: false})
|
||||
@ViewChild(MatPaginator, { static: false })
|
||||
set paginator(value: MatPaginator) {
|
||||
if (this.dataSource != null) {
|
||||
this.dataSource.paginator = value;
|
||||
@@ -52,14 +58,15 @@ export class LoanLockedComponent implements OnInit {
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private loansService: LoansService,
|
||||
private systemService: SystemService,
|
||||
private tasksService: TasksService,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
}
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.allowRunInlineJob = false;
|
||||
@@ -82,7 +89,7 @@ export class LoanLockedComponent implements OnInit {
|
||||
this.loans = data.content;
|
||||
this.dataSource = new MatTableDataSource(this.loans);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.showPaginator = (this.loans.length > this.pageSize);
|
||||
this.showPaginator = this.loans.length > this.pageSize;
|
||||
this.allowRunInlineJob = false;
|
||||
this.selection = new SelectionModel(true, []);
|
||||
});
|
||||
@@ -102,9 +109,9 @@ export class LoanLockedComponent implements OnInit {
|
||||
|
||||
/** Selects all rows if they are not all selected; otherwise clear selection. */
|
||||
masterToggle() {
|
||||
this.isAllSelected() ?
|
||||
this.selection.clear() :
|
||||
this.dataSource.data.forEach((row: any) => this.selection.select(row));
|
||||
this.isAllSelected()
|
||||
? this.selection.clear()
|
||||
: this.dataSource.data.forEach((row: any) => this.selection.select(row));
|
||||
}
|
||||
|
||||
/** The label for the checkbox on the passed row */
|
||||
@@ -145,5 +152,4 @@ export class LoanLockedComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 { TasksService } from 'app/tasks/tasks.service';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
@@ -11,17 +7,16 @@ import { Observable, of } from 'rxjs';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoanLockedResolver implements Resolve<boolean> {
|
||||
/**
|
||||
* @param {TasksService} tasksService Tasks service.
|
||||
*/
|
||||
constructor(private tasksService: TasksService) {}
|
||||
|
||||
/**
|
||||
* @param {TasksService} tasksService Tasks service.
|
||||
*/
|
||||
constructor(private tasksService: TasksService) { }
|
||||
|
||||
/**
|
||||
* Returns all the loans data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.tasksService.getAllLoansLocked(0, 200);
|
||||
}
|
||||
/**
|
||||
* Returns all the loans data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.tasksService.getAllLoansLocked(0, 200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ManageJobsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ManageJobsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ManageJobsComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -12,8 +12,10 @@ export class ManageJobsComponent {
|
||||
/** Process running flag */
|
||||
isCatchUpRunning = true;
|
||||
|
||||
constructor(private systemService: SystemService,
|
||||
private translateService: TranslateService) { }
|
||||
constructor(
|
||||
private systemService: SystemService,
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
onJobTabChange(event: MatTabChangeEvent) {
|
||||
if (event.index === 2) {
|
||||
@@ -26,5 +28,4 @@ export class ManageJobsComponent {
|
||||
title(label: string) {
|
||||
return this.translateService.instant('labels.inputs.' + label);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CustomParametersPopoverComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CustomParametersPopoverComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CustomParametersPopoverComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+11
-11
@@ -47,7 +47,6 @@ interface JobDataType {
|
||||
styleUrls: ['./custom-parameters-popover.component.scss']
|
||||
})
|
||||
export class CustomParametersPopoverComponent implements OnInit {
|
||||
|
||||
/* Job table childer */
|
||||
@ViewChildren(CustomParametersTableComponent) tableComponents: QueryList<CustomParametersTableComponent>;
|
||||
|
||||
@@ -58,7 +57,10 @@ export class CustomParametersPopoverComponent implements OnInit {
|
||||
/* API call response message */
|
||||
messages: { message: string; status: number }[] = [];
|
||||
|
||||
constructor(private systemService: SystemService, @Inject(MAT_DIALOG_DATA) public data: SelectedJobsDataType) { }
|
||||
constructor(
|
||||
private systemService: SystemService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: SelectedJobsDataType
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.selectedJobs = this.data.selectedJobs.selected.map((jobJSON) => ({
|
||||
@@ -78,16 +80,14 @@ export class CustomParametersPopoverComponent implements OnInit {
|
||||
});
|
||||
|
||||
tableData.forEach((job) => {
|
||||
this.systemService.runSelectedJobWithParameters(job.jobId,
|
||||
{ jobParameters: job.jobParameters }
|
||||
)
|
||||
.then((response) => {
|
||||
this.messages.push({
|
||||
message: `${job.displayName}: ${response.statusText} (${response.status})`,
|
||||
status: response.ok
|
||||
this.systemService
|
||||
.runSelectedJobWithParameters(job.jobId, { jobParameters: job.jobParameters })
|
||||
.then((response) => {
|
||||
this.messages.push({
|
||||
message: `${job.displayName}: ${response.statusText} (${response.status})`,
|
||||
status: response.ok
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CustomParametersTableComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CustomParametersTableComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CustomParametersTableComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+7
-5
@@ -7,7 +7,6 @@ import { JobIdAndParameterType, JobParameterType } from '../custom-parameters-po
|
||||
styleUrls: ['./custom-parameters-table.component.scss']
|
||||
})
|
||||
export class CustomParametersTableComponent implements OnInit {
|
||||
|
||||
/* Job name for table title */
|
||||
@Input() displayName: string;
|
||||
/* Job id for table */
|
||||
@@ -20,9 +19,13 @@ export class CustomParametersTableComponent implements OnInit {
|
||||
/* Job parameters copy updated by user input */
|
||||
updatedJobParameters: JobParameterType[];
|
||||
/* Columns for the table */
|
||||
columnsToDisplay: string[] = ['parameterName', 'parameterValue', 'actions'];
|
||||
columnsToDisplay: string[] = [
|
||||
'parameterName',
|
||||
'parameterValue',
|
||||
'actions'
|
||||
];
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.updatedJobParameters = this.jobParameters;
|
||||
@@ -45,7 +48,7 @@ export class CustomParametersTableComponent implements OnInit {
|
||||
deleteParameter(index: number): void {
|
||||
let idx = 0;
|
||||
const jobParameters: JobParameterType[] = [];
|
||||
for ( ; idx < this.updatedJobParameters.length; idx++ ) {
|
||||
for (; idx < this.updatedJobParameters.length; idx++) {
|
||||
if (idx !== index) {
|
||||
jobParameters.push(this.updatedJobParameters[idx]);
|
||||
}
|
||||
@@ -64,5 +67,4 @@ export class CustomParametersTableComponent implements OnInit {
|
||||
jobParameters: this.updatedJobParameters
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditSchedulerJobComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditSchedulerJobComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditSchedulerJobComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+17
-12
@@ -15,7 +15,6 @@ import { SystemService } from 'app/system/system.service';
|
||||
styleUrls: ['./edit-scheduler-job.component.scss']
|
||||
})
|
||||
export class EditSchedulerJobComponent implements OnInit {
|
||||
|
||||
/** Job Data. */
|
||||
jobData: any;
|
||||
/** Job Form. */
|
||||
@@ -28,10 +27,12 @@ export class EditSchedulerJobComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private formBuilder: UntypedFormBuilder ) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private formBuilder: UntypedFormBuilder
|
||||
) {
|
||||
this.route.data.subscribe((data: { jobSelected: any }) => {
|
||||
this.jobData = data.jobSelected;
|
||||
});
|
||||
@@ -49,9 +50,15 @@ export class EditSchedulerJobComponent implements OnInit {
|
||||
*/
|
||||
createJobForm() {
|
||||
this.jobForm = this.formBuilder.group({
|
||||
'displayName': [this.jobData.displayName, Validators.required],
|
||||
'cronExpression': [this.jobData.cronExpression, Validators.required],
|
||||
'active': [this.jobData.active]
|
||||
displayName: [
|
||||
this.jobData.displayName,
|
||||
Validators.required
|
||||
],
|
||||
cronExpression: [
|
||||
this.jobData.cronExpression,
|
||||
Validators.required
|
||||
],
|
||||
active: [this.jobData.active]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,10 +66,8 @@ export class EditSchedulerJobComponent implements OnInit {
|
||||
* Submits the edit job form.
|
||||
*/
|
||||
submit() {
|
||||
this.systemService.updateScheduler(this.jobData.jobId, this.jobForm.value)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
this.systemService.updateScheduler(this.jobData.jobId, this.jobForm.value).subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ErrorLogPopoverComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ErrorLogPopoverComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ErrorLogPopoverComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ErrorLogPopoverComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
+7
-5
@@ -3,7 +3,6 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { SchedulerJob } from '../models/scheduler-job.model';
|
||||
|
||||
|
||||
interface ErrorJobDataType {
|
||||
job: SchedulerJob;
|
||||
}
|
||||
@@ -19,16 +18,19 @@ export class ErrorLogPopoverComponent implements OnInit {
|
||||
/* Initialize Selected Job */
|
||||
job: SchedulerJob;
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: ErrorJobDataType,
|
||||
private translateService: TranslateService) { }
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) public data: ErrorJobDataType,
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.job = this.data.job;
|
||||
}
|
||||
|
||||
buttonLabel(): string {
|
||||
const label: string = this.show ? this.translateService.instant('labels.buttons.Show less') : this.translateService.instant('labels.buttons.Show more');
|
||||
const label: string = this.show
|
||||
? this.translateService.instant('labels.buttons.Show less')
|
||||
: this.translateService.instant('labels.buttons.Show more');
|
||||
return this.translateService.instant('labels.buttons.' + label);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable} from 'rxjs';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ManageSchedulerJobResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class ManageSchedulerJobResolver implements Resolve<Object> {
|
||||
const jobId = route.paramMap.get('id');
|
||||
return this.systemService.getSelectedJob(jobId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ManageSchedulerJobsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageSchedulerJobsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ManageSchedulerJobsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -30,13 +30,20 @@ import { RunSelectedJobsPopoverComponent } from './run-selected-jobs-popover/run
|
||||
styleUrls: ['./manage-scheduler-jobs.component.scss']
|
||||
})
|
||||
export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Jobs data. */
|
||||
jobData: any;
|
||||
/** Scheduler data */
|
||||
schedulerData: any;
|
||||
/** Columns to be displayed in manage scheduler jobs table. */
|
||||
displayedColumns: string[] = ['select', 'displayName', 'active', 'previousRunTime', 'currentlyRunning', 'nextRunTime', 'errorLog'];
|
||||
displayedColumns: string[] = [
|
||||
'select',
|
||||
'displayName',
|
||||
'active',
|
||||
'previousRunTime',
|
||||
'currentlyRunning',
|
||||
'nextRunTime',
|
||||
'errorLog'
|
||||
];
|
||||
/** Data source for manage scheduler jobs table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Initialize Selection */
|
||||
@@ -68,12 +75,14 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private systemService: SystemService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { jobsScheduler: any }) => {
|
||||
if (data.jobsScheduler) {
|
||||
this.jobData = data.jobsScheduler[0];
|
||||
@@ -102,9 +111,7 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
||||
* Selects all rows if they are not all selected; otherwise clear selection.
|
||||
*/
|
||||
masterToggle() {
|
||||
this.isAllSelected() ?
|
||||
this.selection.clear() :
|
||||
this.dataSource.data.forEach(row => this.selection.select(row));
|
||||
this.isAllSelected() ? this.selection.clear() : this.dataSource.data.forEach((row) => this.selection.select(row));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,49 +126,50 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
||||
* Initializes the data source, paginator and sorter for manage scheduler jobs table.
|
||||
*/
|
||||
setJobs() {
|
||||
this.systemService.getJobs()
|
||||
.subscribe((jobData: any) => {
|
||||
this.dataSource = new MatTableDataSource(jobData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
this.jobsCounter = jobData.length;
|
||||
this.selection.clear();
|
||||
this.dataSource.sortingDataAccessor = (item, property) => {
|
||||
switch (property) {
|
||||
case 'previousRunStatus': return item.lastRunHistory.status;
|
||||
case 'errorLog': return item.lastRunHistory.status;
|
||||
case 'previousRunTime': return new Date(item.lastRunHistory.jobRunStartTime);
|
||||
case 'nextRunTime': return new Date(item.nextRunTime);
|
||||
default: return item[property];
|
||||
}
|
||||
};
|
||||
});
|
||||
this.systemService.getJobs().subscribe((jobData: any) => {
|
||||
this.dataSource = new MatTableDataSource(jobData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
this.jobsCounter = jobData.length;
|
||||
this.selection.clear();
|
||||
this.dataSource.sortingDataAccessor = (item, property) => {
|
||||
switch (property) {
|
||||
case 'previousRunStatus':
|
||||
return item.lastRunHistory.status;
|
||||
case 'errorLog':
|
||||
return item.lastRunHistory.status;
|
||||
case 'previousRunTime':
|
||||
return new Date(item.lastRunHistory.jobRunStartTime);
|
||||
case 'nextRunTime':
|
||||
return new Date(item.nextRunTime);
|
||||
default:
|
||||
return item[property];
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
getScheduler() {
|
||||
this.systemService.getScheduler()
|
||||
.subscribe((schedulerData: any) => {
|
||||
this.schedulerData = schedulerData;
|
||||
this.schedulerActive = this.schedulerData.active;
|
||||
});
|
||||
this.systemService.getScheduler().subscribe((schedulerData: any) => {
|
||||
this.schedulerData = schedulerData;
|
||||
this.schedulerActive = this.schedulerData.active;
|
||||
});
|
||||
}
|
||||
|
||||
suspendScheduler(): void {
|
||||
this.systemService.runCommandOnScheduler('stop')
|
||||
.subscribe(() => {
|
||||
this.getScheduler();
|
||||
});
|
||||
this.systemService.runCommandOnScheduler('stop').subscribe(() => {
|
||||
this.getScheduler();
|
||||
});
|
||||
}
|
||||
|
||||
activateScheduler(): void {
|
||||
this.systemService.runCommandOnScheduler('start')
|
||||
.subscribe(() => {
|
||||
this.getScheduler();
|
||||
});
|
||||
this.systemService.runCommandOnScheduler('start').subscribe(() => {
|
||||
this.getScheduler();
|
||||
});
|
||||
}
|
||||
|
||||
isAnyJobSelected(): boolean {
|
||||
return (this.selection.selected.length > 0);
|
||||
return this.selection.selected.length > 0;
|
||||
}
|
||||
|
||||
runSelectedJobs(): void {
|
||||
@@ -180,7 +188,12 @@ export class ManageSchedulerJobsComponent 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);
|
||||
}
|
||||
|
||||
@@ -228,7 +241,7 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
||||
nextStepName: 'Setup Accounting',
|
||||
previousStepName: 'System',
|
||||
stepPercentage: 60
|
||||
},
|
||||
}
|
||||
});
|
||||
nextStepDialogRef.afterClosed().subscribe((response: { nextStep: boolean }) => {
|
||||
if (response.nextStep) {
|
||||
@@ -275,12 +288,12 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
});
|
||||
|
||||
dialog.componentInstance.confirmedJobs.subscribe(result => {
|
||||
dialog.componentInstance.confirmedJobs.subscribe((result) => {
|
||||
if (result) {
|
||||
const selectedJobs = this.selection.selected;
|
||||
const confirmedJobIds = result.map(job => job.jobId);
|
||||
const confirmedJobIds = result.map((job) => job.jobId);
|
||||
|
||||
selectedJobs.forEach(job => {
|
||||
selectedJobs.forEach((job) => {
|
||||
if (!confirmedJobIds.includes(job.jobId)) {
|
||||
this.selection.deselect(job);
|
||||
}
|
||||
@@ -290,5 +303,4 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SystemService } from '../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ManageSchedulerJobsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -29,5 +28,4 @@ export class ManageSchedulerJobsResolver implements Resolve<Object> {
|
||||
this.systemService.getScheduler()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
export interface SchedulerJob {
|
||||
jobId: number;
|
||||
displayName: string;
|
||||
nextRunTime: Date;
|
||||
cronExpression: string;
|
||||
active: boolean;
|
||||
currentlyRunning: boolean;
|
||||
lastRunHistory: LastRunHistory;
|
||||
jobId: number;
|
||||
displayName: string;
|
||||
nextRunTime: Date;
|
||||
cronExpression: string;
|
||||
active: boolean;
|
||||
currentlyRunning: boolean;
|
||||
lastRunHistory: LastRunHistory;
|
||||
}
|
||||
|
||||
export interface LastRunHistory {
|
||||
version: number;
|
||||
jobRunStartTime: Date;
|
||||
jobRunEndTime: Date;
|
||||
status: string;
|
||||
jobRunErrorMessage: string;
|
||||
triggerType: string;
|
||||
jobRunErrorLog: string;
|
||||
version: number;
|
||||
jobRunStartTime: Date;
|
||||
jobRunEndTime: Date;
|
||||
status: string;
|
||||
jobRunErrorMessage: string;
|
||||
triggerType: string;
|
||||
jobRunErrorLog: string;
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('RunSelectedJobsPopoverComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ RunSelectedJobsPopoverComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [RunSelectedJobsPopoverComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(RunSelectedJobsPopoverComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
+16
-19
@@ -1,8 +1,5 @@
|
||||
import { SelectionModel } from '@angular/cdk/collections';
|
||||
import {
|
||||
Component, EventEmitter, Inject, OnInit, Output, QueryList,
|
||||
ViewChildren
|
||||
} from '@angular/core';
|
||||
import { Component, EventEmitter, Inject, OnInit, Output, QueryList, ViewChildren } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { SystemService } from 'app/system/system.service';
|
||||
import { RunSelectedJobsTableComponent } from './run-selected-jobs-table/run-selected-jobs-table.component';
|
||||
@@ -33,13 +30,11 @@ export interface JobDataType {
|
||||
styleUrls: ['./run-selected-jobs-popover.component.scss']
|
||||
})
|
||||
export class RunSelectedJobsPopoverComponent implements OnInit {
|
||||
|
||||
/** Confirmed jobs event emitter */
|
||||
@Output() confirmedJobs = new EventEmitter<JobDataType[]>();
|
||||
|
||||
/** Job table children */
|
||||
@ViewChildren(RunSelectedJobsTableComponent) tableComponents:
|
||||
QueryList<RunSelectedJobsTableComponent>;
|
||||
@ViewChildren(RunSelectedJobsTableComponent) tableComponents: QueryList<RunSelectedJobsTableComponent>;
|
||||
|
||||
/** Initialize Selected Jobs */
|
||||
selectedJobs: JobDataType[] = [];
|
||||
@@ -50,32 +45,34 @@ export class RunSelectedJobsPopoverComponent implements OnInit {
|
||||
/** API call response message */
|
||||
messages: { message: string; status: number }[] = [];
|
||||
|
||||
constructor(private systemService: SystemService, @Inject(MAT_DIALOG_DATA)
|
||||
public data: SelectedJobsDataType) { }
|
||||
constructor(
|
||||
private systemService: SystemService,
|
||||
@Inject(MAT_DIALOG_DATA)
|
||||
public data: SelectedJobsDataType
|
||||
) {}
|
||||
ngOnInit(): void {
|
||||
this.selectedJobs = this.data.selectedJobs.selected.sort((a, b) => a.jobId - b.jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run all confirmed jobs from table
|
||||
*/
|
||||
* Run all confirmed jobs from table
|
||||
*/
|
||||
runSelectedJobs(): void {
|
||||
this.messages = [];
|
||||
let tableData: JobDataType[] = [];
|
||||
this.tableComponents.forEach((tableComponent) => {
|
||||
tableData = (tableComponent.getTableData());
|
||||
tableData = tableComponent.getTableData();
|
||||
});
|
||||
|
||||
tableData.forEach((job) => {
|
||||
this.systemService.runSelectedJob(job.jobId.toString())
|
||||
.then((response) => {
|
||||
this.messages.push({
|
||||
message: `${job.displayName}: ${response.statusText} (${response.status})`,
|
||||
status: response.ok
|
||||
});
|
||||
this.systemService.runSelectedJob(job.jobId.toString()).then((response) => {
|
||||
this.messages.push({
|
||||
message: `${job.displayName}: ${response.statusText} (${response.status})`,
|
||||
status: response.ok
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.confirmedJobs.emit(tableData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('RunSelectedJobsTableComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ RunSelectedJobsTableComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [RunSelectedJobsTableComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(RunSelectedJobsTableComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
+12
-12
@@ -10,24 +10,24 @@ import { JobDataType } from '../run-selected-jobs-popover.component';
|
||||
styleUrls: ['./run-selected-jobs-table.component.scss']
|
||||
})
|
||||
export class RunSelectedJobsTableComponent {
|
||||
|
||||
/** Selected Jobs For Table */
|
||||
@Input() selectedJobs: JobDataType[] = [];
|
||||
|
||||
/** Confirmed Jobs */
|
||||
@Output() confirmedJobs: EventEmitter<JobDataType[]> = new
|
||||
EventEmitter<JobDataType[]>();
|
||||
@Output() confirmedJobs: EventEmitter<JobDataType[]> = new EventEmitter<JobDataType[]>();
|
||||
|
||||
/** Columns for the table */
|
||||
columnsToDisplay: string[] = ['displayName', 'actions'];
|
||||
columnsToDisplay: string[] = [
|
||||
'displayName',
|
||||
'actions'
|
||||
];
|
||||
|
||||
constructor() {
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Removes job from selection array
|
||||
* @param index
|
||||
*/
|
||||
* Removes job from selection array
|
||||
* @param index
|
||||
*/
|
||||
removeJobFromSelection(index: number): void {
|
||||
let idx = 0;
|
||||
const finalSelectedJobs: JobDataType[] = [];
|
||||
@@ -40,9 +40,9 @@ export class RunSelectedJobsTableComponent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets selected jobs array
|
||||
* @returns selected jobs array
|
||||
*/
|
||||
* Gets selected jobs array
|
||||
* @returns selected jobs array
|
||||
*/
|
||||
getTableData(): JobDataType[] {
|
||||
return this.selectedJobs;
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewHistorySchedulerJobComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewHistorySchedulerJobComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewHistorySchedulerJobComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+24
-16
@@ -13,11 +13,17 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
styleUrls: ['./view-history-scheduler-job.component.scss']
|
||||
})
|
||||
export class ViewHistorySchedulerJobComponent implements OnInit {
|
||||
|
||||
/** Job History data. */
|
||||
jobHistoryData: any;
|
||||
/** Columns to be displayed in Scheduler Job History. */
|
||||
displayedColumns: string[] = ['version', 'run_start_time', 'run_end_time', 'status', 'run_type', 'error_log'];
|
||||
displayedColumns: string[] = [
|
||||
'version',
|
||||
'run_start_time',
|
||||
'run_end_time',
|
||||
'status',
|
||||
'run_type',
|
||||
'error_log'
|
||||
];
|
||||
/** Data source for Scheduler Job History table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -30,23 +36,27 @@ export class ViewHistorySchedulerJobComponent implements OnInit {
|
||||
* Retrieves the scheduler Job History data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private dialog: MatDialog,
|
||||
private router: Router ) {
|
||||
this.route.data.subscribe(( data: { jobsSchedulerHistory: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private dialog: MatDialog,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { jobsSchedulerHistory: any }) => {
|
||||
this.jobHistoryData = data.jobsSchedulerHistory;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters data in scheduler Job History table based on passed value.
|
||||
* @param {string} filterValue Value to filter data.
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
const filterObject = [{
|
||||
id: 'version',
|
||||
value: filterValue
|
||||
}];
|
||||
const filterObject = [
|
||||
{
|
||||
id: 'version',
|
||||
value: filterValue
|
||||
}
|
||||
];
|
||||
this.dataSource.filter = JSON.stringify(filterObject);
|
||||
}
|
||||
|
||||
@@ -61,8 +71,7 @@ export class ViewHistorySchedulerJobComponent implements OnInit {
|
||||
this.dataSource = new MatTableDataSource(this.jobHistoryData.pageItems);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
/** Search By Version */
|
||||
this.dataSource.filterPredicate =
|
||||
(data: any, filtersJson: string) => {
|
||||
this.dataSource.filterPredicate = (data: any, filtersJson: string) => {
|
||||
const matchFilter: any[] = [];
|
||||
const filters = JSON.parse(filtersJson);
|
||||
filters.forEach((filter: any) => {
|
||||
@@ -73,7 +82,7 @@ export class ViewHistorySchedulerJobComponent implements OnInit {
|
||||
matchFilter.push(val.toString().toLowerCase().includes(filter.value.toLowerCase()));
|
||||
}
|
||||
});
|
||||
return matchFilter.every(Boolean);
|
||||
return matchFilter.every(Boolean);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,11 +93,10 @@ export class ViewHistorySchedulerJobComponent implements OnInit {
|
||||
openError(version: any) {
|
||||
const openErrorLogDialog = this.dialog.open(ErrorDialogComponent, {
|
||||
width: '400px',
|
||||
data: this.jobHistoryData.pageItems.filter( (data: any) => data.version === version )[0].jobRunErrorLog
|
||||
data: this.jobHistoryData.pageItems.filter((data: any) => data.version === version)[0].jobRunErrorLog
|
||||
});
|
||||
openErrorLogDialog.afterClosed().subscribe((response: any) => {
|
||||
this.router.navigate(['']);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { SystemService } from '../../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ViewHistorySchedulerJobsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class ViewHistorySchedulerJobsResolver implements Resolve<Object> {
|
||||
const jobId = route.paramMap.get('id');
|
||||
return this.systemService.getHistoryScheduler(jobId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewSchedulerJobComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewSchedulerJobComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewSchedulerJobComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+1
-3
@@ -1,5 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import { Component} from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,6 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./view-scheduler-job.component.scss']
|
||||
})
|
||||
export class ViewSchedulerJobComponent {
|
||||
|
||||
/** Job Data. */
|
||||
jobData: any;
|
||||
|
||||
@@ -24,5 +23,4 @@ export class ViewSchedulerJobComponent {
|
||||
this.jobData = data.selectedJob;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { SystemService } from '../../../system.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ViewSchedulerJobResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class ViewSchedulerJobResolver implements Resolve<Object> {
|
||||
const jobId = route.paramMap.get('id');
|
||||
return this.systemService.getSelectedJob(jobId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('WorkflowDiagramComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ WorkflowDiagramComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [WorkflowDiagramComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+13
-8
@@ -3,7 +3,6 @@ import { DagreNodesOnlyLayout, Edge, Layout, Node } from '@swimlane/ngx-graph';
|
||||
import * as shape from 'd3-shape';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
|
||||
export class JobStep {
|
||||
id: number;
|
||||
stepName: string;
|
||||
@@ -18,7 +17,10 @@ export class JobStep {
|
||||
export class WorkflowDiagramComponent implements OnInit {
|
||||
@Input() jobStepsData: JobStep[] = [];
|
||||
|
||||
diagramSize: [number, number] = [1024, 300];
|
||||
diagramSize: [number, number] = [
|
||||
1024,
|
||||
300
|
||||
];
|
||||
public nodes: Node[] = [];
|
||||
public links: Edge[] = [];
|
||||
public layoutSettings = {
|
||||
@@ -27,11 +29,15 @@ export class WorkflowDiagramComponent implements OnInit {
|
||||
public curve: any = shape.curveLinear;
|
||||
public layout: Layout = new DagreNodesOnlyLayout();
|
||||
colorScheme = {
|
||||
domain: ['#5AA454', '#A10A28', '#C7B42C']
|
||||
domain: [
|
||||
'#5AA454',
|
||||
'#A10A28',
|
||||
'#C7B42C'
|
||||
]
|
||||
};
|
||||
center$ = new Subject<any>();
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {
|
||||
let nodeCounter = 0;
|
||||
@@ -49,8 +55,8 @@ export class WorkflowDiagramComponent implements OnInit {
|
||||
|
||||
if (nodeCounter > 0) {
|
||||
const edge: Edge = {
|
||||
id: `link_${(jobStep.id)}`,
|
||||
source: `node_${(jobStep.order - 1)}`,
|
||||
id: `link_${jobStep.id}`,
|
||||
source: `node_${jobStep.order - 1}`,
|
||||
target: currentNode,
|
||||
label: '',
|
||||
data: {
|
||||
@@ -68,7 +74,6 @@ export class WorkflowDiagramComponent implements OnInit {
|
||||
}
|
||||
|
||||
public getStyles(node: Node): any {
|
||||
return 'node_odd';
|
||||
return 'node_odd';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('WorkflowJobsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ WorkflowJobsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [WorkflowJobsComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -30,19 +30,27 @@ export class WorkflowJobsComponent implements OnInit {
|
||||
@ViewChild('table') table: MatTable<JobStep>;
|
||||
|
||||
/** Columns to be displayed in the table. */
|
||||
displayedColumns: string[] = ['stepName', 'stepOrder', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'stepName',
|
||||
'stepOrder',
|
||||
'actions'
|
||||
];
|
||||
|
||||
constructor(private systemService: SystemService,
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService) {}
|
||||
constructor(
|
||||
private systemService: SystemService,
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.systemService.getWorkflowJobNames().toPromise()
|
||||
.then(jobNames => {
|
||||
this.jobNameOptions = jobNames.businessJobs.sort(function (a: any, b: any) {
|
||||
return a.stepName - b.stepName;
|
||||
this.systemService
|
||||
.getWorkflowJobNames()
|
||||
.toPromise()
|
||||
.then((jobNames) => {
|
||||
this.jobNameOptions = jobNames.businessJobs.sort(function (a: any, b: any) {
|
||||
return a.stepName - b.stepName;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,49 +99,54 @@ export class WorkflowJobsComponent implements OnInit {
|
||||
if (this.jobStepName != null) {
|
||||
const jobDatas = this.jobStepName.split('_');
|
||||
this.jobAvailableStepsData = [];
|
||||
this.systemService.getAvailablesJobSteps(jobDatas[0]).toPromise()
|
||||
.then(jobData => {
|
||||
this.jobAvailableStepsData = jobData.availableBusinessSteps.sort(function (a: any, b: any) {
|
||||
return a.stepName - b.stepName;
|
||||
});
|
||||
|
||||
const tmpStepsNames: any = [];
|
||||
this.jobStepsData.forEach((step: any) => {
|
||||
return tmpStepsNames.push(step.stepName);
|
||||
});
|
||||
|
||||
if (this.jobAvailableStepsData.length > 0) {
|
||||
this.jobAvailableStepsData = this.jobAvailableStepsData.filter((item: any) => {
|
||||
return (tmpStepsNames.indexOf(item.stepName) < 0);
|
||||
this.systemService
|
||||
.getAvailablesJobSteps(jobDatas[0])
|
||||
.toPromise()
|
||||
.then((jobData) => {
|
||||
this.jobAvailableStepsData = jobData.availableBusinessSteps.sort(function (a: any, b: any) {
|
||||
return a.stepName - b.stepName;
|
||||
});
|
||||
}
|
||||
|
||||
if (this.jobAvailableStepsData.length > 0) {
|
||||
for (let index = 0; index < this.jobAvailableStepsData.length; index++) {
|
||||
this.jobAvailableStepsData[index].stepDescription = this.translateService.instant(`labels.catalogs.${this.jobAvailableStepsData[index].stepDescription}`);
|
||||
const tmpStepsNames: any = [];
|
||||
this.jobStepsData.forEach((step: any) => {
|
||||
return tmpStepsNames.push(step.stepName);
|
||||
});
|
||||
|
||||
if (this.jobAvailableStepsData.length > 0) {
|
||||
this.jobAvailableStepsData = this.jobAvailableStepsData.filter((item: any) => {
|
||||
return tmpStepsNames.indexOf(item.stepName) < 0;
|
||||
});
|
||||
}
|
||||
const frmFields: FormfieldBase[] = [
|
||||
new SelectBase({
|
||||
controlName: 'stepName',
|
||||
label: this.translateService.instant('labels.text.Step'),
|
||||
options: { label: 'stepDescription', value: 'stepName', data: this.jobAvailableStepsData },
|
||||
order: 1
|
||||
})
|
||||
];
|
||||
const data = {
|
||||
title: this.translateService.instant('labels.text.Add Job Step to Workflow'),
|
||||
layout: { addButtonText: 'Add' },
|
||||
formfields: frmFields
|
||||
};
|
||||
const stepDialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
stepDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
this.jobStepsData = this.jobStepsData.concat(response.data.value);
|
||||
this.stepOrderHasChanged = true;
|
||||
|
||||
if (this.jobAvailableStepsData.length > 0) {
|
||||
for (let index = 0; index < this.jobAvailableStepsData.length; index++) {
|
||||
this.jobAvailableStepsData[index].stepDescription = this.translateService.instant(
|
||||
`labels.catalogs.${this.jobAvailableStepsData[index].stepDescription}`
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
const frmFields: FormfieldBase[] = [
|
||||
new SelectBase({
|
||||
controlName: 'stepName',
|
||||
label: this.translateService.instant('labels.text.Step'),
|
||||
options: { label: 'stepDescription', value: 'stepName', data: this.jobAvailableStepsData },
|
||||
order: 1
|
||||
})
|
||||
|
||||
];
|
||||
const data = {
|
||||
title: this.translateService.instant('labels.text.Add Job Step to Workflow'),
|
||||
layout: { addButtonText: 'Add' },
|
||||
formfields: frmFields
|
||||
};
|
||||
const stepDialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
stepDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
this.jobStepsData = this.jobStepsData.concat(response.data.value);
|
||||
this.stepOrderHasChanged = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,13 +158,14 @@ export class WorkflowJobsComponent implements OnInit {
|
||||
});
|
||||
|
||||
const payload = {
|
||||
'businessSteps': this.jobStepsData
|
||||
businessSteps: this.jobStepsData
|
||||
};
|
||||
|
||||
this.systemService.putWorkflowJobSteps(this.jobStepName, payload).toPromise()
|
||||
.then(data => {
|
||||
this.stepOrderHasChanged = false;
|
||||
});
|
||||
this.systemService
|
||||
.putWorkflowJobSteps(this.jobStepName, payload)
|
||||
.toPromise()
|
||||
.then((data) => {
|
||||
this.stepOrderHasChanged = false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,18 +7,16 @@ import { Observable } from 'rxjs';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WorkflowJobResolver implements Resolve<boolean> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Configuration data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
return this.systemService.getWorkflowJobNames();
|
||||
}
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Configuration data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
return this.systemService.getWorkflowJobNames();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user