From 874feeb657debd98e42a80852da0cf2b0761951b Mon Sep 17 00:00:00 2001 From: Jesse Florig Date: Mon, 20 Mar 2023 14:27:32 +0100 Subject: [PATCH] added action inputs --- dashboard/src/Control.jsx | 46 ++++++++++++++++++++++++++++++------- dashboard/src/msnActions.js | 25 ++++++++++++++++++++ 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/dashboard/src/Control.jsx b/dashboard/src/Control.jsx index 37ab104..81ed374 100644 --- a/dashboard/src/Control.jsx +++ b/dashboard/src/Control.jsx @@ -7,6 +7,7 @@ import { Flex, Heading, HStack, + Input, ListItem, Select, Stack, @@ -51,7 +52,31 @@ ActionButton.propTypes = { connectionCode: PropTypes.number } -function ActionSelect({label, desc, handler, options}){ +function ActionInput({label, desc, connectionCode}){ + const isDisabled = connectionCode !== 1 + return ( + + {label} + + + + + + ) +} + +ActionInput.defaultProps = { + connectionCode: 0 +} + +ActionInput.propTypes = { + label: PropTypes.string.isRequired, + desc: PropTypes.string.isRequired, + connectionCode: PropTypes.number +} + +function ActionSelect({label, desc, handler, options, connectionCode}){ + const isDisabled = connectionCode !== 1 const handleChangeValue = (event) => { handler()(event.target.value) } @@ -62,7 +87,7 @@ function ActionSelect({label, desc, handler, options}){ - { options.map(opt => ( ))} @@ -72,7 +97,8 @@ function ActionSelect({label, desc, handler, options}){ } ActionSelect.defaultProps = { - options: [] + options: [], + connectionCode: 0 } ActionSelect.propTypes = { @@ -81,7 +107,8 @@ ActionSelect.propTypes = { handler: PropTypes.func.isRequired, options: PropTypes.arrayOf(PropTypes.shape({ label: PropTypes.string - })) + })), + connectionCode: PropTypes.number } function ActionsCard({title, actions, wsUrl, logKey}){ @@ -120,8 +147,11 @@ function ActionsCard({title, actions, wsUrl, logKey}){ handler(sendMessage)} connectionCode={statusCode} /> ) } + else if(type === "input"){ + component = () + } else if(type === "select"){ - component = ( handler(sendMessage)} />) + component = ( handler(sendMessage)} connectionCode={statusCode} />) } return component })} @@ -134,9 +164,9 @@ function ActionsCard({title, actions, wsUrl, logKey}){ ActionsCard.propTypes = { title: PropTypes.string.isRequired, actions: PropTypes.arrayOf(PropTypes.shape({ - label: PropTypes.string.isRequired, - desc: PropTypes.string.isRequired, - handler: PropTypes.func.isRequired + label: PropTypes.string, + desc: PropTypes.string, + handler: PropTypes.func })).isRequired, wsUrl: PropTypes.string.isRequired, logKey: PropTypes.string.isRequired diff --git a/dashboard/src/msnActions.js b/dashboard/src/msnActions.js index 43dc419..056bdda 100644 --- a/dashboard/src/msnActions.js +++ b/dashboard/src/msnActions.js @@ -8,6 +8,31 @@ function handlePublishATO(send){ } export default [ + { + type: "input", + label: "Mission ID", + desc: "Mission ID on the dashboard" + }, + { + type: "input", + label: "Takeoff Time", + desc: "Mission takeoff on the dashboard" + }, + { + type: "input", + label: "Return Time", + desc: "Mission return on the dashboard" + }, + { + type: "input", + label: "Mission Platform", + desc: "Mission platform on the dashboard" + }, + { + type: "input", + label: "Mission Target", + desc: "Mission target on the dashboard" + }, { type: "button", label: "Build ATO",