diff options
| author | Keith Wall <kwall@apache.org> | 2014-07-16 11:07:18 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2014-07-16 11:07:18 +0000 |
| commit | e9f4e542b245f40cdcbe4694657b19e636bbecaa (patch) | |
| tree | e29da884b37fb3e27da1e7bd6b92ab95c9f494c9 /qpid/java/broker-plugins/management-http | |
| parent | ee4da00c15c9af165766060dc365255b910c9381 (diff) | |
| download | qpid-python-e9f4e542b245f40cdcbe4694657b19e636bbecaa.tar.gz | |
QPID-5413: [Java Broker] Add virtualhostnode/virtualhost creation dialogue
Work by Andrew MacBean <macbean@apache.org> and me.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1610967 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http')
14 files changed, 579 insertions, 381 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNode.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNode.html deleted file mode 100644 index d5e8d44e98..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNode.html +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - - - - 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" style="width:600px;" data-dojo-props="title:'Add Virtual Host Node And Virtual Host'" id="addVirtualHostNode"> - <form id="addVirtualHostNode.form" method="post" data-dojo-type="dijit/form/Form"> - <div> - <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Virtual Host Node Type*:</div> - <div style="float:left;" class="tableContainer-valueCell formLabel-controlCell"> - <select id="addVirtualHostNode.type" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'type', - required: true, - disabled: true, - placeHolder: 'select node type', - title: 'Select virtual host node type', - searchAttr: 'name'"> - </select> - </div> - </div> - <div style="clear:both"></div> - <div id="addVirtualHostNode.typeFields"></div> - </div> - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="addVirtualHostNode.saveButton" data-dojo-props="label: 'Save'" type="submit">Save</button> - <button data-dojo-type="dijit/form/Button" id="addVirtualHostNode.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html new file mode 100644 index 0000000000..3e65076a4e --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html @@ -0,0 +1,82 @@ +<!-- + - + - 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" style="width:600px;" data-dojo-props="title:'Add'" id="addVirtualHostNodeAndVirtualHost"> + + + <!-- VHN Form --> + <form id="addVirtualHostNode.form" method="post" data-dojo-type="dijit/form/Form"> + <div class="formBox"> + <fieldset> + <legend>Virtual Host Node</legend> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Type*:</div> + <div style="float:left;" class="tableContainer-valueCell formLabel-controlCell"> + <select id="addVirtualHostNode.type" data-dojo-type="dijit/form/FilteringSelect" + data-dojo-props=" + name: 'type', + required: true, + disabled: true, + placeHolder: 'select virtual host node type', + title: 'Select virtual host node type', + searchAttr: 'name'"> + </select> + </div> + </div> + <div style="clear:both"></div> + + <div id="addVirtualHostNode.typeFields"></div> + </fieldset> + </div> + </form> + + <!-- VH Form --> + <form id="addVirtualHost.form" method="post" data-dojo-type="dijit/form/Form"> + <div class="formBox"> + <fieldset> + <legend>Virtual Host</legend> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Type*:</div> + <div style="float:left;" class="tableContainer-valueCell formLabel-controlCell"> + <select id="addVirtualHost.type" data-dojo-type="dijit/form/FilteringSelect" + data-dojo-props=" + name: 'type', + required: true, + disabled: true, + placeHolder: 'select virtual host type', + title: 'Select virtual host type', + searchAttr: 'name'"> + </select> + </div> + </div> + <div style="clear:both"></div> + + <div id="addVirtualHost.typeFields"></div> + </fieldset> + </div> + </form> + + <div class="dijitDialogPaneActionBar"> + <button data-dojo-type="dijit/form/Button" id="addVirtualHostNodeAndVirtualHost.addButton" data-dojo-props="label: 'Add'" type="submit"></button> + <button data-dojo-type="dijit/form/Button" id="addVirtualHostNodeAndVirtualHost.cancelButton" data-dojo-props="label: 'Cancel'" ></button> + </div> + </div> +</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 899d1b3630..eafa5f0619 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 @@ -90,10 +90,32 @@ div .messages { height: 350px; } +.formBox { + border: .1em solid lightgrey; + margin: 10px 0px 20px 0px; + border-radius: 5px; +} + +.formBox legend { + font-weight: bold; + margin-top: -10px; + margin-left: 5px; + background-color: white; +} + +.formBox fieldset { + padding: 10px 0px 10px 0px; +} + +.formBox .formLabel-labelCell { + margin-left: 5px; +} + .formLabel-labelCell { font-weight: bold; } + .formLabel-controlCell { padding: 1px; } diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js index 46afe7d8cb..ccedcdd108 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js @@ -31,7 +31,7 @@ define(["dojo/_base/xhr", "dijit/registry", "dojox/html/entities", "qpid/management/addAuthenticationProvider", - "qpid/management/addVirtualHostNode", + "qpid/management/addVirtualHostNodeAndVirtualHost", "qpid/management/addPort", "qpid/management/addKeystore", "qpid/management/addGroupProvider", @@ -49,7 +49,7 @@ define(["dojo/_base/xhr", "dijit/Menu", "dijit/MenuItem", "dojo/domReady!"], - function (xhr, parser, query, json, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, entities, addAuthenticationProvider, addVirtualHostNode, addPort, addKeystore, addGroupProvider, addAccessControlProvider) { + function (xhr, parser, query, json, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, entities, addAuthenticationProvider, addVirtualHostNodeAndVirtualHost, addPort, addKeystore, addGroupProvider, addAccessControlProvider) { function Broker(name, parent, controller) { this.name = name; @@ -198,8 +198,8 @@ define(["dojo/_base/xhr", } ); - var addHostButton = query(".addVirtualHost", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addHostButton), "onClick", function(evt){ addVirtualHostNode.show(); }); + var addVHNAndVHButton = query(".addVirtualHostNodeAndVirtualHostButton", contentPane.containerNode)[0]; + connect.connect(registry.byNode(addVHNAndVHButton), "onClick", function(evt){ addVirtualHostNodeAndVirtualHost.show(); }); var addPortButton = query(".addPort", contentPane.containerNode)[0]; connect.connect(registry.byNode(addPortButton), "onClick", function(evt){ diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNode.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNode.js deleted file mode 100644 index d1889b8f17..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNode.js +++ /dev/null @@ -1,211 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/_base/event", - "dojo/_base/lang", - "dojo/_base/array", - "dojo/dom", - "dojo/dom-construct", - "dojo/json", - "dojo/parser", - "dojo/store/Memory", - "dijit/registry", - "dijit/Dialog", - "dijit/form/Button", - "dijit/form/FilteringSelect", - "qpid/common/properties", - "dojo/text!addVirtualHostNode.html", - "dijit/form/Form", - "dijit/form/CheckBox", - "dijit/form/RadioButton", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], - function (xhr, event, lang, array, dom, domConstruct, json, parser, Memory, registry, Dialog, Button, FilteringSelect, properties, template) - { - - var addVirtualHostNode = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode); - this.typeFieldsContainer = dom.byId("addVirtualHostNode.typeFields"); - this.dialog = registry.byId("addVirtualHostNode"); - this.saveButton = registry.byId("addVirtualHostNode.saveButton"); - this.cancelButton = registry.byId("addVirtualHostNode.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.saveButton.on("click", function(e){that._save(e);}); - this.form = registry.byId("addVirtualHostNode.form"); - this.type = registry.byId("addVirtualHostNode.type"); - this.type.set("disabled", true); - xhr.get({sync: properties.useSyncGet, handleAs: "json", url: "api/latest/broker?depth=0", load: function(data){that._onBrokerData(data[0]) }}); - this.form.on("submit", function(e){that._submit();} ); - }, - _onBrokerData: function(brokerData) - { - var that=this; - this.supportedVirtualHostNodeTypes = brokerData.supportedVirtualHostNodeTypes; - this.supportedVirtualHostStoreTypes = brokerData.supportedVirtualHostStoreTypes; - var typesData = []; - for (var i =0 ; i < this.supportedVirtualHostNodeTypes.length; i++) - { - var type = this.supportedVirtualHostNodeTypes[i]; - typesData.push( {id: type, name: type} ); - } - var typesStore = new Memory({ data: typesData }); - this.type.set("store", typesStore); - this.type.set("disabled", false); - this.type.on("change", function(type){that._typeChanged(type);}); - }, - show: function() - { - this.form.reset(); - this.type.set("value", null); - this.dialog.show(); - }, - destroy: function() - { - if (this.dialog) - { - this.dialog.destroyRecursive(); - this.dialog = null; - } - - if (this.containerNode) - { - domConstruct.destroy(this.containerNode); - this.containerNode = null; - } - }, - _typeChanged: function(type) - { - var widgets = registry.findWidgets(this.typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - domConstruct.empty(this.typeFieldsContainer); - - if (type) - { - var that = this; - require(["qpid/management/virtualhostnode/" + type.toLowerCase() + "/add"], - function(TypeUI) - { - try - { - TypeUI.show({containerNode:that.typeFieldsContainer, parent: that}); - } - catch(e) - { - console.warn(e); - } - } - ); - } - }, - _cancel: function(e) - { - this.dialog.hide(); - }, - _save: function(e) - { - event.stop(e); - this._submit(); - }, - _submit: function() - { - if(this.form.validate()) - { - var success = false,failureReason=null; - var data = this._getValues(); - xhr.put({ - url: "api/latest/virtualhostnode/" + encodeURIComponent(data.name), - 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'); - } - }, - _getValues: function() - { - var values = {}; - var formWidgets = this.form.getChildren(); - for(var i in formWidgets) - { - var widget = formWidgets[i]; - var value = widget.value; - var propName = widget.name; - if (propName) - { - 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; - } - }; - - addVirtualHostNode.init(); - - return addVirtualHostNode; - } -); 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 new file mode 100644 index 0000000000..e335f51d33 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js @@ -0,0 +1,285 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +define(["dojo/_base/xhr", + "dojo/_base/event", + "dojo/_base/lang", + "dojo/_base/array", + "dojo/dom", + "dojo/dom-construct", + "dojo/json", + "dojo/parser", + "dojo/store/Memory", + "dijit/registry", + "dijit/Dialog", + "dijit/form/Button", + "dijit/form/FilteringSelect", + "qpid/common/properties", + "dojo/text!addVirtualHostNodeAndVirtualHost.html", + "dijit/form/Form", + "dijit/form/CheckBox", + "dijit/form/RadioButton", + "dojox/validate/us", + "dojox/validate/web", + "dojo/domReady!"], + function (xhr, event, lang, array, dom, domConstruct, json, parser, Memory, registry, Dialog, Button, FilteringSelect, properties, template) + { + + var addVirtualHostNodeAndVirtualHost = + { + init: function() + { + var that=this; + this.containerNode = domConstruct.create("div", {innerHTML: template}); + parser.parse(this.containerNode); + + this.dialog = registry.byId("addVirtualHostNodeAndVirtualHost"); + this.addButton = registry.byId("addVirtualHostNodeAndVirtualHost.addButton"); + this.cancelButton = registry.byId("addVirtualHostNodeAndVirtualHost.cancelButton"); + this.cancelButton.on("click", function(e){that._cancel(e);}); + this.addButton.on("click", function(e){that._add(e);}); + + this.virtualHostNodeTypeFieldsContainer = dom.byId("addVirtualHostNode.typeFields"); + this.virtualHostNodeForm = registry.byId("addVirtualHostNode.form"); + this.virtualHostNodeType = registry.byId("addVirtualHostNode.type"); + this.virtualHostNodeType.set("disabled", true); + + this.virtualHostTypeFieldsContainer = dom.byId("addVirtualHost.typeFields"); + this.virtualHostForm = registry.byId("addVirtualHost.form"); + this.virtualHostType = registry.byId("addVirtualHost.type"); + this.virtualHostType.set("disabled", true); + + xhr.get({sync: properties.useSyncGet, handleAs: "json", url: "api/latest/broker?depth=0", load: function(data){that._onBrokerData(data[0]) }}); + }, + _makeTypeStore: function (types) { + var typeData = []; + for (var i = 0; i < types.length; i++) { + var type = types[i]; + typeData.push({id: type, name: type}); + } + return new Memory({ data: typeData }); + }, + _onBrokerData: function(brokerData) + { + var that=this; + this.supportedVirtualHostNodeTypes = brokerData.supportedVirtualHostNodeTypes; + this.supportedVirtualHostNodeTypes.sort(); + this.supportedVirtualHostTypes = brokerData.supportedVirtualHostTypes; + this.supportedVirtualHostTypes.sort(); + + //VH Type BDB_HA_REPLICA is not user creatable. This is only needed until we have model meta data available. + this.supportedVirtualHostTypes = array.filter(this.supportedVirtualHostTypes, function(item){ + return item != "BDB_HA_REPLICA"; + }); + + var virtualHostNodeTypeStore = this._makeTypeStore(this.supportedVirtualHostNodeTypes); + this.virtualHostNodeType.set("store", virtualHostNodeTypeStore); + this.virtualHostNodeType.set("disabled", false); + this.virtualHostNodeType.on("change", function(type){that._typeChanged(type, that.virtualHostNodeTypeFieldsContainer, "qpid/management/virtualhostnode/");}); + + var virtualHostTypeStore = this._makeTypeStore(this.supportedVirtualHostTypes); + this.virtualHostType.set("store", virtualHostTypeStore); + this.virtualHostType.set("disabled", false); + this.virtualHostType.on("change", function(type){that._typeChanged(type, that.virtualHostTypeFieldsContainer, "qpid/management/virtualhost/");}); + }, + show: function() + { + this.virtualHostNodeForm.reset(); + this.virtualHostNodeType.set("value", null); + + this.virtualHostForm.reset(); + this.virtualHostType.set("value", null); + this.dialog.show(); + }, + destroy: function() + { + if (this.dialog) + { + this.dialog.destroyRecursive(); + this.dialog = null; + } + + if (this.containerNode) + { + domConstruct.destroy(this.containerNode); + this.containerNode = null; + } + }, + _typeChanged: function (type, typeFieldsContainer, urlStem) + { + var widgets = registry.findWidgets(typeFieldsContainer); + array.forEach(widgets, function(item) { item.destroyRecursive();}); + domConstruct.empty(typeFieldsContainer); + + if (type) + { + var that = this; + require([urlStem + type.toLowerCase() + "/add"], + function(TypeUI) + { + try + { + TypeUI.show({containerNode:typeFieldsContainer, parent: that}); + } + catch(e) + { + console.warn(e); + } + } + ); + } + }, + _cancel: function(e) + { + this.dialog.hide(); + }, + _add: function(e) + { + event.stop(e); + this._submit(); + }, + _submit: function() + { + if(this.virtualHostNodeForm.validate() && this.virtualHostForm.validate()) + { + var success = false,failureReason=null; + + var virtualHostNodeData = this._getValues(this.virtualHostNodeForm); + var virtualHostData = this._getValues(this.virtualHostForm); + + if (virtualHostNodeData["type"] == "JSON" && virtualHostData["type"] == "ProvidedStore") + { + alert('Cannot use a JSON Virtual Host Node with a ProvidedStore Virtual Host'); + return; + } + + //Default the VH name to be the same as the VHN name. + virtualHostData["name"] = virtualHostNodeData["name"]; + + var encodedVirtualHostNodeName = encodeURIComponent(virtualHostNodeData.name); + xhr.put({ + url: "api/latest/virtualhostnode/" + encodedVirtualHostNodeName, + sync: true, + handleAs: "json", + headers: { "Content-Type": "application/json"}, + putData: json.stringify(virtualHostNodeData), + load: function(x) {success = true; }, + error: function(error) {success = false; failureReason = error;} + }); + + if(success === true) + { + var encodedVirtualHostName = encodeURIComponent(virtualHostData.name); + xhr.put({ + url: "api/latest/virtualhost/" + encodedVirtualHostNodeName + "/" + encodedVirtualHostName, + sync: true, + handleAs: "json", + headers: { "Content-Type": "application/json"}, + putData: json.stringify(virtualHostData), + load: function (x) { + success = true; + }, + error: function (error) { + success = false; + failureReason = error; + } + }); + } + + if (success == true) + { + this.dialog.hide(); + } + else + { + // What if VHN creation was successful but VH was not + alert("Error:" + failureReason); + } + } + else + { + alert('Form contains invalid data. Please correct first'); + } + }, + _getValues: function (form) + { + var values = {}; + var contextMap = {}; + + 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.contextvar) + { + contextMap [propName] = String(value); // Broker requires that context values are Strings + } + else + { + 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; + } + + } + } + } + + // One or more context variables were defined on form + if (Object.keys(contextMap).length > 0) + { + values ["context"] = contextMap; + } + return values; + } + }; + + addVirtualHostNodeAndVirtualHost.init(); + + return addVirtualHostNodeAndVirtualHost; + } +); 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/derby/add.js new file mode 100644 index 0000000000..21d377445d --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +define(["dojo/_base/xhr", + "dojo/parser", + "dojo/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) + { + return { + show: function (data) + { + this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); + parser.parse(this.containerNode); + } + }; + } +); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js new file mode 100644 index 0000000000..512b8de875 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +define(["dojo/_base/xhr", + "dojo/parser", + "dojo/dom", + "dojo/dom-construct", + "dojo/json", + "dijit/registry", + "dojo/text!virtualhost/providedstore/add.html", + "dijit/form/ValidationTextBox", + "dojo/domReady!"], + function (xhr, parser, dom, domConstruct, json, registry, template) + { + return { + show: function (data) + { + this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); + parser.parse(this.containerNode); + } + }; + } +); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js deleted file mode 100644 index af77026c87..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/standard/addVirtualHost.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/json", - "dojo/string", - "dojo/store/Memory", - "dijit/form/FilteringSelect", - "dojo/domReady!"], - function (xhr, dom, construct, win, registry, parser, array, event, json, string, Memory, FilteringSelect) { - return { - show: function() { - var node = dom.byId("addVirtualHost.typeSpecificDiv"); - var that = this; - - array.forEach(registry.toArray(), - function(item) { - if(item.id.substr(0,27) == "formAddVirtualHost.specific") { - item.destroyRecursive(); - } - }); - - - var selectStoreType = function(type) { - if(type && string.trim(type) != "") { - require(["qpid/management/virtualhost/store/"+type.toLowerCase()+"/add"], - function(storeType) - { - storeType.show(); - }); - } - } - - xhr.get({url: "virtualhost/standard/add.html", - sync: true, - load: function(data) { - node.innerHTML = data; - parser.parse(node); - if (that.hasOwnProperty("storeTypeChooser")) - { - that.storeTypeChooser.destroy(); - } - xhr.get({ - sync: true, - url: "service/helper?action=ListVirtualHostTypes", - handleAs: "json" - }).then( - function(data) { - var storeTypes = data; - var storeTypesData = []; - for (var i =0 ; i < storeTypes.length; i++) - { - storeTypesData[i]= {id: storeTypes[i], name: storeTypes[i]}; - } - var storeTypesStore = new Memory({ data: storeTypesData }); - var storeTypesDiv = dom.byId("addVirtualHost.specific.selectStoreType"); - var input = construct.create("input", {id: "addStoreType", required: false}, storeTypesDiv); - that.storeTypeChooser = new FilteringSelect({ id: "addVirtualHost.specific.storeType", - name: "storeType", - store: storeTypesStore, - searchAttr: "name", required: false, - onChange: selectStoreType }, input); - }); - - }}); - } - }; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html index 7572856e35..92661ea288 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html @@ -73,7 +73,7 @@ <br/> <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual Hosts'"> <div class="broker-virtualhosts"></div> - <button data-dojo-type="dijit.form.Button" class="addVirtualHost">Add Virtual Host</button> + <button data-dojo-type="dijit.form.Button" class="addVirtualHostNodeAndVirtualHostButton">Add</button> <div data-dojo-type="dijit.form.DropDownButton" class="virtualHostNodeMenuButton" data-dojo-props="iconClass: 'dijitIconConnector',disabled:true"> <span>Virtual Host Node</span> <div data-dojo-type="dijit.Menu"> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/add.html new file mode 100644 index 0000000000..0d38617074 --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/add.html @@ -0,0 +1,46 @@ +<!-- + ~ 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 tableContainer-labelCell" style="float:left; width: 300px;">Store overfull size:</div> + <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;"> + <input type="text" id="addVirtualHost.storeOverfullSize" + data-dojo-type="dijit/form/NumberTextBox" + data-dojo-props=" + name: 'storeOverfullSize', + required: false, + title: 'Enter ceiling (in bytes) at which store will begin to throttle sessions producing messages', + constraints:{min:0,places:0}" /> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Store underfull size:</div> + <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;"> + <input type="text" id="addVirtualHost.storeUnderfullSize" + data-dojo-type="dijit/form/NumberTextBox" + data-dojo-props=" + name: 'storeUnderfullSize', + required: false, + title: 'Enter floor (in bytes) at which store will cease to throttle sessions producing messages', + constraints:{min:0,places:0}" /> + </div> + </div> + <div style="clear:both"></div> +</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/add.html new file mode 100644 index 0000000000..1405f2444a --- /dev/null +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/add.html @@ -0,0 +1,59 @@ +<!-- + ~ 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 tableContainer-labelCell" style="float:left; width: 300px;">Message store path*:</div> + <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;"> + <input type="text" id="addVirtualHost.storePath" + data-dojo-type="dijit/form/ValidationTextBox" + data-dojo-props=" + name: 'storePath', + placeHolder: 'path/to/store', + required: true, + missingMessage: 'Store path must be supplied', + title: 'Enter message store path'" /> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Store overfull size:</div> + <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;"> + <input type="text" id="addVirtualHost.storeOverfullSize" + data-dojo-type="dijit/form/NumberTextBox" + data-dojo-props=" + name: 'storeOverfullSize', + required: false, + title: 'Enter ceiling (in bytes) at which store will begin to throttle sessions producing messages', + constraints:{min:0,places:0}" /> + </div> + </div> + <div style="clear:both"> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Store underfull size:</div> + <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;"> + <input type="text" id="addVirtualHost.storeUnderfullSize" + data-dojo-type="dijit/form/NumberTextBox" + data-dojo-props=" + name: 'storeUnderfullSize', + required: false, + title: 'Enter floor (in bytes) at which store will cease to throttle sessions producing messages', + constraints:{min:0,places:0}" /> + </div> + </div> + <div style="clear:both"></div> +</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html deleted file mode 100644 index 050ea9533e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/standard/add.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ 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. - --> -<table class="tableContainer-table tableContainer-table-horiz"> - <tr> - <td class="tableContainer-labelCell" style="width: 300px;"><strong>Store Type*: </strong></td> - <td class="tableContainer-valueCell" ><div id="addVirtualHost.specific.selectStoreType"></div></td> - </tr> -</table> -<div id="addVirtualHost.storeSpecificDiv"> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html index 338a46700d..ebdb3b9c0b 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html @@ -20,7 +20,7 @@ --> <div> <div style="clear:both"> - <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Virtual Host Node Name*:</div> + <div class="formLabel-labelCell tableContainer-labelCell" style="float:left; width: 300px;">Name*:</div> <div class="formLabel-controlCell tableContainer-valueCell" style="float:left;"> <input type="text" id="addVirtualHostNode.jsonNodeName" data-dojo-type="dijit/form/ValidationTextBox" |
