@@ -37,6 +37,7 @@ export class DataViewerComponent implements OnInit, OnChanges {
37
37
public page = {
38
38
pageIndex : 0 ,
39
39
pageSize : 20 ,
40
+ totalSize : 0
40
41
} ;
41
42
cli$ : Observable < any > = null ;
42
43
public data = [ ] ;
@@ -120,7 +121,6 @@ export class DataViewerComponent implements OnInit, OnChanges {
120
121
this . _store . dispatch ( new ReqFetchTree ( { id : this . pageData . id } ) ) ;
121
122
this . hashCachedData = null ;
122
123
this . setCachedData = null ;
123
- this . pageData . item . len -= values . length ;
124
124
this . fetchData ( ) ;
125
125
this . util . showMessage ( 'Deleted successfully.' ) ;
126
126
if ( cb ) { cb ( ) ; }
@@ -178,15 +178,17 @@ export class DataViewerComponent implements OnInit, OnChanges {
178
178
this . showPagination = false ;
179
179
if ( type === 'list' ) {
180
180
this . loadingPageData = true ;
181
- this . redisService . call ( instanceId , [ [ 'LRANGE' , key , start , end ] ] ) . subscribe ( ret => {
181
+ this . redisService . call ( instanceId , [ [ 'LRANGE' , key , start , end ] , [ 'LLEN' , key ] ] ) . subscribe ( ret => {
182
+ this . page . totalSize = ret [ 1 ] ;
182
183
this . data = injectValuesToArray ( ret [ 0 ] ) ;
183
184
this . showPagination = true ;
184
185
this . loadingPageData = false ;
185
186
}
186
187
) ;
187
188
} else if ( type === 'zset' ) {
188
189
this . loadingPageData = true ;
189
- this . redisService . call ( instanceId , [ [ 'ZRANGE' , key , start , end , 'withscores' ] ] ) . subscribe ( ret => {
190
+ this . redisService . call ( instanceId , [ [ 'ZRANGE' , key , start , end , 'withscores' ] , [ 'ZCARD' , key ] ] ) . subscribe ( ret => {
191
+ this . page . totalSize = ret [ 1 ] ;
190
192
this . data = [ ] ;
191
193
for ( let i = 0 ; i < ret [ 0 ] . length ; ) {
192
194
this . data . push ( {
@@ -205,6 +207,7 @@ export class DataViewerComponent implements OnInit, OnChanges {
205
207
this . loadingPageData = true ;
206
208
this . redisService . call ( instanceId , [ [ 'SMEMBERS' , key ] ] ) . subscribe ( ret => {
207
209
this . setCachedData = injectValuesToArray ( ret [ 0 ] ) ;
210
+ this . page . totalSize = this . setCachedData . length ;
208
211
this . data = this . setCachedData . slice ( start , end ) ;
209
212
this . loadingPageData = false ;
210
213
this . showPagination = true ;
@@ -225,6 +228,7 @@ export class DataViewerComponent implements OnInit, OnChanges {
225
228
} ) ;
226
229
i += 2 ;
227
230
}
231
+ this . page . totalSize = this . hashCachedData . length ;
228
232
this . data = this . hashCachedData . slice ( start , end ) ;
229
233
this . loadingPageData = false ;
230
234
this . showPagination = true ;
@@ -277,7 +281,6 @@ export class DataViewerComponent implements OnInit, OnChanges {
277
281
this . _store . dispatch ( new ReqFetchTree ( { id : this . pageData . id } ) ) ;
278
282
this . hashCachedData = null ;
279
283
this . setCachedData = null ;
280
- this . pageData . item . len += ret . len ;
281
284
this . fetchData ( ) ;
282
285
}
283
286
} ;
0 commit comments