Add data stores API (#949)

This commit is contained in:
Ayoub Ait Lachgar 2024-02-02 20:48:06 +01:00 committed by GitHub
parent 007facc9d5
commit 15cec29680
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 0 deletions

View File

@ -84,6 +84,7 @@ type OwnProps = {
onLaunchDmnEditor?: (..._args: any[]) => any;
onElementClick?: (..._args: any[]) => any;
onServiceTasksRequested?: (..._args: any[]) => any;
onDataStoresRequested?: (..._args: any[]) => any;
onJsonSchemaFilesRequested?: (..._args: any[]) => any;
onDmnFilesRequested?: (..._args: any[]) => any;
onSearchProcessModels?: (..._args: any[]) => any;
@ -113,6 +114,7 @@ export default function ReactDiagramEditor({
onLaunchDmnEditor,
onElementClick,
onServiceTasksRequested,
onDataStoresRequested,
onJsonSchemaFilesRequested,
onDmnFilesRequested,
onSearchProcessModels,
@ -325,6 +327,12 @@ export default function ReactDiagramEditor({
}
}
function handleDataStoresRequested(event: any) {
if (onDataStoresRequested) {
onDataStoresRequested(event);
}
}
setDiagramModelerState(diagramModeler);
diagramModeler.on('spiff.script.edit', (event: any) => {
@ -384,6 +392,10 @@ export default function ReactDiagramEditor({
handleServiceTasksRequested(event);
});
diagramModeler.on('spiff.data_stores.requested', (event: any) => {
handleDataStoresRequested(event);
});
diagramModeler.on('spiff.json_schema_files.requested', (event: any) => {
if (onJsonSchemaFilesRequested) {
onJsonSchemaFilesRequested(event);
@ -415,6 +427,7 @@ export default function ReactDiagramEditor({
onLaunchJsonSchemaEditor,
onElementClick,
onServiceTasksRequested,
onDataStoresRequested,
onJsonSchemaFilesRequested,
onDmnFilesRequested,
onSearchProcessModels,

View File

@ -367,6 +367,14 @@ export default function ProcessModelEditDiagram() {
};
};
const makeDataStoresApiHandler = (event: any) => {
return function fireEvent(results: any) {
event.eventBus.fire('spiff.data_stores.returned', {
options: results,
});
};
};
const onServiceTasksRequested = (event: any) => {
HttpService.makeCallToBackend({
path: `/service-tasks`,
@ -374,6 +382,13 @@ export default function ProcessModelEditDiagram() {
});
};
const onDataStoresRequested = (event: any) => {
HttpService.makeCallToBackend({
path: `/data-stores`,
successCallback: makeDataStoresApiHandler(event),
});
};
const onJsonSchemaFilesRequested = (event: any) => {
setFileEventBus(event.eventBus);
const re = /.*[-.]schema.json/;
@ -1095,6 +1110,7 @@ export default function ProcessModelEditDiagram() {
diagramType="bpmn"
onLaunchScriptEditor={onLaunchScriptEditor}
onServiceTasksRequested={onServiceTasksRequested}
onDataStoresRequested={onDataStoresRequested}
onLaunchMarkdownEditor={onLaunchMarkdownEditor}
onLaunchBpmnEditor={onLaunchBpmnEditor}
onLaunchJsonSchemaEditor={onLaunchJsonSchemaEditor}