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('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