99 useViewerNodesHandlerHasGrouping ,
1010} from '../../store/reducers/capabilities/hooks' ;
1111import { storageApi } from '../../store/reducers/storage/storage' ;
12+ import type { NodesGroupByField } from '../../types/api/nodes' ;
1213import { useAutoRefreshInterval } from '../../utils/hooks' ;
1314import { useAdditionalNodesProps } from '../../utils/hooks/useAdditionalNodesProps' ;
1415import { NodesUptimeFilterValues } from '../../utils/nodes' ;
@@ -17,12 +18,14 @@ import type {PaginatedStorageProps} from './PaginatedStorage';
1718import { StorageNodesControls } from './StorageControls/StorageControls' ;
1819import { PaginatedStorageNodesTable } from './StorageNodes/PaginatedStorageNodesTable' ;
1920import { useStorageNodesSelectedColumns } from './StorageNodes/columns/hooks' ;
21+ import type { StorageNodesColumnsSettings } from './StorageNodes/columns/types' ;
2022import { TableGroup } from './TableGroup/TableGroup' ;
2123import { useExpandedGroups } from './TableGroup/useExpandedTableGroups' ;
2224import i18n from './i18n' ;
2325import { b , renderPaginatedTableErrorMessage } from './shared' ;
2426import type { StorageViewContext } from './types' ;
2527import { useStorageQueryParams } from './useStorageQueryParams' ;
28+ import { useStorageColumnsSettings } from './utils' ;
2629
2730import './Storage.scss' ;
2831
@@ -68,9 +71,12 @@ function StorageNodesComponent({
6871
6972 const viewerNodesHandlerHasGrouping = useViewerNodesHandlerHasGrouping ( ) ;
7073
74+ const { handleDataFetched, columnsSettings} = useStorageColumnsSettings ( ) ;
75+
7176 const { columnsToShow, columnsToSelect, setColumns} = useStorageNodesColumnsToSelect ( {
7277 database,
7378 viewContext,
79+ columnsSettings,
7480 } ) ;
7581
7682 const renderControls : RenderControls = ( { totalEntities, foundEntities, inited} ) => {
@@ -101,6 +107,7 @@ function StorageNodesComponent({
101107 renderErrorMessage = { renderPaginatedTableErrorMessage }
102108 columns = { columnsToShow }
103109 initialEntitiesCount = { initialEntitiesCount }
110+ onDataFetched = { handleDataFetched }
104111 />
105112 ) ;
106113}
@@ -116,7 +123,7 @@ function GroupedStorageNodesComponent({
116123
117124 const { searchValue, storageNodesGroupByParam, handleShowAllNodes} = useStorageQueryParams ( ) ;
118125
119- const { columnsToShow , columnsToSelect, setColumns} = useStorageNodesColumnsToSelect ( {
126+ const { columnsToSelect, setColumns} = useStorageNodesColumnsToSelect ( {
120127 database,
121128 viewContext,
122129 } ) ;
@@ -168,19 +175,15 @@ function GroupedStorageNodesComponent({
168175 expanded = { isExpanded }
169176 onIsExpandedChange = { setIsGroupExpanded }
170177 >
171- < PaginatedStorageNodesTable
178+ < StorageNodesTableGroupContent
172179 database = { database }
173180 parentRef = { parentRef }
174181 nodeId = { nodeId }
175182 groupId = { groupId }
176183 searchValue = { searchValue }
177- visibleEntities = { 'all' }
178- nodesUptimeFilter = { NodesUptimeFilterValues . All }
179- onShowAll = { handleShowAllNodes }
184+ handleShowAllNodes = { handleShowAllNodes }
180185 filterGroup = { name }
181186 filterGroupBy = { storageNodesGroupByParam }
182- renderErrorMessage = { renderPaginatedTableErrorMessage }
183- columns = { columnsToShow }
184187 initialEntitiesCount = { count }
185188 />
186189 </ TableGroup >
@@ -206,12 +209,66 @@ function GroupedStorageNodesComponent({
206209 ) ;
207210}
208211
212+ interface StorageNodesTableGroupContentProps {
213+ database ?: string ;
214+ parentRef : React . RefObject < HTMLElement > ;
215+ nodeId ?: string | number ;
216+ groupId ?: string | number ;
217+ searchValue : string ;
218+ handleShowAllNodes : VoidFunction ;
219+ filterGroup : string ;
220+ filterGroupBy ?: NodesGroupByField ;
221+ viewContext ?: StorageViewContext ;
222+ initialEntitiesCount : number ;
223+ }
224+
225+ function StorageNodesTableGroupContent ( {
226+ database,
227+ parentRef,
228+ nodeId,
229+ groupId,
230+ searchValue,
231+ handleShowAllNodes,
232+ filterGroup,
233+ filterGroupBy,
234+ viewContext,
235+ initialEntitiesCount,
236+ } : StorageNodesTableGroupContentProps ) {
237+ const { handleDataFetched, columnsSettings} = useStorageColumnsSettings ( ) ;
238+ const { columnsToShow} = useStorageNodesColumnsToSelect ( {
239+ database,
240+ viewContext,
241+ columnsSettings,
242+ } ) ;
243+
244+ return (
245+ < PaginatedStorageNodesTable
246+ database = { database }
247+ parentRef = { parentRef }
248+ nodeId = { nodeId }
249+ groupId = { groupId }
250+ searchValue = { searchValue }
251+ visibleEntities = { 'all' }
252+ nodesUptimeFilter = { NodesUptimeFilterValues . All }
253+ onShowAll = { handleShowAllNodes }
254+ filterGroup = { filterGroup }
255+ filterGroupBy = { filterGroupBy }
256+ renderErrorMessage = { renderPaginatedTableErrorMessage }
257+ columns = { columnsToShow }
258+ initialEntitiesCount = { initialEntitiesCount }
259+ onDataFetched = { handleDataFetched }
260+ />
261+ ) ;
262+ }
263+
209264function useStorageNodesColumnsToSelect ( {
210265 database,
211266 viewContext,
267+ columnsSettings,
212268} : {
213269 database ?: string ;
214270 viewContext ?: StorageViewContext ;
271+ columnsSettings ?: StorageNodesColumnsSettings ;
215272} ) {
216273 const additionalNodesProps = useAdditionalNodesProps ( ) ;
217274 const { visibleEntities} = useStorageQueryParams ( ) ;
@@ -221,5 +278,6 @@ function useStorageNodesColumnsToSelect({
221278 visibleEntities,
222279 database,
223280 viewContext,
281+ columnsSettings,
224282 } ) ;
225283}
0 commit comments