From 7dffa6c6bd8db286afa61108ef6c70bc4875251c Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Wed, 7 May 2014 09:27:02 +0000 Subject: 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 --- .../js/qpid/management/virtualhostnode/bdb/show.js | 81 +++++++ .../qpid/management/virtualhostnode/bdb_ha/show.js | 265 +++++++++++++++++++++ .../java/resources/virtualhostnode/bdb/show.html | 26 ++ .../resources/virtualhostnode/bdb_ha/show.html | 87 +++++++ 4 files changed, 459 insertions(+) create mode 100644 qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/show.js create mode 100644 qpid/java/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/show.js create mode 100644 qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb/show.html create mode 100644 qpid/java/bdbstore/src/main/java/resources/virtualhostnode/bdb_ha/show.html (limited to 'qpid/java/bdbstore/src') 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 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 @@ + +
+
+
Store Path:
+
+
+
+
+
+
+
\ 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 @@ + +
+
+
Group Name:
+
+
+
+
Store Path:
+
+
+
+
Role:
+
N/A
+
+
+
Address:
+
N/A
+
+
+
Coalescing Sync:
+
N/A
+
+
+
Durability:
+
N/A
+
+
+
Allow this node to operate solo:
+
N/A
+
+
+
Election priority:
+
Never
+
+
+
Required minimum number of nodes:
+
+ N/A + [ 0 signifies simple majority ] +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+ +
+
+
+
+ + +
+
+
-- cgit v1.2.1