diff --git a/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx b/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx index bb1e6f248c..bd61d040e6 100644 --- a/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx +++ b/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx @@ -12,11 +12,7 @@ import { TENANT_METRICS_TABS_IDS, TENANT_PAGES_IDS, } from '../../../../store/reducers/tenant/constants'; -import { - setDiagnosticsTab, - setTenantPage, - tenantApi, -} from '../../../../store/reducers/tenant/tenant'; +import {setDiagnosticsTab, tenantApi} from '../../../../store/reducers/tenant/tenant'; import {calculateTenantMetrics} from '../../../../store/reducers/tenants/utils'; import type {AdditionalTenantsProps} from '../../../../types/additionalProps'; import {getInfoTabLinks} from '../../../../utils/additionalProps'; @@ -24,6 +20,7 @@ import {TENANT_DEFAULT_TITLE} from '../../../../utils/constants'; import {useAutoRefreshInterval, useTypedDispatch, useTypedSelector} from '../../../../utils/hooks'; import {useClusterNameFromQuery} from '../../../../utils/hooks/useDatabaseFromQuery'; import {canShowTenantMonitoringTab} from '../../../../utils/monitoringVisibility'; +import {useTenantPage} from '../../TenantNavigation/useTenantNavigation'; import {mapDatabaseTypeToDBName} from '../../utils/schema'; import {HealthcheckPreview} from './Healthcheck/HealthcheckPreview'; @@ -53,6 +50,8 @@ export function TenantOverview({ const clusterName = useClusterNameFromQuery(); const dispatch = useTypedDispatch(); + const {handleTenantPageChange} = useTenantPage(); + const isMetaDatabasesAvailable = useDatabasesAvailable(); const {currentData: tenant, isFetching} = tenantApi.useGetTenantInfoQuery( @@ -196,7 +195,7 @@ export function TenantOverview({ ); const handleOpenMonitoring = () => { - dispatch(setTenantPage(TENANT_PAGES_IDS.diagnostics)); + handleTenantPageChange(TENANT_PAGES_IDS.diagnostics); dispatch(setDiagnosticsTab(TENANT_DIAGNOSTICS_TABS_IDS.monitoring)); }; diff --git a/src/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx b/src/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx index c0565c746e..ee90784ba9 100644 --- a/src/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +++ b/src/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx @@ -3,10 +3,10 @@ import {useThemeValue} from '@gravity-ui/uikit'; import {TENANT_PAGES_IDS} from '../../../store/reducers/tenant/constants'; import type {AdditionalTenantsProps} from '../../../types/additionalProps'; import {cn} from '../../../utils/cn'; -import {useTypedSelector} from '../../../utils/hooks'; import Diagnostics from '../Diagnostics/Diagnostics'; import {Query} from '../Query/Query'; import {TenantNavigation} from '../TenantNavigation/TenantNavigation'; +import {useTenantPage} from '../TenantNavigation/useTenantNavigation'; import './ObjectGeneral.scss'; @@ -19,7 +19,7 @@ interface ObjectGeneralProps { function ObjectGeneral({additionalTenantProps}: ObjectGeneralProps) { const theme = useThemeValue(); - const {tenantPage} = useTypedSelector((state) => state.tenant); + const {tenantPage} = useTenantPage(); const renderPageContent = () => { switch (tenantPage) { diff --git a/src/containers/Tenant/ObjectSummary/ObjectSummary.tsx b/src/containers/Tenant/ObjectSummary/ObjectSummary.tsx index c3fe7b3e86..c1e4c854d2 100644 --- a/src/containers/Tenant/ObjectSummary/ObjectSummary.tsx +++ b/src/containers/Tenant/ObjectSummary/ObjectSummary.tsx @@ -36,6 +36,7 @@ import {prepareSystemViewType} from '../../../utils/schema'; import {EntityTitle} from '../EntityTitle/EntityTitle'; import {SchemaViewer} from '../Schema/SchemaViewer/SchemaViewer'; import {useCurrentSchema} from '../TenantContext'; +import {useTenantPage} from '../TenantNavigation/useTenantNavigation'; import {TENANT_INFO_TABS, TENANT_SCHEMA_TAB, TenantTabsGroups} from '../TenantPages'; import {useTenantQueryParams} from '../useTenantQueryParams'; import {getSummaryControls} from '../utils/controls'; @@ -91,6 +92,8 @@ export function ObjectSummary({ (state) => state.tenant, ); + const {handleTenantPageChange} = useTenantPage(); + const location = useLocation(); const queryParams = qs.parse(location.search, { @@ -411,7 +414,7 @@ export function ObjectSummary({ {showPreview && getSummaryControls( dispatch, - {setActivePath: handleSchemaChange}, + {setActivePath: handleSchemaChange, setTenantPage: handleTenantPageChange}, 'm', )(path, 'preview')} state.tenant); + const {diagnosticsTab} = useTypedSelector((state) => state.tenant); + + const {tenantPage, handleTenantPageChange} = useTenantPage(); + const diagnosticsSchemaActive = tenantPage === TENANT_PAGES_IDS.diagnostics && diagnosticsTab === TENANT_DIAGNOSTICS_TABS_IDS.schema; @@ -24,7 +28,7 @@ export function SchemaActions() {