refresh token table displays count of currently active access tokens, closes #554
parent
665df2b29c
commit
343e95d161
|
@ -231,7 +231,7 @@ var RefreshTokenView = Backbone.View.extend({
|
||||||
expirationDate = moment(expirationDate).calendar();
|
expirationDate = moment(expirationDate).calendar();
|
||||||
}
|
}
|
||||||
|
|
||||||
var json = {token: this.model.toJSON(), client: this.options.client.toJSON(), formattedExpiration: expirationDate};
|
var json = {token: this.model.toJSON(), client: this.options.client.toJSON(), formattedExpiration: expirationDate, accessTokenCount: this.options.accessTokenCount};
|
||||||
|
|
||||||
this.$el.html(this.template(json));
|
this.$el.html(this.template(json));
|
||||||
|
|
||||||
|
@ -435,6 +435,9 @@ var TokenListView = Backbone.View.extend({
|
||||||
$('.paginator-access', this.el).hide();
|
$('.paginator-access', this.el).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// count up refresh tokens
|
||||||
|
var refreshCount = {};
|
||||||
|
|
||||||
_.each(this.model.access.models, function (token, index) {
|
_.each(this.model.access.models, function (token, index) {
|
||||||
// look up client
|
// look up client
|
||||||
var client = _self.options.clientList.getByClientId(token.get('clientId'));
|
var client = _self.options.clientList.getByClientId(token.get('clientId'));
|
||||||
|
@ -446,8 +449,21 @@ var TokenListView = Backbone.View.extend({
|
||||||
$(element).hide();
|
$(element).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(token.get('refreshTokenId'));
|
||||||
|
var refId = token.get('refreshTokenId');
|
||||||
|
if (refId != null) {
|
||||||
|
if (refreshCount[refId]) {
|
||||||
|
refreshCount[refId] += 1;
|
||||||
|
} else {
|
||||||
|
refreshCount[refId] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(refreshCount);
|
||||||
|
|
||||||
// set up pagination
|
// set up pagination
|
||||||
var numPagesRefresh = Math.ceil(this.model.refresh.length / 10);
|
var numPagesRefresh = Math.ceil(this.model.refresh.length / 10);
|
||||||
if (numPagesRefresh > 1) {
|
if (numPagesRefresh > 1) {
|
||||||
|
@ -463,7 +479,7 @@ var TokenListView = Backbone.View.extend({
|
||||||
_.each(this.model.refresh.models, function (token, index) {
|
_.each(this.model.refresh.models, function (token, index) {
|
||||||
// look up client
|
// look up client
|
||||||
var client = _self.options.clientList.getByClientId(token.get('clientId'));
|
var client = _self.options.clientList.getByClientId(token.get('clientId'));
|
||||||
var view = new RefreshTokenView({model: token, client: client, systemScopeList: _self.options.systemScopeList});
|
var view = new RefreshTokenView({model: token, client: client, systemScopeList: _self.options.systemScopeList, accessTokenCount: refreshCount[token.get('id')]});
|
||||||
view.parentView = _self;
|
view.parentView = _self;
|
||||||
var element = view.render().el;
|
var element = view.render().el;
|
||||||
$('#refresh-token-table', _self.el).append(element);
|
$('#refresh-token-table', _self.el).append(element);
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
<td>
|
<td>
|
||||||
<span title="<%= client.clientId %>"><%= client.clientName != null ? client.clientName : ( client.clientId.substr(0,8) + '...' ) %></span>
|
<span title="<%= client.clientId %>"><%= client.clientName != null ? client.clientName : ( client.clientId.substr(0,8) + '...' ) %></span>
|
||||||
<div class="client-more-info-block"></div>
|
<div class="client-more-info-block"></div>
|
||||||
|
<span class="label label-info" title="Number of associated access tokens"><%= accessTokenCount %></span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
|
|
Loading…
Reference in New Issue