From fb03abb7226ab42a6090a967c1748373c3d57e21 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Wed, 25 Feb 2015 08:34:43 +0000 Subject: QPID-6408: [Java Broker] Expose the AMQP connection limits through the web management UI Merged with command: svn merge -c 1661741 https://svn.apache.org/repos/asf/qpid/trunk git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.32@1662181 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/resources/addPort.html | 17 +++++ .../src/main/java/resources/js/qpid/common/util.js | 5 ++ .../main/java/resources/js/qpid/management/Port.js | 13 +++- .../java/resources/js/qpid/management/addPort.js | 15 +++- .../src/main/java/resources/showPort.html | 81 ++++++++++++---------- .../src/main/java/resources/showQueue.html | 2 +- 6 files changed, 95 insertions(+), 38 deletions(-) diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html index b787e701ec..10b79987a5 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html @@ -159,6 +159,23 @@ +
+
+
+ +
+
+ +
+
+
+
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js index 3938b74762..746eb4bbbc 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js @@ -737,6 +737,11 @@ define(["dojo/_base/xhr", return "^(\\d+)|" + singleContextVarRegexp + "$"; } + util.signedOrContextVarRegexp = function(constraints) + { + return "^(-?\\d+)|" + singleContextVarRegexp + "$"; + } + util.nameOrContextVarRegexp = function(constraints) { return "^(\\w+)|" + singleContextVarRegexp + "$"; diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js index 320de8a876..91407c0e83 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js @@ -138,12 +138,15 @@ define(["dojo/dom", "needClientAuthValue", "wantClientAuthValue", "trustStoresValue", + "connectionCountValue", + "maxOpenConnectionsValue", "authenticationProvider", "bindingAddress", "keyStore", "needClientAuth", "wantClientAuth", - "trustStores" + "trustStores", + "maxOpenConnections" ]); this.query = url; @@ -151,6 +154,7 @@ define(["dojo/dom", xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) { that.portData = data[0]; + util.flattenStatistics( that.portData ); that.updateHeader(); }); @@ -178,6 +182,9 @@ define(["dojo/dom", this.protocolsValue.innerHTML = printArray( "protocols", this.portData); this.transportsValue.innerHTML = printArray( "transports", this.portData); this.bindingAddressValue.innerHTML = this.portData[ "bindingAddress" ] ? entities.encode(String(this.portData[ "bindingAddress" ])) : "" ; + this.connectionCountValue.innerHTML = this.portData[ "connectionCount" ] ? entities.encode(String(this.portData[ "connectionCount" ])) : "0" ; + this.maxOpenConnectionsValue.innerHTML = (this.portData[ "maxOpenConnections" ] && this.portData[ "maxOpenConnections" ] >= 0) ? entities.encode(String(this.portData[ "maxOpenConnections" ])) : "(no limit)" ; + this.keyStoreValue.innerHTML = this.portData[ "keyStore" ] ? entities.encode(String(this.portData[ "keyStore" ])) : ""; this.needClientAuthValue.innerHTML = "" ; this.wantClientAuthValue.innerHTML = "" ; @@ -191,6 +198,9 @@ define(["dojo/dom", this.needClientAuth.style.display = "needClientAuth" in typeMetaData.attributes ? "block" : "none"; this.wantClientAuth.style.display = "wantClientAuth" in typeMetaData.attributes ? "block" : "none"; this.trustStores.style.display = "trustStores" in typeMetaData.attributes ? "block" : "none"; + + this.maxOpenConnections.style.display = "maxOpenConnections" in typeMetaData.attributes ? "block" : "none"; + }; PortUpdater.prototype.update = function() @@ -201,6 +211,7 @@ define(["dojo/dom", xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) { thisObj.portData = data[0]; + util.flattenStatistics( thisObj.portData ); thisObj.updateHeader(); }); }; diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js index 43ccdfff70..befb5df9c1 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js @@ -79,6 +79,10 @@ define(["dojo/_base/xhr", registry.byId("formAddPort.bindingAddress").set("disabled", ! ("bindingAddress" in typeMetaData.attributes)); dom.byId("formAddPort:fieldsBindingAddress").style.display = "bindingAddress" in typeMetaData.attributes ? "block" : "none"; + //maxOpenConnections + registry.byId("formAddPort.maxOpenConnections").set("disabled", ! ("maxOpenConnections" in typeMetaData.attributes)); + dom.byId("formAddPort:maxOpenConnections").style.display = "maxOpenConnections" in typeMetaData.attributes ? "block" : "none"; + //transports var transportsMultiSelect = dom.byId("formAddPort.transports"); var transportsValidValues = typeMetaData.attributes.transports.validValues; @@ -314,6 +318,7 @@ define(["dojo/_base/xhr", var nameWidget = registry.byId("formAddPort.name"); var typeWidget = registry.byId("formAddPort.type"); var portWidget = registry.byId("formAddPort.port"); + var maxOpenConnectionsWidget = registry.byId("formAddPort.maxOpenConnections"); var editWarning = dojo.byId("portEditWarning"); var providerWidget = registry.byId("formAddPort.authenticationProvider"); @@ -418,6 +423,13 @@ define(["dojo/_base/xhr", bindAddressWidget.set("disabled", ! ("bindingAddress" in typeMetaData.attributes)); dom.byId("formAddPort:fieldsBindingAddress").style.display = "bindingAddress" in typeMetaData.attributes ? "block" : "none"; + //maxOpenConnections + var maxOpenConnectionsWidget = registry.byId("formAddPort.maxOpenConnections"); + maxOpenConnectionsWidget.set("regExpGen", util.signedOrContextVarRegexp); + maxOpenConnectionsWidget.set("value", port.maxOpenConnections ? port.maxOpenConnections : ""); + maxOpenConnectionsWidget.set("disabled", ! ("maxOpenConnections" in typeMetaData.attributes)); + dom.byId("formAddPort:maxOpenConnections").style.display = "maxOpenConnections" in typeMetaData.attributes ? "block" : "none"; + //ssl keystoreWidget.set("value", port.keyStore ? port.keyStore : ""); if (port.trustStores) @@ -447,6 +459,7 @@ define(["dojo/_base/xhr", truststoreWidget.initialValue = port.trustStores; transportWidget.initialValue = transportWidget.value; providerWidget.initialValue = providerWidget.value; + maxOpenConnectionsWidget.initialValue = maxOpenConnectionsWidget.value; registry.byId("addPort").show(); util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType); @@ -465,8 +478,8 @@ define(["dojo/_base/xhr", nameWidget.set("disabled", false); nameWidget.set("regExpGen", util.nameOrContextVarRegexp); - portWidget.set("regExpGen", util.numericOrContextVarRegexp); + maxOpenConnectionsWidget.set("regExpGen", util.signedOrContextVarRegexp); editWarning.style.display = "none"; registry.byId("addPort").show(); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html index 32071e262d..5e324bd219 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html @@ -25,61 +25,72 @@
Name:
- -
-
Port Type:
-
+
+
+
+
Port Type:
+
+
+
+
+
Open connections (current/maximum):
+
+ / +
+
+
-
+
State:
-
-
+
+
-
+
Port Number:
-
-
+
+
-
+
Protocols:
-
-
+
+
-
Authentication Provider:
-
+
Authentication Provider:
+
-
Binding address:
-
+
Binding address:
+
Transports:
-
-
+
+
-
-
Key Store:
-
-
+
+
Key Store:
+
+
-
-
Need SSL Client Certificate:
-
-
+
+
Need SSL Client Certificate:
+
+
-
-
Want SSL Client Certificate:
-
-
+
+
Want SSL Client Certificate:
+
+
+ +
+
Trust Stores:
+
+
-
-
Trust Stores:
-
-

diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html index a068868e7f..7132dd8105 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html @@ -25,7 +25,7 @@
Name:
-
+
Type:
-- cgit v1.2.1