diff options
| author | Alex Rudyy <orudyy@apache.org> | 2014-05-29 11:36:59 +0000 |
|---|---|---|
| committer | Alex Rudyy <orudyy@apache.org> | 2014-05-29 11:36:59 +0000 |
| commit | 7c06267d61b45d9028d634130442ef910135b3f0 (patch) | |
| tree | 1308cd6f77575366631bb596d06f2bcd92d71596 /qpid/java/broker-plugins | |
| parent | e16f6cc14b3495fc96f132b25b56413ec19a5ce5 (diff) | |
| download | qpid-python-7c06267d61b45d9028d634130442ef910135b3f0.tar.gz | |
QPID-5413: [Java Broker-Web Management] Allow stopping and starting of virtual host node from the virtual host node tab
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1598257 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
2 files changed, 57 insertions, 6 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js index b608663512..f34b2df8a8 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js @@ -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" ])); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html index 2559dd98f9..f5643eebfd 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html @@ -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> |
