@@ -2,14 +2,15 @@ import React from 'react';
22
33import { Tabs } from '@gravity-ui/uikit' ;
44import { Helmet } from 'react-helmet-async' ;
5- import { Link , useLocation , useRouteMatch } from 'react-router-dom' ;
5+ import { Link , useRouteMatch } from 'react-router-dom' ;
6+ import { useQueryParams } from 'use-query-params' ;
67
78import { AutoRefreshControl } from '../../components/AutoRefreshControl/AutoRefreshControl' ;
89import { BasicNodeViewer } from '../../components/BasicNodeViewer' ;
910import { ResponseError } from '../../components/Errors/ResponseError' ;
1011import { FullNodeViewer } from '../../components/FullNodeViewer/FullNodeViewer' ;
1112import { Loader } from '../../components/Loader' ;
12- import routes , { createHref , parseQuery } from '../../routes' ;
13+ import routes from '../../routes' ;
1314import {
1415 useCapabilitiesLoaded ,
1516 useDiskPagesAvailable ,
@@ -22,7 +23,16 @@ import {useAutoRefreshInterval, useTypedDispatch} from '../../utils/hooks';
2223import { StorageWrapper } from '../Storage/StorageWrapper' ;
2324import { Tablets } from '../Tablets' ;
2425
25- import { NODE_PAGES , OVERVIEW , STORAGE , STRUCTURE , TABLETS } from './NodePages' ;
26+ import type { NodeTab } from './NodePages' ;
27+ import {
28+ NODE_PAGES ,
29+ OVERVIEW ,
30+ STORAGE ,
31+ STRUCTURE ,
32+ TABLETS ,
33+ getDefaultNodePath ,
34+ nodePageQueryParams ,
35+ } from './NodePages' ;
2636import NodeStructure from './NodeStructure/NodeStructure' ;
2737
2838import './Node.scss' ;
@@ -40,13 +50,12 @@ export function Node(props: NodeProps) {
4050 const container = React . useRef < HTMLDivElement > ( null ) ;
4151
4252 const dispatch = useTypedDispatch ( ) ;
43- const location = useLocation ( ) ;
4453
4554 const match =
4655 useRouteMatch < { id : string ; activeTab : string } > ( routes . node ) ?? Object . create ( null ) ;
4756
4857 const { id : nodeId , activeTab} = match . params ;
49- const { tenantName : tenantNameFromQuery } = parseQuery ( location ) ;
58+ const [ { database : tenantNameFromQuery } ] = useQueryParams ( nodePageQueryParams ) ;
5059
5160 const [ autoRefreshInterval ] = useAutoRefreshInterval ( ) ;
5261 const { currentData, isFetching, error} = nodeApi . useGetNodeInfoQuery (
@@ -109,7 +118,13 @@ export function Node(props: NodeProps) {
109118 activeTab = { activeTabVerified . id }
110119 wrapTo = { ( { id} , tabNode ) => (
111120 < Link
112- to = { createHref ( routes . node , { id : nodeId , activeTab : id } , { tenantName} ) }
121+ to = { getDefaultNodePath (
122+ nodeId ,
123+ {
124+ database : tenantName ,
125+ } ,
126+ id as NodeTab ,
127+ ) }
113128 key = { id }
114129 className = { b ( 'tab' ) }
115130 >
0 commit comments