File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export default class Browser extends DashboardView {
58
58
newObject : null ,
59
59
60
60
lastError : null ,
61
+ relationCount : 0 ,
61
62
} ;
62
63
}
63
64
@@ -258,6 +259,11 @@ export default class Browser extends DashboardView {
258
259
query . find ( { useMasterKey : true } ) . then ( ( data ) => this . setState ( { data : data , lastMax : 200 } ) ) ;
259
260
}
260
261
262
+ fetchRelationCount ( relation ) {
263
+ let p = this . context . currentApp . getRelationCount ( relation ) ;
264
+ p . then ( ( count ) => this . setState ( { relationCount : count } ) ) ;
265
+ }
266
+
261
267
fetchNextPage ( ) {
262
268
if ( ! this . state . data ) {
263
269
return null ;
@@ -327,8 +333,12 @@ export default class Browser extends DashboardView {
327
333
setRelation ( relation ) {
328
334
this . setState ( {
329
335
relation : relation ,
336
+ relationCount : 0 ,
330
337
selection : { } ,
331
- } , ( ) => this . fetchData ( relation , this . state . filters ) ) ;
338
+ } , ( ) => {
339
+ this . fetchData ( relation , this . state . filters ) ;
340
+ this . fetchRelationCount ( relation ) ;
341
+ } ) ;
332
342
}
333
343
334
344
handlePointerClick ( { className, id } ) {
@@ -541,7 +551,7 @@ export default class Browser extends DashboardView {
541
551
542
552
browser = (
543
553
< DataBrowser
544
- count = { this . state . counts [ className ] }
554
+ count = { this . state . relation ? this . state . relationCount : this . state . counts [ className ] }
545
555
perms = { this . state . clp [ className ] }
546
556
schema = { schema }
547
557
userPointers = { userPointers }
Original file line number Diff line number Diff line change @@ -44,14 +44,15 @@ let BrowserToolbar = ({
44
44
} ) => {
45
45
let selectionLength = Object . keys ( selection ) . length ;
46
46
let details = [ ] ;
47
- if ( ! relation ) {
48
- if ( count !== undefined ) {
47
+ if ( count !== undefined ) {
49
48
if ( count === 1 ) {
50
49
details . push ( '1 object' ) ;
51
50
} else {
52
51
details . push ( prettyNumber ( count ) + ' objects' ) ;
53
52
}
54
- }
53
+ }
54
+
55
+ if ( ! relation ) {
55
56
if ( perms && ! hidePerms ) {
56
57
let read = perms . get && perms . find && perms . get [ '*' ] && perms . find [ '*' ] ;
57
58
let write = perms . create && perms . update && perms . delete && perms . create [ '*' ] && perms . update [ '*' ] && perms . delete [ '*' ] ;
Original file line number Diff line number Diff line change @@ -202,6 +202,12 @@ export default class ParseApp {
202
202
return p ;
203
203
}
204
204
205
+ getRelationCount ( relation ) {
206
+ this . setParseKeys ( ) ;
207
+ let p = relation . query ( ) . count ( { useMasterKey : true } ) ;
208
+ return p ;
209
+ }
210
+
205
211
getAnalyticsRetention ( time ) {
206
212
time = Math . round ( time . getTime ( ) / 1000 ) ;
207
213
return AJAX . abortableGet ( '/apps/' + this . slug + '/analytics_retention?at=' + time ) ;
You can’t perform that action at this time.
0 commit comments