diff options
author | Alex Rudyy <orudyy@apache.org> | 2014-05-07 09:27:02 +0000 |
---|---|---|
committer | Alex Rudyy <orudyy@apache.org> | 2014-05-07 09:27:02 +0000 |
commit | 7dffa6c6bd8db286afa61108ef6c70bc4875251c (patch) | |
tree | f02ec234a95ecdc912b2de3119c55f35db33b872 | |
parent | 304b0dbebc28597538b79472e97af47d4b13a7f4 (diff) | |
download | qpid-python-7dffa6c6bd8db286afa61108ef6c70bc4875251c.tar.gz |
QPID-5413: Add virtual host node UI to view the details about existing virtual host nodes
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1592951 13f79535-47bb-0310-9956-ffa450edef68
23 files changed, 998 insertions, 34 deletions
diff --git a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/show.js b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/show.js new file mode 100644 index 0000000000..704f7a197c --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/show.js @@ -0,0 +1,81 @@ +/* + * + * 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/lang", + "dojo/_base/connect", + "dojo/parser", + "dojo/string", + "dojox/html/entities", + "dojo/query", + "dojo/json", + "dijit/registry", + "qpid/common/UpdatableStore", + "dojo/domReady!"], + function (xhr, lang, connect, parser, json, entities, query, json, registry, UpdatableStore) + { + function BdbNode(containerNode) + { + var that = this; + xhr.get({url: "virtualhostnode/bdb/show.html", + sync: true, + load: function(template) { + containerNode.innerHTML = template; + parser.parse(containerNode); + }}); + this.storePath = query(".storePath", containerNode)[0]; + this.environmentConfigurationPanel = registry.byNode(query(".environmentConfigurationPanel", containerNode)[0]); + this.environmentConfigurationGrid = new UpdatableStore([], + query(".environmentConfiguration", containerNode)[0], + [ {name: 'Name', field: 'id', width: '50%'}, {name: 'Value', field: 'value', width: '50%'} ], + null, + null, + null, true ); + } + + BdbNode.prototype.update=function(data) + { + this.storePath.innerHTML = entities.encode(String(data.storePath)); + if (data.environmentConfiguration) + { + this.environmentConfigurationPanel.domNode.style.display="block"; + var conf = data.environmentConfiguration; + var settings = []; + for(var propName in conf) + { + if(conf.hasOwnProperty(propName)) + { + settings.push({"id": propName, "value": conf[propName]}); + } + } + var changed = this.environmentConfigurationGrid.update(settings); + if (changed) + { + this.environmentConfigurationGrid.grid._refresh(); + } + } + else + { + this.environmentConfigurationPanel.domNode.style.display="none"; + } + }; + + return BdbNode; +}); diff --git a/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js new file mode 100644 index 0000000000..1dfbf0bad5 --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js @@ -0,0 +1,265 @@ +/* + * + * 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/lang", + "dojo/_base/connect", + "dojo/parser", + "dojo/string", + "dojox/html/entities", + "dojo/query", + "dojo/json", + "dijit/registry", + "dojox/grid/EnhancedGrid", + "qpid/common/UpdatableStore", + "qpid/management/UserPreferences", + "dojo/domReady!"], + function (xhr, lang, connect, parser, json, entities, query, json, registry, EnhancedGrid, UpdatableStore, UserPreferences) + { + var nodeFields = ["storePath", "groupName", "role", "address", "coalescingSync", "designatedPrimary", "durability", "priority", "quorumOverride"]; + + function findNode(nodeClass, containerNode) + { + return query("." + nodeClass, containerNode)[0]; + } + + function sendRequest(nodeName, remoteNodeName, method, attributes) + { + var success = false; + var failureReason = ""; + var url = null; + if (nodeName == remoteNodeName) + { + url = "api/latest/virtualhostnode/" + encodeURIComponent(nodeName); + } + else + { + url = "api/latest/replicationnode/" + encodeURIComponent(nodeName) + "/" + encodeURIComponent(remoteNodeName); + } + + if (method == "POST") + { + xhr.put({ + url: url, + sync: true, + handleAs: "json", + headers: { "Content-Type": "application/json"}, + putData: json.stringify(attributes), + load: function(x) {success = true; }, + error: function(error) {success = false; failureReason = error;} + }); + } + else if (method == "DELETE") + { + xhr.del({url: url, sync: true, handleAs: "json"}).then( + function(data) { success = true; }, + function(error) {success = false; failureReason = error;} + ); + } + + if (!success) + { + alert("Error:" + failureReason); + } + } + + function BDBHA(containerNode) { + var that = this; + xhr.get({url: "virtualhostnode/bdb_ha/show.html", + sync: true, + load: function(template) { + containerNode.innerHTML = template; + parser.parse(containerNode); + }}); + + for(var i=0; i<nodeFields.length;i++) + { + var fieldName = nodeFields[i]; + this[fieldName]= findNode(fieldName, containerNode); + } + + this.designatedPrimaryContainer = findNode("designatedPrimaryContainer", containerNode); + this.priorityContainer = findNode("priorityContainer", containerNode); + this.quorumOverrideContainer = findNode("quorumOverrideContainer", containerNode); + this.environmentConfigurationPanel = registry.byNode(query(".environmentConfigurationPanel", containerNode)[0]), + this.environmentConfigurationGrid = new UpdatableStore([], + query(".environmentConfiguration", containerNode)[0], + [ {name: 'Name', field: 'id', width: '50%'}, {name: 'Value', field: 'value', width: '50%'} ], + null, + null, + null, true ); + this.replicatedEnvironmentConfigurationPanel = registry.byNode(query(".replicatedEnvironmentConfigurationPanel", containerNode)[0]); + this.replicatedEnvironmentConfigurationGrid = new UpdatableStore([], + query(".replicatedEnvironmentConfiguration", containerNode)[0], + [ {name: 'Name', field: 'id', width: '50%'}, {name: 'Value', field: 'value', width: '50%'} ], + null, + null, + null, true ); + + this.membersGridPanel = registry.byNode(query(".membersGridPanel", containerNode)[0]); + this.membersGrid = new UpdatableStore([], + findNode("groupMembers", containerNode), + [ + { name: 'Name', field: 'name', width: '10%' }, + { name: 'Role', field: 'role', width: '10%' }, + { name: 'Address', field: 'address', width: '35%' }, + { name: 'Join Time', field: 'joinTime', width: '25%', formatter: function(value){ return value ? UserPreferences.formatDateTime(value) : "";} }, + { name: 'Replication Transaction ID', field: 'lastKnownReplicationTransactionId', width: '20%' } + ], + null, + { + selectionMode: "single", + keepSelection: true, + plugins: { + indirectSelection: true + } + }, + EnhancedGrid, true ); + + this.removeNodeButton = registry.byNode(query(".removeNodeButton", containerNode)[0]); + this.transferMasterButton = registry.byNode(query(".transferMasterButton", containerNode)[0]); + this.transferMasterButton.set("disabled", true); + this.removeNodeButton.set("disabled", true); + + var nodeControlsToggler = function(rowIndex) + { + var data = that.membersGrid.grid.selection.getSelected(); + that.transferMasterButton.set("disabled", data.length != 1|| data[0].role != "REPLICA"); + that.removeNodeButton.set("disabled", data.length != 1 || data[0].role == "MASTER" || data[0].name == that.data.name); + }; + connect.connect(this.membersGrid.grid.selection, 'onSelected', nodeControlsToggler); + connect.connect(this.membersGrid.grid.selection, 'onDeselected', nodeControlsToggler); + + this.transferMasterButton.on("click", + function(e) + { + var data = that.membersGrid.grid.selection.getSelected(); + if (data.length == 1 && confirm("Are you sure you would like to transfer mastership to node '" + data[0].name + "'?")) + { + sendRequest(that.data.name, data[0].name, "POST", {role: "MASTER"}); + that.membersGrid.grid.selection.clear(); + } + } + ); + + this.removeNodeButton.on("click", + function(e){ + var data = that.membersGrid.grid.selection.getSelected(); + if (data.length == 1 && confirm("Are you sure you would like to delete node '" + data[0].name + "'?")) + { + sendRequest(that.data.name, data[0].name, "DELETE"); + that.membersGrid.grid.selection.clear(); + } + } + ); + + this.stopNodeButton = registry.byNode(findNode("stopNodeButton", containerNode)); + this.startNodeButton = registry.byNode(findNode("startNodeButton", containerNode)); + this.editNodeButton = registry.byNode(findNode("editNodeButton", containerNode)); + this.deleteNodeButton = registry.byNode(query(".deleteNodeButton", containerNode)[0]); + this.deleteNodeButton.on("click", + function(e) + { + if (confirm("Deletion of virtual host node will delete both configuration and message data.\n\n Are you sure you want to delete virtual host node?")) + { + sendRequest(that.data.name, that.data.name, "DELETE"); + // TODO: close tab + } + } + ); + + } + + BDBHA.prototype.update=function(data) + { + this.data = data; + for(var i = 0; i < nodeFields.length; i++) + { + var name = nodeFields[i]; + this[name].innerHTML = entities.encode(String(data[name])); + } + + this._updateGrid(this._convertConfig(data.environmentConfiguration), this.environmentConfigurationPanel, this.environmentConfigurationGrid ); + this._updateGrid(this._convertConfig(data.replicatedEnvironmentConfiguration), this.replicatedEnvironmentConfigurationPanel, this.replicatedEnvironmentConfigurationGrid ); + + var members = data.remotereplicationnodes; + if (members) + { + members.push({ + id: data.id, + name: data.name, + groupName: data.groupName, + address: data.address, + role: data.role, + joinTime: data.joinTime, + lastKnownReplicationTransactionId: data.lastKnownReplicationTransactionId + }); + } + this._updateGrid(members, this.membersGridPanel, this.membersGrid); + + if (!members || members.length < 3) + { + this.designatedPrimaryContainer.style.display="block"; + this.priorityContainer.style.display="none"; + this.quorumOverrideContainer.style.display="none"; + } + else + { + this.designatedPrimaryContainer.style.display="none"; + this.priorityContainer.style.display="block"; + this.quorumOverrideContainer.style.display="block"; + } + this.deleteNodeButton.set("disabled", data.role=="MASTER"); + }; + + BDBHA.prototype._updateGrid=function(conf, panel, updatableGrid) + { + if (conf && conf.length > 0) + { + panel.domNode.style.display="block"; + var changed = updatableGrid.update(conf); + if (changed) + { + updatableGrid.grid._refresh(); + } + } + else + { + panel.domNode.style.display="none"; + } + } + + BDBHA.prototype._convertConfig=function(conf) + { + var settings = []; + if (conf) + { + for(var propName in conf) + { + if(conf.hasOwnProperty(propName)) + { + settings.push({"id": propName, "value": conf[propName]}); + } + } + } + return settings; + } + return BDBHA; +}); diff --git a/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb/show.html b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb/show.html new file mode 100644 index 0000000000..cdf96c3fb8 --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb/show.html @@ -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. + --> +<div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Store Path:</div> + <div class="storePath" style="float:left;"></div> + </div> + <div style="clear:both"></div> + <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Environment Configuration', open: true" class="environmentConfigurationPanel"> + <div class="environmentConfiguration"></div> + </div> +</div>
\ No newline at end of file diff --git a/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html new file mode 100644 index 0000000000..5feb5db256 --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html @@ -0,0 +1,87 @@ +<!-- + - + - 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" style="float:left; width: 200px;">Group Name:</div> + <div class="groupName" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px">Store Path:</div> + <div class="storePath" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Role:</div> + <div class="role" style="float:left;">N/A</div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Address:</div> + <div class="address" style="float:left;">N/A</div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Coalescing Sync:</div> + <div class="coalescingSync" style="float:left;">N/A</div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Durability:</div> + <div class="durability" style="float:left;">N/A</div> + </div> + <div style="clear:both" class="designatedPrimaryContainer"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Allow this node to operate solo:</div> + <div class="designatedPrimary" style="float:left;">N/A</div> + </div> + <div style="clear:both" class="priorityContainer"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Election priority:</div> + <div class="priority" style="float:left;">Never</div> + </div> + <div style="clear:both" class="quorumOverrideContainer"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Required minimum number of nodes:</div> + <div style="float:left;"> + <span class="quorumOverride" >N/A</span> + <span style="margin-left: 20px;">[ 0 signifies simple majority ]</span> + </div> + </div> + <div style="clear:both"></div> + <br/> + <div style="clear:both" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Environment Configuration'" class="environmentConfigurationPanel"> + <div class="environmentConfiguration"></div> + </div> + <div style="clear:both"></div> + <br/> + <div style="clear:both" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Replicated Environment Configuration'" class="replicatedEnvironmentConfigurationPanel"> + <div class="replicatedEnvironmentConfiguration"></div> + </div> + <div style="clear:both"></div> + <div class="dijitDialogPaneActionBar"> + <button data-dojo-type="dijit.form.Button" class="startNodeButton" type="button" data-dojo-props="disabled: true">Start</button> + <button data-dojo-type="dijit.form.Button" class="stopNodeButton" type="button" data-dojo-props="disabled: true">Stop</button> + <button data-dojo-type="dijit.form.Button" class="editNodeButton" type="button" data-dojo-props="disabled: true">Edit</button> + <button data-dojo-type="dijit.form.Button" class="deleteNodeButton" data-dojo-props="iconClass: 'dijitIconDelete', disabled: true">Delete Node</button> + </div> + + <br/> + <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Group nodes'" class="membersGridPanel"> + <div class="groupMembers"></div> + <div class="groupMembersToolbar dijitDialogPaneActionBar"> + <button data-dojo-type="dijit.form.Button" class="removeNodeButton" data-dojo-props="iconClass: 'dijitIconDelete'">Remove Node</button> + <button data-dojo-type="dijit.form.Button" class="transferMasterButton" data-dojo-props="iconClass: 'dijitIconConfigure'">Make Node Master</button> + </div> + </div> +</div> diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java index 6655ec1e4b..c3c85d5ed5 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java @@ -256,9 +256,12 @@ public abstract class AbstractVirtualHostNode<X extends AbstractVirtualHostNode< { virtualHost.setDesiredState(State.STOPPED); } - getConfigurationStore().closeConfigurationStore(); - - getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.CLOSE()); + DurableConfigurationStore configurationStore = getConfigurationStore(); + if (configurationStore != null) + { + configurationStore.closeConfigurationStore(); + getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.CLOSE()); + } } @Override 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 new file mode 100644 index 0000000000..d72b41d0c4 --- /dev/null +++ b/qpid/java/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/show.js @@ -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. + * + */ +define(["dojo/_base/xhr", + "dojo/_base/lang", + "dojo/_base/connect", + "dojo/parser", + "dojo/string", + "dojox/html/entities", + "dojo/query", + "dojo/json", + "dojo/domReady!"], + function (xhr, lang, connect, parser, json, entities, query, json) + { + function DerbyNode(containerNode) + { + var that = this; + xhr.get({url: "virtualhostnode/derby/show.html", + sync: true, + load: function(template) { + containerNode.innerHTML = template; + parser.parse(containerNode); + }}); + this.storePath = query(".storePath", containerNode)[0]; + } + + DerbyNode.prototype.update=function(data) + { + this.storePath.innerHTML = entities.encode(String(data.storePath)); + }; + + return DerbyNode; +}); 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 new file mode 100644 index 0000000000..9cf5dadae8 --- /dev/null +++ b/qpid/java/broker-plugins/derby-store/src/main/java/resources/virtualhostnode/derby/show.html @@ -0,0 +1,21 @@ +<!-- + ~ 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 style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Store Path:</div> + <div class="storePath" style="float:left;"></div> +</div>
\ No newline at end of file diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java index 037b9ee037..d70f2a3d78 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/JDBCMessageStore.java @@ -50,7 +50,7 @@ public class JDBCMessageStore extends AbstractJDBCMessageStore implements Messag private static final Logger _logger = Logger.getLogger(JDBCMessageStore.class); public static final String TYPE = "JDBC"; - public static final String CONNECTION_URL = "connectionURL"; + public static final String CONNECTION_URL = "connectionUrl"; public static final String CONNECTION_POOL_TYPE = "connectionPoolType"; public static final String JDBC_BIG_INT_TYPE = "bigIntType"; public static final String JDBC_BYTES_FOR_BLOB = "bytesForBlob"; diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java index f66cb74529..302ec9c59f 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNode.java @@ -21,10 +21,10 @@ package org.apache.qpid.server.virtualhostnode.jdbc; import org.apache.qpid.server.model.ManagedAttribute; +import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.store.jdbc.DefaultConnectionProviderFactory; - -public interface JDBCVirtualHostNode +public interface JDBCVirtualHostNode<X extends JDBCVirtualHostNode<X>> extends VirtualHostNode<X> { //TODO: Split this attribute into connectionUrl, username and password. Make the password attribute secure. @ManagedAttribute(mandatory=true) diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNodeImpl.java b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNodeImpl.java index 8d7c79b656..cb3077bc65 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNodeImpl.java +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/virtualhostnode/jdbc/JDBCVirtualHostNodeImpl.java @@ -31,7 +31,7 @@ import org.apache.qpid.server.store.jdbc.JDBCMessageStoreFactory; import org.apache.qpid.server.virtualhostnode.AbstractStandardVirtualHostNode; @ManagedObject( category = false, type = "JDBC" ) -public class JDBCVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<JDBCVirtualHostNodeImpl> implements JDBCVirtualHostNode +public class JDBCVirtualHostNodeImpl extends AbstractStandardVirtualHostNode<JDBCVirtualHostNodeImpl> implements JDBCVirtualHostNode<JDBCVirtualHostNodeImpl> { @ManagedAttributeField private String _connectionUrl; diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/store/jdbc/add.js b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/store/jdbc/add.js index d1f4787202..21c0c17de9 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/store/jdbc/add.js +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/store/jdbc/add.js @@ -81,7 +81,7 @@ define(["dojo/_base/xhr", var poolTypesDiv = dom.byId("addVirtualHost.specific.selectPoolType"); var input = construct.create("input", {id: "addPoolType", required: false}, poolTypesDiv); that.poolTypeChooser = new FilteringSelect({ id: "addVirtualHost.specific.store.poolType", - name: "connectionPool", + name: "connectionPoolType", store: poolTypesStore, searchAttr: "name", required: false, onChange: selectPoolType }, input); 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 new file mode 100644 index 0000000000..20637da6c2 --- /dev/null +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js @@ -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. + * + */ +define(["dojo/_base/xhr", + "dojo/_base/lang", + "dojo/_base/connect", + "dojo/parser", + "dojo/string", + "dojox/html/entities", + "dojo/query", + "dojo/json", + "dojo/domReady!"], + function (xhr, lang, connect, parser, json, entities, query, json) + { + var fieldNames = ["connectionUrl", "bigIntType", "varBinaryType", "blobType", "bytesForBlob", "connectionPoolType"]; + + function JdbcNode(containerNode) + { + var that = this; + xhr.get({url: "virtualhostnode/jdbc/show.html", + sync: true, + load: function(template) { + containerNode.innerHTML = template; + parser.parse(containerNode); + }}); + for(var i=0; i<fieldNames.length;i++) + { + var fieldName = fieldNames[i]; + this[fieldName]= query("." + fieldName, containerNode)[0]; + } + } + + JdbcNode.prototype.update=function(data) + { + for(var i=0; i<fieldNames.length;i++) + { + var fieldName = fieldNames[i]; + var value = data[fieldName]; + this[fieldName].innerHTML= value?entities.encode(String(value)):""; + } + }; + + return JdbcNode; +}); diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhost/store/jdbc/add.html b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhost/store/jdbc/add.html index c3d6c287a2..0644887a43 100644 --- a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhost/store/jdbc/add.html +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhost/store/jdbc/add.html @@ -19,7 +19,7 @@ <td class="tableContainer-labelCell" style="width: 300px;"><strong>JDBC Url*: </strong></td> <td class="tableContainer-valueCell"> <input dojoType="dijit/form/ValidationTextBox" required="true" id="formAddVirtualHost.specific.store.connectionURL" - name="connectionURL" placeholder="jdbc:provider:info" /> + name="connectionUrl" placeholder="jdbc:provider:info" /> </tr> <tr> <td class="tableContainer-labelCell" style="width: 300px;"><strong>Connection Pool: </strong></td> diff --git a/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/show.html b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/show.html new file mode 100644 index 0000000000..63fec28012 --- /dev/null +++ b/qpid/java/broker-plugins/jdbc-store/src/main/java/resources/virtualhostnode/jdbc/show.html @@ -0,0 +1,44 @@ +<!-- + ~ 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" style="float:left; width: 200px;">Connection URL:</div> + <div class="connectionUrl" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Big Integer Type:</div> + <div class="bigIntType" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Var Binary Type:</div> + <div class="varBinaryType" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Blob Type:</div> + <div class="blobType" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Bytes For Blob:</div> + <div class="bytesForBlob" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Connection Pool Type:</div> + <div class="connectionPoolType" style="float:left;"></div> + </div> + <div style="clear:both"></div> +</div> + diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js index ea3ba78372..97b1e32798 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js @@ -97,8 +97,11 @@ define(["dojo/store/Memory", } } if(modified) { - // ... check attributes for updates - store.notify(theItem, data[i].id); + store.put(data[i], {overwrite: true}); + if (store instanceof Observable) + { + store.notify(theItem, data[i].id); + } changed = true; } } else { 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 a0414b07d2..9696280b2c 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 @@ -44,6 +44,9 @@ define(["dojo/_base/xhr", "dijit/form/ValidationTextBox", "dijit/form/CheckBox", "dojo/store/Memory", + "dijit/form/DropDownButton", + "dijit/Menu", + "dijit/MenuItem", "dojo/domReady!"], function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, entities, addAuthenticationProvider, addVirtualHost, addPort, addKeystore, addGroupProvider, addAccessControlProvider) { @@ -197,17 +200,6 @@ define(["dojo/_base/xhr", var addHostButton = query(".addVirtualHost", contentPane.containerNode)[0]; connect.connect(registry.byNode(addHostButton), "onClick", function(evt){ addVirtualHost.show(); }); - var deleteHostButton = query(".deleteVirtualHost", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deleteHostButton), "onClick", - function(evt){ - util.deleteGridSelections( - that.brokerUpdater, - that.brokerUpdater.vhostsGrid.grid, - "api/latest/virtualhostnodes", - "Deletion of virtual host will delete the message store data.\n\n Are you sure you want to delete virtual host"); - } - ); - var addPortButton = query(".addPort", contentPane.containerNode)[0]; connect.connect(registry.byNode(addPortButton), "onClick", function(evt){ addPort.show(null, that.brokerUpdater.brokerData.authenticationproviders, @@ -335,6 +327,7 @@ define(["dojo/_base/xhr", var gridProperties = { height: 400, + selectionMode: "single", plugins: { pagination: { pageSizes: ["10", "25", "50", "100"], @@ -350,27 +343,30 @@ define(["dojo/_base/xhr", that.vhostsGrid = new UpdatableStore(that.brokerData.virtualhostnodes, query(".broker-virtualhosts")[0], - [ { name: "Virtual Host", field: "_item", width: "120px", + [ + { name: "Node Name", field: "name", width: "20%"}, + { name: "Node State", field: "state", width: "15%"}, + { name: "Virtual Host Path", field: "_item", width: "20%", formatter: function(item){ return item && item.virtualhosts? item.virtualhosts[0].name: (item?item.name: "N/A"); } }, - { name: "State", field: "_item", width: "70px", + { name: "Virtual Host State", field: "_item", width: "15%", formatter: function(item){ return item && item.virtualhosts? item.virtualhosts[0].state: (item?item.state: "N/A"); } }, - { name: "Connections", field: "_item", width: "80px", + { name: "Connections", field: "_item", width: "10%", formatter: function(item){ return item && item.virtualhosts? item.virtualhosts[0].statistics.connectionCount: 0; } }, - { name: "Queues", field: "_item", width: "80px", + { name: "Queues", field: "_item", width: "10%", formatter: function(item){ return item && item.virtualhosts? item.virtualhosts[0].statistics.queueCount: 0; } }, - { name: "Exchanges", field: "_item", width: "100%", + { name: "Exchanges", field: "_item", width: "10%", formatter: function(item){ return item && item.virtualhosts? item.virtualhosts[0].statistics.exchangeCount: 0; } @@ -380,13 +376,57 @@ define(["dojo/_base/xhr", function(evt){ var idx = evt.rowIndex, theItem = this.getItem(idx); - var nodeName = obj.dataStore.getValue(theItem,"name"); - var host = theItem && theItem.virtualhosts? theItem.virtualhosts[0]: null; - var nodeObject = { type: "virtualhostnode", name: nodeName, parent: brokerObj}; - that.controller.show("virtualhost", host?host.name:nodeName, nodeObject, host?host.id:null); + that.showVirtualHost(theItem, brokerObj); }); }, gridProperties, EnhancedGrid); + var virtualHostNodeMenuButton = registry.byNode(query(".virtualHostNodeMenuButton", node)[0]); + var virtualHostMenuButton = registry.byNode(query(".virtualHostMenuButton", node)[0]); + + var toggleVirtualHostNodeNodeMenus = function(rowIndex){ + var data = that.vhostsGrid.grid.selection.getSelected(); + virtualHostNodeMenuButton.set("disabled",data.length!=1); + virtualHostMenuButton.set("disabled",data.length!=1 ); + }; + + connect.connect(that.vhostsGrid.grid.selection, 'onSelected', toggleVirtualHostNodeNodeMenus); + connect.connect(that.vhostsGrid.grid.selection, 'onDeselected', toggleVirtualHostNodeNodeMenus); + + var hostMenuItems = virtualHostMenuButton.dropDown.getChildren(); + var viewVirtualHostItem = hostMenuItems[0]; + viewVirtualHostItem.on("click", function(){ + var data = that.vhostsGrid.grid.selection.getSelected(); + if (data.length == 1) + { + that.showVirtualHost(data[0], brokerObj); + } + }); + + var nodeMenuItems = virtualHostNodeMenuButton.dropDown.getChildren(); + var viewNodeButton = nodeMenuItems[0]; + viewNodeButton.on("click", + function(evt){ + var data = that.vhostsGrid.grid.selection.getSelected(); + if (data.length == 1) + { + var item = data[0]; + that.controller.show("virtualhostnode", item.name, brokerObj, item.id); + } + } + ); + var deleteNodeButton = nodeMenuItems[1]; + deleteNodeButton.on("click", + function(evt){ + util.deleteGridSelections( + that, + that.vhostsGrid.grid, + "api/latest/virtualhostnode", + "Deletion of virtual host node will delete both configuration and message data.\n\n Are you sure you want to delete virtual host node"); + } + ); + + gridProperties.selectionMode="extended"; + that.portsGrid = new UpdatableStore(that.brokerData.ports, query(".broker-ports")[0], [ { name: "Name", field: "name", width: "150px"}, @@ -502,6 +542,14 @@ define(["dojo/_base/xhr", }); } + BrokerUpdater.prototype.showVirtualHost=function(item, brokerObj) + { + var nodeName = item.name; + var host = item.virtualhosts? item.virtualhosts[0]: null; + var nodeObject = { type: "virtualhostnode", name: nodeName, parent: brokerObj}; + this.controller.show("virtualhost", host?host.name:nodeName, nodeObject, host?host.id:null); + } + BrokerUpdater.prototype.updateHeader = function() { this.showReadOnlyAttributes(); 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 new file mode 100644 index 0000000000..e2cd763fba --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js @@ -0,0 +1,132 @@ +/* + * + * 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/query", + "dojo/_base/connect", + "dijit/registry", + "dojox/html/entities", + "qpid/common/properties", + "qpid/common/updater", + "qpid/common/util", + "qpid/common/formatter", + "qpid/common/UpdatableStore", + "qpid/management/addQueue", + "qpid/management/addExchange", + "dojox/grid/EnhancedGrid", + "dojo/domReady!"], + function (xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, EnhancedGrid) { + + function VirtualHostNode(name, parent, controller) + { + this.name = name; + this.controller = controller; + this.modelObj = { type: "virtualhostnode", name: name, parent: parent}; + } + + VirtualHostNode.prototype.getTitle = function() + { + return "VirtualHostNode: " + this.name; + }; + + VirtualHostNode.prototype.open = function(contentPane) + { + var that = this; + this.contentPane = contentPane; + xhr.get({url: "showVirtualHostNode.html", + sync: true, + load: function(data) { + contentPane.containerNode.innerHTML = data; + parser.parse(contentPane.containerNode); + + that.vhostNodeUpdater = new Updater(contentPane.containerNode, that.modelObj, that.controller); + that.vhostNodeUpdater.update(); + + updater.add( that.vhostNodeUpdater ); + }}); + + }; + + VirtualHostNode.prototype.close = function() + { + updater.remove( this.vhostNodeUpdater ); + }; + + function Updater(node, vhost, controller) + { + var that = this; + + function findNode(name) + { + return query("." + name, node)[0]; + } + + function storeNodes(names) + { + for(var i = 0; i < names.length; i++) + { + that[names[i]] = findNode(names[i]); + } + } + + storeNodes(["name", "state", "type", "messageStoreProviderYes","messageStoreProviderNo"]); + this.detailsDiv = findNode("virtualhostnodedetails"); + + this.query = "api/latest/virtualhostnode/" + encodeURIComponent(vhost.name); + } + + Updater.prototype.update = function() + { + var that = this; + xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then( + function(data) + { + that.updateUI(data[0]); + } + ); + }; + + Updater.prototype.updateUI = function(data) + { + this.name.innerHTML = entities.encode(String(data[ "name" ])); + this.state.innerHTML = entities.encode(String(data[ "state" ])); + this.type.innerHTML = entities.encode(String(data[ "type" ])); + this.messageStoreProviderYes.style.display = data.messageStoreProvider? "block" : "none"; + this.messageStoreProviderNo.style.display = data.messageStoreProvider? "none" : "block"; + if (!this.details) + { + var that = this; + require(["qpid/management/virtualhostnode/" + data.type.toLowerCase() + "/show"], + function(VirtualHostNodeDetails) + { + that.details = new VirtualHostNodeDetails(that.detailsDiv); + that.details.update(data); + } + ); + } + else + { + this.details.update(data); + } + } + + return VirtualHostNode; + }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js index edf534176d..4b8e9db4b0 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js @@ -39,10 +39,11 @@ define(["dojo/dom", "qpid/management/Plugin", "qpid/management/logs/LogViewer", "qpid/management/PreferencesProvider", + "qpid/management/VirtualHostNode", "dojo/ready", "dojo/domReady!"], function (dom, registry, ContentPane, CheckBox, UserPreferences, entities, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, - GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, LogViewer, PreferencesProvider, ready) { + GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, LogViewer, PreferencesProvider, VirtualHostNode, ready) { var controller = {}; var constructors = { broker: Broker, virtualhost: VirtualHost, exchange: Exchange, @@ -50,7 +51,8 @@ define(["dojo/dom", authenticationprovider: AuthProvider, groupprovider: GroupProvider, group: Group, keystore: KeyStore, truststore: TrustStore, accesscontrolprovider: AccessControlProvider, port: Port, - plugin: Plugin, logViewer: LogViewer, preferencesprovider: PreferencesProvider}; + plugin: Plugin, logViewer: LogViewer, preferencesprovider: PreferencesProvider, + virtualhostnode: VirtualHostNode}; var tabDiv = dom.byId("managedViews"); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js index 0a05cca75d..3b65ffaacf 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js @@ -296,6 +296,8 @@ define(["dojo/_base/xhr", controller.show("plugin", details.plugin, {type:"broker", name:""}, theItem.id); } else if (details.type == "preferencesprovider") { controller.show("preferencesprovider", details.preferencesprovider, details.parent, theItem.id); + } else if (details.type == "virtualhostnode") { + controller.show("virtualhostnode", details.virtualhostnode, details.parent, theItem.id); } }; diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/show.js new file mode 100644 index 0000000000..e912cf2fb0 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/show.js @@ -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. + * + */ +define(["dojo/_base/xhr", + "dojo/_base/lang", + "dojo/_base/connect", + "dojo/parser", + "dojo/string", + "dojox/html/entities", + "dojo/query", + "dojo/json", + "dojo/domReady!"], + function (xhr, lang, connect, parser, json, entities, query, json) + { + function JsonNode(containerNode) + { + var that = this; + xhr.get({url: "virtualhostnode/json/show.html", + sync: true, + load: function(template) { + containerNode.innerHTML = template; + parser.parse(containerNode); + }}); + this.storePath = query(".storePath", containerNode)[0]; + } + + JsonNode.prototype.update=function(data) + { + this.storePath.innerHTML = entities.encode(String(data.storePath)); + }; + + return JsonNode; +}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html index 0fab44fe84..d036fd9e22 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html @@ -74,7 +74,27 @@ <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual Hosts'"> <div class="broker-virtualhosts"></div> <button data-dojo-type="dijit.form.Button" class="addVirtualHost">Add Virtual Host</button> - <button data-dojo-type="dijit.form.Button" class="deleteVirtualHost">Delete Virtual Host</button> + <div data-dojo-type="dijit.form.DropDownButton" class="virtualHostNodeMenuButton" data-dojo-props="iconClass: 'dijitIconConnector',disabled:true"> + <span>Virtual Host Node</span> + <div data-dojo-type="dijit.Menu"> + <div data-dojo-type="dijit.MenuItem">View</div> + <div data-dojo-type="dijit.MenuItem">Delete</div> + <div data-dojo-type="dijit.MenuItem" + data-dojo-props="disabled: true,onClick: function(){alert('TODO');}">Start</div> + <div data-dojo-type="dijit.MenuItem" + data-dojo-props="disabled:true, onClick: function(){alert('TODO');}">Stop</div> + </div> + </div> + <div data-dojo-type="dijit.form.DropDownButton" class="virtualHostMenuButton" data-dojo-props="iconClass: 'dijitIconPackage',disabled:true"> + <span>Virtual Host</span> + <div data-dojo-type="dijit.Menu" class="virtualHostMenu"> + <div data-dojo-type="dijit.MenuItem" class="viewVirtualHost" >View</div> + <div data-dojo-type="dijit.MenuItem" + data-dojo-props="disabled: true,onClick: function(){alert('TODO');}">Start</div> + <div data-dojo-type="dijit.MenuItem" + data-dojo-props="disabled:true, onClick: function(){alert('TODO');}">Quiesce</div> + </div> + </div> </div> <br/> <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Ports'"> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html new file mode 100644 index 0000000000..2559dd98f9 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML> +<!-- + - + - 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="virtualhostnode"> + <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual Host Node Attributes', open: true"> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Name:</div> + <div class="name" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">State:</div> + <div class="state" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Type:</div> + <div class="type" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Message Store Provider:</div> + <div class="messageStoreProviderYes" style="float:left;display:none">Yes</div> + <div class="messageStoreProviderNo" style="float:left;display:none">No</div> + </div> + <div class="virtualhostnodedetails" style="clear:both"> + </div> + <div style="clear:both"></div> + </div> + <br/> +</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 new file mode 100644 index 0000000000..9cf5dadae8 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html @@ -0,0 +1,21 @@ +<!-- + ~ 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 style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 200px;">Store Path:</div> + <div class="storePath" style="float:left;"></div> +</div>
\ No newline at end of file |