@@ -9,11 +9,12 @@ import type {ProblemFilterValue} from '../../store/reducers/settings/types';
99
1010import { AccessDenied } from '../../components/Errors/403' ;
1111import { Illustration } from '../../components/Illustration' ;
12- import { Loader } from '../../components/Loader' ;
1312import { Search } from '../../components/Search' ;
1413import { ProblemFilter } from '../../components/ProblemFilter' ;
1514import { UptimeFilter } from '../../components/UptimeFIlter' ;
1615import { EntitiesCount } from '../../components/EntitiesCount' ;
16+ import { TableWithControlsLayout } from '../../components/TableWithControlsLayout/TableWithControlsLayout' ;
17+ import { ResponseError } from '../../components/Errors/ResponseError' ;
1718
1819import { DEFAULT_TABLE_SETTINGS , USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY } from '../../utils/constants' ;
1920import { useAutofetcher , useSetting , useTypedSelector } from '../../utils/hooks' ;
@@ -42,11 +43,10 @@ const b = cn('ydb-nodes');
4243interface NodesProps {
4344 path ?: string ;
4445 type ?: EPathType ;
45- className ?: string ;
4646 additionalNodesInfo ?: AdditionalNodesInfo ;
4747}
4848
49- export const Nodes = ( { path, type, className , additionalNodesInfo = { } } : NodesProps ) => {
49+ export const Nodes = ( { path, type, additionalNodesInfo = { } } : NodesProps ) => {
5050 const dispatch = useDispatch ( ) ;
5151
5252 const isClusterNodes = ! path ;
@@ -93,7 +93,7 @@ export const Nodes = ({path, type, className, additionalNodesInfo = {}}: NodesPr
9393
9494 const renderControls = ( ) => {
9595 return (
96- < div className = { b ( 'controls' ) } >
96+ < >
9797 < Search
9898 onChange = { handleSearchQueryChange }
9999 placeholder = "Host name"
@@ -108,7 +108,7 @@ export const Nodes = ({path, type, className, additionalNodesInfo = {}}: NodesPr
108108 label = { 'Nodes' }
109109 loading = { loading && ! wasLoaded }
110110 />
111- </ div >
111+ </ >
112112 ) ;
113113 } ;
114114
@@ -127,44 +127,34 @@ export const Nodes = ({path, type, className, additionalNodesInfo = {}}: NodesPr
127127 }
128128
129129 return (
130- < div className = { b ( 'table-wrapper' ) } >
131- < div className = { b ( 'table-content' ) } >
132- < DataTable
133- theme = "yandex-cloud"
134- data = { nodes || [ ] }
135- columns = { columns }
136- settings = { DEFAULT_TABLE_SETTINGS }
137- initialSortOrder = { {
138- columnId : 'NodeId' ,
139- order : DataTable . ASCENDING ,
140- } }
141- emptyDataMessage = { i18n ( 'empty.default' ) }
142- rowClassName = { ( row ) => b ( 'node' , { unavailable : isUnavailableNode ( row ) } ) }
143- />
144- </ div >
145- </ div >
130+ < DataTable
131+ theme = "yandex-cloud"
132+ data = { nodes || [ ] }
133+ columns = { columns }
134+ settings = { DEFAULT_TABLE_SETTINGS }
135+ initialSortOrder = { {
136+ columnId : 'NodeId' ,
137+ order : DataTable . ASCENDING ,
138+ } }
139+ emptyDataMessage = { i18n ( 'empty.default' ) }
140+ rowClassName = { ( row ) => b ( 'node' , { unavailable : isUnavailableNode ( row ) } ) }
141+ />
146142 ) ;
147143 } ;
148144
149- const renderContent = ( ) => {
150- return (
151- < div className = { b ( null , className ) } >
152- { renderControls ( ) }
153- { renderTable ( ) }
154- </ div >
155- ) ;
156- } ;
157-
158- if ( loading && ! wasLoaded ) {
159- return < Loader size = { isClusterNodes ? 'l' : 'm' } /> ;
160- }
161-
162145 if ( error ) {
163146 if ( error . status === 403 ) {
164147 return < AccessDenied /> ;
165148 }
166- return < div > { error . statusText } </ div > ;
149+ return < ResponseError error = { error } / >;
167150 }
168151
169- return renderContent ( ) ;
152+ return (
153+ < TableWithControlsLayout >
154+ < TableWithControlsLayout . Controls > { renderControls ( ) } </ TableWithControlsLayout . Controls >
155+ < TableWithControlsLayout . Table loading = { loading && ! wasLoaded } className = { b ( 'table' ) } >
156+ { renderTable ( ) }
157+ </ TableWithControlsLayout . Table >
158+ </ TableWithControlsLayout >
159+ ) ;
170160} ;
0 commit comments