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/jdbc-store/src | |
| 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/jdbc-store/src')
7 files changed, 366 insertions, 8 deletions
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> |
