summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2014-05-29 11:36:59 +0000
committerAlex Rudyy <orudyy@apache.org>2014-05-29 11:36:59 +0000
commit7c06267d61b45d9028d634130442ef910135b3f0 (patch)
tree1308cd6f77575366631bb596d06f2bcd92d71596 /qpid/java
parente16f6cc14b3495fc96f132b25b56413ec19a5ce5 (diff)
downloadqpid-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')
-rw-r--r--qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js21
-rw-r--r--qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html8
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js55
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html8
4 files changed, 59 insertions, 33 deletions
diff --git a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js
index da63e031e6..de558048a0 100644
--- a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js
+++ b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js
@@ -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)
diff --git a/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html
index 792305aa8e..c37fa87922 100644
--- a/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html
+++ b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html
@@ -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">
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>