@@ -231,7 +231,7 @@ var RefreshTokenView = Backbone.View.extend({
231
231
expirationDate = moment ( expirationDate ) . calendar ( ) ;
232
232
}
233
233
234
- var json = { token : this . model . toJSON ( ) , client : this . options . client . toJSON ( ) , formattedExpiration : expirationDate } ;
234
+ var json = { token : this . model . toJSON ( ) , client : this . options . client . toJSON ( ) , formattedExpiration : expirationDate , accessTokenCount : this . options . accessTokenCount } ;
235
235
236
236
this . $el . html ( this . template ( json ) ) ;
237
237
@@ -420,7 +420,7 @@ var TokenListView = Backbone.View.extend({
420
420
421
421
// append and render the table structure
422
422
$ ( this . el ) . html ( $ ( '#tmpl-token-table' ) . html ( ) ) ;
423
-
423
+
424
424
var _self = this ;
425
425
426
426
// set up pagination
@@ -435,6 +435,9 @@ var TokenListView = Backbone.View.extend({
435
435
$ ( '.paginator-access' , this . el ) . hide ( ) ;
436
436
}
437
437
438
+ // count up refresh tokens
439
+ var refreshCount = { } ;
440
+
438
441
_ . each ( this . model . access . models , function ( token , index ) {
439
442
// look up client
440
443
var client = _self . options . clientList . getByClientId ( token . get ( 'clientId' ) ) ;
@@ -444,10 +447,23 @@ var TokenListView = Backbone.View.extend({
444
447
$ ( '#access-token-table' , _self . el ) . append ( element ) ;
445
448
if ( Math . ceil ( ( index + 1 ) / 10 ) != 1 ) {
446
449
$ ( element ) . hide ( ) ;
450
+ }
451
+
452
+ console . log ( token . get ( 'refreshTokenId' ) ) ;
453
+ var refId = token . get ( 'refreshTokenId' ) ;
454
+ if ( refId != null ) {
455
+ if ( refreshCount [ refId ] ) {
456
+ refreshCount [ refId ] += 1 ;
457
+ } else {
458
+ refreshCount [ refId ] = 1 ;
459
+ }
460
+
447
461
}
448
462
449
463
} ) ;
450
-
464
+
465
+ console . log ( refreshCount ) ;
466
+
451
467
// set up pagination
452
468
var numPagesRefresh = Math . ceil ( this . model . refresh . length / 10 ) ;
453
469
if ( numPagesRefresh > 1 ) {
@@ -463,7 +479,7 @@ var TokenListView = Backbone.View.extend({
463
479
_ . each ( this . model . refresh . models , function ( token , index ) {
464
480
// look up client
465
481
var client = _self . options . clientList . getByClientId ( token . get ( 'clientId' ) ) ;
466
- var view = new RefreshTokenView ( { model : token , client : client , systemScopeList : _self . options . systemScopeList } ) ;
482
+ var view = new RefreshTokenView ( { model : token , client : client , systemScopeList : _self . options . systemScopeList , accessTokenCount : refreshCount [ token . get ( 'id' ) ] } ) ;
467
483
view . parentView = _self ;
468
484
var element = view . render ( ) . el ;
469
485
$ ( '#refresh-token-table' , _self . el ) . append ( element ) ;
0 commit comments