@@ -2,6 +2,7 @@ import {useEffect, useMemo, useRef} from 'react';
22import { useLocation , useRouteMatch } from 'react-router' ;
33import cn from 'bem-cn-lite' ;
44import { useDispatch } from 'react-redux' ;
5+ import { Helmet } from 'react-helmet-async' ;
56
67import { Tabs } from '@gravity-ui/uikit' ;
78import { Link } from 'react-router-dom' ;
@@ -52,10 +53,6 @@ function Node(props: NodeProps) {
5253 const { activeTabVerified, nodeTabs} = useMemo ( ( ) => {
5354 const hasStorage = node ?. Roles ?. find ( ( el ) => el === STORAGE_ROLE ) ;
5455
55- let actualActiveTab = activeTab ;
56- if ( ! hasStorage && activeTab === STORAGE ) {
57- actualActiveTab = OVERVIEW ;
58- }
5956 const nodePages = hasStorage ? NODE_PAGES : NODE_PAGES . filter ( ( el ) => el . id !== STORAGE ) ;
6057
6158 const actualNodeTabs = nodePages . map ( ( page ) => {
@@ -65,6 +62,11 @@ function Node(props: NodeProps) {
6562 } ;
6663 } ) ;
6764
65+ let actualActiveTab = actualNodeTabs . find ( ( { id} ) => id === activeTab ) ;
66+ if ( ! actualActiveTab ) {
67+ actualActiveTab = actualNodeTabs [ 0 ] ;
68+ }
69+
6870 return { activeTabVerified : actualActiveTab , nodeTabs : actualNodeTabs } ;
6971 } , [ activeTab , node ] ) ;
7072
@@ -97,7 +99,7 @@ function Node(props: NodeProps) {
9799 < Tabs
98100 size = "l"
99101 items = { nodeTabs }
100- activeTab = { activeTabVerified }
102+ activeTab = { activeTabVerified . id }
101103 wrapTo = { ( { id} , tabNode ) => (
102104 < Link
103105 to = { createHref ( routes . node , { id : nodeId , activeTab : id } ) }
@@ -113,7 +115,7 @@ function Node(props: NodeProps) {
113115 ) ;
114116 } ;
115117 const renderTabContent = ( ) => {
116- switch ( activeTab ) {
118+ switch ( activeTabVerified . id ) {
117119 case STORAGE : {
118120 return (
119121 < div className = { b ( 'storage' ) } >
@@ -145,6 +147,13 @@ function Node(props: NodeProps) {
145147 if ( node ) {
146148 return (
147149 < div className = { b ( null , props . className ) } ref = { container } >
150+ < Helmet
151+ titleTemplate = { `%s — ${ node . Host } — YDB Monitoring` }
152+ defaultTitle = { `${ node . Host } — YDB Monitoring` }
153+ >
154+ < title > { activeTabVerified . title } </ title >
155+ </ Helmet >
156+
148157 < BasicNodeViewer
149158 node = { node }
150159 additionalNodesProps = { props . additionalNodesProps }
0 commit comments