Skip to content

Commit 1652e6c

Browse files
committed
fix: review fixes
1 parent d34653e commit 1652e6c

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

src/components/Errors/ResponseError/ResponseError.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ export const ResponseError = ({
1414
}: ResponseErrorProps) => {
1515
const message = prepareErrorMessage(error) || defaultMessage;
1616

17-
return <div className={`error ${className}`}>{message}</div>;
17+
return <div className={`error ${className || ''}`}>{message}</div>;
1818
};

src/components/ProgressViewer/ProgressViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,5 @@ export function ProgressViewer({
140140
);
141141
}
142142

143-
return <div className={`${b({size})} ${className} error`}>{i18n('no-data')}</div>;
143+
return <div className={`${b({size})} ${className || ''} error`}>{i18n('no-data')}</div>;
144144
}

src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ import {LabelWithPopover} from '../../../../../components/LabelWithPopover';
99
import {ProgressViewer} from '../../../../../components/ProgressViewer/ProgressViewer';
1010
import {parseQuery} from '../../../../../routes';
1111
import {TENANT_STORAGE_TABS_IDS} from '../../../../../store/reducers/tenant/constants';
12-
import {setStorageTab} from '../../../../../store/reducers/tenant/tenant';
1312
import {cn} from '../../../../../utils/cn';
1413
import {formatStorageValues} from '../../../../../utils/dataFormatters/dataFormatters';
15-
import {useTypedDispatch, useTypedSelector} from '../../../../../utils/hooks';
14+
import {useTypedSelector} from '../../../../../utils/hooks';
1615
import {TenantTabsGroups, getTenantPath} from '../../../TenantPages';
1716
import {TenantDashboard} from '../TenantDashboard/TenantDashboard';
1817
import i18n from '../i18n';
@@ -43,20 +42,13 @@ interface TenantStorageProps {
4342
}
4443

4544
export function TenantStorage({tenantName, metrics}: TenantStorageProps) {
46-
const dispatch = useTypedDispatch();
4745
const location = useLocation();
4846
const {storageTab = TENANT_STORAGE_TABS_IDS.tables} = useTypedSelector((state) => state.tenant);
4947

5048
const {blobStorageUsed, tabletStorageUsed, blobStorageLimit, tabletStorageLimit} = metrics;
5149

5250
const queryParams = parseQuery(location);
5351

54-
React.useEffect(() => {
55-
if (!storageTab) {
56-
dispatch(setStorageTab(TENANT_STORAGE_TABS_IDS.tables));
57-
}
58-
}, [storageTab, dispatch]);
59-
6052
const renderTabContent = () => {
6153
switch (storageTab) {
6254
case TENANT_STORAGE_TABS_IDS.tables:

src/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@
4949
"title_top-groups-by-usage": "Top Groups By Usage",
5050
"action_by-load": "By Load",
5151
"action_by-pool-usage": "By Pool Usage"
52-
}
52+
}

src/store/reducers/tenant/tenant.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ const slice = createSlice({
4646
},
4747
setMetricsTab: (state, action: PayloadAction<TenantMetricsTab>) => {
4848
// Ensure we always have a valid metrics tab - fallback to CPU if empty/invalid
49-
const validTabs = Object.values(TENANT_METRICS_TABS_IDS);
50-
const isValidTab = action.payload && validTabs.includes(action.payload as any);
49+
const validTabs = Object.values(TENANT_METRICS_TABS_IDS) as TenantMetricsTab[];
50+
const isValidTab = action.payload && validTabs.includes(action.payload);
5151
state.metricsTab = isValidTab ? action.payload : TENANT_METRICS_TABS_IDS.cpu;
5252
},
5353
setStorageTab: (state, action: PayloadAction<TenantStorageTab>) => {
54-
state.storageTab = action.payload;
54+
// Ensure we always have a valid storage tab - fallback to tables if empty/invalid
55+
const validTabs = Object.values(TENANT_STORAGE_TABS_IDS) as TenantStorageTab[];
56+
const isValidTab = action.payload && validTabs.includes(action.payload);
57+
state.storageTab = isValidTab ? action.payload : TENANT_STORAGE_TABS_IDS.tables;
5558
},
5659
},
5760
});

0 commit comments

Comments
 (0)