summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2014-05-13 13:03:28 +0000
committerAlex Rudyy <orudyy@apache.org>2014-05-13 13:03:28 +0000
commitffce902c8ed77fb770c1c3b77064504f4faf7452 (patch)
tree2f6f19ed41e7c739db0aba9189870141be350bd4 /qpid/java/broker-plugins
parentc6774b45a316b499e0593b54a1c088ceca65265a (diff)
downloadqpid-python-ffce902c8ed77fb770c1c3b77064504f4faf7452.tar.gz
QPID-5413: Add UI for creation of virtual host nodes
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1594221 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
-rw-r--r--qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js41
-rw-r--r--qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/add.html61
-rw-r--r--qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js73
-rw-r--r--qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/add.html75
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html67
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNode.html47
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css3
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js6
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js210
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNode.js210
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js41
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html50
-rw-r--r--qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js40
-rw-r--r--qpid/java/broker-plugins/memory-store/src/main/java/resources/virtualhostnode/memory/add.html48
14 files changed, 692 insertions, 280 deletions
diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js
new file mode 100644
index 0000000000..d981f1e13f
--- /dev/null
+++ b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js
@@ -0,0 +1,41 @@
+/*
+ *
+ * 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!virtualhostnode/derby/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/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/add.html b/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/add.html
new file mode 100644
index 0000000000..76684c0d63
--- /dev/null
+++ b/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/add.html
@@ -0,0 +1,61 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Virtual Host Node Name*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.derbyNodeName"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'name',
+ placeHolder: 'node name',
+ required: true,
+ missingMessage: 'A node name must be supplied',
+ title: 'Enter node name',
+ pattern: '^[\x20-\x2e\x30-\x7F]{1,255}$'" />
+ </div>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Store path*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.derbyStorePath"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'storePath',
+ placeHolder: 'path/to/store',
+ required: true,
+ missingMessage: 'Store path must be supplied',
+ title: 'Enter store path'" />
+ </div>
+ </div>
+ <div style="clear:both;display:none">
+ <div class="formLabel-labelCell" style="float:left; width: 300px;">Combined store:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.derbyMessageStoreProvider"
+ data-dojo-type="dijit/form/CheckBox"
+ data-dojo-props="
+ name: 'messageStoreProvider',
+ required: true,
+ checked: true" />
+ </div>
+ </div>
+ <div style="clear:both"></div>
+</div>
diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js
new file mode 100644
index 0000000000..1f8b8d39d3
--- /dev/null
+++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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/_base/array",
+ "dojo/parser",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dojo/json",
+ "dojo/string",
+ "dojo/store/Memory",
+ "dijit/registry",
+ "dojo/text!virtualhostnode/jdbc/add.html",
+ "dojo/text!service/helper?action=pluginList&plugin=JDBCConnectionProviderFactory",
+ "dijit/form/ValidationTextBox",
+ "dijit/form/CheckBox",
+ "dojo/domReady!"],
+ function (xhr, array, parser, dom, domConstruct, json, string, Memory, registry, template, poolTypeJsonString)
+ {
+ return {
+ show: function (data)
+ {
+ this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
+ parser.parse(this.containerNode);
+
+ var poolTypes = json.parse(poolTypeJsonString);
+ var poolTypesData = [];
+ for (var i =0 ; i < poolTypes.length; i++)
+ {
+ poolTypesData[i]= {id: poolTypes[i], name: poolTypes[i]};
+ }
+ var poolTypesStore = new Memory({ data: poolTypesData });
+ var poolTypeControl = registry.byId("addVirtualHostNode.jdbcConnectionPoolType");
+ poolTypeControl.set("store", poolTypesStore);
+
+ var poolTypeFieldsDiv = dom.byId("addVirtualHost.poolSpecificDiv");
+ poolTypeControl.on("change",
+ function(type)
+ {
+ if(type && string.trim(type) != "")
+ {
+ var widgets = registry.findWidgets(poolTypeFieldsDiv);
+ array.forEach(widgets, function(item) { item.destroyRecursive();});
+ domConstruct.empty(poolTypeFieldsDiv);
+ require(["qpid/management/virtualhost/store/pool/"+type.toLowerCase()+"/add"],
+ function(poolType)
+ {
+ poolType.show();
+ });
+ }
+ }
+ );
+ }
+ };
+ }
+);
diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/add.html b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/add.html
new file mode 100644
index 0000000000..e08e709253
--- /dev/null
+++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/add.html
@@ -0,0 +1,75 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Virtual Host Node Name*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.jdbcNodeName"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'name',
+ placeHolder: 'node name',
+ required: true,
+ missingMessage: 'A node name must be supplied',
+ title: 'Enter node name',
+ pattern: '^[\x20-\x2e\x30-\x7F]{1,255}$'" />
+ </div>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">JDBC Url*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.jdbcConnectionUrl"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'connectionUrl',
+ placeHolder: 'jdbc:provider:info',
+ required: true,
+ missingMessage: 'JDBC URL must be supplied',
+ title: 'Enter JDBC URL'" />
+ </div>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Connection Pool*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.jdbcConnectionPoolType"
+ data-dojo-type="dijit/form/FilteringSelect"
+ data-dojo-props="
+ name: 'connectionPoolType',
+ required: true,
+ missingMessage: 'Connection Pool type must be supplied',
+ title: 'Select Connection Pool',
+ placeHolder: 'Select pool type'" />
+ </div>
+ </div>
+ <div style="clear:both;display:none">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Combined store:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.derbyMessageStoreProvider"
+ data-dojo-type="dijit/form/CheckBox"
+ data-dojo-props="
+ name: 'messageStoreProvider',
+ required: true,
+ checked: true" />
+ </div>
+ </div>
+ <div style="clear:both"></div>
+ <div id="addVirtualHost.poolSpecificDiv"></div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
deleted file mode 100644
index 282f4ab8f6..0000000000
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
+++ /dev/null
@@ -1,67 +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.
- -
- -->
-<div class="dijitHidden">
- <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add Virtual Host'" id="addVirtualHost">
- <form id="formAddVirtualHost" method="post" dojoType="dijit.form.Form">
- <table class="tableContainer-table tableContainer-table-horiz">
- <tr>
- <td class="tableContainer-labelCell" style="width: 300px;"><strong>Name*: </strong></td>
- <td class="tableContainer-valueCell">
- <input type="text" required="true" name="name" id="formAddVirtualHost.name"
- placeholder="Virtual Host Name" dojoType="dijit.form.ValidationTextBox"
- missingMessage="A name must be supplied" regexp="^[\x20-\x2e\x30-\x7F]{1,255}$"/>
- </td>
- </tr>
- </table>
- <br />
- <div>Specify either a store type and location, or an XML configuration file location, but not both.</div>
- <div style="height: 300px;" id="addVirtualHost.variants">
- <div id="addVirtualHost.configPathDiv">
- <table class="tableContainer-table tableContainer-table-horiz">
- <tr>
- <td class="tableContainer-labelCell" style="width: 300px;"><strong>Path to virtual host configuration file*: </strong></td>
- <td class="tableContainer-valueCell">
- <input dojoType="dijit.form.ValidationTextBox" id="formAddVirtualHost.configPath"
- name="configPath" placeholder="/path/to/virtualhost.xml" />
- </td>
- </tr>
- </table>
- </div>
- <div id="addVirtualHost.attributesDiv">
- <table class="tableContainer-table tableContainer-table-horiz">
- <tr>
- <td class="tableContainer-labelCell" style="width: 300px;"><strong>Type*: </strong></td>
- <td class="tableContainer-valueCell" ><div id="addVirtualHost.selectType"></div></td>
- </tr>
- </table>
- <div id="addVirtualHost.typeSpecificDiv">
- </div>
- </div>
- </div>
-
- <div class="dijitDialogPaneActionBar">
- <!-- submit buttons -->
- <input type="submit" value="Save" label="Save" dojoType="dijit.form.Button" />
- <input type="hidden" id="formAddVirtualHost.id" name="id"/>
- </div>
- </form>
- </div>
-</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNode.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNode.html
new file mode 100644
index 0000000000..d5e86130a3
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNode.html
@@ -0,0 +1,47 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div class="dijitHidden">
+ <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add Virtual Host Node And Virtual Host'" id="addVirtualHostNode">
+ <form id="addVirtualHostNode.form" method="post" data-dojo-type="dijit/form/Form">
+ <div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Virtual Host Node Type*:</div>
+ <div style="float:left;" class="tableContainer-valueCell formLabel-controlCell">
+ <select id="addVirtualHostNode.type" data-dojo-type="dijit/form/FilteringSelect"
+ data-dojo-props="
+ name: 'type',
+ required: true,
+ disabled: true,
+ title: 'Select virtual host node type',
+ searchAttr: 'name'">
+ </select>
+ </div>
+ </div>
+ <div style="clear:both"></div>
+ <div id="addVirtualHostNode.typeFields"></div>
+ </div>
+ <div class="dijitDialogPaneActionBar">
+ <button data-dojo-type="dijit/form/Button" id="addVirtualHostNode.saveButton" data-dojo-props="label: 'Save'" type="submit">Save</button>
+ <button data-dojo-type="dijit/form/Button" id="addVirtualHostNode.cancelButton" data-dojo-props="label: 'Cancel'" ></button>
+ </div>
+ </form>
+ </div>
+</div>
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 d9064f40c9..899d1b3630 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
@@ -94,6 +94,9 @@ div .messages {
font-weight: bold;
}
+.formLabel-controlCell {
+ padding: 1px;
+}
.columnDefDialogButtonIcon {
background: url("../dojo/dojox/grid/enhanced/resources/images/sprite_icons.png") no-repeat;
background-position: -260px 2px;
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
index 9696280b2c..618b49b02f 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
@@ -30,7 +30,7 @@ define(["dojo/_base/xhr",
"dijit/registry",
"dojox/html/entities",
"qpid/management/addAuthenticationProvider",
- "qpid/management/addVirtualHost",
+ "qpid/management/addVirtualHostNode",
"qpid/management/addPort",
"qpid/management/addKeystore",
"qpid/management/addGroupProvider",
@@ -48,7 +48,7 @@ define(["dojo/_base/xhr",
"dijit/Menu",
"dijit/MenuItem",
"dojo/domReady!"],
- function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, entities, addAuthenticationProvider, addVirtualHost, addPort, addKeystore, addGroupProvider, addAccessControlProvider) {
+ function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, entities, addAuthenticationProvider, addVirtualHostNode, addPort, addKeystore, addGroupProvider, addAccessControlProvider) {
function Broker(name, parent, controller) {
this.name = name;
@@ -198,7 +198,7 @@ define(["dojo/_base/xhr",
);
var addHostButton = query(".addVirtualHost", contentPane.containerNode)[0];
- connect.connect(registry.byNode(addHostButton), "onClick", function(evt){ addVirtualHost.show(); });
+ connect.connect(registry.byNode(addHostButton), "onClick", function(evt){ addVirtualHostNode.show(); });
var addPortButton = query(".addPort", contentPane.containerNode)[0];
connect.connect(registry.byNode(addPortButton), "onClick", function(evt){
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
deleted file mode 100644
index a66dbb3cea..0000000000
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
+++ /dev/null
@@ -1,210 +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/_base/event",
- "dojo/_base/json",
- "dojo/string",
- "dojo/store/Memory",
- "dijit/form/FilteringSelect",
- "dojo/_base/connect",
- "dojo/dom-style",
- "dijit/form/NumberSpinner", // required by the form
- /* dojox/ validate resources */
- "dojox/validate/us", "dojox/validate/web",
- /* basic dijit classes */
- "dijit/Dialog",
- "dijit/form/CheckBox", "dijit/form/Textarea",
- "dijit/form/FilteringSelect", "dijit/form/TextBox",
- "dijit/form/ValidationTextBox", "dijit/form/DateTextBox",
- "dijit/form/TimeTextBox", "dijit/form/Button",
- "dijit/form/RadioButton", "dijit/form/Form",
- "dijit/form/DateTextBox",
- /* basic dojox classes */
- "dojox/form/BusyButton", "dojox/form/CheckedMultiSelect",
- "dojox/layout/TableContainer",
- "dijit/layout/AccordionContainer",
- "dijit/layout/AccordionPane",
- "dojo/domReady!"],
- function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect, connect, domStyle) {
-
- var addVirtualHost = {};
-
- var node = construct.create("div", null, win.body(), "last");
-
- var convertToVirtualHost = function convertToVirtualHost(formValues)
- {
- var newVirtualHost = {messageStoreProvider:true};
- var id = dojo.byId("formAddVirtualHost.id").value;
- if (id)
- {
- newVirtualHost.id = id;
- }
- for(var propName in formValues)
- {
- if(formValues.hasOwnProperty(propName))
- {
- if(formValues[ propName ] !== "") {
- newVirtualHost[ propName ] = formValues[propName];
- }
-
- }
- }
-
- //temporary hacks to verify the REST API
- if (newVirtualHost.type == "STANDARD")
- {
- newVirtualHost.type = newVirtualHost.storeType;
- delete newVirtualHost.storeType;
- }
- else if (newVirtualHost.type == "BDB_HA")
- {
- newVirtualHost.name =registry.byId("formAddVirtualHost.specific.nodeName").value;
- }
- return newVirtualHost;
- }
-
- if (!dijit.registry["addVirtualHost"])
- {
- var that = this;
- xhr.get({url: "addVirtualHost.html",
- sync: true,
- load: function(data) {
- var theForm;
- node.innerHTML = data;
- addVirtualHost.dialogNode = dom.byId("addVirtualHost");
- parser.instantiate([addVirtualHost.dialogNode]);
-
- var configPathPane = new dijit.layout.AccordionPane({
- title: "Configuration File"
- }, "addVirtualHost.configPathDiv");
-
- var attributesPane = new dijit.layout.AccordionPane({
- title: "Virtual Host Attributes",
- selected: true
- }, "addVirtualHost.attributesDiv");
-
- var aContainer = new dijit.layout.AccordionContainer({
- style: "height: 150px"
- },
- "addVirtualHost.variants");
-
- aContainer.addChild(attributesPane);
- aContainer.addChild(configPathPane);
- aContainer.startup();
-
- theForm = registry.byId("formAddVirtualHost");
- theForm.on("submit", function(e) {
-
- event.stop(e);
- if(theForm.validate()){
-
- var formValues = theForm.getValues();
- if (formValues.configPath == "" && formValues["type"] == "")
- {
- alert("Please specify either configuration file or type for the virtual host");
- return false;
- }
- if (formValues.configPath != "" && formValues["type"] != "")
- {
- alert("Either configuration file or type have to be specified!");
- return false;
- }
- var newVirtualHost = convertToVirtualHost(formValues);
- var that = this;
-
- xhr.put({url: "api/latest/virtualhostnode/" + encodeURIComponent(newVirtualHost.name),
- sync: true, handleAs: "json",
- headers: { "Content-Type": "application/json"},
- putData: json.toJson(newVirtualHost),
- load: function(x) {that.success = true; },
- error: function(error) {that.success = false; that.failureReason = error;}});
-
- if(this.success === true)
- {
- registry.byId("addVirtualHost").hide();
- }
- else
- {
- alert("Error:" + this.failureReason);
- }
- return false;
- }else{
- alert('Form contains invalid data. Please correct first');
- return false;
- }
- });
- }});
- }
-
- addVirtualHost.selectVhostType = function(type) {
- if(type && string.trim(type) != "") {
- require(["qpid/management/virtualhost/"+type.toLowerCase()+"/addVirtualHost"],
- function(vhostType)
- {
- vhostType.show();
- });
- }
- }
-
- addVirtualHost.show = function() {
- var that = this;
- dom.byId("addVirtualHost.typeSpecificDiv").innerHTML = "";
- registry.byId("formAddVirtualHost").reset();
- dojo.byId("formAddVirtualHost.id").value="";
-
- if (!that.hasOwnProperty("typeChooser"))
- {
- xhr.get({
- sync: true,
- url: "service/helper?action=ListVirtualHostTypes",
- handleAs: "json"
- }).then(
- function(data) {
- var vhostTypes = data;
- var vhostTypesData = [];
- for (var i =0 ; i < vhostTypes.length; i++)
- {
- vhostTypesData[i]= {id: vhostTypes[i], name: vhostTypes[i]};
- }
- var typesStore = new Memory({ data: vhostTypesData });
- var typesDiv = dom.byId("addVirtualHost.selectType");
- var input = construct.create("input", {id: "addType", required: false}, typesDiv);
- that.typeChooser = new FilteringSelect({ id: "addVirtualHost.type",
- name: "type",
- store: typesStore,
- searchAttr: "name",
- required: false,
- onChange: that.selectVhostType }, input);
- });
- }
-
-
- registry.byId("addVirtualHost").show();
-
- }
- return addVirtualHost;
- });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNode.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNode.js
new file mode 100644
index 0000000000..fd18414aa9
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNode.js
@@ -0,0 +1,210 @@
+/*
+ *
+ * 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/_base/event",
+ "dojo/_base/lang",
+ "dojo/_base/array",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dojo/json",
+ "dojo/parser",
+ "dojo/store/Memory",
+ "dijit/registry",
+ "dijit/Dialog",
+ "dijit/form/Button",
+ "dijit/form/FilteringSelect",
+ "qpid/common/properties",
+ "dojo/text!addVirtualHostNode.html",
+ "dijit/form/Form",
+ "dijit/form/CheckBox",
+ "dijit/form/RadioButton",
+ "dojox/validate/us",
+ "dojox/validate/web",
+ "dojo/domReady!"],
+ function (xhr, event, lang, array, dom, domConstruct, json, parser, Memory, registry, Dialog, Button, FilteringSelect, properties, template)
+ {
+
+ var addVirtualHostNode =
+ {
+ init: function()
+ {
+ var that=this;
+ this.containerNode = domConstruct.create("div", {innerHTML: template});
+ parser.parse(this.containerNode);
+ this.typeFieldsContainer = dom.byId("addVirtualHostNode.typeFields");
+ this.dialog = registry.byId("addVirtualHostNode");
+ this.saveButton = registry.byId("addVirtualHostNode.saveButton");
+ this.cancelButton = registry.byId("addVirtualHostNode.cancelButton");
+ this.cancelButton.on("click", function(e){that._cancel(e);});
+ this.saveButton.on("click", function(e){that._save(e);});
+ this.form = registry.byId("addVirtualHostNode.form");
+ this.type = registry.byId("addVirtualHostNode.type");
+ this.type.set("disabled", true);
+ xhr.get({sync: properties.useSyncGet, handleAs: "json", url: "api/latest/broker?depth=0", load: function(data){that._onBrokerData(data[0]) }});
+ this.form.on("submit", function(e){that._submit();} );
+ },
+ _onBrokerData: function(brokerData)
+ {
+ var that=this;
+ this.supportedVirtualHostNodeTypes = brokerData.supportedVirtualHostNodeTypes;
+ this.supportedVirtualHostStoreTypes = brokerData.supportedVirtualHostStoreTypes;
+ var typesData = [];
+ for (var i =0 ; i < this.supportedVirtualHostNodeTypes.length; i++)
+ {
+ var type = this.supportedVirtualHostNodeTypes[i];
+ typesData.push( {id: type, name: type} );
+ }
+ var typesStore = new Memory({ data: typesData });
+ this.type.set("store", typesStore);
+ this.type.set("disabled", false);
+ this.type.on("change", function(type){that._typeChanged(type);});
+ },
+ show: function()
+ {
+ this.form.reset();
+ this.dialog.show();
+ },
+ destroy: function()
+ {
+ if (this.dialog)
+ {
+ this.dialog.destroyRecursive();
+ this.dialog = null;
+ }
+
+ if (this.containerNode)
+ {
+ domConstruct.destroy(this.containerNode);
+ this.containerNode = null;
+ }
+ },
+ _typeChanged: function(type)
+ {
+ if (type)
+ {
+ var widgets = registry.findWidgets(this.typeFieldsContainer);
+ array.forEach(widgets, function(item) { item.destroyRecursive();});
+ domConstruct.empty(this.typeFieldsContainer);
+
+ var that = this;
+ require(["qpid/management/virtualhostnode/" + type.toLowerCase() + "/add"],
+ function(TypeUI)
+ {
+ try
+ {
+ TypeUI.show({containerNode:that.typeFieldsContainer, parent: that});
+ }
+ catch(e)
+ {
+ console.warn(e);
+ }
+ }
+ );
+ }
+ },
+ _cancel: function(e)
+ {
+ this.dialog.hide();
+ },
+ _save: function(e)
+ {
+ event.stop(e);
+ this._submit();
+ },
+ _submit: function()
+ {
+ if(this.form.validate())
+ {
+ var success = false,failureReason=null;
+ var data = this._getValues();
+ xhr.put({
+ url: "api/latest/virtualhostnode/" + encodeURIComponent(data.name),
+ sync: true,
+ handleAs: "json",
+ headers: { "Content-Type": "application/json"},
+ putData: json.stringify(data),
+ load: function(x) {success = true; },
+ error: function(error) {success = false; failureReason = error;}
+ });
+
+ if(success === true)
+ {
+ this.dialog.hide();
+ }
+ else
+ {
+ alert("Error:" + failureReason);
+ }
+ }
+ else
+ {
+ alert('Form contains invalid data. Please correct first');
+ }
+ },
+ _getValues: function()
+ {
+ var values = {};
+ var formWidgets = this.form.getChildren();
+ for(var i in formWidgets)
+ {
+ var widget = formWidgets[i];
+ var value = widget.value;
+ var propName = widget.name;
+ if (propName)
+ {
+ if (widget instanceof dijit.form.CheckBox)
+ {
+ values[ propName ] = widget.checked;
+ }
+ else if (widget instanceof dijit.form.RadioButton && value)
+ {
+ var currentValue = values[propName];
+ if (currentValue)
+ {
+ if (lang.isArray(currentValue))
+ {
+ currentValue.push(value)
+ }
+ else
+ {
+ values[ propName ] = [currentValue, value];
+ }
+ }
+ else
+ {
+ values[ propName ] = value;
+ }
+ }
+ else
+ {
+ values[ propName ] = value ? value: null;
+ }
+ }
+ }
+ return values;
+ }
+ };
+
+ addVirtualHostNode.init();
+
+ return addVirtualHostNode;
+ }
+);
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js
new file mode 100644
index 0000000000..17d20fde32
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js
@@ -0,0 +1,41 @@
+/*
+ *
+ * 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!virtualhostnode/json/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/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html
new file mode 100644
index 0000000000..338a46700d
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html
@@ -0,0 +1,50 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Virtual Host Node Name*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.jsonNodeName"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'name',
+ placeHolder: 'node name',
+ required: true,
+ missingMessage: 'A node name must be supplied',
+ title: 'Enter node name',
+ pattern: '^[\x20-\x2e\x30-\x7F]{1,255}$'" />
+ </div>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Store path*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.jsonStorePath"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'storePath',
+ placeHolder: 'path/to/store',
+ required: true,
+ missingMessage: 'Store path must be supplied',
+ title: 'Enter store path'" />
+ </div>
+ </div>
+ <div style="clear:both"></div>
+</div>
diff --git a/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js b/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js
new file mode 100644
index 0000000000..51ec19ea1b
--- /dev/null
+++ b/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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!virtualhostnode/memory/add.html",
+ "dijit/form/ValidationTextBox",
+ "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/broker-plugins/memory-store/src/main/java/resources/virtualhostnode/memory/add.html b/qpid/java/broker-plugins/memory-store/src/main/java/resources/virtualhostnode/memory/add.html
new file mode 100644
index 0000000000..ebcf53e0b2
--- /dev/null
+++ b/qpid/java/broker-plugins/memory-store/src/main/java/resources/virtualhostnode/memory/add.html
@@ -0,0 +1,48 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Virtual Host Node Name*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.derbyNodeName"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'name',
+ placeHolder: 'node name',
+ required: true,
+ missingMessage: 'A node name must be supplied',
+ title: 'Enter node name',
+ pattern: '^[\x20-\x2e\x30-\x7F]{1,255}$'" />
+ </div>
+ </div>
+ <div style="clear:both;display:none">
+ <div class="formLabel-labelCell" style="float:left; width: 300px;">Combined store:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;">
+ <input type="text" id="addVirtualHostNode.derbyMessageStoreProvider"
+ data-dojo-type="dijit/form/CheckBox"
+ data-dojo-props="
+ name: 'messageStoreProvider',
+ required: true,
+ checked: true" />
+ </div>
+ </div>
+ <div style="clear:both"></div>
+</div>