@@ -20,6 +20,7 @@ import {
2020 StorageTypes ,
2121 setStorageType ,
2222 VisibleEntitiesTitles ,
23+ getStoragePoolsGroupsCount ,
2324} from '../../store/reducers/storage' ;
2425import { getNodesList } from '../../store/reducers/clusterNodes' ;
2526import StorageGroups from './StorageGroups/StorageGroups' ;
@@ -52,6 +53,7 @@ class Storage extends React.Component {
5253 getStorageInfo : PropTypes . func ,
5354 setInitialState : PropTypes . func ,
5455 flatListStorageEntities : PropTypes . array ,
56+ groupsCount : PropTypes . object ,
5557 setStorageFilter : PropTypes . func ,
5658 setVisibleEntities : PropTypes . func ,
5759 visibleEntities : PropTypes . string ,
@@ -199,10 +201,44 @@ class Storage extends React.Component {
199201 setStorageType ( value ) ;
200202 } ;
201203
204+ renderEntitiesCount ( ) {
205+ const {
206+ storageType,
207+ groupsCount,
208+ flatListStorageEntities,
209+ loading,
210+ wasLoaded,
211+ } = this . props ;
212+
213+ let label = `${ storageType === StorageTypes . groups ? 'Groups' : 'Nodes' } : ` ;
214+
215+ if ( loading && ! wasLoaded ) {
216+ label += '...' ;
217+ return label ;
218+ }
219+
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+ }
230+ }
231+
232+ return label ;
233+ }
234+
202235 renderControls ( ) {
203- const { setStorageFilter, visibleEntities, storageType, flatListStorageEntities, loading, wasLoaded} =
204- this . props ;
205- const showLoader = loading && ! wasLoaded ;
236+ const {
237+ setStorageFilter,
238+ visibleEntities,
239+ storageType,
240+ } = this . props ;
241+
206242 return (
207243 < div className = { b ( 'controls' ) } >
208244 < div className = { b ( 'search' ) } >
@@ -231,9 +267,9 @@ class Storage extends React.Component {
231267 { StorageTypes . nodes }
232268 </ RadioButton . Option >
233269 </ RadioButton >
234- < Label theme = "info" size = "m" > { ` ${
235- storageType === StorageTypes . groups ? 'Groups' : 'Nodes'
236- } : ${ ( showLoader ) ? '...' : flatListStorageEntities . length } ` } </ Label >
270+ < Label theme = "info" size = "m" >
271+ { this . renderEntitiesCount ( ) }
272+ </ Label >
237273 </ div >
238274 ) ;
239275 }
@@ -270,6 +306,7 @@ function mapStateToProps(state) {
270306
271307 return {
272308 flatListStorageEntities : getFilteredEntities ( state ) ,
309+ groupsCount : getStoragePoolsGroupsCount ( state ) ,
273310 autorefresh : state . schema . autorefresh ,
274311 nodes : getNodesObject ( state ) ,
275312 loading,
0 commit comments