Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js?rev=1741609&r1=1741608&r2=1741609&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js Fri Apr 29 11:04:40 2016 @@ -18,67 +18,79 @@ * under the License. * */ -define(["dojo/query","dijit/registry","qpid/common/util","dojo/store/Memory","dijit/form/FilteringSelect","dijit/form/ValidationTextBox","dijit/form/CheckBox"], - function (query, registry, util, Memory) - { - return { - show: function(data) - { - var that = this; - util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/simpleldap/add.html", function(){that._postParse(data);}); - }, - _postParse: function(data) - { - var that = this; - var obj = {type:"truststore", parent: {type: "broker"}}; - data.parent.management.load(obj).then( - function(trustStores) - { - that._initTrustStores(trustStores, data.containerNode); - if (data.data) - { - that._initFields(data.data, data.containerNode, data.parent.management.metadata ); - } - }, - util.xhrErrorHandler - ); +define(["dojo/query", + "dijit/registry", + "qpid/common/util", + "dojo/store/Memory", + "dijit/form/FilteringSelect", + "dijit/form/ValidationTextBox", + "dijit/form/CheckBox"], function (query, registry, util, Memory) + { + return { + show: function (data) + { + var that = this; + util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/simpleldap/add.html", function () + { + that._postParse(data); + }); + }, + _postParse: function (data) + { + var that = this; + var obj = { + type: "truststore", + parent: {type: "broker"} + }; + data.parent.management.load(obj).then(function (trustStores) + { + that._initTrustStores(trustStores, data.containerNode); + if (data.data) + { + that._initFields(data.data, + data.containerNode, + data.parent.management.metadata); + } + }, util.xhrErrorHandler); - }, - _initTrustStores: function(trustStores, containerNode) - { - var data = []; - for (var i=0; i< trustStores.length; i++) - { - data.push( {id: trustStores[i].name, name: trustStores[i].name} ); - } - var trustStoresStore = new Memory({ data: data }); + }, + _initTrustStores: function (trustStores, containerNode) + { + var data = []; + for (var i = 0; i < trustStores.length; i++) + { + data.push({ + id: trustStores[i].name, + name: trustStores[i].name + }); + } + var trustStoresStore = new Memory({data: data}); - var trustStore = registry.byNode(query(".trustStore", containerNode)[0]); - trustStore.set("store", trustStoresStore); - }, - _initFields:function(data, containerNode, metadata) - { - var attributes = metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes; - for(var name in attributes) - { - var domNode = query("." + name, containerNode)[0]; - if (domNode) - { - var widget = registry.byNode(domNode); - if (widget) - { - if (widget instanceof dijit.form.CheckBox) - { - widget.set("checked", data[name]); - } - else - { - widget.set("value", data[name]); - } - } - } - } - } - }; - } -); + var trustStore = registry.byNode(query(".trustStore", containerNode)[0]); + trustStore.set("store", trustStoresStore); + }, + _initFields: function (data, containerNode, metadata) + { + var attributes = metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes; + for (var name in attributes) + { + var domNode = query("." + name, containerNode)[0]; + if (domNode) + { + var widget = registry.byNode(domNode); + if (widget) + { + if (widget instanceof dijit.form.CheckBox) + { + widget.set("checked", data[name]); + } + else + { + widget.set("value", data[name]); + } + } + } + } + } + }; + });
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js?rev=1741609&r1=1741608&r2=1741609&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js Fri Apr 29 11:04:40 2016 @@ -17,26 +17,24 @@ * under the License. */ -define(["qpid/common/util", "dojo/domReady!"], - function (util) - { +define(["qpid/common/util", "dojo/domReady!"], function (util) +{ function SimpleLdapAuthenticationProvider(data) { this.fields = []; var attributes = data.parent.management.metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes; - for(var name in attributes) + for (var name in attributes) { this.fields.push(name); } util.buildUI(data.containerNode, data.parent, "authenticationprovider/simpleldap/show.html", this.fields, this); } - SimpleLdapAuthenticationProvider.prototype.update = function(data) + SimpleLdapAuthenticationProvider.prototype.update = function (data) { util.updateUI(data, this.fields, this); } return SimpleLdapAuthenticationProvider; - } -); +}); Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js?rev=1741609&r1=1741608&r2=1741609&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js Fri Apr 29 11:04:40 2016 @@ -43,105 +43,128 @@ define(["dojo/dom", "dojo/ready", "dojox/uuid/generateRandomUuid", "dojo/domReady!"], - function (dom, registry, ContentPane, CheckBox, entities, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, - GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, PreferencesProvider, VirtualHostNode, Logger, QueryTab, ready) { + function (dom, registry, ContentPane, CheckBox, entities, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, PreferencesProvider, VirtualHostNode, Logger, QueryTab, ready) + { var controller = {}; - var constructors = { broker: Broker, virtualhost: VirtualHost, exchange: Exchange, - queue: Queue, connection: Connection, - authenticationprovider: AuthProvider, groupprovider: GroupProvider, - group: Group, keystore: KeyStore, truststore: TrustStore, - accesscontrolprovider: AccessControlProvider, port: Port, - plugin: Plugin, preferencesprovider: PreferencesProvider, - virtualhostnode: VirtualHostNode, brokerlogger: Logger, virtualhostlogger: Logger, - queryTab: QueryTab}; + var constructors = { + broker: Broker, + virtualhost: VirtualHost, + exchange: Exchange, + queue: Queue, + connection: Connection, + authenticationprovider: AuthProvider, + groupprovider: GroupProvider, + group: Group, + keystore: KeyStore, + truststore: TrustStore, + accesscontrolprovider: AccessControlProvider, + port: Port, + plugin: Plugin, + preferencesprovider: PreferencesProvider, + virtualhostnode: VirtualHostNode, + brokerlogger: Logger, + virtualhostlogger: Logger, + queryTab: QueryTab + }; var tabDiv = dom.byId("managedViews"); - ready(function() { - controller.tabContainer = registry.byId("managedViews"); - }); - + ready(function () + { + controller.tabContainer = registry.byId("managedViews"); + }); controller.viewedObjects = {}; - controller.show = function(objType, name, parent, objectId) { + controller.show = function (objType, name, parent, objectId) + { function generateName(obj) { - if(obj) { - var name = obj.type + (obj.type == "broker" ? "" : ":" + obj.name); - if (obj.parent) - { - name = generateName(obj.parent) + "/" + name; - } - return name; - } - return ""; + if (obj) + { + var name = obj.type + (obj.type == "broker" ? "" : ":" + obj.name); + if (obj.parent) + { + name = generateName(obj.parent) + "/" + name; + } + return name; + } + return ""; } var that = this; - var objId = (parent ? generateName(parent) + "/" : "") + objType + ":" + (name ? name : "-" + dojox.uuid.generateRandomUuid()); + var objId = (parent ? generateName(parent) + "/" : "") + objType + ":" + (name ? name : "-" + + dojox.uuid.generateRandomUuid()); - var obj = this.viewedObjects[ objId ]; - if(obj) { + var obj = this.viewedObjects[objId]; + if (obj) + { this.tabContainer.selectChild(obj.contentPane); - } else { - var Constructor = constructors[ objType ]; - if(Constructor) { + } + else + { + var Constructor = constructors[objType]; + if (Constructor) + { obj = new Constructor(name, parent, this); obj.tabData = { objectId: objectId, objectType: objType }; - this.viewedObjects[ objId ] = obj; + this.viewedObjects[objId] = obj; - var contentPane = new ContentPane({ region: "center" , - title: entities.encode(obj.getTitle()), - closable: true, - onClose: function() { - obj.close(); - delete that.viewedObjects[ objId ]; - return true; - } + var contentPane = new ContentPane({ + region: "center", + title: entities.encode(obj.getTitle()), + closable: true, + onClose: function () + { + obj.close(); + delete that.viewedObjects[objId]; + return true; + } }); - this.tabContainer.addChild( contentPane ); + this.tabContainer.addChild(contentPane); var userPreferences = this.management.userPreferences; if (objType != "broker" && name) { - var preferencesCheckBox = new dijit.form.CheckBox({ - checked: userPreferences.isTabStored(obj.tabData), - title: "If checked the tab is saved in user preferences and restored on next login" - }); - var tabs = this.tabContainer.tablist.getChildren(); - preferencesCheckBox.placeAt(tabs[tabs.length-1].titleNode, "first"); - preferencesCheckBox.on("change", function(value){ - if (value) + var preferencesCheckBox = new dijit.form.CheckBox({ + checked: userPreferences.isTabStored(obj.tabData), + title: "If checked the tab is saved in user preferences and restored on next login" + }); + var tabs = this.tabContainer.tablist.getChildren(); + preferencesCheckBox.placeAt(tabs[tabs.length - 1].titleNode, "first"); + preferencesCheckBox.on("change", function (value) { - userPreferences.appendTab(obj.tabData); - } - else - { - userPreferences.removeTab(obj.tabData); - } - }); + if (value) + { + userPreferences.appendTab(obj.tabData); + } + else + { + userPreferences.removeTab(obj.tabData); + } + }); } obj.open(contentPane); contentPane.startup(); - if(obj.startup) { + if (obj.startup) + { obj.startup(); } - this.tabContainer.selectChild( contentPane ); + this.tabContainer.selectChild(contentPane); } } }; - controller.init=function(management) - { - controller.management = management; - } + controller.init = function (management) + { + controller.management = management; + } return controller; }); Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js?rev=1741609&r1=1741608&r2=1741609&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js Fri Apr 29 11:04:40 2016 @@ -43,119 +43,142 @@ define(["dojox/html/entities", "dojox/validate/us", "dojox/validate/web", "dojo/domReady!"], - function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) - { - var numericFieldNames = ["statisticsReportingPeriod", "connection.sessionCountLimit", "connection.heartBeatDelay"]; - - var brokerEditor = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){ that._postParse();}); - }, - _postParse: function() - { - var that=this; - this.dialog = registry.byId("editBrokerDialog"); - this.saveButton = registry.byId("editBroker.saveButton"); - this.cancelButton = registry.byId("editBroker.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.saveButton.on("click", function(e){that._save(e);}); - this.form = registry.byId("editBrokerForm"); - this.form.on("submit", function(){return false;}); - this.context = registry.byId("editBroker.context"); - }, - show: function(management, brokerData) - { - this.management = management; - var that=this; - this.dialog.set("title", "Edit Broker - " + entities.encode(String(brokerData.name))); - var typeMetaData = management.metadata.getMetaData("Broker", "Broker"); - var encrypters = typeMetaData.attributes.confidentialConfigurationEncryptionProvider.validValues; - var encrypterTypesData = []; - encrypterTypesData.push({id: undefined, name: "None"}); - array.forEach(encrypters, - function(item) - { - encrypterTypesData.push({id: item, name: item}); - } - ); - - var encrytperTypesStore = new Memory({ data: encrypterTypesData }); - var encrypterControl = registry.byId("editBroker.confidentialConfigurationEncryptionProvider"); - encrypterControl.set("store", encrytperTypesStore); - encrypterControl.set("value", undefined); - - management.load( {type:"broker"}, { actuals: true }).then( - function(data) - { - that._show(data[0], brokerData); - }); - }, - 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 that = this; - this.management.update({type: "broker"}, data).then(function(x){that.dialog.hide();}); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _show:function(actualData, effectiveData) - { - this.initialData = actualData; - util.applyToWidgets(dom.byId("editBroker.allFields"), "Broker", "Broker", actualData, this.management.metadata); - util.setContextData(this.context, management, {type: "broker"}, actualData, effectiveData ); - - // Add regexp to the numeric fields - for(var i = 0; i < numericFieldNames.length; i++) - { - registry.byId("editBroker." + numericFieldNames[i]).set("regExpGen", util.numericOrContextVarRegexp); - } - - this.dialog.startup(); - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("editBroker.contentPane"), this.dialog); - } - } - }; - - brokerEditor.init(); - - return brokerEditor; - } -); + function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) + { + var numericFieldNames = ["statisticsReportingPeriod", + "connection.sessionCountLimit", + "connection.heartBeatDelay"]; + + var brokerEditor = { + init: function () + { + var that = this; + this.containerNode = domConstruct.create("div", {innerHTML: template}); + parser.parse(this.containerNode).then(function (instances) + { + that._postParse(); + }); + }, + _postParse: function () + { + var that = this; + this.dialog = registry.byId("editBrokerDialog"); + this.saveButton = registry.byId("editBroker.saveButton"); + this.cancelButton = registry.byId("editBroker.cancelButton"); + this.cancelButton.on("click", function (e) + { + that._cancel(e); + }); + this.saveButton.on("click", function (e) + { + that._save(e); + }); + this.form = registry.byId("editBrokerForm"); + this.form.on("submit", function () + { + return false; + }); + this.context = registry.byId("editBroker.context"); + }, + show: function (management, brokerData) + { + this.management = management; + var that = this; + this.dialog.set("title", "Edit Broker - " + entities.encode(String(brokerData.name))); + var typeMetaData = management.metadata.getMetaData("Broker", "Broker"); + var encrypters = typeMetaData.attributes.confidentialConfigurationEncryptionProvider.validValues; + var encrypterTypesData = []; + encrypterTypesData.push({ + id: undefined, + name: "None" + }); + array.forEach(encrypters, function (item) + { + encrypterTypesData.push({ + id: item, + name: item + }); + }); + + var encrytperTypesStore = new Memory({data: encrypterTypesData}); + var encrypterControl = registry.byId("editBroker.confidentialConfigurationEncryptionProvider"); + encrypterControl.set("store", encrytperTypesStore); + encrypterControl.set("value", undefined); + + management.load({type: "broker"}, {actuals: true}).then(function (data) + { + that._show(data[0], brokerData); + }); + }, + 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 that = this; + this.management.update({type: "broker"}, data).then(function (x) + { + that.dialog.hide(); + }); + } + else + { + alert('Form contains invalid data. Please correct first'); + } + }, + _show: function (actualData, effectiveData) + { + this.initialData = actualData; + util.applyToWidgets(dom.byId("editBroker.allFields"), + "Broker", + "Broker", + actualData, + this.management.metadata); + util.setContextData(this.context, management, {type: "broker"}, actualData, effectiveData); + + // Add regexp to the numeric fields + for (var i = 0; i < numericFieldNames.length; i++) + { + registry.byId("editBroker." + numericFieldNames[i]) + .set("regExpGen", util.numericOrContextVarRegexp); + } + + this.dialog.startup(); + this.dialog.show(); + if (!this.resizeEventRegistered) + { + this.resizeEventRegistered = true; + util.resizeContentAreaAndRepositionDialog(dom.byId("editBroker.contentPane"), this.dialog); + } + } + }; + + brokerEditor.init(); + + return brokerEditor; + }); Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js?rev=1741609&r1=1741608&r2=1741609&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js Fri Apr 29 11:04:40 2016 @@ -41,141 +41,165 @@ define(["dojox/html/entities", "dojox/validate/us", "dojox/validate/web", "dojo/domReady!"], - function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, util, template) - { + function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, util, template) + { - 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).then(function(instances){ that._postParse();}); - }, - _postParse: function() - { - var that=this; - 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);}); - this.form = registry.byId("formEditQueue"); - this.form.on("submit", function(){return false;}); - this.typeSelector = registry.byId("formEditQueue.type"); - }, - show: function(management,modelObj) - { - var that=this; - this.management = management; - this.modelObj = modelObj; - if (!this.context) - { - this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.context.placeAt(dom.byId("formEditQueue.context")); - } - this.dialog.set("title", "Edit Queue - " + entities.encode(String(modelObj.name))); - management.load(modelObj, { actuals: true }).then( - function(actualData) - { - management.load(modelObj).then( - function(effectiveData) - { - that._show(actualData[0], effectiveData[0]); - }, - util.xhrErrorHandler); - }); - }, - 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 that = this; - this.management.update(that.modelObj, data).then(function(x){that.dialog.hide()}); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _show:function(actualData, effectiveData) - { - - this.initialData = actualData; - this.form.reset(); - - var that = this; - util.applyToWidgets(that.allFieldsContainer, "Queue", actualData.type, actualData, this.management.metadata); - - util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData); - - // Add regexp to the numeric fields - for(var i = 0; i < numericFieldNames.length; i++) - { - registry.byId("formEditQueue." +numericFieldNames[i]).set("regExpGen", util.numericOrContextVarRegexp); - } - - var queueType = this.typeSelector.get("value"); - query(".typeSpecificDiv").forEach(function(node, index, arr){ - if (node.id === "formEditQueueType:" + queueType) - { - node.style.display = "block"; - util.applyMetadataToWidgets(node, "Queue", queueType, that.management.metadata); - } - else - { - node.style.display = "none"; - } - }); - this.dialog.startup(); - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("formEditQueue.contentPane"), this.dialog); - } - } - }; - - queueEditor.init(); - - return queueEditor; - } -); + 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).then(function (instances) + { + that._postParse(); + }); + }, + _postParse: function () + { + var that = this; + 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); + }); + this.form = registry.byId("formEditQueue"); + this.form.on("submit", function () + { + return false; + }); + this.typeSelector = registry.byId("formEditQueue.type"); + }, + show: function (management, modelObj) + { + var that = this; + this.management = management; + this.modelObj = modelObj; + if (!this.context) + { + this.context = new qpid.common.ContextVariablesEditor({ + name: 'context', + title: 'Context variables' + }); + this.context.placeAt(dom.byId("formEditQueue.context")); + } + this.dialog.set("title", "Edit Queue - " + entities.encode(String(modelObj.name))); + management.load(modelObj, {actuals: true}).then(function (actualData) + { + management.load(modelObj) + .then(function (effectiveData) + { + that._show(actualData[0], + effectiveData[0]); + }, util.xhrErrorHandler); + }); + }, + 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 that = this; + this.management.update(that.modelObj, data).then(function (x) + { + that.dialog.hide() + }); + } + else + { + alert('Form contains invalid data. Please correct first'); + } + }, + _show: function (actualData, effectiveData) + { + + this.initialData = actualData; + this.form.reset(); + + var that = this; + util.applyToWidgets(that.allFieldsContainer, + "Queue", + actualData.type, + actualData, + this.management.metadata); + + util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData); + + // Add regexp to the numeric fields + for (var i = 0; i < numericFieldNames.length; i++) + { + registry.byId("formEditQueue." + numericFieldNames[i]) + .set("regExpGen", util.numericOrContextVarRegexp); + } + + var queueType = this.typeSelector.get("value"); + query(".typeSpecificDiv").forEach(function (node, index, arr) + { + if (node.id === "formEditQueueType:" + queueType) + { + node.style.display = "block"; + util.applyMetadataToWidgets(node, + "Queue", + queueType, + that.management.metadata); + } + else + { + node.style.display = "none"; + } + }); + this.dialog.startup(); + this.dialog.show(); + if (!this.resizeEventRegistered) + { + this.resizeEventRegistered = true; + util.resizeContentAreaAndRepositionDialog(dom.byId("formEditQueue.contentPane"), this.dialog); + } + } + }; + + queueEditor.init(); + + return queueEditor; + }); Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js?rev=1741609&r1=1741608&r2=1741609&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js Fri Apr 29 11:04:40 2016 @@ -43,171 +43,204 @@ define(["dojox/html/entities", "dojox/validate/us", "dojox/validate/web", "dojo/domReady!"], - function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) - { - var fields = [ "name", "connectionThreadPoolSize", "queue.deadLetterQueueEnabled", - "storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", "storeTransactionOpenTimeoutWarn", - "storeTransactionOpenTimeoutClose", "housekeepingCheckPeriod", "housekeepingThreadCount"]; - var numericFieldNames = ["storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", - "storeTransactionOpenTimeoutWarn", "storeTransactionOpenTimeoutClose", - "housekeepingCheckPeriod", "housekeepingThreadCount", - "connectionThreadPoolSize"]; - - - var virtualHostEditor = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){ that._postParse();}); - }, - _postParse: function() - { - var that=this; - this.allFieldsContainer = dom.byId("editVirtualHost.allFields"); - this.typeFieldsContainer = dom.byId("editVirtualHost.typeFields"); - 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"); - this.form.on("submit", function(){return false;}); - }, - show: function(management, modelObj) - { - this.management = management; - this.modelObj = modelObj; - var that=this; - if (!this.context) - { - this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.context.placeAt(dom.byId("editVirtualHost.context")); - } - this.dialog.set("title", "Edit Virtual Host - " + entities.encode(String(modelObj.name))); - - management.load(modelObj, { actuals: true }).then( - function(actualData) - { - management.load(modelObj).then( - function(effectiveData) - { - that._show(actualData[0], effectiveData[0]); - }, - util.xhrErrorHandler); - }); - - }, - 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 that=this; - this.management.update(that.modelObj, data).then( function(x){ that.dialog.hide();} ); - } - 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]); - } - } - - util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData ); - - // Add regexp to the numeric fields - for(var i = 0; i < numericFieldNames.length; i++) - { - this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp); - } - - var that = this; - - var widgets = registry.findWidgets(this.typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - domConstruct.empty(this.typeFieldsContainer); - - require(["qpid/management/virtualhost/" + actualData.type.toLowerCase() + "/edit"], - function(TypeUI) - { - try - { - var metadata = that.management.metadata; - TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: actualData, metadata: metadata}); - that.form.connectChildren(); - - util.applyToWidgets(that.allFieldsContainer, "VirtualHost", actualData.type, actualData, metadata); - } - catch(e) - { - if (console && console.warn ) - { - console.warn(e); - } - } - } - ); - - this.dialog.startup(); - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("editVirtualHost.contentPane"), this.dialog); - } - } - }; - - virtualHostEditor.init(); - - return virtualHostEditor; - } -); + function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) + { + var fields = ["name", + "connectionThreadPoolSize", + "queue.deadLetterQueueEnabled", + "storeTransactionIdleTimeoutWarn", + "storeTransactionIdleTimeoutClose", + "storeTransactionOpenTimeoutWarn", + "storeTransactionOpenTimeoutClose", + "housekeepingCheckPeriod", + "housekeepingThreadCount"]; + var numericFieldNames = ["storeTransactionIdleTimeoutWarn", + "storeTransactionIdleTimeoutClose", + "storeTransactionOpenTimeoutWarn", + "storeTransactionOpenTimeoutClose", + "housekeepingCheckPeriod", + "housekeepingThreadCount", + "connectionThreadPoolSize"]; + + var virtualHostEditor = { + init: function () + { + var that = this; + this.containerNode = domConstruct.create("div", {innerHTML: template}); + parser.parse(this.containerNode).then(function (instances) + { + that._postParse(); + }); + }, + _postParse: function () + { + var that = this; + this.allFieldsContainer = dom.byId("editVirtualHost.allFields"); + this.typeFieldsContainer = dom.byId("editVirtualHost.typeFields"); + 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"); + this.form.on("submit", function () + { + return false; + }); + }, + show: function (management, modelObj) + { + this.management = management; + this.modelObj = modelObj; + var that = this; + if (!this.context) + { + this.context = new qpid.common.ContextVariablesEditor({ + name: 'context', + title: 'Context variables' + }); + this.context.placeAt(dom.byId("editVirtualHost.context")); + } + this.dialog.set("title", "Edit Virtual Host - " + entities.encode(String(modelObj.name))); + + management.load(modelObj, {actuals: true}).then(function (actualData) + { + management.load(modelObj) + .then(function (effectiveData) + { + that._show(actualData[0], + effectiveData[0]); + }, util.xhrErrorHandler); + }); + + }, + 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 that = this; + this.management.update(that.modelObj, data).then(function (x) + { + that.dialog.hide(); + }); + } + 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]); + } + } + + util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData); + + // Add regexp to the numeric fields + for (var i = 0; i < numericFieldNames.length; i++) + { + this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp); + } + + var that = this; + + var widgets = registry.findWidgets(this.typeFieldsContainer); + array.forEach(widgets, function (item) + { + item.destroyRecursive(); + }); + domConstruct.empty(this.typeFieldsContainer); + + require(["qpid/management/virtualhost/" + actualData.type.toLowerCase() + "/edit"], function (TypeUI) + { + try + { + var metadata = that.management.metadata; + TypeUI.show({ + containerNode: that.typeFieldsContainer, + parent: that, + data: actualData, + metadata: metadata + }); + that.form.connectChildren(); + + util.applyToWidgets(that.allFieldsContainer, + "VirtualHost", + actualData.type, + actualData, + metadata); + } + catch (e) + { + if (console && console.warn) + { + console.warn(e); + } + } + }); + + this.dialog.startup(); + this.dialog.show(); + if (!this.resizeEventRegistered) + { + this.resizeEventRegistered = true; + util.resizeContentAreaAndRepositionDialog(dom.byId("editVirtualHost.contentPane"), this.dialog); + } + } + }; + + virtualHostEditor.init(); + + return virtualHostEditor; + }); Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js?rev=1741609&r1=1741608&r2=1741609&view=diff ============================================================================== --- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js (original) +++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js Fri Apr 29 11:04:40 2016 @@ -43,126 +43,158 @@ define(["dojox/html/entities", "dojox/validate/us", "dojox/validate/web", "dojo/domReady!"], - function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) - { - var virtualHostNodeEditor = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){ that._postParse();}); - }, - _postParse: function() - { - var that=this; - this.allFieldsContainer = dom.byId("editVirtualHostNode.allFields"); - this.typeFieldsContainer = dom.byId("editVirtualHostNode.typeFields"); - this.dialog = registry.byId("editVirtualHostNodeDialog"); - this.saveButton = registry.byId("editVirtualHostNode.saveButton"); - this.cancelButton = registry.byId("editVirtualHostNode.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.saveButton.on("click", function(e){that._save(e);}); - this.name = registry.byId("editVirtualHostNode.name"); - this.form = registry.byId("editVirtualHostNodeForm"); - this.form.on("submit", function(){return false;}); - }, - show: function(management, modelObj, effectiveData) - { - this.management = management; - this.modelObj = modelObj; - var that=this; - if (!this.context) - { - this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.context.placeAt(dom.byId("editVirtualHostNode.context")); - } - this.dialog.set("title", "Edit Virtual Host Node - " + entities.encode(String(effectiveData.name))); - management.load( modelObj, { actuals: true }).then( function(data){that._show(data[0], effectiveData);}); - }, - 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 that = this; - this.management.update(that.modelObj, data).then( function(x){ that.dialog.hide();} ); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _show:function(actualData, effectiveData) - { - this.initialData = actualData; - this.name.set("value", actualData.name); - - var that = this; - - util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData ); - - var widgets = registry.findWidgets(this.typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - domConstruct.empty(this.typeFieldsContainer); - - require(["qpid/management/virtualhostnode/" + actualData.type.toLowerCase() + "/edit"], - function(TypeUI) - { - try - { - var metadata = that.management.metadata; - TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: actualData, effectiveData: effectiveData, metadata: metadata}); - that.form.connectChildren(); - - util.applyToWidgets(that.allFieldsContainer, "VirtualHostNode", actualData.type, actualData, metadata); - } - catch(e) - { - if (console && console.warn ) - { - console.warn(e); - } - } - } - ); - - this.dialog.startup(); - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("editVirtualHostNode.contentPane"), this.dialog); - } - } - }; - - virtualHostNodeEditor.init(); - - return virtualHostNodeEditor; - } -); + function (entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) + { + var virtualHostNodeEditor = { + init: function () + { + var that = this; + this.containerNode = domConstruct.create("div", {innerHTML: template}); + parser.parse(this.containerNode).then(function (instances) + { + that._postParse(); + }); + }, + _postParse: function () + { + var that = this; + this.allFieldsContainer = dom.byId("editVirtualHostNode.allFields"); + this.typeFieldsContainer = dom.byId("editVirtualHostNode.typeFields"); + this.dialog = registry.byId("editVirtualHostNodeDialog"); + this.saveButton = registry.byId("editVirtualHostNode.saveButton"); + this.cancelButton = registry.byId("editVirtualHostNode.cancelButton"); + this.cancelButton.on("click", function (e) + { + that._cancel(e); + }); + this.saveButton.on("click", function (e) + { + that._save(e); + }); + this.name = registry.byId("editVirtualHostNode.name"); + this.form = registry.byId("editVirtualHostNodeForm"); + this.form.on("submit", function () + { + return false; + }); + }, + show: function (management, modelObj, effectiveData) + { + this.management = management; + this.modelObj = modelObj; + var that = this; + if (!this.context) + { + this.context = new qpid.common.ContextVariablesEditor({ + name: 'context', + title: 'Context variables' + }); + this.context.placeAt(dom.byId("editVirtualHostNode.context")); + } + this.dialog.set("title", "Edit Virtual Host Node - " + entities.encode(String(effectiveData.name))); + management.load(modelObj, {actuals: true}).then(function (data) + { + that._show(data[0], effectiveData); + }); + }, + 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 that = this; + this.management.update(that.modelObj, data).then(function (x) + { + that.dialog.hide(); + }); + } + else + { + alert('Form contains invalid data. Please correct first'); + } + }, + _show: function (actualData, effectiveData) + { + this.initialData = actualData; + this.name.set("value", actualData.name); + + var that = this; + + util.setContextData(this.context, this.management, this.modelObj, actualData, effectiveData); + + var widgets = registry.findWidgets(this.typeFieldsContainer); + array.forEach(widgets, function (item) + { + item.destroyRecursive(); + }); + domConstruct.empty(this.typeFieldsContainer); + + require(["qpid/management/virtualhostnode/" + actualData.type.toLowerCase() + "/edit"], + function (TypeUI) + { + try + { + var metadata = that.management.metadata; + TypeUI.show({ + containerNode: that.typeFieldsContainer, + parent: that, + data: actualData, + effectiveData: effectiveData, + metadata: metadata + }); + that.form.connectChildren(); + + util.applyToWidgets(that.allFieldsContainer, + "VirtualHostNode", + actualData.type, + actualData, + metadata); + } + catch (e) + { + if (console && console.warn) + { + console.warn(e); + } + } + }); + + this.dialog.startup(); + this.dialog.show(); + if (!this.resizeEventRegistered) + { + this.resizeEventRegistered = true; + util.resizeContentAreaAndRepositionDialog(dom.byId("editVirtualHostNode.contentPane"), + this.dialog); + } + } + }; + + virtualHostNodeEditor.init(); + + return virtualHostNodeEditor; + }); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
