Allow add new Job step to Workflow Jobs
This commit is contained in:
committed by
Arnold Gálovics
parent
1a18759c2f
commit
11b1e6793b
@@ -72,8 +72,10 @@ export class ManageSchedulerJobsComponent implements OnInit, AfterViewInit {
|
|||||||
private configurationWizardService: ConfigurationWizardService,
|
private configurationWizardService: ConfigurationWizardService,
|
||||||
private popoverService: PopoverService) {
|
private popoverService: PopoverService) {
|
||||||
this.route.data.subscribe((data: { jobsScheduler: any }) => {
|
this.route.data.subscribe((data: { jobsScheduler: any }) => {
|
||||||
this.jobData = data.jobsScheduler[0];
|
if (data.jobsScheduler) {
|
||||||
this.schedulerData = data.jobsScheduler[1];
|
this.jobData = data.jobsScheduler[0];
|
||||||
|
this.schedulerData = data.jobsScheduler[1];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<div class="action-button" fxLayoutGap="25px" *ngIf="jobStepsData.length > 0">
|
<div class="action-button" fxLayoutGap="25px" *ngIf="jobStepsData.length > 0">
|
||||||
<button mat-raised-button color="primary">
|
<button mat-raised-button color="primary" (click)="addJobStep()">
|
||||||
<fa-icon icon="plus"></fa-icon> Link Job Step
|
<fa-icon icon="plus"></fa-icon> Link Job Step
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import { FormControl, Validators } from '@angular/forms';
|
|||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { MatTable } from '@angular/material/table';
|
import { MatTable } from '@angular/material/table';
|
||||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||||
|
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||||
|
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||||
|
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||||
import { SystemService } from 'app/system/system.service';
|
import { SystemService } from 'app/system/system.service';
|
||||||
import { JobStep } from './workflow-diagram/workflow-diagram.component';
|
import { JobStep } from './workflow-diagram/workflow-diagram.component';
|
||||||
|
|
||||||
@@ -17,6 +20,7 @@ export class WorkflowJobsComponent implements OnInit {
|
|||||||
|
|
||||||
jobNameOptions: any = [];
|
jobNameOptions: any = [];
|
||||||
jobStepsData: any = [];
|
jobStepsData: any = [];
|
||||||
|
jobAvailableStepsData: any = [];
|
||||||
jobStepsDataBase: any = [];
|
jobStepsDataBase: any = [];
|
||||||
jobStepName: String = null;
|
jobStepName: String = null;
|
||||||
|
|
||||||
@@ -77,6 +81,56 @@ export class WorkflowJobsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Job Step to Workflow
|
||||||
|
*/
|
||||||
|
addJobStep() {
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.jobAvailableStepsData.length > 0) {
|
||||||
|
const frmFields: FormfieldBase[] = [
|
||||||
|
new SelectBase({
|
||||||
|
controlName: 'stepName',
|
||||||
|
label: 'Step',
|
||||||
|
options: { label: 'stepDescription', value: 'stepName', data: this.jobAvailableStepsData },
|
||||||
|
order: 1
|
||||||
|
})
|
||||||
|
];
|
||||||
|
const data = {
|
||||||
|
title: '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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
saveChanges() {
|
saveChanges() {
|
||||||
// Set the new Order
|
// Set the new Order
|
||||||
let stepOrder = 1;
|
let stepOrder = 1;
|
||||||
|
|||||||
@@ -262,12 +262,19 @@ export class SystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Observable<any>} Fetches Jobs.
|
* @returns {Observable<any>} Updates Jobs.
|
||||||
*/
|
*/
|
||||||
putWorkflowJobSteps(jobName: String, payload: any): Observable<any> {
|
putWorkflowJobSteps(jobName: String, payload: any): Observable<any> {
|
||||||
return this.http.put(`/jobs/${jobName}/steps`, payload);
|
return this.http.put(`/jobs/${jobName}/steps`, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} Fetches Steps.
|
||||||
|
*/
|
||||||
|
getAvailablesJobSteps(jobCategory: String): Observable<any> {
|
||||||
|
return this.http.get(`/jobs/${jobCategory}/available-steps`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Observable<any>} Fetches Scheduler.
|
* @returns {Observable<any>} Fetches Scheduler.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user