From 917a969fc3364b87524c8ff2c37d15ec24fcdb69 Mon Sep 17 00:00:00 2001 From: Ben Gilbert Date: Mon, 10 Nov 2025 03:28:07 +0000 Subject: [PATCH 1/8] fix modifying param (redux) --- gcs/src/components/params/valueInput.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcs/src/components/params/valueInput.jsx b/gcs/src/components/params/valueInput.jsx index 1b8bfa7fc..99ffcfd47 100644 --- a/gcs/src/components/params/valueInput.jsx +++ b/gcs/src/components/params/valueInput.jsx @@ -76,12 +76,12 @@ export default function ValueInput({ index, paramDef, className }) { } else { // Otherwise add it to modified params dispatch( - appendModifiedParams({ + appendModifiedParams([{ param_id: param.param_id, param_value: value, param_type: param.param_type, initial_value: param.param_value, - }), + }]), ) } } From ec80cce8f985f8d71154868589f7bdf735f7bb87 Mon Sep 17 00:00:00 2001 From: Ben Gilbert Date: Mon, 10 Nov 2025 03:31:42 +0000 Subject: [PATCH 2/8] refactor params styling --- gcs/src/components/params/paramsToolbar.jsx | 130 +++----------- gcs/src/components/params/rowItem.jsx | 8 +- gcs/src/params.jsx | 180 +++++++++++++++----- 3 files changed, 164 insertions(+), 154 deletions(-) diff --git a/gcs/src/components/params/paramsToolbar.jsx b/gcs/src/components/params/paramsToolbar.jsx index 84a455e84..8b8fdcf47 100644 --- a/gcs/src/components/params/paramsToolbar.jsx +++ b/gcs/src/components/params/paramsToolbar.jsx @@ -8,13 +8,9 @@ rebooting the autopilot // 3rd party imports import { Button, TextInput, Tooltip } from "@mantine/core" import { - IconDownload, IconEye, - IconPencil, IconPower, - IconRefresh, - IconTool, - IconUpload, + IconTool } from "@tabler/icons-react" // Styling imports @@ -25,108 +21,52 @@ const tailwindColors = resolveConfig(tailwindConfig).theme.colors // Redux import { useDispatch, useSelector } from "react-redux" import { - emitExportParamsToFile, emitRebootAutopilot, - emitRefreshParams, - emitSetMultipleParams, resetParamState, selectModifiedParams, selectParamSearchValue, selectShowModifiedParams, setAutoPilotRebootModalOpen, - setFetchingVars, - setModifiedParams, - setParams, setParamSearchValue, - setShownParams, - toggleShowModifiedParams, + toggleShowModifiedParams } from "../../redux/slices/paramsSlice.js" -export default function ParamsToolbar({ loadParamsFromFile }) { +export default function ParamsToolbar() { const dispatch = useDispatch() - const modifiedParams = useSelector(selectModifiedParams) const showModifiedParams = useSelector(selectShowModifiedParams) const searchValue = useSelector(selectParamSearchValue) - function refreshCallback() { - dispatch(setParams([])) - dispatch(setModifiedParams([])) - dispatch(setShownParams([])) - dispatch(emitRefreshParams()) - dispatch(setFetchingVars(true)) - } - function rebootCallback() { dispatch(emitRebootAutopilot()) dispatch(setAutoPilotRebootModalOpen(true)) dispatch(resetParamState()) } - async function saveParamsToFile() { - const options = { - title: "Save parameters to a file", - filters: [ - { name: "Param File", extensions: ["param"] }, - { name: "All Files", extensions: ["*"] }, - ], - } - - const result = await window.ipcRenderer.invoke( - "app:get-save-file-path", - options, - ) - - if (!result.canceled) { - dispatch( - emitExportParamsToFile({ - filePath: result.filePath, - }), - ) - } - } - return ( -
- - - - - - dispatch(setParamSearchValue(event.currentTarget.value)) - } - /> - - - - + + + + + dispatch(setParamSearchValue(event.currentTarget.value)) + } + /> +
- - - - ) } diff --git a/gcs/src/components/params/rowItem.jsx b/gcs/src/components/params/rowItem.jsx index 256fe3ac1..aa15263a4 100644 --- a/gcs/src/components/params/rowItem.jsx +++ b/gcs/src/components/params/rowItem.jsx @@ -59,15 +59,17 @@ const RowItem = memo(({ index, style }) => { }, [aircraftType, param]) return ( -
-
+
+

{param.param_id}

{paramDef?.Values && paramDef?.Range && ( {Object.keys(paramDef?.Values).map((key) => { diff --git a/gcs/src/params.jsx b/gcs/src/params.jsx index 99544d848..236c6d9fa 100644 --- a/gcs/src/params.jsx +++ b/gcs/src/params.jsx @@ -8,8 +8,9 @@ import { useEffect } from "react" // 3rd Party Imports -import { Button, Progress } from "@mantine/core" +import { Button, Divider, Progress } from "@mantine/core" import { useDebouncedValue } from "@mantine/hooks" +import { ResizableBox } from "react-resizable" import AutoSizer from "react-virtualized-auto-sizer" import { FixedSizeList } from "react-window" @@ -27,7 +28,9 @@ import { EXCLUDE_PARAMS_LOAD } from "./helpers/mavlinkConstants.js" import { showErrorNotification } from "./helpers/notification.js" import { selectConnectedToDrone } from "./redux/slices/droneConnectionSlice.js" import { + emitExportParamsToFile, emitRefreshParams, + emitSetMultipleParams, resetParamState, selectFetchingVars, selectFetchingVarsProgress, @@ -42,6 +45,8 @@ import { setLoadedFileName, setLoadedParams, setLoadParamsFileModalOpen, + setModifiedParams, + setParams, setShownParams, } from "./redux/slices/paramsSlice.js" @@ -105,6 +110,37 @@ export default function Params() { dispatch(setHasFetchedOnce(true)) } + function refreshCallback() { + dispatch(setParams([])) + dispatch(setModifiedParams([])) + dispatch(setShownParams([])) + dispatch(emitRefreshParams()) + dispatch(setFetchingVars(true)) + } + + async function saveParamsToFile() { + const options = { + title: "Save parameters to a file", + filters: [ + { name: "Param File", extensions: ["param"] }, + { name: "All Files", extensions: ["*"] }, + ], + } + + const result = await window.ipcRenderer.invoke( + "app:get-save-file-path", + options, + ) + + if (!result.canceled) { + dispatch( + emitExportParamsToFile({ + filePath: result.filePath, + }), + ) + } + } + async function loadParamsFromFile() { const result = await window.ipcRenderer.invoke( "params:load-params-from-file", @@ -150,8 +186,7 @@ export default function Params() { dispatch(setLoadParamsFileModalOpen(true)) } else { showErrorNotification( - `Error loading params from file: ${ - result.error || "Please try again." + `Error loading params from file: ${result.error || "Please try again." }`, ) } @@ -163,51 +198,102 @@ export default function Params() { {connected ? ( - <> - {fetchingVars && ( -
- {fetchingVarsProgress.param_id && ( -

- Fetched {fetchingVarsProgress.param_id} -

- )} - -
- )} - - {Object.keys(params).length > 0 && !fetchingVars && ( -
- - -
- - {({ height, width }) => ( - - {Row} - - )} - +
+
+ {/* Resizable Sidebar */} +
+ } + className="relative bg-falcongrey-800 overflow-y-auto" + > +
+
+ + +
+ +
+ + +
-
- )} - {Object.keys(params).length === 0 && !fetchingVars && ( -
-

- No parameters found, try fetching them again. -

- -
- )} - + + + {/* Main content area */} +
+ {fetchingVars && ( +
+ {fetchingVarsProgress.param_id && ( +

+ Fetched {fetchingVarsProgress.param_id} +

+ )} + +
+ )} + + {Object.keys(params).length > 0 && !fetchingVars && ( +
+ + +
+ + {({ height, width }) => ( + + {Row} + + )} + +
+
+ )} + {Object.keys(params).length === 0 && !fetchingVars && ( +
+

+ No parameters found, try fetching them again. +

+ +
+ )}
+
+
) : ( )} From 179140d7579cdcaa8ad82acc628daf6a73a41118 Mon Sep 17 00:00:00 2001 From: Ben Gilbert Date: Mon, 10 Nov 2025 03:33:34 +0000 Subject: [PATCH 3/8] formatting --- gcs/src/components/params/paramsToolbar.jsx | 19 ++++++++-------- gcs/src/components/params/valueInput.jsx | 14 +++++++----- gcs/src/params.jsx | 25 +++++++++------------ 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/gcs/src/components/params/paramsToolbar.jsx b/gcs/src/components/params/paramsToolbar.jsx index 8b8fdcf47..2fbc5391a 100644 --- a/gcs/src/components/params/paramsToolbar.jsx +++ b/gcs/src/components/params/paramsToolbar.jsx @@ -7,11 +7,7 @@ rebooting the autopilot // 3rd party imports import { Button, TextInput, Tooltip } from "@mantine/core" -import { - IconEye, - IconPower, - IconTool -} from "@tabler/icons-react" +import { IconEye, IconPower, IconTool } from "@tabler/icons-react" // Styling imports import resolveConfig from "tailwindcss/resolveConfig" @@ -23,12 +19,11 @@ import { useDispatch, useSelector } from "react-redux" import { emitRebootAutopilot, resetParamState, - selectModifiedParams, selectParamSearchValue, selectShowModifiedParams, setAutoPilotRebootModalOpen, setParamSearchValue, - toggleShowModifiedParams + toggleShowModifiedParams, } from "../../redux/slices/paramsSlice.js" export default function ParamsToolbar() { @@ -46,7 +41,9 @@ export default function ParamsToolbar() {
diff --git a/gcs/src/components/params/valueInput.jsx b/gcs/src/components/params/valueInput.jsx index 99ffcfd47..5ebba3e20 100644 --- a/gcs/src/components/params/valueInput.jsx +++ b/gcs/src/components/params/valueInput.jsx @@ -76,12 +76,14 @@ export default function ValueInput({ index, paramDef, className }) { } else { // Otherwise add it to modified params dispatch( - appendModifiedParams([{ - param_id: param.param_id, - param_value: value, - param_type: param.param_type, - initial_value: param.param_value, - }]), + appendModifiedParams([ + { + param_id: param.param_id, + param_value: value, + param_type: param.param_type, + initial_value: param.param_value, + }, + ]), ) } } diff --git a/gcs/src/params.jsx b/gcs/src/params.jsx index 236c6d9fa..9b1bbe5cb 100644 --- a/gcs/src/params.jsx +++ b/gcs/src/params.jsx @@ -186,7 +186,8 @@ export default function Params() { dispatch(setLoadParamsFileModalOpen(true)) } else { showErrorNotification( - `Error loading params from file: ${result.error || "Please try again." + `Error loading params from file: ${ + result.error || "Please try again." }`, ) } @@ -215,15 +216,14 @@ export default function Params() { >
-
- -
@@ -291,7 +285,8 @@ export default function Params() {

- )}
+ )} +
) : ( From 5d1c83cfc2cc8f7d5388ef6103e720e1153e615d Mon Sep 17 00:00:00 2001 From: Ben Gilbert Date: Mon, 10 Nov 2025 14:52:51 +0000 Subject: [PATCH 4/8] remove unneeded loadParamsFromFile prop --- gcs/src/params.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcs/src/params.jsx b/gcs/src/params.jsx index 9b1bbe5cb..0f48a52cf 100644 --- a/gcs/src/params.jsx +++ b/gcs/src/params.jsx @@ -260,7 +260,7 @@ export default function Params() { {Object.keys(params).length > 0 && !fetchingVars && (
- +
From 0ff2c9782267526c20d70cb164226b5585688af6 Mon Sep 17 00:00:00 2001 From: Ben Gilbert Date: Mon, 10 Nov 2025 14:53:31 +0000 Subject: [PATCH 5/8] hide left menu when loading params --- gcs/src/params.jsx | 80 +++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/gcs/src/params.jsx b/gcs/src/params.jsx index 0f48a52cf..4dd268eff 100644 --- a/gcs/src/params.jsx +++ b/gcs/src/params.jsx @@ -186,8 +186,7 @@ export default function Params() { dispatch(setLoadParamsFileModalOpen(true)) } else { showErrorNotification( - `Error loading params from file: ${ - result.error || "Please try again." + `Error loading params from file: ${result.error || "Please try again." }`, ) } @@ -201,45 +200,46 @@ export default function Params() { {connected ? (
- {/* Resizable Sidebar */} -
- } - className="relative bg-falcongrey-800 overflow-y-auto" - > -
-
- - -
- -
- - + {!fetchingVars && ( +
+ } + className="relative bg-falcongrey-800 overflow-y-auto" + > +
+
+ + +
+ +
+ + +
-
- + + )} {/* Main content area */}
From e4947ae46ce7566ca97e7f51c2015890bb176998 Mon Sep 17 00:00:00 2001 From: Ben Gilbert Date: Mon, 10 Nov 2025 15:08:10 +0000 Subject: [PATCH 6/8] kushs requested changes center param search bar move controls to sidebar --- gcs/src/components/params/paramsToolbar.jsx | 70 ++++----------------- gcs/src/params.jsx | 33 +++++++++- 2 files changed, 42 insertions(+), 61 deletions(-) diff --git a/gcs/src/components/params/paramsToolbar.jsx b/gcs/src/components/params/paramsToolbar.jsx index 2fbc5391a..88b9537bb 100644 --- a/gcs/src/components/params/paramsToolbar.jsx +++ b/gcs/src/components/params/paramsToolbar.jsx @@ -6,77 +6,29 @@ rebooting the autopilot */ // 3rd party imports -import { Button, TextInput, Tooltip } from "@mantine/core" -import { IconEye, IconPower, IconTool } from "@tabler/icons-react" - -// Styling imports -import resolveConfig from "tailwindcss/resolveConfig" -import tailwindConfig from "../../../tailwind.config.js" -const tailwindColors = resolveConfig(tailwindConfig).theme.colors +import { TextInput } from "@mantine/core" // Redux import { useDispatch, useSelector } from "react-redux" import { - emitRebootAutopilot, - resetParamState, selectParamSearchValue, - selectShowModifiedParams, - setAutoPilotRebootModalOpen, - setParamSearchValue, - toggleShowModifiedParams, + setParamSearchValue } from "../../redux/slices/paramsSlice.js" export default function ParamsToolbar() { const dispatch = useDispatch() - const showModifiedParams = useSelector(selectShowModifiedParams) const searchValue = useSelector(selectParamSearchValue) - function rebootCallback() { - dispatch(emitRebootAutopilot()) - dispatch(setAutoPilotRebootModalOpen(true)) - dispatch(resetParamState()) - } - return ( -
-
- - - - - - dispatch(setParamSearchValue(event.currentTarget.value)) - } - /> -
- - +
+ + dispatch(setParamSearchValue(event.currentTarget.value)) + } + />
) } diff --git a/gcs/src/params.jsx b/gcs/src/params.jsx index 4dd268eff..90d28d813 100644 --- a/gcs/src/params.jsx +++ b/gcs/src/params.jsx @@ -14,6 +14,11 @@ import { ResizableBox } from "react-resizable" import AutoSizer from "react-virtualized-auto-sizer" import { FixedSizeList } from "react-window" +// Styling imports +import resolveConfig from "tailwindcss/resolveConfig" +import tailwindConfig from "../tailwind.config.js" +const tailwindColors = resolveConfig(tailwindConfig).theme.colors + // Custom components, helpers, and data import Layout from "./components/layout.jsx" import NoDroneConnected from "./components/noDroneConnected.jsx" @@ -48,6 +53,7 @@ import { setModifiedParams, setParams, setShownParams, + toggleShowModifiedParams, } from "./redux/slices/paramsSlice.js" function cleanFloat(value, decimals = 5) { @@ -118,6 +124,12 @@ export default function Params() { dispatch(setFetchingVars(true)) } + function rebootCallback() { + dispatch(emitRebootAutopilot()) + dispatch(setAutoPilotRebootModalOpen(true)) + dispatch(resetParamState()) + } + async function saveParamsToFile() { const options = { title: "Save parameters to a file", @@ -202,9 +214,9 @@ export default function Params() {
{!fetchingVars && (
+ +
+ + +
+
)} From 65603403068f4ba299d0a46e5a39e9f106e2a913 Mon Sep 17 00:00:00 2001 From: Ben Gilbert Date: Tue, 11 Nov 2025 23:06:34 +0000 Subject: [PATCH 7/8] hopefully final change repositioned `show modified params` button back to top toolbar --- gcs/src/components/params/paramsToolbar.jsx | 30 ++++++++++++++++++--- gcs/src/params.jsx | 14 +++------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/gcs/src/components/params/paramsToolbar.jsx b/gcs/src/components/params/paramsToolbar.jsx index 88b9537bb..7cce560f3 100644 --- a/gcs/src/components/params/paramsToolbar.jsx +++ b/gcs/src/components/params/paramsToolbar.jsx @@ -6,21 +6,45 @@ rebooting the autopilot */ // 3rd party imports -import { TextInput } from "@mantine/core" +import { Button, TextInput, Tooltip } from "@mantine/core" +import { IconEye, IconTool } from "@tabler/icons-react" + +// Styling imports +import resolveConfig from "tailwindcss/resolveConfig" +import tailwindConfig from "../../../tailwind.config.js" +const tailwindColors = resolveConfig(tailwindConfig).theme.colors // Redux import { useDispatch, useSelector } from "react-redux" import { + selectModifiedParams, selectParamSearchValue, - setParamSearchValue + selectShowModifiedParams, + setParamSearchValue, + toggleShowModifiedParams, } from "../../redux/slices/paramsSlice.js" export default function ParamsToolbar() { const dispatch = useDispatch() const searchValue = useSelector(selectParamSearchValue) + const modifiedParams = useSelector(selectModifiedParams) + const showModifiedParams = useSelector(selectShowModifiedParams) return ( -
+
+ + +
-
-
)} From f2a799338c3c5c77ce8df25e5c3265c88cf95dfc Mon Sep 17 00:00:00 2001 From: Ben Gilbert Date: Wed, 12 Nov 2025 13:23:40 +0000 Subject: [PATCH 8/8] strict equality --- gcs/src/components/params/paramsToolbar.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcs/src/components/params/paramsToolbar.jsx b/gcs/src/components/params/paramsToolbar.jsx index 7cce560f3..d5bcddaf6 100644 --- a/gcs/src/components/params/paramsToolbar.jsx +++ b/gcs/src/components/params/paramsToolbar.jsx @@ -40,7 +40,7 @@ export default function ParamsToolbar() { size="sm" onClick={() => dispatch(toggleShowModifiedParams())} color={tailwindColors.orange[600]} - disabled={modifiedParams.length == 0} + disabled={modifiedParams.length === 0} > {showModifiedParams ? : }