diff --git a/plugins/orchestrator-backend/src/service/SonataFlowService.ts b/plugins/orchestrator-backend/src/service/SonataFlowService.ts index 1730115624..a9f504a4bd 100644 --- a/plugins/orchestrator-backend/src/service/SonataFlowService.ts +++ b/plugins/orchestrator-backend/src/service/SonataFlowService.ts @@ -217,7 +217,7 @@ export class SonataFlowService { } const items = await Promise.all( workflowIds.map(async (workflowId: string) => { - return this.getWorkflowOverview(workflowId); + return this.fetchWorkflowOverview(workflowId); }), ); return items.filter((item): item is WorkflowOverview => !!item); @@ -227,7 +227,7 @@ export class SonataFlowService { ); } catch (error) { this.logger.error( - `Error when fetching workflows for workflowoverview: ${error}`, + `Error when fetching workflows for workflowOverview: ${error}`, ); } return undefined; @@ -472,7 +472,7 @@ export class SonataFlowService { }; } - private async getWorkflowOverview( + public async fetchWorkflowOverview( workflowId: string, ): Promise { const definition = await this.fetchWorkflowDefinition(workflowId); diff --git a/plugins/orchestrator-backend/src/service/router.ts b/plugins/orchestrator-backend/src/service/router.ts index d77f8b14a5..2dc580b2f0 100644 --- a/plugins/orchestrator-backend/src/service/router.ts +++ b/plugins/orchestrator-backend/src/service/router.ts @@ -212,6 +212,22 @@ function setupInternalRoutes( res.status(200).json(executionResponse); }); + router.get('/workflows/:workflowId/overview', async (req, res) => { + const { + params: { workflowId }, + } = req; + const overviewObj = + await sonataFlowService.fetchWorkflowOverview(workflowId); + + if (!overviewObj) { + res + .status(500) + .send(`Couldn't fetch workflow overview for ${workflowId}`); + return; + } + res.status(200).json(overviewObj); + }); + router.get('/instances', async (_, res) => { const instances = await sonataFlowService.fetchProcessInstances();