Skip to content

Commit ce61d0a

Browse files
authored
fix(orchestrator):remove workflow input editor (#943)
Signed-off-by: Lior Soffer <liorsoffer1@gmail.com>
1 parent 6a41cd5 commit ce61d0a

6 files changed

Lines changed: 72 additions & 131 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator': patch
3+
---
4+
5+
"fix(orchestrator):remove workflow input editor"

workspaces/orchestrator/plugins/orchestrator/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"@kie-tools-core/editor": "^10.0.0",
6666
"@kie-tools/serverless-workflow-standalone-editor": "^10.0.0",
6767
"@material-ui/core": "^4.12.4",
68-
"@monaco-editor/react": "^4.6.0",
6968
"@red-hat-developer-hub/backstage-plugin-orchestrator-common": "workspace:^",
7069
"@red-hat-developer-hub/backstage-plugin-orchestrator-form-api": "workspace:^",
7170
"@red-hat-developer-hub/backstage-plugin-orchestrator-form-react": "workspace:^",

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import {
4848
} from '../../routes';
4949
import { getErrorObject } from '../../utils/ErrorUtils';
5050
import { BaseOrchestratorPage } from '../BaseOrchestratorPage';
51-
import JsonTextAreaForm from './JsonTextAreaForm';
51+
import MissingSchemaNotice from './MissingSchemaNotice';
5252
import { getSchemaUpdater } from './schemaUpdater';
5353

5454
export const ExecuteWorkflowPage = () => {
@@ -75,9 +75,11 @@ export const ExecuteWorkflowPage = () => {
7575
}, [orchestratorApi, workflowId]);
7676

7777
const [schema, setSchema] = useState<JSONSchema7 | undefined>();
78+
7879
useEffect(() => {
7980
setSchema(value?.inputSchema);
8081
}, [value]);
82+
8183
const updateSchema = useMemo(
8284
() => getSchemaUpdater(schema, setSchema),
8385
[schema],
@@ -116,7 +118,11 @@ export const ExecuteWorkflowPage = () => {
116118
const error = responseError || workflowNameError;
117119
let pageContent;
118120

119-
if (loading || workflowNameLoading) {
121+
if (
122+
loading ||
123+
workflowNameLoading ||
124+
(!loading && value?.inputSchema && !schema) // wait for useEffect to setSchema
125+
) {
120126
pageContent = <Progress />;
121127
} else if (error) {
122128
pageContent = <ResponseErrorPanel error={error} />;
@@ -140,7 +146,7 @@ export const ExecuteWorkflowPage = () => {
140146
initialFormData={initialFormData}
141147
/>
142148
) : (
143-
<JsonTextAreaForm
149+
<MissingSchemaNotice
144150
handleExecute={handleExecute}
145151
isExecuting={isExecuting}
146152
/>

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/JsonTextAreaForm.tsx

Lines changed: 0 additions & 95 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright Red Hat, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import React from 'react';
18+
19+
import type { JsonObject } from '@backstage/types';
20+
21+
import Alert from '@mui/material/Alert';
22+
import AlertTitle from '@mui/material/AlertTitle';
23+
import Grid from '@mui/material/Grid';
24+
25+
import { SubmitButton } from '@red-hat-developer-hub/backstage-plugin-orchestrator-form-react';
26+
27+
const MissingSchemaNotice = ({
28+
isExecuting,
29+
handleExecute,
30+
}: {
31+
isExecuting: boolean;
32+
handleExecute: (parameters: JsonObject) => Promise<void>;
33+
}) => {
34+
return (
35+
<Grid container spacing={2}>
36+
<Grid item xs={12}>
37+
<Alert severity="info" style={{ width: '100%' }}>
38+
<AlertTitle>Missing JSON Schema for Input Form</AlertTitle>
39+
This workflow will run without any input values.
40+
<br />
41+
To enable a form-based input, please provide a valid JSON schema in
42+
the <code>dataInputSchema</code> property of your workflow definition
43+
file.
44+
</Alert>
45+
</Grid>
46+
<Grid item xs={12}>
47+
<SubmitButton
48+
submitting={isExecuting}
49+
handleClick={() => handleExecute({})}
50+
>
51+
Run
52+
</SubmitButton>
53+
</Grid>
54+
</Grid>
55+
);
56+
};
57+
58+
export default MissingSchemaNotice;

workspaces/orchestrator/yarn.lock

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9326,30 +9326,6 @@ __metadata:
93269326
languageName: node
93279327
linkType: hard
93289328

9329-
"@monaco-editor/loader@npm:^1.4.0":
9330-
version: 1.4.0
9331-
resolution: "@monaco-editor/loader@npm:1.4.0"
9332-
dependencies:
9333-
state-local: ^1.0.6
9334-
peerDependencies:
9335-
monaco-editor: ">= 0.21.0 < 1"
9336-
checksum: 374ec0ea872ee15b33310e105a43217148161480d3955c5cece87d0f801754cd2c45a3f6c539a75da18a066c1615756fb87eaf1003f1df6a64a0cbce5d2c3749
9337-
languageName: node
9338-
linkType: hard
9339-
9340-
"@monaco-editor/react@npm:^4.6.0":
9341-
version: 4.6.0
9342-
resolution: "@monaco-editor/react@npm:4.6.0"
9343-
dependencies:
9344-
"@monaco-editor/loader": ^1.4.0
9345-
peerDependencies:
9346-
monaco-editor: ">= 0.25.0 < 1"
9347-
react: ^16.8.0 || ^17.0.0 || ^18.0.0
9348-
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0
9349-
checksum: 9d44e76c5baad6db5f84c90a5540fbd3c9af691b97d76cf2a99b3c8273004d0efe44c2572d80e9d975c9af10022c21e4a66923924950a5201e82017c8b20428c
9350-
languageName: node
9351-
linkType: hard
9352-
93539329
"@motionone/animation@npm:^10.12.0":
93549330
version: 10.18.0
93559331
resolution: "@motionone/animation@npm:10.18.0"
@@ -11586,7 +11562,6 @@ __metadata:
1158611562
"@kie-tools-core/editor": ^10.0.0
1158711563
"@kie-tools/serverless-workflow-standalone-editor": ^10.0.0
1158811564
"@material-ui/core": ^4.12.4
11589-
"@monaco-editor/react": ^4.6.0
1159011565
"@mui/icons-material": ^5.17.1
1159111566
"@mui/material": ^5.17.1
1159211567
"@red-hat-developer-hub/backstage-plugin-orchestrator-common": "workspace:^"
@@ -34029,13 +34004,6 @@ __metadata:
3402934004
languageName: node
3403034005
linkType: hard
3403134006

34032-
"state-local@npm:^1.0.6":
34033-
version: 1.0.7
34034-
resolution: "state-local@npm:1.0.7"
34035-
checksum: d1afcf1429e7e6eb08685b3a94be8797db847369316d4776fd51f3962b15b984dacc7f8e401ad20968e5798c9565b4b377afedf4e4c4d60fe7495e1cbe14a251
34036-
languageName: node
34037-
linkType: hard
34038-
3403934007
"static-eval@npm:2.0.2":
3404034008
version: 2.0.2
3404134009
resolution: "static-eval@npm:2.0.2"

0 commit comments

Comments
 (0)