From 5d00cdaaf0b07c9d50f3f239f561828988e6f9cf Mon Sep 17 00:00:00 2001 From: jacovinus Date: Fri, 22 Dec 2023 11:45:42 +0100 Subject: [PATCH 1/3] fix: change quota value 0 to unlimited --- packages/main/plugins/Cardinality/Totals.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/main/plugins/Cardinality/Totals.tsx b/packages/main/plugins/Cardinality/Totals.tsx index 70ac4a66..48f1f9e9 100644 --- a/packages/main/plugins/Cardinality/Totals.tsx +++ b/packages/main/plugins/Cardinality/Totals.tsx @@ -76,8 +76,8 @@ const TOTALS_VALUES = { value: (val: string | number | null | undefined) => `${val ?? 0 }`, }, quota: { - text: "Quota", - value : (val: string | number ) => `${val}` + text: "Quota Limit", + value : (val: string | number ) => val === 0 ? 'Unlimited' : `${val}` } }; export const Totals: React.FC = ({ From 89153f667cc81aa714668f3925841ce24e56ba0b Mon Sep 17 00:00:00 2001 From: jacovinus Date: Fri, 22 Dec 2023 15:06:46 +0100 Subject: [PATCH 2/3] fix: local tabs state --- packages/main/sections/Queries/QueryItem.tsx | 5 +++- packages/main/sections/Queries/helpers.tsx | 24 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/main/sections/Queries/QueryItem.tsx b/packages/main/sections/Queries/QueryItem.tsx index cc6a4926..b52124ea 100644 --- a/packages/main/sections/Queries/QueryItem.tsx +++ b/packages/main/sections/Queries/QueryItem.tsx @@ -17,6 +17,8 @@ import { filterLocal, getStoredQueries, setStoredQuery, + setLocalTabsState, + getLocalTabsState } from "./helpers"; import { useIdRefs } from "./hooks"; @@ -52,7 +54,7 @@ const QueryItem = (props: any) => { const isQueryOpen = useState(true); const idRefs = useIdRefs(name); const theme = useTheme(); - const [tabsValue, setTabsValue] = useState(0); + const [tabsValue, setTabsValue] = useState(getLocalTabsState(name, id)); const onAddQuery = () => { const panelData = setNewPanelData(panelSelected, data, idRefs); @@ -96,6 +98,7 @@ const QueryItem = (props: any) => { }; const onTabChange = (e: React.SyntheticEvent, tabValue: number) => { + setLocalTabsState(name, id, tabValue); setTabsValue(() => tabValue); }; const { activeTabs, isActiveTabs } = useActiveTabs(`Query Item`); diff --git a/packages/main/sections/Queries/helpers.tsx b/packages/main/sections/Queries/helpers.tsx index 2a3d8970..35633ea5 100644 --- a/packages/main/sections/Queries/helpers.tsx +++ b/packages/main/sections/Queries/helpers.tsx @@ -90,3 +90,27 @@ export const dataViewAction = (panel: any, data: any) => { return setRightDataView(data); } }; + +export const setLocalTabsState = (panel: string, queryId: string, value: number) => { + try { + const localTabs = JSON.parse(localStorage.getItem("localTabsState") || "{}"); + const panelState = localTabs[panel] || {}; + + panelState[queryId] = value; + localTabs[panel] = panelState; + + localStorage.setItem("localTabsState", JSON.stringify(localTabs)); + } catch (e) { + console.log(e); + } +}; + +export const getLocalTabsState = (panel: string, queryId: string) => { + try { + const tabsState = JSON.parse(localStorage.getItem("localTabsState") || "{}"); + return tabsState[panel]?.[queryId] || 0; + } catch (e) { + console.log(e); + return 0; + } +}; \ No newline at end of file From fd4078dba54662223709f8b36c32476864d40c6f Mon Sep 17 00:00:00 2001 From: jacovinus Date: Fri, 22 Dec 2023 15:11:06 +0100 Subject: [PATCH 3/3] fix: package version and formatting --- packages/main/package.json | 2 +- packages/main/sections/Queries/helpers.tsx | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/main/package.json b/packages/main/package.json index f432393e..0d0362c3 100644 --- a/packages/main/package.json +++ b/packages/main/package.json @@ -1,7 +1,7 @@ { "name": "@ui/main", "private": true, - "version": "0.27.8", + "version": "0.28.2", "type": "module", "scripts": { "dev": "VITE_APP_VERSION=$npm_package_version vite", diff --git a/packages/main/sections/Queries/helpers.tsx b/packages/main/sections/Queries/helpers.tsx index 35633ea5..42da26f7 100644 --- a/packages/main/sections/Queries/helpers.tsx +++ b/packages/main/sections/Queries/helpers.tsx @@ -91,9 +91,15 @@ export const dataViewAction = (panel: any, data: any) => { } }; -export const setLocalTabsState = (panel: string, queryId: string, value: number) => { +export const setLocalTabsState = ( + panel: string, + queryId: string, + value: number +) => { try { - const localTabs = JSON.parse(localStorage.getItem("localTabsState") || "{}"); + const localTabs = JSON.parse( + localStorage.getItem("localTabsState") || "{}" + ); const panelState = localTabs[panel] || {}; panelState[queryId] = value; @@ -107,10 +113,12 @@ export const setLocalTabsState = (panel: string, queryId: string, value: number) export const getLocalTabsState = (panel: string, queryId: string) => { try { - const tabsState = JSON.parse(localStorage.getItem("localTabsState") || "{}"); + const tabsState = JSON.parse( + localStorage.getItem("localTabsState") || "{}" + ); return tabsState[panel]?.[queryId] || 0; } catch (e) { console.log(e); return 0; } -}; \ No newline at end of file +};