mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-02-04 21:03:52 +00:00
Updated Sartography Lib and
Better handled the data returned from validating
This commit is contained in:
parent
bc3ce7e820
commit
6653ea5a8f
6
package-lock.json
generated
6
package-lock.json
generated
@ -12440,9 +12440,9 @@
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"sartography-workflow-lib": {
|
||||
"version": "0.0.511",
|
||||
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.511.tgz",
|
||||
"integrity": "sha512-C0H9HbZtLz3PHG4oiolaM/XQVlje5k91cvpwO8juWMjZ8q6z1T74MO0cw936iobxgWaIyv/8lcP8vY4YHd/0sw=="
|
||||
"version": "0.0.517",
|
||||
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.517.tgz",
|
||||
"integrity": "sha512-BYkfE0iWDtVOZ/9Z4xZyBRQ4zUNG2rlBCAAHPvEGz/SqyHZ35futrcX7rfJVdT7V20xA+tb/iYWq6zrZivNI2Q=="
|
||||
},
|
||||
"sass": {
|
||||
"version": "1.26.3",
|
||||
|
@ -55,7 +55,7 @@
|
||||
"ngx-markdown": "^9.1.1",
|
||||
"protractor": "^7.0.0",
|
||||
"rxjs": "~6.5.4",
|
||||
"sartography-workflow-lib": "0.0.511",
|
||||
"sartography-workflow-lib": "0.0.517",
|
||||
"tslib": "^1.13.0",
|
||||
"uuid": "^7.0.2",
|
||||
"zone.js": "^0.10.3"
|
||||
|
@ -11,7 +11,8 @@ import {
|
||||
BPMN_DIAGRAM_DEFAULT,
|
||||
DMN_DIAGRAM_DEFAULT,
|
||||
FileType,
|
||||
getDiagramTypeFromXml
|
||||
getDiagramTypeFromXml,
|
||||
CameltoSnakeCase
|
||||
} from 'sartography-workflow-lib';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { BpmnWarning } from '../_interfaces/bpmn-warning';
|
||||
@ -65,8 +66,8 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit, On
|
||||
console.log('DiagramComponent default onChange');
|
||||
}
|
||||
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
// ? I feel like there's better ways to handle the changes to a single attribute but I didn't want to mess around with getters and setters since this class already had some
|
||||
if (changes.validation_data) {
|
||||
this.validation_data = changes.validation_data.currentValue;
|
||||
if (this.modeler) {
|
||||
@ -222,14 +223,7 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit, On
|
||||
|
||||
eventBus.on('editor.scripts.request', () => {
|
||||
this.api.listScripts().subscribe((data) => {
|
||||
data.forEach(element => {
|
||||
var string = element.name,
|
||||
regex = /(?<!^)([A-Z][a-z]|(?<=[a-z])[A-Z])/g;
|
||||
var modified = string.replace(regex, function (match) {
|
||||
return "_" + match.toLowerCase();
|
||||
}).toLowerCase();
|
||||
element.name = modified;
|
||||
});
|
||||
data.forEach(element => {element.name = CameltoSnakeCase(element.name);});
|
||||
this.modeler.get('eventBus').fire('editor.scripts.response', { scripts: data });
|
||||
})
|
||||
});
|
||||
|
@ -201,16 +201,17 @@ export class ModelerComponent implements AfterViewInit {
|
||||
this.saveChanges();
|
||||
this.api.validateWorkflowSpecification(this.diagramFileMeta.workflow_spec_id, until_task).subscribe(apiErrors => {
|
||||
this.validationState = true;
|
||||
if (apiErrors && apiErrors.length > 0) {
|
||||
apiErrors.forEach((error) => {
|
||||
if (error.code == "validation_break") {
|
||||
this.validationData = error.task_data;
|
||||
} else {
|
||||
this.validationState = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!this.validationState) {
|
||||
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; }
|
||||
|
||||
if (this.validationState == false) {
|
||||
this.bottomSheet.open(ApiErrorsComponent, { data: { apiErrors: apiErrors } });
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user