From 09201f55ce0dab184febd579fe9961d1b42b11bf Mon Sep 17 00:00:00 2001 From: Brandon McArthur Date: Thu, 12 Dec 2024 15:55:38 -0700 Subject: [PATCH] added server support to inputs --- src/components/Content/Content.tsx | 2 + .../ContentContainer/ContentContainer.tsx | 1 + src/components/Panel/Panel.tsx | 12 ++++- src/components/PanelDialog/PanelDialog.tsx | 19 ++++++- src/components/PanelInputs/PanelInputText.tsx | 49 +++++++++++++------ src/components/PanelLabels/PanelLabels.tsx | 4 +- .../PanelZoomLabels/PanelZoomLabels.tsx | 4 +- src/jsApi.ts | 6 +++ src/types/configs.d.ts | 8 ++- 9 files changed, 83 insertions(+), 22 deletions(-) diff --git a/src/components/Content/Content.tsx b/src/components/Content/Content.tsx index de026b9d..a118e3d6 100644 --- a/src/components/Content/Content.tsx +++ b/src/components/Content/Content.tsx @@ -220,6 +220,7 @@ const Content: React.FC = ({ table, tableWrapperRef, tableContentR handlePanelChange={handlePanelChange} selectedValue={curPanel} index={i} + storageInterface={displayInfo?.inputs?.storageInterface || { type: 'localStorage' }} > = ({ table, tableWrapperRef, tableContentR source={panelDialog.source as string} index={panelDialog.index as number} onClose={() => dispatch(setPanelDialog({ open: false }))} + storageInterface={displayInfo?.inputs?.storageInterface || { type: 'localStorage' }} /> )} diff --git a/src/components/ContentContainer/ContentContainer.tsx b/src/components/ContentContainer/ContentContainer.tsx index fa210e3d..0d118120 100644 --- a/src/components/ContentContainer/ContentContainer.tsx +++ b/src/components/ContentContainer/ContentContainer.tsx @@ -173,6 +173,7 @@ const ContentContainer: React.FC = () => { panelKey={panelKey as string} isNumeric={meta.type === INPUT_TYPE_NUMBER} input={meta as ITextInput | INumberInput} + storageInterface={displayInfo?.inputs?.storageInterface || { type: 'localStorage' }} /> ); } diff --git a/src/components/Panel/Panel.tsx b/src/components/Panel/Panel.tsx index 8559903e..07e7f28a 100644 --- a/src/components/Panel/Panel.tsx +++ b/src/components/Panel/Panel.tsx @@ -23,6 +23,7 @@ interface PanelProps { handlePanelChange: (value: string) => void; selectedValue: string; index: number; + storageInterface: IInputClientSideStorage | IInputServerSideStorage; } const Panel: React.FC = ({ @@ -35,6 +36,7 @@ const Panel: React.FC = ({ handlePanelChange, selectedValue, index, + storageInterface, }) => { const dispatch = useDispatch(); const { data: displayInfo } = useDisplayInfo(); @@ -94,7 +96,15 @@ const Panel: React.FC = ({ )} - {showLabels && } + {showLabels && ( + + )} ); }; diff --git a/src/components/PanelDialog/PanelDialog.tsx b/src/components/PanelDialog/PanelDialog.tsx index 6c9ccac5..118f5ec7 100644 --- a/src/components/PanelDialog/PanelDialog.tsx +++ b/src/components/PanelDialog/PanelDialog.tsx @@ -23,13 +23,23 @@ interface PanelDialogProps { source: string; onClose: () => void; index: number; + storageInterface: IInputClientSideStorage | IInputServerSideStorage; } interface PanelExtended extends IPanelMeta { sourcePath: string; } -const PanelDialog: React.FC = ({ data, filteredData, open, panel, source, onClose, index }) => { +const PanelDialog: React.FC = ({ + data, + filteredData, + open, + panel, + source, + onClose, + index, + storageInterface, +}) => { const displayMetas = useDisplayMetas(); const theme = useTheme(); const panelMetas = displayMetas.filter((meta) => meta.type === META_TYPE_PANEL && meta.varname !== panel?.varname); @@ -286,7 +296,12 @@ const PanelDialog: React.FC = ({ data, filteredData, open, pan - +