Author: orudyy
Date: Thu May 29 11:36:59 2014
New Revision: 1598257

URL: http://svn.apache.org/r1598257
Log:
QPID-5413: [Java Broker-Web Management] Allow stopping and starting of virtual 
host node from the virtual host node tab

Modified:
    
qpid/trunk/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js
    
qpid/trunk/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html
    
qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
    
qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html

Modified: 
qpid/trunk/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js?rev=1598257&r1=1598256&r2=1598257&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js
 (original)
+++ 
qpid/trunk/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js
 Thu May 29 11:36:59 2014
@@ -181,30 +181,13 @@ define(["dojo/_base/xhr",
             }
           }
       );
-
-      this.stopNodeButton = registry.byNode(findNode("stopNodeButton", 
containerNode));
-      this.startNodeButton = registry.byNode(findNode("startNodeButton", 
containerNode));
-      this.editNodeButton = registry.byNode(findNode("editNodeButton", 
containerNode));
-      this.editNodeButton.on("click",
+      this.parent.editNodeButton.set("disabled", false);
+      this.parent.editNodeButton.on("click",
           function(e)
           {
             edit.show(that.data.name);
           }
       );
-      this.deleteNodeButton = registry.byNode(query(".deleteNodeButton", 
containerNode)[0]);
-      this.deleteNodeButton.on("click",
-          function(e)
-          {
-            if (confirm("Deletion of virtual host node will delete both 
configuration and message data.\n\n Are you sure you want to delete virtual 
host node?"))
-            {
-              if (sendRequest(that.data.name, that.data.name, "DELETE"))
-              {
-                that.parent.destroy();
-              }
-            }
-          }
-      );
-
     }
 
     BDBHA.prototype.update=function(data)

Modified: 
qpid/trunk/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html?rev=1598257&r1=1598256&r2=1598257&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html
 (original)
+++ 
qpid/trunk/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html
 Thu May 29 11:36:59 2014
@@ -64,14 +64,6 @@
     <div class="replicatedEnvironmentConfiguration"></div>
   </div>
   <div style="clear:both"></div>
-  <div class="dijitDialogPaneActionBar">
-      <button data-dojo-type="dijit.form.Button" class="startNodeButton" 
type="button" data-dojo-props="disabled: true">Start</button>
-      <button data-dojo-type="dijit.form.Button" class="stopNodeButton" 
type="button" data-dojo-props="disabled: true">Stop</button>
-      <button data-dojo-type="dijit.form.Button" class="editNodeButton" 
type="button">Edit</button>
-      <button data-dojo-type="dijit.form.Button" class="deleteNodeButton" 
data-dojo-props="iconClass: 'dijitIconDelete'">Delete Node</button>
-  </div>
-
-  <br/>
   <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Group nodes'" 
class="membersGridPanel">
       <div class="groupMembers"></div>
       <div class="groupMembersToolbar dijitDialogPaneActionBar">

Modified: 
qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js?rev=1598257&r1=1598256&r2=1598257&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
 (original)
+++ 
qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
 Thu May 29 11:36:59 2014
@@ -56,15 +56,57 @@ define(["dojo/_base/xhr",
                         load:  function(data) {
                             contentPane.containerNode.innerHTML = data;
                             parser.parse(contentPane.containerNode);
-
-                            that.vhostNodeUpdater = new 
Updater(contentPane.containerNode, that.modelObj, that);
-                            that.vhostNodeUpdater.update();
-
-                            updater.add( that.vhostNodeUpdater );
+                            that.onOpen(contentPane.containerNode)
                        }});
 
            };
 
+           VirtualHostNode.prototype.onOpen = function(containerNode)
+           {
+             var that = this;
+             this.stopNodeButton = registry.byNode(query(".stopNodeButton", 
containerNode)[0]);
+             this.startNodeButton = registry.byNode(query(".startNodeButton", 
containerNode)[0]);
+             this.editNodeButton = registry.byNode(query(".editNodeButton", 
containerNode)[0]);
+             this.deleteNodeButton = 
registry.byNode(query(".deleteNodeButton", containerNode)[0]);
+             this.deleteNodeButton.on("click",
+                 function(e)
+                 {
+                   if (confirm("Deletion of virtual host node will delete both 
configuration and message data.\n\n"
+                           + "Are you sure you want to delete virtual host 
node '" + entities.encode(String(that.name)) + "'?"))
+                   {
+                     if (util.sendRequest("api/latest/virtualhostnode/" + 
encodeURIComponent( that.name) , "DELETE"))
+                     {
+                       that.destroy();
+                     }
+                   }
+                 }
+             );
+             this.startNodeButton.on("click",
+               function(event)
+               {
+                 that.startNodeButton.set("disabled", true);
+                 util.sendRequest("api/latest/virtualhostnode/" + 
encodeURIComponent(that.name),
+                         "PUT", {desiredState: "ACTIVE"});
+               });
+
+             this.stopNodeButton.on("click",
+               function(event)
+               {
+                 if (confirm("Stopping the node will also shutdown the virtual 
host. "
+                         + "Are you sure you want to stop virtual host node '"
+                         + entities.encode(String(that.name)) +"'?"))
+                 {
+                     that.stopNodeButton.set("disabled", true);
+                     util.sendRequest("api/latest/virtualhostnode/" + 
encodeURIComponent(that.name),
+                             "PUT", {desiredState: "STOPPED"});
+                 }
+               });
+             this.vhostNodeUpdater = new Updater(containerNode, this.modelObj, 
this);
+             this.vhostNodeUpdater.update();
+
+             updater.add( this.vhostNodeUpdater );
+           }
+
            VirtualHostNode.prototype.close = function()
            {
                updater.remove( this.vhostNodeUpdater );
@@ -115,6 +157,9 @@ define(["dojo/_base/xhr",
 
            Updater.prototype.updateUI = function(data)
            {
+             this.virtualHostNode.startNodeButton.set("disabled", data.state 
!= "STOPPED");
+             this.virtualHostNode.stopNodeButton.set("disabled", data.state != 
"ACTIVE");
+
              this.name.innerHTML = entities.encode(String(data[ "name" ]));
              this.state.innerHTML = entities.encode(String(data[ "state" ]));
              this.type.innerHTML = entities.encode(String(data[ "type" ]));

Modified: 
qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html?rev=1598257&r1=1598256&r2=1598257&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html
 (original)
+++ 
qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html
 Thu May 29 11:36:59 2014
@@ -42,7 +42,13 @@
         <div class="virtualhostnodedetails" style="clear:both">
         </div>
         <div style="clear:both"></div>
-      </div>
+    </div>
+    <div class="dijitDialogPaneActionBar">
+      <button data-dojo-type="dijit.form.Button" class="startNodeButton" 
type="button" data-dojo-props="disabled: true">Start</button>
+      <button data-dojo-type="dijit.form.Button" class="stopNodeButton" 
type="button" data-dojo-props="disabled: true">Stop</button>
+      <button data-dojo-type="dijit.form.Button" class="editNodeButton" 
type="button" data-dojo-props="disabled: true">Edit</button>
+      <button data-dojo-type="dijit.form.Button" class="deleteNodeButton" 
data-dojo-props="iconClass: 'dijitIconDelete'">Delete</button>
+    </div>
     <br/>
 </div>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to