summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins/management-http
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2014-12-28 19:26:55 +0000
committerKeith Wall <kwall@apache.org>2014-12-28 19:26:55 +0000
commitb0175c7154a5025c0e98c7fff7d3a59f5fb4a405 (patch)
treea018d1493b43caf48c697f4fe4c327f64cdba1bb /qpid/java/broker-plugins/management-http
parentf8f58ec7e1e5517ff0a3ecc25248fa636b67a393 (diff)
downloadqpid-python-b0175c7154a5025c0e98c7fff7d3a59f5fb4a405.tar.gz
QPID-6290: [Java Broker] Management UI - refactor add VHN/VH to remove type based conditional logic
* Also removed now defunct Broker attributes #supportedVirtualHostNodeTypes and #supportedVirtualHostTypes git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1648245 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http')
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java2
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js6
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js78
3 files changed, 25 insertions, 61 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
index 1e795480fc..9460c7a64e 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
@@ -54,8 +54,6 @@ public class HelperServlet extends AbstractServlet
_mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
Action[] supportedActions = {
- new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOSTNODE_TYPES, "ListVirtualHostNodeTypes"),
- new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOST_TYPES, "ListVirtualHostTypes"),
new ListBrokerAttribute(Broker.SUPPORTED_PREFERENCES_PROVIDER_TYPES, "ListPreferencesProvidersTypes"),
new ListBrokerAttribute(Broker.PRODUCT_VERSION, "version"),
new ListGroupProviderAttributes(),
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
index 749b9b89cb..c62ba5d5d4 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
@@ -69,7 +69,13 @@ define(["dojo/_base/xhr",
implementsManagedInterface: function (category, type, managedInterfaceName)
{
return this.getMetaData(category, type).managedInterfaces.indexOf(managedInterfaceName) >= 0;
+ },
+ validChildTypes: function (category, type, childCategory)
+ {
+ var metaData = this.getMetaData(category, type);
+ return metaData ? metaData.validChildTypes[childCategory] : [];
}
+
};
metadata._init();
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
index b54d7bb778..f379361a09 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
@@ -90,24 +90,15 @@ define(["dojo/_base/xhr",
this.virtualHostType.set("disabled", true);
- this.supportedVirtualHostNodeTypes = metadata.getTypesForCategory("VirtualHostNode");
- this.supportedVirtualHostNodeTypes.sort();
- this.supportedVirtualHostTypes = metadata.getTypesForCategory("VirtualHost");
- this.supportedVirtualHostTypes.sort();
-
- //VH Type BDB_HA_REPLICA is not user creatable. This is only needed until we have model meta data available.
- this.supportedVirtualHostTypes = array.filter(this.supportedVirtualHostTypes, function(item){
- return item != "BDB_HA_REPLICA" && item != "BDB_HA";
- });
+ var supportedVirtualHostNodeTypes = metadata.getTypesForCategory("VirtualHostNode");
+ supportedVirtualHostNodeTypes.sort();
- var virtualHostNodeTypeStore = util.makeTypeStore(this.supportedVirtualHostNodeTypes);
+ var virtualHostNodeTypeStore = util.makeTypeStore(supportedVirtualHostNodeTypes);
this.virtualHostNodeType.set("store", virtualHostNodeTypeStore);
this.virtualHostNodeType.set("disabled", false);
this.virtualHostNodeType.on("change", function(type){that._vhnTypeChanged(type, that.virtualHostNodeTypeFieldsContainer, "qpid/management/virtualhostnode/");});
- this.virtualHostTypeStore = util.makeTypeStore(this.supportedVirtualHostTypes);
- this.virtualHostType.set("store", this.virtualHostTypeStore);
- this.virtualHostType.set("disabled", false);
+ this.virtualHostType.set("disabled", true);
this.virtualHostType.on("change", function(type){that._vhTypeChanged(type, that.virtualHostTypeFieldsContainer, "qpid/management/virtualhost/");});
if (this.reader)
@@ -191,8 +182,21 @@ define(["dojo/_base/xhr",
},
_vhnTypeChanged: function (type, typeFieldsContainer, urlStem)
{
- this._processDropDownsForBdbHa(type);
- this._processDropDownsForJson(type);
+ var validChildTypes = metadata.validChildTypes("VirtualHostNode", type, "VirtualHost");
+ validChildTypes.sort();
+
+ var virtualHostTypeStore = util.makeTypeStore( validChildTypes );
+
+ this.virtualHostType.set("store", virtualHostTypeStore);
+ this.virtualHostType.set("disabled", validChildTypes.length <= 1);
+ if (validChildTypes.length == 1)
+ {
+ this.virtualHostType.set("value", validChildTypes[0]);
+ }
+ else
+ {
+ this.virtualHostType.reset();
+ }
var vhnTypeSelected = !(type == '');
this.virtualHostNodeUploadFields.style.display = vhnTypeSelected ? "block" : "none";
@@ -272,50 +276,6 @@ define(["dojo/_base/xhr",
this.addButton.set("disabled", false);
this.virtualHostNodeSelectedFileStatusContainer.className = "loadedIcon";
},
- _processDropDownsForBdbHa: function (type)
- {
- if (type == "BDB_HA")
- {
- this.virtualHostType.set("disabled", true);
- if (!this.virtualHostTypeStore.get("BDB_HA"))
- {
- this.virtualHostTypeStore.add({id: "BDB_HA", name: "BDB_HA"});
- }
- this.virtualHostType.set("value", "BDB_HA");
- }
- else
- {
- if (this.virtualHostTypeStore.get("BDB_HA"))
- {
- this.virtualHostTypeStore.remove("BDB_HA");
- }
- this.virtualHostType.set("value", "");
-
- this.virtualHostType.set("disabled", false);
- }
- },
- _processDropDownsForJson: function (type)
- {
- if (type == "JSON")
- {
- if (this.virtualHostType.value == "ProvidedStore")
- {
- this.virtualHostType.set("value", "");
- }
-
- if (this.virtualHostTypeStore.get("ProvidedStore"))
- {
- this.virtualHostTypeStore.remove("ProvidedStore");
- }
- }
- else
- {
- if (!this.virtualHostTypeStore.get("ProvidedStore"))
- {
- this.virtualHostTypeStore.add({id: "ProvidedStore", name: "ProvidedStore"});
- }
- }
- },
_cancel: function(e)
{
if (this.reader)