@@ -18,14 +18,14 @@ import type {PaginatedStorageProps} from './PaginatedStorage';
1818import { StorageNodesControls } from './StorageControls/StorageControls' ;
1919import { PaginatedStorageNodesTable } from './StorageNodes/PaginatedStorageNodesTable' ;
2020import { useStorageNodesSelectedColumns } from './StorageNodes/columns/hooks' ;
21- import type { StorageNodesColumn } from './StorageNodes/columns/types' ;
21+ import type { StorageNodesColumnsSettings } from './StorageNodes/columns/types' ;
2222import { TableGroup } from './TableGroup/TableGroup' ;
2323import { useExpandedGroups } from './TableGroup/useExpandedTableGroups' ;
2424import i18n from './i18n' ;
2525import { b , renderPaginatedTableErrorMessage } from './shared' ;
2626import type { StorageViewContext } from './types' ;
2727import { useStorageQueryParams } from './useStorageQueryParams' ;
28- import { useTableCSSVariables } from './utils' ;
28+ import { useStorageColumnsSettings } from './utils' ;
2929
3030import './Storage.scss' ;
3131
@@ -71,13 +71,14 @@ function StorageNodesComponent({
7171
7272 const viewerNodesHandlerHasGrouping = useViewerNodesHandlerHasGrouping ( ) ;
7373
74+ const { handleDataFetched, columnsSettings} = useStorageColumnsSettings ( ) ;
75+
7476 const { columnsToShow, columnsToSelect, setColumns} = useStorageNodesColumnsToSelect ( {
7577 database,
7678 viewContext,
79+ columnsSettings,
7780 } ) ;
7881
79- const { tableStyle, handleDataFetched} = useTableCSSVariables ( ) ;
80-
8182 const renderControls : RenderControls = ( { totalEntities, foundEntities, inited} ) => {
8283 return (
8384 < StorageNodesControls
@@ -106,8 +107,7 @@ function StorageNodesComponent({
106107 renderErrorMessage = { renderPaginatedTableErrorMessage }
107108 columns = { columnsToShow }
108109 initialEntitiesCount = { initialEntitiesCount }
109- tableStyle = { tableStyle }
110- onDataFetched = { tableStyle ? undefined : handleDataFetched }
110+ onDataFetched = { handleDataFetched }
111111 />
112112 ) ;
113113}
@@ -123,7 +123,7 @@ function GroupedStorageNodesComponent({
123123
124124 const { searchValue, storageNodesGroupByParam, handleShowAllNodes} = useStorageQueryParams ( ) ;
125125
126- const { columnsToShow , columnsToSelect, setColumns} = useStorageNodesColumnsToSelect ( {
126+ const { columnsToSelect, setColumns} = useStorageNodesColumnsToSelect ( {
127127 database,
128128 viewContext,
129129 } ) ;
@@ -184,7 +184,6 @@ function GroupedStorageNodesComponent({
184184 handleShowAllNodes = { handleShowAllNodes }
185185 filterGroup = { name }
186186 filterGroupBy = { storageNodesGroupByParam }
187- columns = { columnsToShow }
188187 initialEntitiesCount = { count }
189188 />
190189 </ TableGroup >
@@ -219,7 +218,7 @@ interface StorageNodesTableGroupContentProps {
219218 handleShowAllNodes : VoidFunction ;
220219 filterGroup : string ;
221220 filterGroupBy ?: NodesGroupByField ;
222- columns : StorageNodesColumn [ ] ;
221+ viewContext ?: StorageViewContext ;
223222 initialEntitiesCount : number ;
224223}
225224
@@ -232,10 +231,15 @@ function StorageNodesTableGroupContent({
232231 handleShowAllNodes,
233232 filterGroup,
234233 filterGroupBy,
235- columns ,
234+ viewContext ,
236235 initialEntitiesCount,
237236} : StorageNodesTableGroupContentProps ) {
238- const { tableStyle, handleDataFetched} = useTableCSSVariables ( ) ;
237+ const { handleDataFetched, columnsSettings} = useStorageColumnsSettings ( ) ;
238+ const { columnsToShow} = useStorageNodesColumnsToSelect ( {
239+ database,
240+ viewContext,
241+ columnsSettings,
242+ } ) ;
239243
240244 return (
241245 < PaginatedStorageNodesTable
@@ -250,20 +254,21 @@ function StorageNodesTableGroupContent({
250254 filterGroup = { filterGroup }
251255 filterGroupBy = { filterGroupBy }
252256 renderErrorMessage = { renderPaginatedTableErrorMessage }
253- columns = { columns }
257+ columns = { columnsToShow }
254258 initialEntitiesCount = { initialEntitiesCount }
255- tableStyle = { tableStyle }
256- onDataFetched = { tableStyle ? undefined : handleDataFetched }
259+ onDataFetched = { handleDataFetched }
257260 />
258261 ) ;
259262}
260263
261264function useStorageNodesColumnsToSelect ( {
262265 database,
263266 viewContext,
267+ columnsSettings,
264268} : {
265269 database ?: string ;
266270 viewContext ?: StorageViewContext ;
271+ columnsSettings ?: StorageNodesColumnsSettings ;
267272} ) {
268273 const additionalNodesProps = useAdditionalNodesProps ( ) ;
269274 const { visibleEntities} = useStorageQueryParams ( ) ;
@@ -273,5 +278,6 @@ function useStorageNodesColumnsToSelect({
273278 visibleEntities,
274279 database,
275280 viewContext,
281+ columnsSettings,
276282 } ) ;
277283}
0 commit comments