Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaunchForm RJSF Form issue #692

Merged
merged 4 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@material-ui/pickers": "^3.2.2",
"@rjsf/core": "3.2.1",
"@rjsf/material-ui": "3.2.1",
"@rjsf/utils": "^5.0.0-beta.12",
"@rjsf/validator-ajv6": "^5.0.0-beta.12",
"@rjsf/core": "^5.1.0",
"@rjsf/material-ui": "^5.1.0",
"@rjsf/utils": "^5.1.0",
"@rjsf/validator-ajv8": "^5.1.0",
"@types/d3-shape": "^1.2.6",
"@xstate/react": "^1.0.0",
"axios": "^0.27.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import TextField from '@material-ui/core/TextField';
import Typography from '@material-ui/core/Typography';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import Form from '@rjsf/material-ui';
import validator from '@rjsf/validator-ajv8';
import { State } from 'xstate';
import { LaunchAdvancedOptionsRef } from './types';
import {
Expand Down Expand Up @@ -194,6 +195,7 @@ export const LaunchFormAdvancedInputs = React.forwardRef<
}}
formData={labelsParamData}
onChange={handleLabelsChange}
validator={validator}
>
<div />
</Form>
Expand Down Expand Up @@ -226,6 +228,7 @@ export const LaunchFormAdvancedInputs = React.forwardRef<
}}
formData={annotationsParamData}
onChange={handleAnnotationsParamData}
validator={validator}
>
<div />
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ export const LaunchWorkflowForm: React.FC<LaunchWorkflowFormProps> = props => {
showErrors={state.context.showErrors}
/>
) : null}
<LaunchFormAdvancedInputs ref={advancedOptionsRef} state={state} />
{isEnterInputsState(baseState) ? (
<LaunchFormAdvancedInputs
ref={advancedOptionsRef}
state={state}
/>
) : null}
<LaunchInterruptibleInput
initialValue={state.context.interruptible}
ref={interruptibleInputRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TextField, Card, CardContent, CardHeader } from '@material-ui/core';
import { useState } from 'react';
import Form from '@rjsf/material-ui';
import { MuiThemeProvider, createTheme } from '@material-ui/core/styles';
import validator from '@rjsf/validator-ajv8';
import { makeStringChangeHandler } from './handlers';
import { InputProps } from './types';
import { getLaunchInputId } from './utils';
Expand Down Expand Up @@ -86,10 +87,10 @@ export const StructInput: React.FC<InputProps> = props => {
jsonFormRenderable && value ? JSON.parse(value as string) : {},
);

const onFormChange = ({ formData }, _e) => {
const onFormChange = React.useCallback(({ formData }) => {
onChange(JSON.stringify(formData));
setParamData(formData);
};
}, []);

return jsonFormRenderable ? (
<MuiThemeProvider theme={muiTheme}>
Expand All @@ -98,6 +99,7 @@ export const StructInput: React.FC<InputProps> = props => {
<CardContent>
<Form
schema={JSON.parse(JSON.stringify(parsedJson))}
validator={validator}
formData={paramData}
onChange={onFormChange}
>
Expand Down
Loading