lazy load for client list
parent
5fdfbbd968
commit
a10761b889
|
@ -14,6 +14,23 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
Backbone.Model.prototype.fetchIfNeeded = function(options) {
|
||||||
|
if (!this.isFetched) {
|
||||||
|
return this.fetch(options);
|
||||||
|
} else {
|
||||||
|
return options.success(this, null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Backbone.Collection.prototype.fetchIfNeeded = function(options) {
|
||||||
|
if (!this.isFetched) {
|
||||||
|
return this.fetch(options);
|
||||||
|
} else {
|
||||||
|
return options.success(this, null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
var URIModel = Backbone.Model.extend({
|
var URIModel = Backbone.Model.extend({
|
||||||
|
|
||||||
validate: function(attrs){
|
validate: function(attrs){
|
||||||
|
@ -418,6 +435,7 @@ var AppRouter = Backbone.Router.extend({
|
||||||
|
|
||||||
// load things in the right order:
|
// load things in the right order:
|
||||||
|
|
||||||
|
$('#loadingbox').show('slow');
|
||||||
$("#loading").html("server configuration");
|
$("#loading").html("server configuration");
|
||||||
var base = $('base').attr('href');
|
var base = $('base').attr('href');
|
||||||
$.getJSON(base + '.well-known/openid-configuration', function(data) {
|
$.getJSON(base + '.well-known/openid-configuration', function(data) {
|
||||||
|
@ -440,10 +458,11 @@ var AppRouter = Backbone.Router.extend({
|
||||||
app.clientStats.fetch({
|
app.clientStats.fetch({
|
||||||
success: function(model, response) {
|
success: function(model, response) {
|
||||||
/**/
|
/**/
|
||||||
$("#content .progress .bar").css("width", "100%");
|
$("#loadingbox .progress .bar").css("width", "100%");
|
||||||
$("#loading").html("console");
|
$("#loading").html("console");
|
||||||
var baseUrl = $.url(app.serverConfiguration.issuer);
|
var baseUrl = $.url(app.serverConfiguration.issuer);
|
||||||
Backbone.history.start({pushState: true, root: baseUrl.attr('relative') + 'manage/'});
|
Backbone.history.start({pushState: true, root: baseUrl.attr('relative') + 'manage/'});
|
||||||
|
$('#loadingbox').hide('slow');
|
||||||
/** /
|
/** /
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -471,9 +490,11 @@ var AppRouter = Backbone.Router.extend({
|
||||||
{text:"Manage Clients", href:"manage/#admin/clients"}
|
{text:"Manage Clients", href:"manage/#admin/clients"}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$('#content').html(this.clientListView.render().el);
|
this.clientListView.load(function() {
|
||||||
this.clientListView.delegateEvents();
|
$('#content').html(app.clientListView.render().el);
|
||||||
|
app.clientListView.delegateEvents();
|
||||||
setPageTitle("Manage Clients");
|
setPageTitle("Manage Clients");
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,24 @@ var ClientListView = Backbone.View.extend({
|
||||||
tagName: 'span',
|
tagName: 'span',
|
||||||
|
|
||||||
initialize:function () {
|
initialize:function () {
|
||||||
//this.model.bind("reset", this.render, this);
|
},
|
||||||
|
|
||||||
|
load:function(callback) {
|
||||||
|
var cleanup = function() {
|
||||||
|
$('#loadingbox').hide('slow');
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#loadingbox').show('slow');
|
||||||
|
$('#loading').html('clients');
|
||||||
|
|
||||||
|
$.when(this.model.fetchIfNeeded(),
|
||||||
|
this.options.whiteListList.fetchIfNeeded(),
|
||||||
|
this.options.stats.fetchIfNeeded(),
|
||||||
|
this.options.systemScopeList.fetchIfNeeded()).done(cleanup);
|
||||||
|
|
||||||
|
//this.model.fetchIfNeeded({success:cleanup});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
events:{
|
events:{
|
||||||
|
|
Loading…
Reference in New Issue