From cb1fbd9ab2250ea775f7c1783339dfaf42dbd3bd Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Thu, 17 Jul 2014 10:24:52 +0000 Subject: QPID-5413: [Java Broker] Add VHN/VH creation dialog for BDB HA. Work completed by Andrew MacBean and me. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1611314 13f79535-47bb-0310-9956-ffa450edef68 --- .../js/qpid/management/virtualhost/bdb_ha/add.js | 39 +++++++ .../virtualhost/bdb_ha/addVirtualHost.js | 51 --------- .../qpid/management/virtualhostnode/bdb_ha/add.js | 77 +++++++------- .../bdb_ha/add/existinggroup/add.js | 39 +++++++ .../virtualhostnode/bdb_ha/add/newgroup/add.js | 52 +++++++++ .../java/resources/virtualhost/bdb_ha/add.html | 78 +------------- .../java/resources/virtualhostnode/bdb_ha/add.html | 87 +++------------ .../bdb_ha/add/existinggroup/add.html | 117 +++++++++++++++++++++ .../virtualhostnode/bdb_ha/add/newgroup/add.html | 81 ++++++++++++++ .../src/main/java/resources/css/common.css | 10 +- .../management/addVirtualHostNodeAndVirtualHost.js | 74 ++++++++++--- 11 files changed, 455 insertions(+), 250 deletions(-) create mode 100644 qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js delete mode 100644 qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/addVirtualHost.js create mode 100644 qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/existinggroup/add.js create mode 100644 qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/newgroup/add.js create mode 100644 qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add/existinggroup/add.html create mode 100644 qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add/newgroup/add.html diff --git a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js new file mode 100644 index 0000000000..093f63af35 --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +define(["dojo/_base/xhr", + "dojo/parser", + "dojo/dom", + "dojo/dom-construct", + "dojo/json", + "dijit/registry", + "dojo/text!virtualhost/bdb_ha/add.html", + "dijit/form/ValidationTextBox", + "dijit/form/CheckBox", + "dojo/domReady!"], + function (xhr, parser, dom, domConstruct, json, registry, template) + { + return { + show: function(data) + { + this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); + parser.parse(this.containerNode); + } + }; + } +); diff --git a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/addVirtualHost.js b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/addVirtualHost.js deleted file mode 100644 index 44ad5fa57a..0000000000 --- a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/addVirtualHost.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/domReady!"], - function (xhr, dom, construct, win, registry, parser, array) { - return { - show: function() { - - var node = dom.byId("addVirtualHost.typeSpecificDiv"); - var that = this; - - array.forEach(registry.toArray(), - function(item) { - if(item.id.substr(0,27) == "formAddVirtualHost.specific") { - item.destroyRecursive(); - } - }); - - xhr.get({url: "virtualhost/bdb_ha/add.html", - sync: true, - load: function(data) { - node.innerHTML = data; - parser.parse(node); - }}); - } - }; - }); diff --git a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js index 83ae7e21cd..6431ddb6db 100644 --- a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js +++ b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js @@ -20,6 +20,7 @@ */ define(["dojo/_base/xhr", "dojo/parser", + "dojo/_base/array", "dojo/dom", "dojo/dom-construct", "dojo/json", @@ -28,46 +29,48 @@ define(["dojo/_base/xhr", "dijit/form/ValidationTextBox", "dijit/form/RadioButton", "dojo/domReady!"], - function (xhr, parser, dom, domConstruct, json, registry, template) + function (xhr, parser, array, dom, domConstruct, json, registry, template) { + return { + show: function(data) + { + var that=this; - var nodeFields = ["address", "helperAddress", "joinGroup", "newGroup"]; + this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); + parser.parse(this.containerNode); - return { - show: function(data) - { - var that = this; - this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); - parser.parse(this.containerNode); - for(var i=0; i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path to store location*: - -
Node Name*: - -
Replication Group*: - -
Node Address*: - -
Helper Address*: - -
Durability: - -
Coalesce local sync: - - - -
Designated Primary: - - -
+
+
+
The virtualhost will have the same name as the group.
+
\ No newline at end of file diff --git a/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add.html b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add.html index d1792267a4..3f888405b0 100644 --- a/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add.html +++ b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add.html @@ -20,84 +20,23 @@ -->
-
Node Group*:
+
Create new group or join existing group*:
- - - - + +
+
-
-
Node Name*:
-
- -
-
-
-
Virtual Host Name*:
-
- -
-
-
-
Address*:
-
- -
-
-
-
Store path*:
-
- -
-
-
+
diff --git a/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add/existinggroup/add.html b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add/existinggroup/add.html new file mode 100644 index 0000000000..eca6a41bb8 --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add/existinggroup/add.html @@ -0,0 +1,117 @@ + +
+ +
+
+ Existing details +
+
Group Name*:
+
+ +
+
+
+
Node name from group*:
+
+ +
+
+
+
Node address of same node*:
+
+ +
+
+
+
+ + +
+
+ New node details +
+
Node Name*:
+
+ +
+
+
+
Address*:
+
+ +
+
+
+
Store path*:
+
+ +
+
+
+
+
+
diff --git a/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add/newgroup/add.html b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add/newgroup/add.html new file mode 100644 index 0000000000..4d0edd5fc7 --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/add/newgroup/add.html @@ -0,0 +1,81 @@ + +
+
+
Node Name*:
+
+ +
+
+
+
Group Name*:
+
+ +
+
+
+
Address*:
+
+ +
+
+
+
Store path*:
+
+ +
+
+ + + +
+
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css b/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css index eafa5f0619..2291fdf816 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css @@ -92,7 +92,7 @@ div .messages { .formBox { border: .1em solid lightgrey; - margin: 10px 0px 20px 0px; + margin: 10px 5px; border-radius: 5px; } @@ -104,7 +104,7 @@ div .messages { } .formBox fieldset { - padding: 10px 0px 10px 0px; + padding: 5px; } .formBox .formLabel-labelCell { @@ -187,4 +187,10 @@ div .messages { background: url("../images/help.png") no-repeat; width: 16px; height: 16px; +} + +.infoMessage +{ + padding: 5px; + font-style: italic; } \ No newline at end of file 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 e335f51d33..1b1b2914e3 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 @@ -86,18 +86,18 @@ define(["dojo/_base/xhr", //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"; + return item != "BDB_HA_REPLICA" && item != "BDB_HA"; }); var virtualHostNodeTypeStore = this._makeTypeStore(this.supportedVirtualHostNodeTypes); this.virtualHostNodeType.set("store", virtualHostNodeTypeStore); this.virtualHostNodeType.set("disabled", false); - this.virtualHostNodeType.on("change", function(type){that._typeChanged(type, that.virtualHostNodeTypeFieldsContainer, "qpid/management/virtualhostnode/");}); + this.virtualHostNodeType.on("change", function(type){that._vhnTypeChanged(type, that.virtualHostNodeTypeFieldsContainer, "qpid/management/virtualhostnode/");}); - var virtualHostTypeStore = this._makeTypeStore(this.supportedVirtualHostTypes); - this.virtualHostType.set("store", virtualHostTypeStore); + this.virtualHostTypeStore = this._makeTypeStore(this.supportedVirtualHostTypes); + this.virtualHostType.set("store", this.virtualHostTypeStore); this.virtualHostType.set("disabled", false); - this.virtualHostType.on("change", function(type){that._typeChanged(type, that.virtualHostTypeFieldsContainer, "qpid/management/virtualhost/");}); + this.virtualHostType.on("change", function(type){that._vhTypeChanged(type, that.virtualHostTypeFieldsContainer, "qpid/management/virtualhost/");}); }, show: function() { @@ -122,6 +122,16 @@ define(["dojo/_base/xhr", this.containerNode = null; } }, + _vhnTypeChanged: function (type, typeFieldsContainer, urlStem) + { + this._processDropDownsForBdbHa(type); + this._processDropDownsForJson(type); + this._typeChanged(type, typeFieldsContainer, urlStem); + }, + _vhTypeChanged: function (type, typeFieldsContainer, urlStem) + { + this._typeChanged(type, typeFieldsContainer, urlStem); + }, _typeChanged: function (type, typeFieldsContainer, urlStem) { var widgets = registry.findWidgets(typeFieldsContainer); @@ -146,6 +156,52 @@ define(["dojo/_base/xhr", ); } }, + _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.virtualHostType.value == "BDB_HA") + { + 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) { this.dialog.hide(); @@ -164,12 +220,6 @@ define(["dojo/_base/xhr", var virtualHostNodeData = this._getValues(this.virtualHostNodeForm); var virtualHostData = this._getValues(this.virtualHostForm); - if (virtualHostNodeData["type"] == "JSON" && virtualHostData["type"] == "ProvidedStore") - { - alert('Cannot use a JSON Virtual Host Node with a ProvidedStore Virtual Host'); - return; - } - //Default the VH name to be the same as the VHN name. virtualHostData["name"] = virtualHostNodeData["name"]; @@ -184,7 +234,7 @@ define(["dojo/_base/xhr", error: function(error) {success = false; failureReason = error;} }); - if(success === true) + if(success === true && virtualHostNodeData["type"] != "BDB_HA") { var encodedVirtualHostName = encodeURIComponent(virtualHostData.name); xhr.put({ -- cgit v1.2.1