Decline requests for resources relying on rebinded state in non HOT states

No point in asking for applications when HA state is STANDBY. For example 404 
response should mean that the resource doesn't exist, not that it's not loaded 
yet.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/9b85ada8
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/9b85ada8
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/9b85ada8

Branch: refs/heads/0.7.0-incubating
Commit: 9b85ada85f00d6e0cec39f6fd3b9776637e5db48
Parents: c765b16
Author: Svetoslav Neykov <[email protected]>
Authored: Wed Mar 4 16:50:00 2015 +0200
Committer: Svetoslav Neykov <[email protected]>
Committed: Thu Mar 19 16:01:29 2015 +0200

----------------------------------------------------------------------
 usage/jsgui/src/main/webapp/assets/js/router.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/9b85ada8/usage/jsgui/src/main/webapp/assets/js/router.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/router.js 
b/usage/jsgui/src/main/webapp/assets/js/router.js
index 485af82..3e38841 100644
--- a/usage/jsgui/src/main/webapp/assets/js/router.js
+++ b/usage/jsgui/src/main/webapp/assets/js/router.js
@@ -89,7 +89,7 @@ define([
         homePage:function (trail) {
             var that = this;
             // render the page after we fetch the collection -- no rendering 
on error
-            this.applications.fetch({success:function () {
+            function render() {
                 var homeView = new HomeView({
                     collection:that.applications,
                     locations:that.locations,
@@ -97,6 +97,9 @@ define([
                 });
                 var veryFirstViewLoad = !that.currentView;
                 that.showView("#application-content", homeView);
+            }
+            this.applications.fetch({success:function () {
+                render();
                 // show add application wizard if none already exist and this 
is the first page load
                 if ((veryFirstViewLoad && trail=='auto' && 
that.applications.isEmpty()) ||
                      (trail=='add_application') ) {
@@ -106,7 +109,7 @@ define([
                         }
                     });
                 }
-            }})
+            }, error: render});
         },
         applicationsPage:function (app, trail, tab) {
             if (trail === undefined) trail = app

Reply via email to