diff options
| author | Alex Rudyy <orudyy@apache.org> | 2014-08-01 18:08:31 +0000 |
|---|---|---|
| committer | Alex Rudyy <orudyy@apache.org> | 2014-08-01 18:08:31 +0000 |
| commit | 400d9be252bcc666fe43b1be582f34202faf23f7 (patch) | |
| tree | 5fbf8cc572fa43c1aa319d2fb55edd845d8f10ba /qpid/java/broker-plugins | |
| parent | 290b63ca0be3e72432208c01887ac928ff7b8fe5 (diff) | |
| download | qpid-python-400d9be252bcc666fe43b1be582f34202faf23f7.tar.gz | |
QPID-5928: [Java Broker] Add UI into web management console for editing of virtual host nodes and virtual hosts
The work is done by Andrew MacBean and Alex Rudyy.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1615187 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
30 files changed, 1152 insertions, 168 deletions
diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js new file mode 100644 index 0000000000..5438eda926 --- /dev/null +++ b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js @@ -0,0 +1,30 @@ +/* + * 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(["qpid/common/util", "dojo/domReady!"], + function (util) + { + var fieldNames = ["storeUnderfullSize", "storeOverfullSize", "storePath"]; + return { + show: function(data) + { + util.buildEditUI(data.containerNode, "virtualhost/sizemonitoring/edit.html", "editVirtualHost.", fieldNames, data.data); + } + }; + } +); diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js new file mode 100644 index 0000000000..5fa0443185 --- /dev/null +++ b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js @@ -0,0 +1,30 @@ +/* + * 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(["qpid/common/util", "dijit/registry", "dojo/domReady!"], + function (util, registry) + { + return { + show: function(data) + { + util.buildEditUI(data.containerNode, "virtualhostnode/filebased/edit.html", "editVirtualHostNode.", ["storePath"], data.data); + registry.byId("editVirtualHostNode.storePath").set("disabled", data.data.state != "STOPPED"); + } + }; + } +); diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/show.js b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/show.js index cc84f9edc1..22f6e4fa37 100644 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/show.js +++ b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/show.js @@ -25,11 +25,13 @@ define(["qpid/common/util", "dojo/domReady!"], function DerbyNode(data) { + this.parent = data.parent; util.buildUI(data.containerNode, data.parent, "virtualhostnode/derby/show.html", fields, this); } DerbyNode.prototype.update=function(data) { + this.parent.editNodeButton.set("disabled", !(data.state == "STOPPED" || data.state == "ERRORED")); util.updateUI(data, fields, this); }; diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/show.html b/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/show.html index a90ae74aaa..56c09a8ad7 100644 --- a/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/show.html +++ b/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/show.html @@ -16,6 +16,6 @@ --> <div style="clear:both"> - <div class="formLabel-labelCell">Store Path:</div> + <div class="formLabel-labelCell">Configuration store path:</div> <div class="storePath"></div> </div> diff --git a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/js/qpid/management/store/pool/bonecp/edit.js b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/js/qpid/management/store/pool/bonecp/edit.js new file mode 100644 index 0000000000..46345bca58 --- /dev/null +++ b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/js/qpid/management/store/pool/bonecp/edit.js @@ -0,0 +1,55 @@ +/* + * + * 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/domReady!"], + function (xhr, dom, construct, win, registry, parser) { + var fieldNames = ["maxConnectionsPerPartition", "minConnectionsPerPartition", "partitionCount"]; + return { + show: function(data) { + var that = this; + xhr.get({url: "virtualhost/store/pool/bonecp/add.html", + sync: true, + load: function(template) { + for ( var i = 0 ; i < fieldNames.length; i++ ) + { + var widgetName = fieldNames[i]; + var widget = registry.byId("formAddVirtualHost.qpid.jdbcstore.bonecp." + widgetName); + if (widget) + { + widget.destroyRecursive(); + } + } + data.containerNode.innerHTML = template; + parser.parse(data.containerNode); + for ( var i = 0 ; i < fieldNames.length; i++ ) + { + var widgetName = fieldNames[i]; + registry.byId("formAddVirtualHost.qpid.jdbcstore.bonecp." + widgetName).set("value", data.data.context["qpid.jdbcstore.bonecp." + widgetName]); + } + }}); + } + }; + }); diff --git a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/virtualhost/store/pool/bonecp/add.html b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/virtualhost/store/pool/bonecp/add.html index 39fc3f617f..df35a3cce0 100644 --- a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/virtualhost/store/pool/bonecp/add.html +++ b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/virtualhost/store/pool/bonecp/add.html @@ -14,6 +14,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> +<div class="formBox" style="clear:both"> +<fieldset> +<legend>BoneCP Settings</legend> <table class="tableContainer-table tableContainer-table-horiz"> <tr> @@ -54,3 +57,5 @@ </tr> </table> +</fieldset> +</div>
\ No newline at end of file diff --git a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/virtualhostnode/store/pool/bonecp/add.html b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/virtualhostnode/store/pool/bonecp/add.html index dbaf8ea4ee..e4334e395f 100644 --- a/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/virtualhostnode/store/pool/bonecp/add.html +++ b/qpid/java/broker-plugins/jdbc-provider-bone/src/main/java/resources/virtualhostnode/store/pool/bonecp/add.html @@ -14,6 +14,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> +<div class="formBox" style="clear:both"> +<fieldset> +<legend>BoneCP Settings</legend> <table class="tableContainer-table tableContainer-table-horiz"> <tr> @@ -54,3 +57,5 @@ </tr> </table> +</fieldset> +</div>
\ No newline at end of file diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/store/pool/none/edit.js b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/store/pool/none/edit.js new file mode 100644 index 0000000000..675a919b3d --- /dev/null +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/store/pool/none/edit.js @@ -0,0 +1,26 @@ +/* + * + * 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([], + function () + { + return {show: function(data) {}}; + } +); diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/edit.js b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/edit.js new file mode 100644 index 0000000000..a4cd23392c --- /dev/null +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/edit.js @@ -0,0 +1,76 @@ +/* + * 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(["qpid/common/util", + "dojo/text!service/helper?action=pluginList&plugin=JDBCConnectionProviderFactory", + "dojo/_base/array", + "dojo/json", + "dojo/string", + "dojo/store/Memory", + "dojo/dom", + "dojo/dom-construct", + "dijit/registry", + "dojo/domReady!"], + function (util, poolTypeJsonString, array, json, string, Memory, dom, domConstruct, registry) + { + + var fieldNames = ["connectionUrl", "username", "connectionPoolType"]; + return { + show: function(data) + { + util.buildEditUI(data.containerNode, "virtualhost/jdbc/edit.html", "editVirtualHost.", fieldNames, data.data); + + 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("editVirtualHost.connectionPoolType"); + poolTypeControl.set("store", poolTypesStore); + poolTypeControl.set("value", data.data.connectionPoolType); + + var passwordControl = registry.byId("editVirtualHost.password"); + if (data.data.password) + { + passwordControl.set("placeHolder", "*******"); + } + + var poolTypeFieldsDiv = dom.byId("editVirtualHost.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/store/pool/"+type.toLowerCase()+"/edit"], + function(poolType) + { + poolType.show({containerNode:poolTypeFieldsDiv, data: data.data}) + }); + } + } + ); + } + }; + } +); diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js index 5e3a5a087c..edca323926 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js @@ -18,8 +18,8 @@ * under the License. * */ -define(["qpid/common/util", "dojo/query", "dojo/domReady!"], - function (util, query) +define(["qpid/common/util", "dojo/query", "dojo/_base/array", "dojo/dom-construct", "dijit/registry", "dojo/domReady!"], + function (util, query, array, domConstruct, registry) { var fieldNames = ["connectionUrl", "username", "connectionPoolType"]; @@ -32,14 +32,19 @@ define(["qpid/common/util", "dojo/query", "dojo/domReady!"], JDBC.prototype.update = function(data) { + var previousConnectionPoolType = this.connectionPoolType ? this.connectionPoolType.innerHTML : null; util.updateUI(data, fieldNames, this); this.usernameAttributeContainer.style.display = data.username ? "block" : "none"; - if (!this.poolDetails) + if (!this.poolDetails || previousConnectionPoolType != data.connectionPoolType) { var that = this; require(["qpid/management/store/pool/" + data.connectionPoolType.toLowerCase() + "/show"], function(PoolDetails) { + var widgets = registry.findWidgets(that.connectionPoolTypeAttributeContainer); + array.forEach(widgets, function(item) { item.destroyRecursive();}); + domConstruct.empty(that.connectionPoolTypeAttributeContainer); + that.poolDetails = new PoolDetails({containerNode:that.connectionPoolTypeAttributeContainer, parent: that}); that.poolDetails.update(data); } diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/edit.js b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/edit.js new file mode 100644 index 0000000000..0e062b8f08 --- /dev/null +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/edit.js @@ -0,0 +1,89 @@ +/* + * 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(["qpid/common/util", + "dojo/text!service/helper?action=pluginList&plugin=JDBCConnectionProviderFactory", + "dojo/_base/array", + "dojo/json", + "dojo/string", + "dojo/store/Memory", + "dojo/dom", + "dojo/dom-construct", + "dijit/registry", + "dojo/domReady!"], + function (util, poolTypeJsonString, array, json, string, Memory, dom, domConstruct, registry) + { + var fieldNames = ["connectionUrl", "username", "connectionPoolType"]; + return { + show: function(data) + { + util.buildEditUI(data.containerNode, "virtualhostnode/jdbc/edit.html", "editVirtualHostNode.", fieldNames, data.data); + if (!(data.data.state == "STOPPED" || data.data.state == "ERRORED")) + { + for( var i = 0 ; i < fieldNames.length ; i++ ) + { + registry.byId("editVirtualHostNode." + fieldNames[i]).set("disabled", true); + } + registry.byId("editVirtualHostNode.password").set("disabled", true); + } + + 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("editVirtualHostNode.connectionPoolType"); + poolTypeControl.set("store", poolTypesStore); + poolTypeControl.set("value", data.data.connectionPoolType); + + var passwordControl = registry.byId("editVirtualHostNode.password"); + if (data.data.password) + { + passwordControl.set("placeHolder", "*******"); + } + + var poolTypeFieldsDiv = dom.byId("editVirtualHostNode.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/store/pool/"+type.toLowerCase()+"/edit"], + function(poolType) + { + poolType.show({containerNode:poolTypeFieldsDiv, data: data.data}) + + if (!(data.data.state == "STOPPED" || data.data.state == "ERRORED")) + { + var widgets = registry.findWidgets(poolTypeFieldsDiv); + array.forEach(widgets, function(item) { item.set("disabled", true);}); + } + }); + } + } + ); + } + }; + } +); diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js index ced243241b..b41fe32010 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js @@ -19,15 +19,14 @@ * */ -define(["qpid/common/util", - "dojo/query", - "dojo/domReady!"], - function (util, query) +define(["qpid/common/util", "dojo/query", "dojo/_base/array", "dojo/dom-construct", "dijit/registry", "dojo/domReady!"], + function (util, query, array, domConstruct, registry) { var fieldNames = ["connectionUrl", "username", "connectionPoolType"]; function Jdbc(data) { + this.parent = data.parent; util.buildUI(data.containerNode, data.parent, "virtualhostnode/jdbc/show.html", fieldNames, this); this.usernameAttributeContainer=query(".usernameAttributeContainer", data.containerNode)[0]; @@ -36,15 +35,21 @@ define(["qpid/common/util", Jdbc.prototype.update=function(data) { + var previousConnectionPoolType = this.connectionPoolType ? this.connectionPoolType.innerHTML : null; + this.parent.editNodeButton.set("disabled", !(data.state == "STOPPED" || data.state == "ERRORED")); util.updateUI(data, fieldNames, this); this.usernameAttributeContainer.style.display = data.username ? "block" : "none"; - if (!this.poolDetails) + if (!this.poolDetails || previousConnectionPoolType != data.connectionPoolType) { var that = this; require(["qpid/management/store/pool/" + data.connectionPoolType.toLowerCase() + "/show"], function(PoolDetails) { + var widgets = registry.findWidgets(that.connectionPoolTypeAttributeContainer); + array.forEach(widgets, function(item) { item.destroyRecursive();}); + domConstruct.empty(that.connectionPoolTypeAttributeContainer); + that.poolDetails = new PoolDetails({containerNode:that.connectionPoolTypeAttributeContainer, parent: that}); that.poolDetails.update(data); } diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhost/jdbc/edit.html b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhost/jdbc/edit.html new file mode 100644 index 0000000000..199d80f546 --- /dev/null +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhost/jdbc/edit.html @@ -0,0 +1,79 @@ +<!-- + ~ 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">JDBC Url*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHost.connectionUrl" + 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', + pattern: '^jdbc:.*:.*$'"/> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Username*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHost.username" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'username', + placeHolder: 'username', + required: true, + missingMessage: 'Username must be supplied', + title: 'Enter username'" /> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Password*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="password" id="editVirtualHost.password" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'password', + placeHolder: 'password', + type: 'password', + required: false, + missingMessage: 'Password must be supplied', + title: 'Enter password'" /> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Connection Pool*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHost.connectionPoolType" + 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"></div> + <div id="editVirtualHost.poolSpecificDiv"></div> + +</div> diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/edit.html b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/edit.html new file mode 100644 index 0000000000..6f2ddfff73 --- /dev/null +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/edit.html @@ -0,0 +1,78 @@ +<!-- + - + - 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">JDBC Url*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHostNode.connectionUrl" + 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', + pattern: '^jdbc:.*:.*$'"/> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Username*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHostNode.username" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'username', + placeHolder: 'username', + required: true, + missingMessage: 'Username must be supplied', + title: 'Enter username'" /> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Password*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="password" id="editVirtualHostNode.password" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'password', + placeHolder: 'password', + required: false, + missingMessage: 'Password must be supplied', + title: 'Enter password'" /> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Connection Pool*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHostNode.connectionPoolType" + 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"></div> + <div id="editVirtualHostNode.poolSpecificDiv"></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 d8ef0b30b6..2e1033c15e 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 @@ -128,10 +128,6 @@ div .messages { width: 100%; } -.formBoxButtons { - float : right; -} - .formLabel-controlCell { padding: 1px; float: left; @@ -213,11 +209,6 @@ div .messages { font-style: italic; } -.dijitDialogPaneActionBar .editNodeButton -{ - display: none -} - .alignLeft { float: left; } @@ -227,3 +218,11 @@ div .messages { .multiLineValue { display: inline-block; } +.haOptionLabel { + font-weight: bold; + margin-left: 5px; +} +.editNoteBanner { + font-style: italic; + margin: 0px 0px 10px 5px; +}
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html index eac16d0acf..1be5c5d29c 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html @@ -19,94 +19,118 @@ <div class="dijitHidden"> <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Edit Virtual Host'" id="editVirtualHostDialog"> <form id="editVirtualHostForm" method="post" data-dojo-type="dijit/form/Form"> - - <div id="editVirtualHost.typeFields"></div> - + <div class="editNoteBanner">NOTE: All changes will only take effect after Virtual Host restart.</div> <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell">Dead letter queue enabled:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input type="checkbox" id="editVirtualHost.queue.deadLetterQueueEnabled" - data-dojo-type="dijit/form/CheckBox" - data-dojo-props="name: 'queue.deadLetterQueueEnabled'"> - </input> + <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHost.name" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'name', + placeHolder: 'name', + required: true, + missingMessage: 'Name must be supplied', + disabled: true, + title: 'Enter virtual host name'" /> </div> </div> - <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell">Store Transaction Idle Timeout Warn:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/NumberSpinner" - id="editVirtualHost.storeTransactionIdleTimeoutWarn" - name="storeTransactionIdleTimeoutWarn" - smallDelta="1000" - constraints="{min: 0, places: 0, pattern: '#'}" - placeHolder="idle timeout warn time in ms" - missingMessage="An idle timeout warn time in ms must be supplied"/> - </div> - </div> - <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell">Store Transaction Idle Timeout Close:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/NumberSpinner" - id="editVirtualHost.storeTransactionIdleTimeoutClose" - name="storeTransactionIdleTimeoutClose" - smallDelta="1000" - constraints="{min: 0, places: 0, pattern: '#'}" - placeHolder="idle timeout close time in ms" - missingMessage="An idle timeout close time in ms must be supplied"/> - </div> - </div> - <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell">Store Transaction Open Timeout Warn:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/NumberSpinner" - id="editVirtualHost.storeTransactionOpenTimeoutWarn" - name="storeTransactionOpenTimeoutWarn" - smallDelta="1000" - constraints="{min: 0, places: 0, pattern: '#'}" - placeHolder="open timeout warn time in ms" - missingMessage="An open timeout warn time in ms must be supplied"/> - </div> - </div> - <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell">Store Transaction Open Timeout Close:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/NumberSpinner" - id="editVirtualHost.storeTransactionOpenTimeoutClose" - name="storeTransactionOpenTimeoutClose" - smallDelta="1000" - constraints="{min: 0, places: 0, pattern: '#'}" - placeHolder="open timeout close time in ms" - missingMessage="An open timeout close time in ms must be supplied"/> - </div> + <div id="editVirtualHost.typeFields"></div> + + <div class="formBox" style="clear:both"> + <fieldset> + <legend>Store transaction settings</legend> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Idle Timeout Warn:</div> + <div class="tableContainer-valueCell formLabel-controlCell"> + <input data-dojo-type="dijit/form/NumberSpinner" + id="editVirtualHost.storeTransactionIdleTimeoutWarn" + name="storeTransactionIdleTimeoutWarn" + smallDelta="1000" + constraints="{min: 0, places: 0, pattern: '#'}" + placeHolder="idle timeout warn time in ms" + missingMessage="An idle timeout warn time in ms must be supplied"/> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Idle Timeout Close:</div> + <div class="tableContainer-valueCell formLabel-controlCell"> + <input data-dojo-type="dijit/form/NumberSpinner" + id="editVirtualHost.storeTransactionIdleTimeoutClose" + name="storeTransactionIdleTimeoutClose" + smallDelta="1000" + constraints="{min: 0, places: 0, pattern: '#'}" + placeHolder="idle timeout close time in ms" + missingMessage="An idle timeout close time in ms must be supplied"/> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Open Timeout Warn:</div> + <div class="tableContainer-valueCell formLabel-controlCell"> + <input data-dojo-type="dijit/form/NumberSpinner" + id="editVirtualHost.storeTransactionOpenTimeoutWarn" + name="storeTransactionOpenTimeoutWarn" + smallDelta="1000" + constraints="{min: 0, places: 0, pattern: '#'}" + placeHolder="open timeout warn time in ms" + missingMessage="An open timeout warn time in ms must be supplied"/> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Open Timeout Close:</div> + <div class="tableContainer-valueCell formLabel-controlCell"> + <input data-dojo-type="dijit/form/NumberSpinner" + id="editVirtualHost.storeTransactionOpenTimeoutClose" + name="storeTransactionOpenTimeoutClose" + smallDelta="1000" + constraints="{min: 0, places: 0, pattern: '#'}" + placeHolder="open timeout close time in ms" + missingMessage="An open timeout close time in ms must be supplied"/> + </div> + </div> + </fieldset> </div> - <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell">House keeping check period (ms):</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/NumberSpinner" - id="editVirtualHost.housekeepingCheckPeriod" - name="housekeepingCheckPeriod" - smallDelta="1000" - constraints="{min: 1, places: 0, pattern: '#'}" - placeHolder="house keeping check period in ms" - missingMessage="A house keeping check period must be supplied"/> - </div> + <div class="formBox" style="clear:both"> + <fieldset> + <legend>House keeping settings</legend> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Check period (ms):</div> + <div class="tableContainer-valueCell formLabel-controlCell"> + <input data-dojo-type="dijit/form/NumberSpinner" + id="editVirtualHost.housekeepingCheckPeriod" + name="housekeepingCheckPeriod" + smallDelta="1000" + constraints="{min: 1, places: 0, pattern: '#'}" + placeHolder="house keeping check period in ms" + missingMessage="A house keeping check period must be supplied"/> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Thread count:</div> + <div class="tableContainer-valueCell formLabel-controlCell"> + <input data-dojo-type="dijit/form/NumberSpinner" + id="editVirtualHost.housekeepingThreadCount" + name="housekeepingThreadCount" + smallDelta="1" + constraints="{min: 1, places: 0, pattern: '#'}" + placeHolder="house keeping thread count" + missingMessage="A house keeping thread count must be supplied"/> + </div> + </div> + </fieldset> </div> + <div style="clear:both"></div> <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell">House keeping thread count:</div> + <div class="formLabel-labelCell tableContainer-labelCell">Dead letter queue enabled:</div> <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/NumberSpinner" - id="editVirtualHost.housekeepingThreadCount" - name="housekeepingThreadCount" - smallDelta="1" - constraints="{min: 1, places: 0, pattern: '#'}" - placeHolder="house keeping thread count" - missingMessage="A house keeping thread count must be supplied"/> + <input type="checkbox" id="editVirtualHost.queue.deadLetterQueueEnabled" + data-dojo-type="dijit/form/CheckBox" + data-dojo-props="name: 'queue.deadLetterQueueEnabled'"> + </input> </div> </div> - <div style="clear:both"></div> <div class="dijitDialogPaneActionBar"> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html new file mode 100644 index 0000000000..49f069c06d --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.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 class="dijitHidden"> + <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Edit Virtual Host'" id="editVirtualHostNodeDialog"> + <form id="editVirtualHostNodeForm" method="post" data-dojo-type="dijit/form/Form"> + <div class="editNoteBanner">NOTE: All changes will only take effect after Virtual Host Node restart.</div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHostNode.name" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'name', + placeHolder: 'name', + required: true, + missingMessage: 'Name must be supplied', + disabled: true, + title: 'Enter virtual host name'" /> + </div> + </div> + + <div id="editVirtualHostNode.typeFields"></div> + + <div style="clear:both"></div> + + <div class="dijitDialogPaneActionBar"> + <button data-dojo-type="dijit/form/Button" id="editVirtualHostNode.saveButton" data-dojo-props="label: 'Save'">Save</button> + <button data-dojo-type="dijit/form/Button" id="editVirtualHostNode.cancelButton" data-dojo-props="label: 'Cancel'" ></button> + </div> + </form> + </div> +</div> 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 60c05a5df6..5ba7cc7b2c 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 @@ -18,7 +18,6 @@ * under the License. * */ - define(["dojo/_base/xhr", "dojo/_base/event", "dojo/json", @@ -29,6 +28,7 @@ define(["dojo/_base/xhr", "dojo/query", "dojo/parser", "dojox/html/entities", + "dijit/registry", "dijit/TitlePane", "dijit/Dialog", "dijit/form/Form", @@ -41,7 +41,7 @@ define(["dojo/_base/xhr", "dojox/validate/web", "dojo/domReady!" ], - function (xhr, event, json, lang, dom, geometry, win, query, parser, entities) { + function (xhr, event, json, lang, dom, geometry, win, query, parser, entities, registry) { var util = {}; if (Array.isArray) { util.isArray = function (object) { @@ -494,21 +494,42 @@ define(["dojo/_base/xhr", return object1 === object2; } - util.buildUI = function(containerNode, parent, htmlTemplateLocation, fieldNames, obj) + util.parseHtmlIntoDiv = function(containerNode, htmlTemplateLocation) { xhr.get({url: htmlTemplateLocation, - sync: true, - load: function(template) { - containerNode.innerHTML = template; - parser.parse(containerNode); - }}); - for(var i=0; i<fieldNames.length;i++) + sync: true, + load: function(template) { + containerNode.innerHTML = template; + parser.parse(containerNode); + }}); + } + util.buildUI = function(containerNode, parent, htmlTemplateLocation, fieldNames, obj) + { + this.parseHtmlIntoDiv(containerNode, htmlTemplateLocation); + if (fieldNames && obj) { - var fieldName = fieldNames[i]; - obj[fieldName]= query("." + fieldName, containerNode)[0]; + for(var i=0; i<fieldNames.length;i++) + { + var fieldName = fieldNames[i]; + obj[fieldName]= query("." + fieldName, containerNode)[0]; + } } } + util.buildEditUI = function(containerNode, htmlTemplateLocation, fieldNamePrefix, fieldNames, data) + { + this.parseHtmlIntoDiv(containerNode, htmlTemplateLocation); + if (fieldNames) + { + for(var i = 0; i < fieldNames.length; i++) + { + var fieldName = fieldNames[i]; + var widget = registry.byId(fieldNamePrefix + fieldName); + widget.set("value", data[fieldName]); + } + } + } + util.updateUI = function(data, fieldNames, obj) { for(var i=0; i<fieldNames.length;i++) @@ -519,7 +540,7 @@ define(["dojo/_base/xhr", } } - util.getFormWidgetValues = function (form) + util.getFormWidgetValues = function (form, initialData) { var values = {}; var formWidgets = form.getChildren(); @@ -530,35 +551,72 @@ define(["dojo/_base/xhr", var propName = widget.name; if (propName && (widget.required || value )) { - if (widget instanceof dijit.form.CheckBox) + if (widget.excluded) { - values[ propName ] = widget.checked; + continue; + } + if (widget.contextvar) + { + var context = values["context"]; + if (!context) + { + context = {}; + values["context"] = context; + } + context[propName]=String(value); } - else if (widget instanceof dijit.form.RadioButton && value) + else if (widget instanceof dijit.form.RadioButton) { - var currentValue = values[propName]; - if (currentValue) + if (widget.checked) { - if (lang.isArray(currentValue)) + var currentValue = values[propName]; + if (currentValue) { - currentValue.push(value) + if (lang.isArray(currentValue)) + { + currentValue.push(value) + } + else + { + values[ propName ] = [currentValue, value]; + } } else { - values[ propName ] = [currentValue, value]; + values[ propName ] = value; } } - else - { - values[ propName ] = value; - } + } + else if (widget instanceof dijit.form.CheckBox) + { + values[ propName ] = widget.checked; } else { - values[ propName ] = value ? value: null; + if (widget.get("type") == "password") + { + if (value) + { + values[ propName ] = value; + } + } + else + { + values[ propName ] = value ? value: null; + } } } } + if (initialData) + { + for(var propName in values) + { + if (values[propName] == initialData[propName]) + { + delete values[propName]; + } + } + } return values; } diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js index dd79fbc385..9cc0d1f1b2 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js @@ -325,7 +325,7 @@ define(["dojo/_base/xhr", thisObj.virtualHost.startButton.set("disabled", thisObj.vhostData.state != "STOPPED"); thisObj.virtualHost.stopButton.set("disabled", thisObj.vhostData.state != "ACTIVE"); - thisObj.virtualHost.editButton.set("disabled", false); + thisObj.virtualHost.editButton.set("disabled", thisObj.vhostData.state == "UNAVAILABLE"); util.flattenStatistics( thisObj.vhostData ); var connections = thisObj.vhostData[ "connections" ]; 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 2bf60a9c92..a2343fa6cc 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 @@ -31,9 +31,10 @@ define(["dojo/_base/xhr", "qpid/common/UpdatableStore", "qpid/management/addQueue", "qpid/management/addExchange", + "qpid/management/editVirtualHostNode", "dojox/grid/EnhancedGrid", "dojo/domReady!"], - function (xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, EnhancedGrid) { + function (xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, editVirtualHostNode, EnhancedGrid) { function VirtualHostNode(name, parent, controller) { @@ -102,6 +103,13 @@ define(["dojo/_base/xhr", } }); + this.editNodeButton.on("click", + function(event) + { + editVirtualHostNode.show(that.name); + } + ); + this.vhostsGrid = new UpdatableStore([], query(".virtualHost", containerNode)[0], [ { name: "Name", field: "name", width: "40%"}, @@ -177,7 +185,7 @@ define(["dojo/_base/xhr", Updater.prototype.updateUI = function(data) { - this.virtualHostNode.startNodeButton.set("disabled", data.state != "STOPPED"); + this.virtualHostNode.startNodeButton.set("disabled", !(data.state == "STOPPED" || data.state == "ERRORED")); this.virtualHostNode.stopNodeButton.set("disabled", data.state != "ACTIVE"); this.name.innerHTML = entities.encode(String(data[ "name" ])); @@ -199,10 +207,7 @@ define(["dojo/_base/xhr", this.details.update(data); } - if (data.virtualhosts) - { - this.virtualHostNode.vhostsGrid.update(data.virtualhosts); - } + this.virtualHostNode.vhostsGrid.update(data.virtualhosts || []); } return VirtualHostNode; diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js index abc127caf5..c2f35ac9ec 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js @@ -46,7 +46,7 @@ define(["dojo/_base/xhr", "dojo/domReady!"], function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) { - var fields = [ "queue.deadLetterQueueEnabled", "storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", "storeTransactionOpenTimeoutWarn", "storeTransactionOpenTimeoutClose", "housekeepingCheckPeriod", "housekeepingThreadCount"]; + var fields = [ "name", "queue.deadLetterQueueEnabled", "storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", "storeTransactionOpenTimeoutWarn", "storeTransactionOpenTimeoutClose", "housekeepingCheckPeriod", "housekeepingThreadCount"]; var virtualHostEditor = { @@ -55,7 +55,8 @@ define(["dojo/_base/xhr", var that=this; this.containerNode = domConstruct.create("div", {innerHTML: template}); parser.parse(this.containerNode); - this.dialog = registry.byId("editVirtualHostDialog") + this.typeFieldsContainer = dom.byId("editVirtualHost.typeFields"); + this.dialog = registry.byId("editVirtualHostDialog"); this.saveButton = registry.byId("editVirtualHost.saveButton"); this.cancelButton = registry.byId("editVirtualHost.cancelButton"); this.cancelButton.on("click", function(e){that._cancel(e);}); @@ -70,7 +71,6 @@ define(["dojo/_base/xhr", show: function(hostData) { var that=this; - this.hostName = hostData.hostName; this.query = "api/latest/virtualhost/" + encodeURIComponent(hostData.nodeName) + "/" + encodeURIComponent(hostData.hostName); this.dialog.set("title", "Edit Virtual Host - " + entities.encode(String(hostData.hostName))); xhr.get( @@ -105,53 +105,79 @@ define(["dojo/_base/xhr", }, _save: function(e) { - event.stop(e); - if(this.form.validate()) - { - var data = util.getFormWidgetValues(this.form); + event.stop(e); + if(this.form.validate()) + { + var data = util.getFormWidgetValues(this.form, this.initialData); - var success = false,failureReason=null; - xhr.put({ - url: this.query, - 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;} - }); + var success = false,failureReason=null; + xhr.put({ + url: this.query, + 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); - } + if(success === true) + { + this.dialog.hide(); + } + else + { + alert("Error:" + failureReason); + } } else { alert('Form contains invalid data. Please correct first'); } - }, - _show:function(node) - { + }, + _show:function(virtualHostData) + { + this.initialData = virtualHostData; for(var i = 0; i < fields.length; i++) { var fieldName = fields[i]; if (this[fieldName] instanceof dijit.form.CheckBox) { - this[fieldName].set("checked", node[fieldName]); + this[fieldName].set("checked", virtualHostData[fieldName]); } else { - this[fieldName].set("value", node[fieldName]); + this[fieldName].set("value", virtualHostData[fieldName]); } - } + + var that = this; + + var widgets = registry.findWidgets(this.typeFieldsContainer); + array.forEach(widgets, function(item) { item.destroyRecursive();}); + domConstruct.empty(this.typeFieldsContainer); + + require(["qpid/management/virtualhost/" + virtualHostData.type.toLowerCase() + "/edit"], + function(TypeUI) + { + try + { + TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: virtualHostData}); + that.form.connectChildren(); + } + catch(e) + { + if (console && console.warn ) + { + console.warn(e); + } + } + } + ); + + this.dialog.startup(); this.dialog.show(); - } + } }; virtualHostEditor.init(); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js new file mode 100644 index 0000000000..e56e34ef41 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js @@ -0,0 +1,170 @@ +/* + * + * 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", + "dojox/html/entities", + "dojo/_base/array", + "dojo/_base/event", + "dojo/_base/lang", + "dojo/_base/window", + "dojo/dom", + "dojo/dom-construct", + "dijit/registry", + "dojo/parser", + 'dojo/json', + "dojo/query", + "dojo/store/Memory", + "dojo/data/ObjectStore", + "qpid/common/util", + "dojo/text!editVirtualHostNode.html", + "dijit/Dialog", + "dijit/form/CheckBox", + "dijit/form/FilteringSelect", + "dijit/form/ValidationTextBox", + "dijit/form/Button", + "dijit/form/Form", + "dijit/form/NumberSpinner", + "dojox/validate/us", + "dojox/validate/web", + "dojo/domReady!"], + function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) + { + var virtualHostNodeEditor = + { + init: function() + { + var that=this; + this.containerNode = domConstruct.create("div", {innerHTML: template}); + parser.parse(this.containerNode); + this.typeFieldsContainer = dom.byId("editVirtualHostNode.typeFields"); + this.dialog = registry.byId("editVirtualHostNodeDialog"); + this.saveButton = registry.byId("editVirtualHostNode.saveButton"); + this.cancelButton = registry.byId("editVirtualHostNode.cancelButton"); + this.cancelButton.on("click", function(e){that._cancel(e);}); + this.saveButton.on("click", function(e){that._save(e);}); + this.name = registry.byId("editVirtualHostNode.name"); + this.form = registry.byId("editVirtualHostNodeForm"); + }, + show: function(nodeName) + { + var that=this; + this.query = "api/latest/virtualhostnode/" + encodeURIComponent(nodeName); + this.dialog.set("title", "Edit Virtual Host Node - " + entities.encode(String(nodeName))); + xhr.get( + { + url: this.query, + sync: true, + handleAs: "json", + load: function(data) + { + that._show(data[0]); + } + } + ); + }, + destroy: function() + { + if (this.dialog) + { + this.dialog.destroyRecursive(); + this.dialog = null; + } + + if (this.containerNode) + { + domConstruct.destroy(this.containerNode); + this.containerNode = null; + } + }, + _cancel: function(e) + { + this.dialog.hide(); + }, + _save: function(e) + { + event.stop(e); + if(this.form.validate()) + { + var data = util.getFormWidgetValues(this.form, this.initialData); + + var success = false,failureReason=null; + xhr.put({ + url: this.query, + 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'); + } + }, + _show:function(nodeData) + { + this.initialData = nodeData; + this.name.set("value", nodeData.name); + + var that = this; + + var widgets = registry.findWidgets(this.typeFieldsContainer); + array.forEach(widgets, function(item) { item.destroyRecursive();}); + domConstruct.empty(this.typeFieldsContainer); + + require(["qpid/management/virtualhostnode/" + nodeData.type.toLowerCase() + "/edit"], + function(TypeUI) + { + try + { + TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: nodeData}); + that.form.connectChildren(); + } + catch(e) + { + if (console && console.warn ) + { + console.warn(e); + } + } + } + ); + + this.dialog.startup(); + this.dialog.show(); + } + }; + + virtualHostNodeEditor.init(); + + return virtualHostNodeEditor; + } +); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js new file mode 100644 index 0000000000..35ecbec315 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js @@ -0,0 +1,30 @@ +/* + * 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(["qpid/common/util", "dijit/registry", "dojo/domReady!"], + function (util, registry) + { + return { + show: function(data) + { + util.buildEditUI(data.containerNode, "virtualhostnode/filebased/edit.html", "editVirtualHostNode.", ["storePath"], data.data); + registry.byId("editVirtualHostNode.storePath").set("disabled", !(data.data.state == "STOPPED" || data.data.state == "ERRORED")); + } + }; + } +); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html index b3785d6801..3d2dc3cc9c 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html @@ -19,12 +19,12 @@ <div> <div style="clear:both"> - <div class="formLabel-labelCell">Store Overfull Limit:</div> - <div ></span> bytes</div> + <div class="formLabel-labelCell">Store overfull size:</div> + <div ><span class="storeOverfullSize" ></span> bytes</div> </div> <div style="clear:both"> - <div class="formLabel-labelCell">Store Underfull Limit:</div> - <div></span> bytes</div> + <div class="formLabel-labelCell">Store underfull size:</div> + <div><span class="storeUnderfullSize" ></span> bytes</div> </div> <div style="clear:both"></div> </div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/edit.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/edit.html new file mode 100644 index 0000000000..088057533b --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/edit.html @@ -0,0 +1,68 @@ +<!-- + ~ 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">Message store path*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHost.storePath" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'storePath', + placeHolder: 'path/to/store', + required: true, + missingMessage: 'Store path must be supplied', + disabled: true, + title: 'Enter message store path'" /> + </div> + </div> + + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Store overfull size (bytes):</div> + <div class="tableContainer-valueCell formLabel-controlCell"> + <input data-dojo-type="dijit/form/NumberSpinner" + id="editVirtualHost.storeOverfullSize" + data-dojo-props=" + name: 'storeOverfullSize', + placeHolder: 'size in bytes', + required: false, + title: 'Enter ceiling (in bytes) at which store will begin to throttle sessions producing messages', + constraints:{min:0,places:0}" + /> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell">Store underfull size (bytes):</div> + <div class="tableContainer-valueCell formLabel-controlCell"> + <input data-dojo-type="dijit/form/NumberSpinner" + id="editVirtualHost.storeUnderfullSize" + data-dojo-props=" + name: 'storeUnderfullSize', + placeHolder: 'size in bytes', + required: false, + title: 'Enter floor (in bytes) at which store will cease to throttle sessions producing messages', + constraints:{min:0,places:0}" + /> + </div> + </div> + + <div style="clear:both"></div> + +</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html index 245635b333..350a9777cb 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html @@ -19,16 +19,16 @@ <div> <div style="clear:both"> - <div class="formLabel-labelCell">Store Path:</div> + <div class="formLabel-labelCell">Message store path:</div> <div class="storePath"></div> </div> <div style="clear:both"> - <div class="formLabel-labelCell">Store Overfull Limit:</div> - <div ></span> bytes</div> + <div class="formLabel-labelCell">Store overfull size:</div> + <div><span class="storeOverfullSize"></span> bytes</div> </div> <div style="clear:both"> - <div class="formLabel-labelCell">Store Underfull Limit:</div> - <div></span> bytes</div> + <div class="formLabel-labelCell">Store underfull size:</div> + <div><span class="storeUnderfullSize"></span> bytes</div> </div> <div style="clear:both"></div> </div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/filebased/edit.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/filebased/edit.html new file mode 100644 index 0000000000..7c5c07e4a8 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/filebased/edit.html @@ -0,0 +1,38 @@ +<!-- + ~ 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">Configuration store path*:</div> + <div class="formLabel-controlCell tableContainer-valueCell"> + <input type="text" id="editVirtualHostNode.storePath" + 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 configuration store path'" /> + </div> + </div> + + <div style="clear:both"></div> + +</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html index 05a85daf6e..b8c6adeed3 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html @@ -16,6 +16,6 @@ --> <div style="clear:both"> - <div class="formLabel-labelCell">Store Path:</div> + <div class="formLabel-labelCell">Configuration store path:</div> <div class="storePath"></div> </div> diff --git a/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/edit.js b/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/edit.js new file mode 100644 index 0000000000..cfe7ebee8c --- /dev/null +++ b/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/edit.js @@ -0,0 +1,28 @@ +/* + * 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/domReady!"], + function () + { + return { + show: function(data) + { + } + }; + } +); diff --git a/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/show.js b/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/show.js index a431b63b86..4c858c612a 100644 --- a/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/show.js +++ b/qpid/java/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/show.js @@ -22,10 +22,15 @@ define([], { function Memory(data) { + this.parent = data.parent; + this.parent.editNodeButton.set("disabled",true); + this.parent.editNodeButton.domNode.style.display = "none"; } Memory.prototype.update = function(data) { + this.parent.editNodeButton.set("disabled", true); + this.parent.editNodeButton.domNode.style.display = "none"; } return Memory; |
