14
14
* See the License for the specific language governing permissions and
15
15
* limitations under the License.
16
16
******************************************************************************/
17
+
18
+ Backbone . Model . prototype . fetchIfNeeded = function ( options ) {
19
+ if ( ! this . isFetched ) {
20
+ return this . fetch ( options ) ;
21
+ } else {
22
+ return options . success ( this , null ) ;
23
+ }
24
+ } ;
25
+ Backbone . Collection . prototype . fetchIfNeeded = function ( options ) {
26
+ if ( ! this . isFetched ) {
27
+ return this . fetch ( options ) ;
28
+ } else {
29
+ return options . success ( this , null ) ;
30
+ }
31
+ } ;
32
+
33
+
17
34
var URIModel = Backbone . Model . extend ( {
18
35
19
36
validate : function ( attrs ) {
@@ -418,11 +435,12 @@ var AppRouter = Backbone.Router.extend({
418
435
419
436
// load things in the right order:
420
437
438
+ $ ( '#loadingbox' ) . show ( 'slow' ) ;
421
439
$ ( "#loading" ) . html ( "server configuration" ) ;
422
440
var base = $ ( 'base' ) . attr ( 'href' ) ;
423
441
$ . getJSON ( base + '.well-known/openid-configuration' , function ( data ) {
424
442
app . serverConfiguration = data ;
425
- /**/
443
+ /** /
426
444
$("#content .progress .bar").css("width", "20%");
427
445
$("#loading").html("scopes");
428
446
app.systemScopeList.fetch({
@@ -440,11 +458,12 @@ var AppRouter = Backbone.Router.extend({
440
458
app.clientStats.fetch({
441
459
success: function(model, response) {
442
460
/**/
443
- $ ( "#content .progress .bar" ) . css ( "width" , "100%" ) ;
461
+ $ ( "#loadingbox .progress .bar" ) . css ( "width" , "100%" ) ;
444
462
$ ( "#loading" ) . html ( "console" ) ;
445
463
var baseUrl = $ . url ( app . serverConfiguration . issuer ) ;
446
464
Backbone . history . start ( { pushState : true , root : baseUrl . attr ( 'relative' ) + 'manage/' } ) ;
447
- /**/
465
+ $ ( '#loadingbox' ) . hide ( 'slow' ) ;
466
+ /** /
448
467
}
449
468
});
450
469
}
@@ -471,9 +490,11 @@ var AppRouter = Backbone.Router.extend({
471
490
{ text :"Manage Clients" , href :"manage/#admin/clients" }
472
491
] ) ;
473
492
474
- $ ( '#content' ) . html ( this . clientListView . render ( ) . el ) ;
475
- this . clientListView . delegateEvents ( ) ;
476
- setPageTitle ( "Manage Clients" ) ;
493
+ this . clientListView . load ( function ( ) {
494
+ $ ( '#content' ) . html ( app . clientListView . render ( ) . el ) ;
495
+ app . clientListView . delegateEvents ( ) ;
496
+ setPageTitle ( "Manage Clients" ) ;
497
+ } ) ;
477
498
478
499
} ,
479
500
0 commit comments