diff options
| author | Andrew MacBean <macbean@apache.org> | 2014-07-25 16:16:12 +0000 |
|---|---|---|
| committer | Andrew MacBean <macbean@apache.org> | 2014-07-25 16:16:12 +0000 |
| commit | 151622bd91d7eb031498ff598a31a295af27799b (patch) | |
| tree | 37c36b0b878866689603d6c85da3a217d6125d2d /qpid/java/broker-plugins/management-http | |
| parent | 6b02c4c08fdc26de6e048357111d9e0b85ab4927 (diff) | |
| download | qpid-python-151622bd91d7eb031498ff598a31a295af27799b.tar.gz | |
QPID-5928: [Java Broker] Implement or update virtualhostnode & virtualhost
Work completed by Alex Rudyy <orudyy@apache.org> and me.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1613461 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http')
13 files changed, 627 insertions, 101 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/show.html index bc302d1e65..aca9f5d309 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/show.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/show.html @@ -18,4 +18,4 @@ <div style="clear:both"> <div class="formLabel-labelCell" style="float:left; width: 100px;">Path:</div> <div class="fileSystemPreferencesProviderPath" style="float:left;"></div> -</div>
\ No newline at end of file +</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 8a0ea792f5..8be41ce793 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 @@ -205,4 +205,9 @@ div .messages { font-style: italic; } +.dijitDialogPaneActionBar .editNodeButton +{ + display: none +} + 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 new file mode 100644 index 0000000000..04d6a803a2 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html @@ -0,0 +1,118 @@ +<!-- + ~ 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="editVirtualHostDialog"> + <form id="editVirtualHostForm" method="post" data-dojo-type="dijit/form/Form"> + + <div id="editVirtualHost.typeFields"></div> + + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Dead letter queue enabled:</div> + <div style="float:left;" 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> + </div> + + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Store Transaction Idle Timeout Warn:</div> + <div style="float:left;" 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" style="float:left; width: 300px;">Store Transaction Idle Timeout Close:</div> + <div style="float:left;" 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" style="float:left; width: 300px;">Store Transaction Open Timeout Warn:</div> + <div style="float:left;" 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" style="float:left; width: 300px;">Store Transaction Open Timeout Close:</div> + <div style="float:left;" 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> + + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">House keeping check period (ms):</div> + <div style="float:left;" 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" style="float:left; width: 300px;">House keeping thread count:</div> + <div style="float:left;" 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> + + <div style="clear:both"></div> + + <div class="dijitDialogPaneActionBar"> + <button data-dojo-type="dijit/form/Button" id="editVirtualHost.saveButton" data-dojo-props="label: 'Save'">Save</button> + <button data-dojo-type="dijit/form/Button" id="editVirtualHost.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 1391d7d5ff..60c05a5df6 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 @@ -26,6 +26,9 @@ define(["dojo/_base/xhr", "dojo/dom-construct", "dojo/dom-geometry", "dojo/window", + "dojo/query", + "dojo/parser", + "dojox/html/entities", "dijit/TitlePane", "dijit/Dialog", "dijit/form/Form", @@ -38,7 +41,7 @@ define(["dojo/_base/xhr", "dojox/validate/web", "dojo/domReady!" ], - function (xhr, event, json, lang, dom, geometry, win) { + function (xhr, event, json, lang, dom, geometry, win, query, parser, entities) { var util = {}; if (Array.isArray) { util.isArray = function (object) { @@ -491,5 +494,73 @@ define(["dojo/_base/xhr", return object1 === object2; } + util.buildUI = function(containerNode, parent, htmlTemplateLocation, fieldNames, obj) + { + xhr.get({url: htmlTemplateLocation, + sync: true, + load: function(template) { + containerNode.innerHTML = template; + parser.parse(containerNode); + }}); + for(var i=0; i<fieldNames.length;i++) + { + var fieldName = fieldNames[i]; + obj[fieldName]= query("." + fieldName, containerNode)[0]; + } + } + + util.updateUI = function(data, fieldNames, obj) + { + for(var i=0; i<fieldNames.length;i++) + { + var fieldName = fieldNames[i]; + var value = data[fieldName]; + obj[fieldName].innerHTML= (value == undefined || value == null) ? "" : entities.encode(String(value)); + } + } + + util.getFormWidgetValues = function (form) + { + var values = {}; + var formWidgets = form.getChildren(); + for(var i in formWidgets) + { + var widget = formWidgets[i]; + var value = widget.value; + var propName = widget.name; + if (propName && (widget.required || value )) + { + if (widget instanceof dijit.form.CheckBox) + { + values[ propName ] = widget.checked; + } + else if (widget instanceof dijit.form.RadioButton && value) + { + var currentValue = values[propName]; + if (currentValue) + { + if (lang.isArray(currentValue)) + { + currentValue.push(value) + } + else + { + values[ propName ] = [currentValue, value]; + } + } + else + { + values[ propName ] = value; + } + } + else + { + values[ propName ] = value ? value: null; + } + } + } + return values; + } + return util; }); 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 999638d0c7..d0ffb49c2e 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 @@ -32,8 +32,9 @@ define(["dojo/_base/xhr", "qpid/management/addQueue", "qpid/management/addExchange", "dojox/grid/EnhancedGrid", + "qpid/management/editVirtualHost", "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, EnhancedGrid, editVirtualHost) { function VirtualHost(name, parent, controller) { this.name = name; @@ -52,21 +53,18 @@ define(["dojo/_base/xhr", xhr.get({url: "showVirtualHost.html", sync: true, load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode); + var containerNode = contentPane.containerNode; + containerNode.innerHTML = data; + parser.parse(containerNode); - that.vhostUpdater = new Updater(contentPane.containerNode, that.modelObj, that.controller); + that.vhostUpdater = new Updater(containerNode, that.modelObj, that.controller, that); - updater.add( that.vhostUpdater ); - - that.vhostUpdater.update(); - - var addQueueButton = query(".addQueueButton", contentPane.containerNode)[0]; + var addQueueButton = query(".addQueueButton", containerNode)[0]; connect.connect(registry.byNode(addQueueButton), "onClick", function(evt){ addQueue.show({virtualhost:that.name,virtualhostnode:that.modelObj.parent.name}) }); - var deleteQueueButton = query(".deleteQueueButton", contentPane.containerNode)[0]; + var deleteQueueButton = query(".deleteQueueButton", containerNode)[0]; connect.connect(registry.byNode(deleteQueueButton), "onClick", function(evt){ util.deleteGridSelections( @@ -77,10 +75,10 @@ define(["dojo/_base/xhr", } ); - var addExchangeButton = query(".addExchangeButton", contentPane.containerNode)[0]; + var addExchangeButton = query(".addExchangeButton", containerNode)[0]; connect.connect(registry.byNode(addExchangeButton), "onClick", function(evt){ addExchange.show({virtualhost:that.name,virtualhostnode:that.modelObj.parent.name}) }); - var deleteExchangeButton = query(".deleteExchangeButton", contentPane.containerNode)[0]; + var deleteExchangeButton = query(".deleteExchangeButton", containerNode)[0]; connect.connect(registry.byNode(deleteExchangeButton), "onClick", function(evt) { @@ -91,6 +89,54 @@ define(["dojo/_base/xhr", "Are you sure you want to delete exchange"); } ); + + that.stopButton = registry.byNode(query(".stopButton", containerNode)[0]); + that.startButton = registry.byNode(query(".startButton", containerNode)[0]); + that.editButton = registry.byNode(query(".editButton", containerNode)[0]); + that.deleteButton = registry.byNode(query(".deleteButton", containerNode)[0]); + that.deleteButton.on("click", + function(e) + { + if (confirm("Deletion of virtual host will delete message data.\n\n" + + "Are you sure you want to delete virtual host '" + entities.encode(String(that.name)) + "'?")) + { + if (util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name) , "DELETE")) + { + that.destroy(); + } + } + } + ); + that.startButton.on("click", + function(event) + { + that.startButton.set("disabled", true); + util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name), + "PUT", {desiredState: "ACTIVE"}); + }); + + that.stopButton.on("click", + function(event) + { + if (confirm("Stopping the virtual host will also stop its children. " + + "Are you sure you want to stop virtual host '" + + entities.encode(String(that.name)) +"'?")) + { + that.stopButton.set("disabled", true); + util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name), + "PUT", {desiredState: "STOPPED"}); + } + }); + + that.editButton.on("click", + function(event) + { + editVirtualHost.show({nodeName:that.modelObj.parent.name,hostName:that.name}); + }); + + that.vhostUpdater.update(); + updater.add( that.vhostUpdater ); + }}); }; @@ -99,9 +145,17 @@ define(["dojo/_base/xhr", updater.remove( this.vhostUpdater ); }; - function Updater(node, vhost, controller) + VirtualHost.prototype.destroy = function() { + this.close(); + this.contentPane.onClose() + this.controller.tabContainer.removeChild(this.contentPane); + this.contentPane.destroyRecursive(); + } + function Updater(node, vhost, controller, virtualHost) + { + this.virtualHost = virtualHost; var that = this; function findNode(name) { @@ -116,6 +170,7 @@ define(["dojo/_base/xhr", } storeNodes(["name", + "type", "state", "durable", "lifetimePolicy", @@ -125,9 +180,15 @@ define(["dojo/_base/xhr", "msgOutRate", "bytesOutRate", "bytesOutRateUnits", - "storeType", - "storePath", - "configPath"]); + "virtualHostDetailsContainer", + "deadLetterQueueEnabled", + "housekeepingCheckPeriod", + "housekeepingThreadCount", + "storeTransactionIdleTimeoutClose", + "storeTransactionIdleTimeoutWarn", + "storeTransactionOpenTimeoutClose", + "storeTransactionOpenTimeoutWarn" + ]); this.query = "api/latest/virtualhost/"+ encodeURIComponent(vhost.parent.name) + "/" + encodeURIComponent(vhost.name); @@ -136,11 +197,6 @@ define(["dojo/_base/xhr", xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) { that.vhostData = data[0]; - if (!that.vhostData.hasOwnProperty("configPath")) - { - var node = findNode("configPathDiv"); - node.style.display = "none"; - } // flatten statistics into attributes util.flattenStatistics( that.vhostData ); @@ -231,24 +287,33 @@ define(["dojo/_base/xhr", Updater.prototype.updateHeader = function() { this.name.innerHTML = entities.encode(String(this.vhostData[ "name" ])); + this.type.innerHTML = entities.encode(String(this.vhostData[ "type" ])); this.state.innerHTML = entities.encode(String(this.vhostData[ "state" ])); this.durable.innerHTML = entities.encode(String(this.vhostData[ "durable" ])); this.lifetimePolicy.innerHTML = entities.encode(String(this.vhostData[ "lifetimePolicy" ])); - if (this.vhostData.messageStoreSettings) - { - this.storeType.innerHTML = entities.encode(String(this.vhostData[ "messageStoreSettings" ].storeType)); - this.storePath.innerHTML = entities.encode(String(this.vhostData[ "messageStoreSettings" ].storePath)); - } + this.deadLetterQueueEnabled.innerHTML = entities.encode(String(this.vhostData[ "queue.deadLetterQueueEnabled" ])); + util.updateUI(this.vhostData, + ["housekeepingCheckPeriod", + "housekeepingThreadCount", + "storeTransactionIdleTimeoutClose", + "storeTransactionIdleTimeoutWarn", + "storeTransactionOpenTimeoutClose", + "storeTransactionOpenTimeoutWarn"], + this) }; Updater.prototype.update = function() { - var thisObj = this; xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}) .then(function(data) { thisObj.vhostData = data[0]; + + thisObj.virtualHost.startButton.set("disabled", thisObj.vhostData.state != "STOPPED"); + thisObj.virtualHost.stopButton.set("disabled", thisObj.vhostData.state != "ACTIVE"); + thisObj.virtualHost.editButton.set("disabled", false); + util.flattenStatistics( thisObj.vhostData ); var connections = thisObj.vhostData[ "connections" ]; var queues = thisObj.vhostData[ "queues" ]; @@ -348,7 +413,20 @@ define(["dojo/_base/xhr", // update connections thisObj.connectionsGrid.update(thisObj.vhostData.connections) - + if (thisObj.details) + { + thisObj.details.update(thisObj.vhostData); + } + else + { + require(["qpid/management/virtualhost/" + thisObj.vhostData.type.toLowerCase() + "/show"], + function(VirtualHostDetails) + { + thisObj.details = new VirtualHostDetails({containerNode:thisObj.virtualHostDetailsContainer, parent: thisObj}); + thisObj.details.update(thisObj.vhostData); + } + ); + } }); }; 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 f34b2df8a8..78ef2e89df 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 @@ -138,7 +138,7 @@ define(["dojo/_base/xhr", } } - storeNodes(["name", "state", "type", "messageStoreProviderYes","messageStoreProviderNo"]); + storeNodes(["name", "state", "type"]); this.detailsDiv = findNode("virtualhostnodedetails"); this.query = "api/latest/virtualhostnode/" + encodeURIComponent(nodeObject.name); @@ -163,8 +163,6 @@ define(["dojo/_base/xhr", 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; 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 new file mode 100644 index 0000000000..abc127caf5 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js @@ -0,0 +1,161 @@ +/* + * + * 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!editVirtualHost.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 fields = [ "queue.deadLetterQueueEnabled", "storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", "storeTransactionOpenTimeoutWarn", "storeTransactionOpenTimeoutClose", "housekeepingCheckPeriod", "housekeepingThreadCount"]; + + var virtualHostEditor = + { + init: function() + { + var that=this; + this.containerNode = domConstruct.create("div", {innerHTML: template}); + parser.parse(this.containerNode); + 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);}); + this.saveButton.on("click", function(e){that._save(e);}); + for(var i = 0; i < fields.length; i++) + { + var fieldName = fields[i]; + this[fieldName] = registry.byId("editVirtualHost." + fieldName); + } + this.form = registry.byId("editVirtualHostForm"); + }, + 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( + { + 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); + + 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(node) + { + 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]); + } + else + { + this[fieldName].set("value", node[fieldName]); + } + + } + this.dialog.show(); + } + }; + + virtualHostEditor.init(); + + return virtualHostEditor; + } +); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/show.js index 21d377445d..8416211c62 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/show.js @@ -17,24 +17,21 @@ * under the License. */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/dom", - "dojo/dom-construct", - "dojo/json", - "dijit/registry", - "dojo/text!virtualhost/sizemonitoring/add.html", - "dijit/form/ValidationTextBox", - "dijit/form/NumberTextBox", - "dojo/domReady!"], - function (xhr, parser, dom, domConstruct, json, registry, template) +define(["qpid/common/util", "dojo/domReady!"], + function (util) { - return { - show: function (data) - { - this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); - parser.parse(this.containerNode); - } - }; + var fields = ["storeUnderfullSize", "storeOverfullSize"]; + + function ProvidedStore(data) + { + util.buildUI(data.containerNode, data.parent, "virtualhost/providedstore/show.html", fields, this); + } + + ProvidedStore.prototype.update = function(data) + { + util.updateUI(data, fields, this); + } + + return ProvidedStore; } ); 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 index bbff43c706..80e3ce26f1 100644 --- 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 @@ -18,35 +18,22 @@ * 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(data) - { - var containerNode = data.containerNode; - this.parent = data.parent; - 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]; - } + define(["qpid/common/util", + "dojo/domReady!"], + function (util) + { + var fields = ["storePath"]; - JsonNode.prototype.update=function(data) - { - this.storePath.innerHTML = entities.encode(String(data.storePath)); - }; + function JSON(data) + { + util.buildUI(data.containerNode, data.parent, "virtualhostnode/json/show.html", fields, this); + } - return JsonNode; -}); + JSON.prototype.update = function(data) + { + util.updateUI(data, fields, this); + } + + return JSON; + } + ); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html index 93a802c37e..8957639dae 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html @@ -27,6 +27,10 @@ <div class="name" style="float:left;"></div> </div> <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 100px;">Type:</div> + <div class="type" style="float:left;"></div> + </div> + <div style="clear:both"> <div class="formLabel-labelCell" style="float:left; width: 100px;">State:</div> <div class="state" style="float:left;"></div> </div> @@ -39,6 +43,65 @@ <div class="lifetimePolicy" style="float:left;"></div> </div> <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 300px;">Dead letter queue enabled:</div> + <div class="deadLetterQueueEnabled" style="float:left;"></div> + </div> + <div style="clear:both" class="virtualHostDetailsContainer"></div> + <div style="clear:both"></div> + + <br/> + + <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Store Transaction Settings', open: false"> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 300px;">Idle timeout before a warning (ms) :</div> + <div class="storeTransactionIdleTimeoutWarn" style="float:left;"></div> + <div class="formLabel-description">The time a transaction can be idle for after which a warning alert will be issued</div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 300px;">Idle timeout before closing (ms) :</div> + <div class="storeTransactionIdleTimeoutClose" style="float:left;"></div> + <div class="formLabel-description">The time a transaction can be idle for before the connection it is on is closed</div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 300px;" >Open timeout before warning (ms) :</div> + <div class="storeTransactionOpenTimeoutWarn" style="float:left;"></div> + <div class="formLabel-description">The time a transaction can be open for after which a warning alert will be issued</div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 300px;">Open timeout before closing (ms) :</div> + <div class="storeTransactionOpenTimeoutClose" style="float:left;"></div> + <div class="formLabel-description">The time a transaction can be open for before the connection it is on is closed</div> + </div> + <div style="clear:both"></div> + </div> + + <br/> + + <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'House Keeping Settings', open: false"> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 300px;">House keeping check period (ms):</div> + <div class="housekeepingCheckPeriod" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 300px;">House keeping thread count:</div> + <div class="housekeepingThreadCount" style="float:left;"></div> + </div> + <div style="clear:both"></div> + </div> + + </div> + + <div class="dijitDialogPaneActionBar"> + <button data-dojo-type="dijit.form.Button" class="startButton" type="button" data-dojo-props="disabled: true">Start</button> + <button data-dojo-type="dijit.form.Button" class="stopButton" type="button" data-dojo-props="disabled: true">Stop</button> + <button data-dojo-type="dijit.form.Button" class="editButton" type="button" data-dojo-props="disabled: true">Edit</button> + <button data-dojo-type="dijit.form.Button" class="deleteButton" data-dojo-props="iconClass: 'dijitIconDelete'">Delete</button> + </div> + + <br/> + + <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Statistics', open: true"> + <div style="clear:both"> <div class="formLabel-labelCell" style="float:left; width: 100px;">Inbound:</div> <div style="float:left;"> <span class="msgInRate"></span> @@ -56,20 +119,9 @@ <span class="bytesOutRateUnits"></span> </div> </div> - <div style="clear:both"> - <div class="formLabel-labelCell" style="float:left; width: 100px;">Store Type:</div> - <div class="storeType" style="float:left;"></div> - </div> - <div style="clear:both"> - <div class="formLabel-labelCell" style="float:left; width: 100px;">Store Path:</div> - <div class="storePath" style="float:left;"></div> - </div> - <div class="configPathDiv" style="clear:both"> - <div class="formLabel-labelCell" style="float:left; width: 100px;">Config Path:</div> - <div class="configPath" style="float:left;"></div> - </div> <div style="clear:both"></div> - </div> + </div> + <br/> <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Exchanges'"> <div class="exchanges"></div> 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 index f5643eebfd..d6c0bcb549 100644 --- 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 @@ -27,17 +27,12 @@ <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 class="formLabel-labelCell" style="float:left; width: 200px;">State:</div> + <div class="state" style="float:left;"></div> </div> <div class="virtualhostnodedetails" style="clear:both"> </div> 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 new file mode 100644 index 0000000000..a81511495b --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html @@ -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. + --> + +<div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 100px;">Store Overfull Limit:</div> + <div style="float:left;"><span class="storeOverfullSize" ></span> bytes</div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 100px;">Store Underfull Limit:</div> + <div style="float:left;"><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/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html new file mode 100644 index 0000000000..23f9069ce2 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html @@ -0,0 +1,34 @@ +<!-- + ~ 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: 100px;">Store Path:</div> + <div class="storePath" style="float:left;"></div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 100px;">Store Overfull Limit:</div> + <div style="float:left;"><span class="storeOverfullSize" ></span> bytes</div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell" style="float:left; width: 100px;">Store Underfull Limit:</div> + <div style="float:left;"><span class="storeUnderfullSize"></span> bytes</div> + </div> + <div style="clear:both"></div> +</div> |
