diff options
| author | Andrew MacBean <macbean@apache.org> | 2014-10-03 14:09:50 +0000 |
|---|---|---|
| committer | Andrew MacBean <macbean@apache.org> | 2014-10-03 14:09:50 +0000 |
| commit | 3d939257a2b16d039b5fed60098dae0e76c157da (patch) | |
| tree | 885ac2086d95290a53e0b79d4820855844790873 /qpid/java/broker-plugins | |
| parent | b12030c46de5452a7402699fecb888788409834e (diff) | |
| download | qpid-python-3d939257a2b16d039b5fed60098dae0e76c157da.tar.gz | |
QPID-6130: [Java Broker] Introduce edit queue dialog to web management UI
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1629203 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
9 files changed, 540 insertions, 44 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html index 352e69893b..d74dd6ebee 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html @@ -73,8 +73,8 @@ value: '', searchAttr: 'name', required: false, - promptMessage: 'Message durability override. If not default, messages arriving will have durability setting overridden', - title: 'Enter message durability override'"> + promptMessage: 'Message persistence override. If not default, messages arriving will have persistence setting overridden', + title: 'Enter message persistence override'"> <option value="ALWAYS">Always</option> <option value="DEFAULT">Default</option> <option value="NEVER">Never</option> @@ -108,10 +108,8 @@ </div> </div> - <br/> <div class="clear"></div> - <div id="formAddQueueTypePriority:fields" class="hidden" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Priority Queue Settings'"> <div class="clear"> @@ -166,8 +164,9 @@ <div class="clear"></div> </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Flow Control Settings', open: false"> + <div class="clear formBox"> + <fieldset> + <legend>Flow Control Settings</legend> <div class="clear"> <div class="formLabel-labelCell">Capacity:</div> <div class="formLabel-controlCell"> @@ -194,11 +193,13 @@ trim: true"/> </div> </div> + </fieldset> <div class="clear"></div> </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Alerting Settings', open: false"> + <div class="clear formBox"> + <fieldset> + <legend>Alerting Settings</legend> <div class="clear"> <div class="formLabel-labelCell">Queue Depth:</div> <div class="formLabel-controlCell"> @@ -264,11 +265,13 @@ trim: true"/> </div> </div> + </fieldset> <div class="clear"></div> </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Other Settings', open: false"> + <div class="clear formBox"> + <fieldset> + <legend>Other Settings</legend> <div class="clear"> <div class="formLabel-labelCell">Maximum Delivery Retries:</div> <div class="formLabel-controlCell"> @@ -323,9 +326,14 @@ title: 'Controls where a shared groups feature is enabled'"/> </div> </div> + </fieldset> <div class="clear"></div> </div> + <div class="clear" data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> + <div id="formAddQueue.context" ></div> + </div> + <div class="dijitDialogPaneActionBar"> <!-- submit buttons --> <input type="submit" value="Create Queue" label="Create Queue" dojoType="dijit.form.Button" /> 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 7c8ca2e644..d04117b266 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 @@ -262,7 +262,6 @@ div .messages { /* Required to keep queue type radio buttons on one line when dialog adds scrollbar */ #addQueue { - max-height: 350px; overflow: auto; width: 630px; } @@ -305,4 +304,4 @@ div .messages { width:100%; max-height: 140px; overflow: auto; -}
\ No newline at end of file +} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html new file mode 100644 index 0000000000..5587bbbdab --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html @@ -0,0 +1,247 @@ +<!-- + ~ 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 Queue'" id="editQueue"> + <form id="formEditQueue" method="post" dojoType="dijit.form.Form"> + <div id="formEditQueue.allFields"> + <div id="formEditQueue.contentPane"> + <div class="editNoteBanner">NOTE: All changes will only take effect after Virtual Host restart.</div> + <div class="clear"> + <div class="formLabel-labelCell">Queue Name:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.name" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'name', + placeHolder: 'queue name', + required: true, + promptMessage: 'Name of queue', + disabled: 'true'"/> + </div> + </div> + + <div class="clear"> + <div class="formLabel-labelCell">Queue Type:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.type" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'type', + placeHolder: 'queue type', + required: true, + promptMessage: 'Type of queue', + disabled: 'true'"/> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Durable?</div> + <div class="formLabel-controlCell"> + <input type="checkbox" id="formEditQueue.durable" + dojoType="dijit.form.CheckBox" + data-dojo-props=" + name: 'durable', + value: 'durable', + disabled: 'true'"/> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Persist Messages?</div> + <div class="formLabel-controlCell"> + <select id="formEditQueue.messageDurability" + dojoType="dijit.form.FilteringSelect" + data-dojo-props=" + name: 'messageDurability', + value: '', + searchAttr: 'name', + required: false, + promptMessage: 'Message persistence override. If not default, messages arriving will have persistence setting overridden', + title: 'Enter message persistence override'"> + <option value="ALWAYS">Always</option> + <option value="DEFAULT">Default</option> + <option value="NEVER">Never</option> + </select> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Maximum Ttl:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.maximumMessageTtl" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'maximumMessageTtl', + placeHolder: 'ttl in ms', + promptMessage: 'Maximum message time to live (ttl) in ms. Messages arriving with larger ttl values will be overridden by this value', + title: 'Enter the maximum message time to live in milliseconds', + trim: true"/> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Minimum Ttl:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.minimumMessageTtl" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'minimumMessageTtl', + placeHolder: 'ttl in ms', + promptMessage: 'Minimum message time to live (ttl) in ms. Messages arriving with smaller ttl values will be overridden by this value', + title: 'Enter the minimum message time to live in milliseconds', + trim: true"/> + </div> + </div> + + <div class="clear"></div> + + <div class="clear formBox"> + <fieldset> + <legend>Flow Control Settings</legend> + <div class="clear"> + <div class="formLabel-labelCell">Capacity:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.queueFlowControlSizeBytes" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'queueFlowControlSizeBytes', + placeHolder: 'size in bytes', + promptMessage: 'Ceiling (in bytes) at which queue will begin to throttle sessions producing messages', + title: 'Enter the ceiling (in bytes) at which queue will begin to throttle sessions producing messages', + trim: true"/> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Resume Capacity:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.queueFlowResumeSizeBytes" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'queueFlowResumeSizeBytes', + placeHolder: 'size in bytes', + promptMessage: 'Floor (in bytes) at which queue will cease to throttle sessions producing messages', + title: 'Enter the floor (in bytes) at which queue will cease to throttle sessions producing messages', + trim: true"/> + </div> + </div> + </fieldset> + <div class="clear"></div> + </div> + + <div class="clear formBox"> + <fieldset> + <legend>Alerting Settings</legend> + <div class="clear"> + <div class="formLabel-labelCell">Queue Depth:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.alertThresholdQueueDepthMessages" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'alertThresholdQueueDepthMessages', + placeHolder: 'number of messages', + promptMessage: 'Ceiling value for number of messages on queue before alerts will be generated', + title: 'Enter the ceiling value for number of messages on queue before alerts will be generated', + trim: true"/> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Queue Depth:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.alertThresholdQueueDepthBytes" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'alertThresholdQueueDepthBytes', + placeHolder: 'total message size in bytes', + promptMessage: 'Ceiling value (in bytes) for total size of all messages on the queue before alerts will be generated', + title: 'Enter the ceiling value (in bytes) for total size of all messages on the queue before alerts will be generated', + trim: true"/> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Message Age:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.alertThresholdMessageAge" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'alertThresholdMessageAge', + placeHolder: 'time in ms', + promptMessage: 'Message age (in milliseconds) above which alerts will be generated', + title: 'Enter the message age (in milliseconds) above which alerts will be generated', + trim: true"/> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Message Size:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.alertThresholdMessageSize" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'alertThresholdMessageSize', + placeHolder: 'message size in bytes', + promptMessage: 'Message size (in bytes) above which alerts will be generated', + title: 'Enter the message size (in bytes) above which alerts will be generated', + trim: true"/> + </div> + </div> + <div class="clear"> + <div class="formLabel-labelCell">Gap between alerts:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.alertRepeatGap" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'alertRepeatGap', + placeHolder: 'time in ms', + promptMessage: 'Minimum time (in milliseconds) between each alert', + title: 'Enter the minimum time (in milliseconds) between each alert.', + trim: true"/> + </div> + </div> + </fieldset> + <div class="clear"></div> + </div> + + <div class="clear formBox"> + <fieldset> + <legend>Other Settings</legend> + <div class="clear"> + <div class="formLabel-labelCell">Maximum Delivery Retries:</div> + <div class="formLabel-controlCell"> + <input type="text" id="formEditQueue.maximumDeliveryAttempts" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'maximumDeliveryAttempts', + placeHolder: 'number of retries', + promptMessage: 'Maximum number of delivery attempts before the message will be sent to the alternate exchange', + title: 'Enter the maximum number of delivery attempts before the message will be sent to the alternate exchange', + trim: true"/> + </div> + </div> + </fieldset> + <div class="clear"></div> + </div> + + <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> + <div id="formEditQueue.context" ></div> + </div> + </div> + <div class="dijitDialogPaneActionBar"> + <button data-dojo-type="dijit/form/Button" id="formEditQueue.saveButton" data-dojo-props="label: 'Save'">Save</button> + <button data-dojo-type="dijit/form/Button" id="formEditQueue.cancelButton" data-dojo-props="label: 'Cancel'" ></button> + </div> + </div> + + </form> + </div> +</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js index e5d341de91..a3e4023273 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js @@ -77,8 +77,8 @@ function (util, xhr, declare, array, connect, lang, domConstruct, parser, query, var addButton = registry.byNode(addButtonNode); var deleteButton = registry.byNode(deleteButtonNode); var layout = [[ - { name: "Name", field: "name", width: "40%", editable: true, selectOnClick: false, type: dojox.grid.cells._Widget, widgetClass: dijit.form.TextBox }, - { name: 'Actual Value', field: 'actualValue', width: '30%', editable: true, selectOnClick: false, type: dojox.grid.cells._Widget, widgetClass: dijit.form.TextBox}, + { name: "Name", field: "name", width: "40%", editable: true}, + { name: 'Actual Value', field: 'actualValue', width: '30%', editable: true}, { name: 'Effective Value', field: 'effectiveValue', width: '30%', editable: false} ]]; var data = []; @@ -177,6 +177,38 @@ function (util, xhr, declare, array, connect, lang, domConstruct, parser, query, } this.setData(actualValues, allEffectiveValues, inheritedActualValues); }, + loadInheritedData: function(restUrl) + { + var allEffectiveValues = null; + xhr.get( + { + url: restUrl, + sync: true, + content: { actuals: false }, + handleAs: "json", + load: function(data) + { + allEffectiveValues = data[0].context; + } + } + ); + + var inheritedActualValues = null; + xhr.get( + { + url: restUrl, + sync: true, + content: { actuals: true, inheritedActuals: true}, + handleAs: "json", + load: function(data) + { + inheritedActualValues = data[0].context; + } + } + ); + + this.setData({}, allEffectiveValues, inheritedActualValues); + }, setData: function(actualValues, allEffectiveValues, inheritedActualValues) { this.value = actualValues; @@ -523,4 +555,4 @@ function (util, xhr, declare, array, connect, lang, domConstruct, parser, query, } }); -});
\ No newline at end of file +}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Queue.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Queue.js index b4ef7b4403..5b441a7b2f 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Queue.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Queue.js @@ -34,6 +34,7 @@ define(["dojo/_base/xhr", "qpid/management/moveCopyMessages", "qpid/management/showMessage", "qpid/management/UserPreferences", + "qpid/management/editQueue", "dojo/store/JsonRest", "dojox/grid/EnhancedGrid", "dojo/data/ObjectStore", @@ -42,7 +43,7 @@ define(["dojo/_base/xhr", "dojox/grid/enhanced/plugins/IndirectSelection", "dojo/domReady!"], function (xhr, parser, query, registry, connect, event, json, properties, updater, util, formatter, - UpdatableStore, addBinding, moveMessages, showMessage, UserPreferences, JsonRest, EnhancedGrid, ObjectStore, entities) { + UpdatableStore, addBinding, moveMessages, showMessage, UserPreferences, editQueue, JsonRest, EnhancedGrid, ObjectStore, entities) { function Queue(name, parent, controller) { this.name = name; @@ -172,6 +173,12 @@ define(["dojo/_base/xhr", event.stop(evt); that.deleteQueue(); }); + var editQueueButton = query(".editQueueButton", contentPane.containerNode)[0]; + connect.connect(registry.byNode(editQueueButton), "onClick", + function(evt){ + event.stop(evt); + editQueue.show({nodeName:that.modelObj.parent.parent.name, hostName:that.modelObj.parent.name,queueName:that.name}); + }); UserPreferences.addListener(that); }}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js index 444ed67d63..2e18f27a40 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js @@ -28,6 +28,7 @@ define(["dojo/_base/xhr", "dojo/_base/event", 'dojo/_base/json', 'qpid/common/util', + "qpid/common/ContextVariablesEditor", "dijit/form/NumberSpinner", // required by the form /* dojox/ validate resources */ "dojox/validate/us", "dojox/validate/web", @@ -200,6 +201,14 @@ define(["dojo/_base/xhr", registry.byId("addQueue").show(); util.applyMetadataToWidgets(form.domNode, "Queue", "standard"); + if (!this.context) + { + this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); + this.context.placeAt(dom.byId("formAddQueue.context")); + } + + var escapedUrl = "api/latest/virtualhost/" + encodeURIComponent(addQueue.vhostnode) + "/" + encodeURIComponent(addQueue.vhost); + this.context.loadInheritedData(escapedUrl); }; return addQueue; diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js index 226674bf5a..7786fe9914 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js @@ -134,35 +134,10 @@ define(["dojo/_base/xhr", this.virtualHostContext.placeAt(dom.byId("addVirtualHost.context")); } - var inheritedActualValues = null; - xhr.get( - { - url: "api/latest/broker", - sync: true, - content: { actuals: true, inheritedActuals: true}, - handleAs: "json", - load: function(data) - { - inheritedActualValues = data[0].context; - } - } - ); - var effectiveValues = null; - xhr.get( - { - url: "api/latest/broker", - sync: true, - handleAs: "json", - load: function(data) - { - effectiveValues = data[0].context; - } - } - ); + this.virtualHostNodeContext.loadInheritedData("api/latest/broker"); + this.virtualHostContext.loadInheritedData("api/latest/broker"); - this.virtualHostNodeContext.setData({},effectiveValues,inheritedActualValues); - this.virtualHostContext.setData({},effectiveValues,inheritedActualValues); this.dialog.show(); if (!this.resizeEventRegistered) { diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js new file mode 100644 index 0000000000..63eb34876b --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js @@ -0,0 +1,218 @@ +/* + * + * 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!editQueue.html", + "qpid/common/ContextVariablesEditor", + "dijit/Dialog", + "dijit/form/CheckBox", + "dijit/form/FilteringSelect", + "dijit/form/ValidationTextBox", + "dijit/form/Button", + "dijit/form/Form", + "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 = ["name", + "type", + "durable", + "messageDurability", + "maximumMessageTtl", + "minimumMessageTtl", + "queueFlowControlSizeBytes", + "queueFlowResumeSizeBytes", + "alertThresholdQueueDepthMessages", + "alertThresholdQueueDepthBytes", + "alertThresholdMessageAge", + "alertThresholdMessageSize", + "alertRepeatGap", + "maximumDeliveryAttempts"]; + + var numericFieldNames = ["maximumMessageTtl", + "minimumMessageTtl", + "queueFlowControlSizeBytes", + "queueFlowResumeSizeBytes", + "alertThresholdQueueDepthMessages", + "alertThresholdQueueDepthBytes", + "alertThresholdMessageAge", + "alertThresholdMessageSize", + "alertRepeatGap", + "maximumDeliveryAttempts"]; + + var queueEditor = + { + init: function() + { + var that=this; + this.containerNode = domConstruct.create("div", {innerHTML: template}); + parser.parse(this.containerNode); + this.allFieldsContainer = dom.byId("formEditQueue.allFields"); + this.dialog = registry.byId("editQueue"); + this.saveButton = registry.byId("formEditQueue.saveButton"); + this.cancelButton = registry.byId("formEditQueue.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("formEditQueue." + fieldName); + } + this.form = registry.byId("formEditQueue"); + this.form.on("submit", function(){return false;}); + }, + show: function(hostData) + { + var that=this; + if (!this.context) + { + this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); + this.context.placeAt(dom.byId("formEditQueue.context")); + } + this.query = "api/latest/queue/" + encodeURIComponent(hostData.nodeName) + "/" + encodeURIComponent(hostData.hostName) + "/" + encodeURIComponent(hostData.queueName); + this.dialog.set("title", "Edit Queue - " + entities.encode(String(hostData.queueName))); + xhr.get( + { + url: this.query, + sync: true, + content: { actuals: true }, + handleAs: "json", + load: function(data) + { + that._show(data[0], hostData); + } + } + ); + }, + destroy: function() + { + if (this.dialog) + { + this.dialog.destroyRecursive(); + this.dialog = null; + } + + if (this.containerNode) + { + domConstruct.destroy(this.containerNode); + this.containerNode = null; + } + }, + _cancel: function(e) + { + this.dialog.hide(); + }, + _save: function(e) + { + event.stop(e); + if(this.form.validate()) + { + var data = util.getFormWidgetValues(this.form, this.initialData); + var context = this.context.get("value"); + if (context && !util.equals(context, this.initialData.context)) + { + data["context"] = context; + } + 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 + { + util.xhrErrorHandler(failureReason); + } + } + else + { + alert('Form contains invalid data. Please correct first'); + } + }, + _show:function(actualData, effectiveData) + { + + this.initialData = actualData; + for(var i = 0; i < fields.length; i++) + { + var fieldName = fields[i]; + var widget = this[fieldName]; + widget.reset(); + + if (widget instanceof dijit.form.CheckBox) + { + widget.set("checked", actualData[fieldName]); + } + else + { + widget.set("value", actualData[fieldName]); + } + } + + var that = this; + util.applyMetadataToWidgets(that.allFieldsContainer, "Queue", actualData.type); + + this.context.load(this.query, {actualValues:actualData.context, effectiveValues:effectiveData.context}); + + // Add regexp to the numeric fields + for(var i = 0; i < numericFieldNames.length; i++) + { + this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp); + } + + this.dialog.startup(); + this.dialog.show(); + if (!this.resizeEventRegistered) + { + this.resizeEventRegistered = true; + util.resizeContentAreaAndRepositionDialog(dom.byId("formEditQueue.contentPane"), this.dialog); + } + } + }; + + queueEditor.init(); + + return queueEditor; + } +); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html index e5b9699c64..a068868e7f 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html @@ -198,7 +198,7 @@ </div> </div> <div class="clear"> - <div class="formLabel-labelCell">Alert frequency:</div> + <div class="formLabel-labelCell">Gap between alerts:</div> <div> <span class="alertRepeatGap"></span> <span class="alertRepeatGapUnits"></span> @@ -208,6 +208,7 @@ </div> <div class="dijitDialogPaneActionBar"> + <button data-dojo-type="dijit.form.Button" class="editQueueButton" type="button">Edit Queue</button> <button data-dojo-type="dijit.form.Button" class="deleteQueueButton" type="button">Delete Queue</button> </div> </div> |
