activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1428627 - in /activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/console: index.html js/app.js
Date Thu, 03 Jan 2013 21:59:17 GMT
Author: chirino
Date: Thu Jan  3 21:59:16 2013
New Revision: 1428627

URL: http://svn.apache.org/viewvc?rev=1428627&view=rev
Log:
Update the ajax console to display install location and to support creating queues and topics.

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=1428627&r1=1428626&r2=1428627&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 21:59:16 2013
@@ -94,7 +94,7 @@
           <div class="tab-pane active" id="TAB_Virtual_Hosts">
             <div class="form-horizontal">
               <div class="control-group">
-                <label class="control-label" for="select01"><strong style="font-size:170%">Virtual
Host:</strong></label>
+                <label class="control-label"><strong style="font-size:170%">Virtual
Host:</strong></label>
                 <div class="controls">
                   {{view Ember.Select contentBinding="App.broker.virtual_hosts" selectionBinding="App.VirtualHostController.selected"}}
                   <!-- <a class="btn" href="#"><i class="icon-stop icon-white"></i>
Stop</a> -->
@@ -125,13 +125,16 @@
               <div class="span8">
                 {{view Bootstrap.Tabs contentBinding="App.VirtualHostController.tabs" selectionBinding="App.VirtualHostController.selected_tab"}}
                 <div>
+
+                  {{#if App.DestinationsController.show_create_box}}
                   <div class="well form-horizontal">
-                    <label class="control-label" for="select01"><strong>Create:
</strong></label>
+                    <label class="control-label"><strong>Create: </strong></label>
                     <div class="controls">
-                      <input type="text" class="input-xlarge" id="create_queue">
-                      <a class="btn" href="#"><i class="icon-plus-sign icon-white"></i></a>
+                      {{view Ember.TextField class="input-xlarge" placeholder="name" valueBinding="App.DestinationsController.create_name"}}
+                      <a class="btn" href="#" {{action "create" target="App.DestinationsController"
on="click"}}><i class="icon-plus-sign icon-white"></i></a>
                     </div>
                   </div>
+                  {{/if}}
 
                   <table class="details table table-bordered table-striped" style="">
                     <tbody>
@@ -200,10 +203,10 @@
                     <td><strong>Version: </strong>{{App.broker.version}}</td>
                   </tr>
                   <tr>
-                    <td><strong>Installed: </td>
+                    <td><strong>Install Directory: </strong>{{App.broker.home_location}}</td>
                   </tr>
                   <tr>
-                    <td><strong>Configuration: </td>
+                    <td><strong>Instance Directory: </strong>{{App.broker.base_location}}</td>
                   </tr>
                   </tbody>
                 </table>

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=1428627&r1=1428626&r2=1428627&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
21:59:16 2013
@@ -14,25 +14,36 @@ App = Em.Application.create({
     App.BrokerController.refresh();
     App.VirtualHostController.refresh();
   },
-  
-  fetch:function(path, success, error) {
+
+  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();
+    } else {
+      Bootstrap.AlertMessage.create({
+        type:"error",
+        message:xhr.status+": "+thrown
+      }).appendTo("#notifications")
+    }
+  },
+
+  get:function(path, success, error) {
+    this.http("GET", path, success, error)
+  },
+
+  put:function(path, success, error) {
+    this.http("PUT", path, success, error)
+  },
+
+  http:function(type, path, success, error) {
     if( !error ) {
-      error = function(xhr, status, thrown) {
-        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+": "+error
-          }).appendTo("#notifications")
-        }
-      }
+      error = this.default_error_handler;
     }
     $.ajax({
+      type: type,
       url: "../api/json"+path,
       headers: {
         AuthPrompt:'false',
@@ -41,7 +52,7 @@ App = Em.Application.create({
       success: success,
       error: error,
     });
-  }
+  },
 });
 
 App.LoginController = Em.Controller.create({
@@ -89,7 +100,7 @@ App.LoginController = Em.Controller.crea
   },
 
   logout: function() {
-    App.fetch("/session/signout", function(data) {
+    App.get("/session/signout", function(data) {
       App.LoginController.set('content', data);
     });
     this.set('content', null);
@@ -114,7 +125,7 @@ App.LoginController = Em.Controller.crea
   refresh: function(clear) {
     var was_logged_in = this.get('is_logged_in')
     var kind = this.get('kind')
-    App.fetch("/session/whoami", function(data) {
+    App.get("/session/whoami", function(data) {
       App.LoginController.set('content', data);
       if( App.LoginController.get('is_logged_in') ) {
         App.refresh();
@@ -128,7 +139,7 @@ App.LoginController = Em.Controller.crea
 App.broker = Ember.Object.create({});
 App.BrokerController = Ember.Controller.create({
   refresh: function() {
-    App.fetch("/broker", function(json) {
+    App.get("/broker", function(json) {
       App.broker.setProperties(json);
       if( App.VirtualHostController.get('selected') == null && json.virtual_hosts.length
> 0 ) {
         App.VirtualHostController.set('selected', json.virtual_hosts[0]);
@@ -147,10 +158,10 @@ App.VirtualHostController = Em.ArrayCont
   refresh: function() {
     var selected = this.get("selected")
     if( selected ) {
-      App.fetch("/broker/virtual-hosts/"+selected, function(host) {
+      App.get("/broker/virtual-hosts/"+selected, function(host) {
         App.virtual_host.setProperties(host);
         if( host.store ) {
-          App.fetch("/broker/virtual-hosts/"+selected+"/store", function(store) {
+          App.get("/broker/virtual-hosts/"+selected+"/store", function(store) {
             App.virtual_host_store.setProperties(store);
           });
         } 
@@ -161,6 +172,7 @@ App.VirtualHostController = Em.ArrayCont
 
 App.DestinationsController = Ember. ArrayController.create({
   virtual_hostBinding: "App.VirtualHostController.selected",
+  create_name: "",
 
   kind: function(){
     var s = App.VirtualHostController.get('selected_tab');
@@ -184,10 +196,26 @@ App.DestinationsController = Ember. Arra
     }
     var kind = this.get('kind')
     var fields = ['id', 'metrics.queue_items', 'metrics.queue_size', 'metrics.producer_count',
'metrics.consumer_count'];
-    App.fetch("/broker/virtual-hosts/"+virtual_host+"/"+kind+"?ps=10000&f="+fields.join("&f="),
function(data) {
+    App.get("/broker/virtual-hosts/"+virtual_host+"/"+kind+"?ps=10000&f="+fields.join("&f="),
function(data) {
       App.DestinationsController.set('content', data.rows);
     });
-  }.observes("virtual_host", "kind")
+  }.observes("virtual_host", "kind"),
+
+  show_create_box: function(){
+    var kind = this.get('kind');
+    return kind == "queues" || kind == "topics";
+  }.property("kind"),
+
+  create: function() {
+    var virtual_host = this.get('virtual_host');
+    var kind = this.get('kind');
+    var create_name = this.get('create_name');
+    var self = this;
+    App.put("/broker/virtual-hosts/"+virtual_host+"/"+kind+"/"+create_name, function(data)
{
+      self.refresh();
+    });
+  },
+
 });
 
 Ember.View.create({



Mime
View raw message