mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-01-27 09:05:02 +00:00
Added Line HighLighting
This commit is contained in:
parent
9307c32d0d
commit
6c1741a5e3
@ -42,7 +42,7 @@
|
||||
"camunda-bpmn-moddle": "^4.4.0",
|
||||
"camunda-dmn-moddle": "^1.0.0",
|
||||
"diagram-js": "^6.6.1",
|
||||
"diagram-js-code-editor": "^1.1.1",
|
||||
"diagram-js-code-editor": "^1.1.5",
|
||||
"diagram-js-minimap": "^2.0.3",
|
||||
"dmn-js": "^7.5.1",
|
||||
"dmn-js-properties-panel": "^0.3.5",
|
||||
|
@ -27,10 +27,11 @@ import { dmnModelerConfig } from './dmn-modeler-config';
|
||||
export class DiagramComponent implements ControlValueAccessor, AfterViewInit, OnChanges {
|
||||
@Input() fileName: string;
|
||||
@Input() validation_data: Object = {};
|
||||
@Input() validation_state: string;
|
||||
@ViewChild('containerRef', { static: true }) containerRef: ElementRef;
|
||||
@ViewChild('propertiesRef', { static: true }) propertiesRef: ElementRef;
|
||||
@Output() private importDone: EventEmitter<ImportEvent> = new EventEmitter();
|
||||
@Input() validationState: string;
|
||||
|
||||
@Output() validationStart: EventEmitter<string> = new EventEmitter();
|
||||
private diagramType: FileType;
|
||||
private modeler: BpmnModeler | DmnModeler;
|
||||
@ -69,7 +70,20 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit, On
|
||||
if (changes.validation_data) {
|
||||
this.validation_data = changes.validation_data.currentValue;
|
||||
if (this.modeler) {
|
||||
this.modeler.get('eventBus').fire('editor.objects.response', { objects: this.validation_data });
|
||||
if(this.validation_data['task_data']) {
|
||||
this.modeler.get('eventBus').fire('editor.objects.response', {objects: this.validation_data['task_data']});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changes.validation_state) {
|
||||
this.validation_state = changes.validation_state.currentValue;
|
||||
if (this.modeler) {
|
||||
const resp = {state: this.validation_state, line_number: undefined
|
||||
};
|
||||
if (this.validation_data['line_number']){
|
||||
resp.line_number = this.validation_data['line_number'];
|
||||
}
|
||||
this.modeler.get('eventBus').fire('editor.validation.response', resp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,7 +240,7 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit, On
|
||||
});
|
||||
});
|
||||
|
||||
eventBus.on('editor.validate.request', (request) => {
|
||||
eventBus.on('editor.validation.request', (request) => {
|
||||
this.validationStart.emit(request.task_name);
|
||||
});
|
||||
|
||||
|
@ -72,7 +72,7 @@
|
||||
|
||||
<div fxLayout="column">
|
||||
<div class="diagram-parent">
|
||||
<app-diagram #diagram (importDone)="handleImported($event)" [fileName]="getFileName()" [validation_data]="validationData" (validationStart)="partially_validate($event)" ></app-diagram>
|
||||
<app-diagram #diagram (importDone)="handleImported($event)" [fileName]="getFileName()" [validation_state]="validationState" [validation_data]="validationData" (validationStart)="partially_validate($event)" ></app-diagram>
|
||||
|
||||
<div *ngIf="importError" class="import-error">
|
||||
<strong>Failed to render diagram: </strong>
|
||||
|
@ -68,7 +68,7 @@ export class ModelerComponent implements AfterViewInit {
|
||||
@ViewChild(DiagramComponent) private diagramComponent: DiagramComponent;
|
||||
@ViewChild('fileInput', { static: true }) fileInput: ElementRef;
|
||||
private diagramType: FileType;
|
||||
private validationState: boolean;
|
||||
private validationState: string;
|
||||
validationData: Object = {};
|
||||
private workflowSpecId: string;
|
||||
private fileMetaId: number;
|
||||
@ -202,19 +202,20 @@ export class ModelerComponent implements AfterViewInit {
|
||||
partially_validate(until_task: string) {
|
||||
this.saveChanges();
|
||||
const study_id = this.settingsService.getStudyIdForValidation();
|
||||
this.api.validateWorkflowSpecification(this.diagramFileMeta.workflow_spec_id, until_task, study_id).subscribe(apiErrors => {
|
||||
this.validationState = true;
|
||||
this.validationData = { 'required_only': undefined, 'all_fields': undefined };
|
||||
if (apiErrors && apiErrors.length === 2) {
|
||||
if (apiErrors[0].code === 'validation_break') {
|
||||
this.validationData['all_fields'] = apiErrors[0].task_data;
|
||||
} else { this.validationState = false; }
|
||||
if (apiErrors[1].code === 'validation_break') {
|
||||
this.validationData['required_only'] = apiErrors[1].task_data;
|
||||
} else { this.validationState = false; }
|
||||
} else { this.validationState = false; }
|
||||
this.validationState = 'unknown';
|
||||
this.validationData = { 'testing_only': {a: 1, b: 'b', c: false, e: [], d: undefined}, 'real_fields': undefined };
|
||||
|
||||
if (this.validationState === false) {
|
||||
this.api.validateWorkflowSpecification(this.diagramFileMeta.workflow_spec_id, until_task, study_id).subscribe(apiErrors => {
|
||||
if (apiErrors && apiErrors.length === 1) {
|
||||
if (apiErrors[0].code === 'validation_break') {
|
||||
this.validationData = apiErrors[0];
|
||||
this.validationState = 'passing';
|
||||
} else {
|
||||
this.validationData = apiErrors[0];
|
||||
this.validationState = 'failing';
|
||||
}
|
||||
}
|
||||
if (apiErrors.length > 0 && this.validationState !== 'passing') {
|
||||
this.bottomSheet.open(ApiErrorsComponent, { data: { apiErrors: apiErrors } });
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user