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/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 = ({ 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..42da26f7 100644 --- a/packages/main/sections/Queries/helpers.tsx +++ b/packages/main/sections/Queries/helpers.tsx @@ -90,3 +90,35 @@ 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; + } +};