From 2d4d4f15ad479099690c570fbd720fa9ccff18b2 Mon Sep 17 00:00:00 2001 From: Bat-Zion Rotman Date: Thu, 21 Nov 2024 14:55:46 +0200 Subject: [PATCH] fix(orchestrator): execute should allow no inputs --- app-config.yaml | 15 ++++++++++++++- packages/app/package.json | 3 ++- packages/app/src/App.tsx | 3 +++ packages/app/src/components/Root/Root.tsx | 7 +++++++ packages/backend/package.json | 3 ++- packages/backend/src/index.ts | 1 + .../orchestrator-backend/src/service/api/v2.ts | 2 +- 7 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app-config.yaml b/app-config.yaml index c595b021c54..61a0ed90e94 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -18,7 +18,10 @@ backend: # Uncomment the following host directive to bind to specific interfaces # host: 127.0.0.1 csp: - connect-src: ["'self'", 'http:', 'https:'] + frame-ancestors: ['http://localhost:3000', 'http://localhost:7007'] + script-src: ["'self'", "'unsafe-inline'", "'unsafe-eval'"] + script-src-elem: ["'self'", "'unsafe-inline'", "'unsafe-eval'"] + connect-src: ["'self'", 'http:', 'https:', 'data:'] # Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference # Default Helmet Content-Security-Policy values can be removed by setting the key to false cors: @@ -80,3 +83,13 @@ catalog: dynamicPlugins: frontend: {} +orchestrator: + sonataFlowService: + baseUrl: http://localhost + port: 8899 + autoStart: true + workflowsSource: + gitRepositoryUrl: https://github.com/parodos-dev/backstage-orchestrator-workflows + localPath: /tmp/orchestrator/repository + dataIndexService: + url: http://localhost:8899 \ No newline at end of file diff --git a/packages/app/package.json b/packages/app/package.json index a1f30e322ee..87c5eb26c66 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -56,7 +56,8 @@ "react-dom": "^18.0.0", "react-router": "^6.23.0", "react-router-dom": "^6.23.0", - "tss-react": "^4.9.10" + "tss-react": "^4.9.10", + "@janus-idp/backstage-plugin-orchestrator": "*" }, "devDependencies": { "prettier": "3.3.3", diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index d601a5bdaef..9720682225d 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -34,6 +34,8 @@ import { UserSettingsPage } from '@backstage/plugin-user-settings'; import { getThemes } from '@redhat-developer/red-hat-developer-hub-theme'; +import { OrchestratorPage } from '@janus-idp/backstage-plugin-orchestrator'; + import { apis } from './apis'; import { entityPage } from './components/catalog/EntityPage'; import { Root } from './components/Root'; @@ -85,6 +87,7 @@ const routes = ( } /> } /> + } /> {/* Items in this group will be scrollable if they run out of space */} + diff --git a/packages/backend/package.json b/packages/backend/package.json index 0cffa6c5d23..da1d5197a43 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -41,7 +41,8 @@ "@janus-idp/backstage-plugin-rbac-backend": "*", "@manypkg/get-packages": "^1.1.3", "app": "*", - "winston": "^3.11.0" + "winston": "^3.11.0", + "@janus-idp/backstage-plugin-orchestrator-backend": "*" }, "devDependencies": { "prettier": "3.3.3", diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 8348d75d134..f8fa54067b8 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -45,6 +45,7 @@ backend.add( // permission plugin backend.add(import('@janus-idp/backstage-plugin-rbac-backend')); +backend.add(import('@janus-idp/backstage-plugin-orchestrator-backend')); // search plugin backend.add(import('@backstage/plugin-search-backend/alpha')); diff --git a/plugins/orchestrator-backend/src/service/api/v2.ts b/plugins/orchestrator-backend/src/service/api/v2.ts index 32bf50b3db3..92ead1ff3ee 100644 --- a/plugins/orchestrator-backend/src/service/api/v2.ts +++ b/plugins/orchestrator-backend/src/service/api/v2.ts @@ -148,7 +148,7 @@ export class V2 { workflowId: string, businessKey: string | undefined, ): Promise { - if (Object.keys(executeWorkflowRequestDTO?.inputData).length === 0) { + if (!executeWorkflowRequestDTO?.inputData) { throw new Error( `ExecuteWorkflowRequestDTO.inputData is required for executing workflow with id ${workflowId}`, );