You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2013/01/04 00:43:15 UTC

svn commit: r1428674 - in /activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console: index.html js/app.js

Author: chirino
Date: Thu Jan  3 23:43:15 2013
New Revision: 1428674

URL: http://svn.apache.org/viewvc?rev=1428674&view=rev
Log:
Trap and track broker online/offline status.

Modified:
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html?rev=1428674&r1=1428673&r2=1428674&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/index.html Thu Jan  3 23:43:15 2013
@@ -61,6 +61,11 @@
 </div>
 <div class="container" style="padding-top:51px;">
   <div class="row" id="notifications" style="padding-top: 1em;" >
+    <script type="text/x-handlebars" data-template-name="notifications">
+    {{#if App.BrokerController.offline}}
+    <div class="alert alert-message alert-error">Currently having trouble connecting to the broker...</div>
+    {{/if}}
+    </script>
   </div>
   <div id="content-holder" class="row">
   <script type="text/x-handlebars" data-template-name="content">

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js?rev=1428674&r1=1428673&r2=1428674&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console/js/app.js Thu Jan  3 23:43:15 2013
@@ -16,17 +16,22 @@ App = Em.Application.create({
   },
 
   default_error_handler:function(xhr, status, thrown) {
-    if( xhr.status == 401 ) {
-      Bootstrap.AlertMessage.create({
-        type:"warning",
-        message:"Action not authorized."
-      }).appendTo("#notifications")
-      App.LoginController.refresh();
+    if( xhr.status == 0 ) {
+      App.BrokerController.set("offline", true);
     } else {
-      Bootstrap.AlertMessage.create({
-        type:"error",
-        message:xhr.status+": "+thrown
-      }).appendTo("#notifications")
+      App.BrokerController.set("offline", false);
+      if( xhr.status == 401 ) {
+        Bootstrap.AlertMessage.create({
+          type:"warning",
+          message:"Action not authorized."
+        }).appendTo("#notifications")
+        App.LoginController.refresh();
+      } else {
+        Bootstrap.AlertMessage.create({
+          type:"error",
+          message:xhr.status+": "+thrown
+        }).appendTo("#notifications")
+      }
     }
   },
 
@@ -41,7 +46,12 @@ App = Em.Application.create({
         AuthPrompt:'false',
       },
       dataType: 'json',
-      success: success,
+      success: function(data, textStatus, jqXHR){
+        App.BrokerController.set("offline", false);
+        if( success ) {
+          success(data, textStatus, jqXHR)
+        }
+      },
       error: error,
     });
   },
@@ -130,6 +140,7 @@ App.LoginController = Em.Controller.crea
 
 App.broker = Ember.Object.create({});
 App.BrokerController = Ember.Controller.create({
+  offline:false,
   refresh: function() {
     App.ajax("GET", "/broker", function(json) {
       App.broker.setProperties(json);
@@ -235,6 +246,10 @@ App.DestinationsController = Ember. Arra
 });
 
 Ember.View.create({
+  templateName: 'notifications',
+}).appendTo("#notifications");
+
+Ember.View.create({
   templateName: 'navbar',
 }).appendTo("#navbar-holder");