@@ -21,6 +21,7 @@ import {
2121 setStorageType ,
2222 VisibleEntitiesTitles ,
2323 getStoragePoolsGroupsCount ,
24+ getStorageNodesCount ,
2425} from '../../store/reducers/storage' ;
2526import { getNodesList } from '../../store/reducers/clusterNodes' ;
2627import StorageGroups from './StorageGroups/StorageGroups' ;
@@ -54,6 +55,7 @@ class Storage extends React.Component {
5455 setInitialState : PropTypes . func ,
5556 flatListStorageEntities : PropTypes . array ,
5657 groupsCount : PropTypes . object ,
58+ nodesCount : PropTypes . object ,
5759 setStorageFilter : PropTypes . func ,
5860 setVisibleEntities : PropTypes . func ,
5961 visibleEntities : PropTypes . string ,
@@ -205,28 +207,23 @@ class Storage extends React.Component {
205207 const {
206208 storageType,
207209 groupsCount,
208- flatListStorageEntities ,
210+ nodesCount ,
209211 loading,
210212 wasLoaded,
211213 } = this . props ;
212214
213215 let label = `${ storageType === StorageTypes . groups ? 'Groups' : 'Nodes' } : ` ;
216+ const count = storageType === StorageTypes . groups ? groupsCount : nodesCount ;
214217
215218 if ( loading && ! wasLoaded ) {
216219 label += '...' ;
217220 return label ;
218221 }
219222
220- if ( storageType === StorageTypes . nodes ) {
221- label += flatListStorageEntities . length ;
222- }
223-
224- if ( storageType === StorageTypes . groups ) {
225- if ( groupsCount . total === groupsCount . found ) {
226- label += groupsCount . total ;
227- } else {
228- label += `${ groupsCount . found } out of ${ groupsCount . total } ` ;
229- }
223+ if ( count . total === count . found ) {
224+ label += count . total ;
225+ } else {
226+ label += `${ count . found } of ${ count . total } ` ;
230227 }
231228
232229 return label ;
@@ -309,6 +306,7 @@ function mapStateToProps(state) {
309306 groupsCount : getStoragePoolsGroupsCount ( state ) ,
310307 autorefresh : state . schema . autorefresh ,
311308 nodes : getNodesObject ( state ) ,
309+ nodesCount : getStorageNodesCount ( state ) ,
312310 loading,
313311 wasLoaded,
314312 error,
0 commit comments