fixed client editor lazy loading
parent
f4a1a2acff
commit
6d5a967d8a
|
@ -523,16 +523,16 @@ var AppRouter = Backbone.Router.extend({
|
||||||
displayClientSecret:false,
|
displayClientSecret:false,
|
||||||
requireAuthTime:true,
|
requireAuthTime:true,
|
||||||
defaultMaxAge:60000,
|
defaultMaxAge:60000,
|
||||||
scope: _.uniq(_.flatten(this.systemScopeList.defaultScopes().pluck("value"))),
|
scope: _.uniq(_.flatten(app.systemScopeList.defaultScopes().pluck("value"))),
|
||||||
accessTokenValiditySeconds:3600,
|
accessTokenValiditySeconds:3600,
|
||||||
idTokenValiditySeconds:600,
|
idTokenValiditySeconds:600,
|
||||||
grantTypes: ["authorization_code"],
|
grantTypes: ["authorization_code"],
|
||||||
responseTypes: ["code"],
|
responseTypes: ["code"],
|
||||||
subjectType: "public"
|
subjectType: "PUBLIC"
|
||||||
}, { silent: true });
|
}, { silent: true });
|
||||||
|
|
||||||
|
|
||||||
$('#content').html(this.clientFormView.render().el);
|
$('#content').html(app.clientFormView.render().el);
|
||||||
setPageTitle("New Client");
|
setPageTitle("New Client");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -551,8 +551,24 @@ var AppRouter = Backbone.Router.extend({
|
||||||
{text:"Edit", href:"manage/#admin/client/" + id}
|
{text:"Edit", href:"manage/#admin/client/" + id}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// TODO: this won't load on its own anymore, need to dynamically load the client in question first (don't need to load the rest)
|
||||||
|
|
||||||
var client = this.clientList.get(id);
|
var client = this.clientList.get(id);
|
||||||
|
|
||||||
|
if (client == null) {
|
||||||
|
// it wasn't in the list, try loading the client directly
|
||||||
|
client = new ClientModel({id: id});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#loadingbox').sheet('show');
|
||||||
|
$('#loading').html('<span class="label" id="loading-scopes">Scopes</span> '
|
||||||
|
+ '<span class="label" id="loading-client">Client</span> ');
|
||||||
|
|
||||||
|
// re-sync the client every time
|
||||||
|
client.fetch({
|
||||||
|
success: function(client, response, options) {
|
||||||
|
$('#loading-client').addClass('label-success');
|
||||||
|
|
||||||
if (client.get("clientSecret") == null) {
|
if (client.get("clientSecret") == null) {
|
||||||
client.set({
|
client.set({
|
||||||
requireClientSecret:false
|
requireClientSecret:false
|
||||||
|
@ -570,10 +586,33 @@ var AppRouter = Backbone.Router.extend({
|
||||||
displayClientSecret:false
|
displayClientSecret:false
|
||||||
}, { silent: true });
|
}, { silent: true });
|
||||||
|
|
||||||
this.clientFormView = new ClientFormView({model:client, systemScopeList: this.systemScopeList});
|
app.clientFormView = new ClientFormView({model:client, systemScopeList: app.systemScopeList});
|
||||||
$('#content').html(this.clientFormView.render().el);
|
app.clientFormView.load(function() {
|
||||||
|
console.log("yup!");
|
||||||
|
$('#content').html(app.clientFormView.render().el);
|
||||||
setPageTitle("Edit Client");
|
setPageTitle("Edit Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(model, response, options) {
|
||||||
|
|
||||||
|
//Pull out the response text.
|
||||||
|
var responseJson = JSON.parse(response.responseText);
|
||||||
|
|
||||||
|
//Display an alert with an error message
|
||||||
|
$('#modalAlert div.modal-header').html(responseJson.error);
|
||||||
|
$('#modalAlert div.modal-body').html(responseJson.error_description);
|
||||||
|
|
||||||
|
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
||||||
|
"backdrop" : "static",
|
||||||
|
"keyboard" : true,
|
||||||
|
"show" : true // ensure the modal is shown immediately
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
whiteList:function () {
|
whiteList:function () {
|
||||||
|
|
|
@ -496,6 +496,26 @@ var ClientFormView = Backbone.View.extend({
|
||||||
"change #logoUri input":"previewLogo"
|
"change #logoUri input":"previewLogo"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
load:function(callback) {
|
||||||
|
if (this.options.systemScopeList.isFetched) {
|
||||||
|
$('#loadingbox').sheet('hide');
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.model.get('id') == null) {
|
||||||
|
// only show the box if this is a new client, otherwise the box is already showing
|
||||||
|
$('#loadingbox').sheet('show');
|
||||||
|
$('#loading').html('<span class="label" id="loading-scopes">Scopes</span> ');
|
||||||
|
}
|
||||||
|
|
||||||
|
$.when(this.options.systemScopeList.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}}))
|
||||||
|
.done(function() {
|
||||||
|
$('#loadingbox').sheet('hide');
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
toggleRefreshTokenTimeout:function () {
|
toggleRefreshTokenTimeout:function () {
|
||||||
$("#refreshTokenValidityTime", this.$el).toggle();
|
$("#refreshTokenValidityTime", this.$el).toggle();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue