From 0bfebc776b3bc8f756513663f3b19ba4dcdd2a8c Mon Sep 17 00:00:00 2001 From: Marcus Oskarsson Date: Mon, 16 Oct 2023 17:12:34 +0200 Subject: [PATCH] Added missing files --- .../AnnotatedBeamlineActionForm.jsx | 54 +++++++++++++++++ .../BeamlineActions/BeamlineActionForm.jsx | 58 +++++++++++++++++++ .../BeamlineActions.module.css | 16 +++++ 3 files changed, 128 insertions(+) create mode 100644 ui/src/components/BeamlineActions/AnnotatedBeamlineActionForm.jsx create mode 100644 ui/src/components/BeamlineActions/BeamlineActionForm.jsx create mode 100644 ui/src/components/BeamlineActions/BeamlineActions.module.css diff --git a/ui/src/components/BeamlineActions/AnnotatedBeamlineActionForm.jsx b/ui/src/components/BeamlineActions/AnnotatedBeamlineActionForm.jsx new file mode 100644 index 000000000..59d6a2414 --- /dev/null +++ b/ui/src/components/BeamlineActions/AnnotatedBeamlineActionForm.jsx @@ -0,0 +1,54 @@ +import React from 'react'; +import { Row, Col, Button } from 'react-bootstrap'; +import JSForm from '@rjsf/core'; +import validator from '@rjsf/validator-ajv8'; +import styles from './BeamlineActions.module.css'; + +export default function AnnotatedBeamlineActionForm(props) { + const { + actionId, + actionSchema, + isActionRunning, + handleStopAction, + handleStartAction, + } = props; + + return ( + + +
+ { + handleStartAction(actionId, formData); + }} + > + {isActionRunning ? ( + + ) : ( + + )} + +
+ + + + ); +} diff --git a/ui/src/components/BeamlineActions/BeamlineActionForm.jsx b/ui/src/components/BeamlineActions/BeamlineActionForm.jsx new file mode 100644 index 000000000..d3dbe048e --- /dev/null +++ b/ui/src/components/BeamlineActions/BeamlineActionForm.jsx @@ -0,0 +1,58 @@ +import React, { Fragment } from 'react'; +import { Row, Col, Button, Form } from 'react-bootstrap'; + +export default function BeamlineActionForm(props) { + const { + actionId, + isActionRunning, + actionArguments, + handleStopAction, + handleStartAction, + handleSetActionArgument, + } = props; + + return ( + + {actionArguments.map((arg, i) => ( + + + {arg.name} + + + { + handleSetActionArgument(actionId, i, e.target.value); + }} + /> + + + ))} + + {isActionRunning ? ( + + ) : ( + + )} + + + ); +} diff --git a/ui/src/components/BeamlineActions/BeamlineActions.module.css b/ui/src/components/BeamlineActions/BeamlineActions.module.css new file mode 100644 index 000000000..ca31e4a85 --- /dev/null +++ b/ui/src/components/BeamlineActions/BeamlineActions.module.css @@ -0,0 +1,16 @@ +.formContainer :global(.rjsf) legend { + display: none; +} + +.formContainer :global(.rjsf) :global(.control-label) { + display: inline; +} + +.formContainer :global(.rjsf) :global(.field-description) { + display: inline; + margin-left: 0.5em; +} + +.submitButton { + margin-top: 1em; +}