qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject svn commit: r1750594 [1/2] - in /qpid/java/trunk/broker-plugins/management-http/src/main/java/resources: ./ css/ js/qpid/common/ js/qpid/management/ js/qpid/management/query/ query/
Date Tue, 28 Jun 2016 23:25:47 GMT
Author: orudyy
Date: Tue Jun 28 23:25:46 2016
New Revision: 1750594

URL: http://svn.apache.org/viewvc?rev=1750594&view=rev
Log:
QPID-7248: Extend query UI to allow queries to be saved, cloned and deleted

Added:
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js
      - copied, changed from r1750360, qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryCreateDialogForm.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryWidget.js
      - copied, changed from r1750360, qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/SearchTextBox.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryCloneDialogForm.html
      - copied, changed from r1750360, qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/OptionsPanel.html
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryCreateDialogForm.html
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QuerySaveDialogForm.html
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryWidget.html
      - copied, changed from r1750360, qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryBuilder.html
Removed:
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryBuilder.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/QueryBuilder.html
Modified:
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Management.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/QueryTab.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryGrid.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryStore.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/OptionsPanel.html
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showQueryTab.html

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css?rev=1750594&r1=1750593&r2=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/css/common.css Tue Jun 28 23:25:46 2016
@@ -163,9 +163,11 @@ div .messages {
 
 .formLabel-controlCell {
   padding: 1px;
-  float: left;
+  overflow: hidden;
+  text-align: left;
 }
 
+
 .columnDefDialogButtonIcon {
   background: url("../dojo/dojox/grid/enhanced/resources/images/sprite_icons.png") no-repeat;
     background-position: -260px 2px;
@@ -457,10 +459,8 @@ td.advancedSearchField, col.autoWidth {
     width: auto;
 }
 
-.claro .advancedSearchField .dijitTextArea,
-.advancedSearchField textarea
-{
-    height: 1.6em;
+.claro.qpid .formLabel-controlCell textarea,
+.claro.qpid .advancedSearchField textarea {
     width: 100%;
     padding: 0px;
     box-sizing: border-box;
@@ -469,6 +469,11 @@ td.advancedSearchField, col.autoWidth {
     -ms-box-sizing: border-box;
     resize: vertical;
 }
+
+.claro.qpid .advancedSearchField textarea {
+    height: 1.6em;
+}
+
 .criteriaCondition
 {
   vertical-align: top;
@@ -536,4 +541,66 @@ td.advancedSearchField, col.autoWidth {
 
 .claro.qpid  .dgrid-hider-toggle {
       background-position: -32px -192px;
+}
+
+.claro #login.dijitToolbar {
+    padding-bottom: 5px;
+    padding-top: 4px;
+}
+
+.userIcon.ui-icon {
+    background-position: -146px -98px;
+}
+
+.advancedViewIcon.ui-icon {
+    background-position: -176px -112px;
+    width: 16px;
+    height: 16px;
+}
+
+.trashIcon.ui-icon {
+    background-position: -180px -98px;
+}
+
+.claro .searchBox {
+    padding-right: 16px;
+    padding-left: 16px;
+    position: relative;
+    width: 12.5em;
+}
+
+.claro .searchBox span.search.ui-icon {
+    width: 16px;
+    height: 16px;
+    z-index: 1000;
+    background-position: -160px -112px;
+    position: absolute;
+    left: 0px;
+    top: 0px;
+    -moz-transform: scaleX(-1);
+    -o-transform: scaleX(-1);
+    -webkit-transform: scaleX(-1);
+    transform: scaleX(-1);
+    filter: FlipH;
+    -ms-filter: "FlipH";
+}
+
+.claro .searchBox a.clear.ui-icon {
+    display: block;
+    overflow: hidden;
+    text-indent: -1000px;
+    position: absolute;
+    right: 0px;
+    top: 0px;
+    z-index: 1000;
+    cursor: pointer;
+    width: 16px;
+    height: 16px;
+    background-position: -80px -128px;
+}
+
+.claro .searchBox a.clear:hover {
+    background: url('../dojo/dgrid/css/images/ui-icons_ffffff_256x240.png')  no-repeat;
+    background-position: -80px -128px;
+    background-color: #D3D3D3;
 }
\ No newline at end of file

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html?rev=1750594&r1=1750593&r2=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/index.html Tue Jun 28 23:25:46 2016
@@ -87,64 +87,27 @@
         var management = null;
         require([
                     "dojo/parser",
-                    "dojo/query",
                     "qpid/common/ConsoleHelper",
-                    "qpid/management/Management",
-                    "qpid/common/util",
                     "qpid/management/treeView",
                     "qpid/management/controller",
-                    "qpid/common/updater",
-                    "dojox/html/entities",
-                    "dijit/registry",
-                    "dojo/dom",
                     "dijit/layout/BorderContainer",
                     "dijit/layout/TabContainer",
                     "dijit/layout/ContentPane",
-                    "dijit/TitlePane",
+                    "dijit/Toolbar",
+                    "dijit/ToolbarSeparator",
+                    "dijit/form/DropDownButton",
+                    "dijit/form/Button",
+                    "dijit/Dialog",
                     "dijit/Menu",
                     "dijit/MenuItem",
                     "qpid/common/footer"
                 ],
-                function (parser, query, ConsoleHelper, Management, util, treeView, controller, updater, entities, registry, dom)
+                function (parser, ConsoleHelper, treeView, controller)
                 {
-                    parser.parse();
                     qpidManagementHelper = ConsoleHelper;
-                    qpidManagementHelper.controller = controller;
-                    management = new Management("", util.xhrErrorHandler);
-                    management.authenticate().then(function (data)
-                                                   {
-                                                       if (data.user)
-                                                       {
-                                                           var userName = entities.encode(String(data.user));
-                                                           var controlButton = registry.byId("authenticatedUserControls");
-                                                           if (controlButton)
-                                                           {
-                                                               controlButton.set("label", userName);
-                                                           }
-                                                           dom.byId("authenticatedUser").innerHTML = userName;
-                                                           dom.byId("login").style.display = "inline";
-                                                           management.init(function ()
-                                                                           {
-                                                                               updater.registerUpdateIntervalListener(
-                                                                                       management.userPreferences);
-                                                                               qpidManagementHelper.management =
-                                                                                       management;
-                                                                               controller.init(management);
-                                                                               treeView.create(getContextPath()
-                                                                                               + 'service/structure',
-                                                                                               management,
-                                                                                               query('div[qpid-type="treeView"]')[0]);
-                                                                               dijit.Tooltip.defaultPosition =
-                                                                                       ["after-centered",
-                                                                                        "below-centered"];
-                                                                           });
-                                                       }
-                                                       else
-                                                       {
-                                                           alert("User identifier is not found! Re-authenticate!");
-                                                           window.location = "logout";
-                                                       }
-                                                   });
+                    parser.parse();
+                    qpidManagementHelper.init(controller, treeView);
+                    management = qpidManagementHelper.management;
                 });
     </script>
 
@@ -155,20 +118,33 @@
     <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top', isLayoutContainer:false">
         <div id="header"></div>
         <div class="alignRight">
-          <div id="login" class="hidden"><span id="authenticatedUser" class="hidden"></span>
-            <div id="authenticatedUserControls" data-dojo-type="dijit.form.DropDownButton" data-dojo-props="iconClass: 'preferencesIcon'">
-            <div data-dojo-type="dijit.Menu">
-                <div data-dojo-type="dijit.MenuItem" data-dojo-props="onClick: function(){window.location='logout';}" >Log out</div>
-                <div data-dojo-type="dijit.MenuItem"
-                    data-dojo-props="iconClass:'dijitIconFunction',onClick: function(){qpidManagementHelper.showPreferencesDialog();}">Preferences</div>
-                <div data-dojo-type="dijit.MenuItem" data-dojo-props="onClick: function(){qpidManagementHelper.showAPI();}">REST API</div>
-                <div data-dojo-type="dijit.MenuItem"
-                     data-dojo-props="iconClass: 'helpIcon', onClick: function(){qpidManagementHelper.showHelp();}">Help</div>
-                <div data-dojo-type="dijit.MenuItem"
-                     data-dojo-props="iconClass: 'dijitIconApplication', onClick: function(){qpidManagementHelper.controller.show('queryTab');}">Query</div>
+          <div id="login" class="hidden" data-dojo-type="dijit/Toolbar">
+            <div id="query" data-dojo-type="dijit/form/DropDownButton" data-dojo-props="iconClass: 'dijitIconApplication'">
+                <span>Query</span>
+                <div data-dojo-type="dijit/Menu">
+                    <div data-dojo-type="dijit/MenuItem"
+                      data-dojo-props="onClick: function(e){qpidManagementHelper.showQueryCreateDialog(e);}">Create</div>
+                      <div data-dojo-type="dijit/MenuItem"
+                             data-dojo-props="onClick: function(e){qpidManagementHelper.showQueryOpenDialog(e);}">Open</div>
+                </div>
+            </div>
+            <div data-dojo-type="dijit/form/DropDownButton" data-dojo-props="iconClass: 'helpIcon', showLabel: false">
+                <span>Help</span>
+                <div data-dojo-type="dijit/Menu">
+                  <div data-dojo-type="dijit/MenuItem" data-dojo-props="onClick: function(){qpidManagementHelper.showAPI();}">REST API</div>
+                  <div data-dojo-type="dijit/MenuItem"
+                       data-dojo-props="iconClass: 'helpIcon', onClick: function(){qpidManagementHelper.showHelp();}">Help</div>
+                </div>
+            </div>
+            <span data-dojo-type="dijit/ToolbarSeparator"></span>
+            <div id="authenticatedUserControls" data-dojo-type="dijit/form/DropDownButton" data-dojo-props="iconClass: 'userIcon ui-icon'">
+                <div data-dojo-type="dijit/Menu">
+                    <div data-dojo-type="dijit/MenuItem" data-dojo-props="onClick: function(){qpidManagementHelper.logout();}" >Log out</div>
+                    <div data-dojo-type="dijit/MenuItem"
+                        data-dojo-props="iconClass:'dijitIconFunction',onClick: function(){qpidManagementHelper.showPreferencesDialog();}">Preferences</div>
+                </div>
             </div>
           </div>
-        </div>
        </div>
     </div>
     <div id="tree" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading', splitter: true, isLayoutContainer:false">

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js?rev=1750594&r1=1750593&r2=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js Tue Jun 28 23:25:46 2016
@@ -18,22 +18,32 @@
  * under the License.
  *
  */
-define(["dojo/domReady!"], function ()
+define(["dojo/query",
+        "dijit/registry",
+        "dojox/html/entities",
+        "qpid/common/updater",
+        "qpid/management/Management",
+        "qpid/common/util",
+        "dijit/Dialog",
+        "dojo/domReady!"], function (query, registry, entities, updater, Management, util, Dialog)
 {
 
     var preferencesDialog = null;
     var helpURL = null;
+    var queryCreateDialog = null;
+    var queryCreateDialogForm = null;
 
     return {
         showPreferencesDialog: function ()
         {
             if (preferencesDialog == null)
             {
+                var management = this.management;
                 require(["qpid/management/Preferences", "dojo/ready"], function (PreferencesDialog, ready)
                 {
                     ready(function ()
                     {
-                        preferencesDialog = new PreferencesDialog(this.management);
+                        preferencesDialog = new PreferencesDialog(management);
                         preferencesDialog.showDialog();
                     });
                 });
@@ -95,6 +105,92 @@ define(["dojo/domReady!"], function ()
             }
 
             openWindow("/apidocs");
+        },
+        showQueryCreateDialog: function (e)
+        {
+            var management = this.management;
+            var controller = this.controller;
+            if (queryCreateDialog == null)
+            {
+                require(["qpid/management/query/QueryCreateDialogForm", "dojo/ready"],
+                    function (QueryCreateDialogForm, ready)
+                    {
+                        ready(function ()
+                        {
+                            queryCreateDialogForm = new QueryCreateDialogForm({management: management});
+                            queryCreateDialogForm.on("create", function (e)
+                            {
+                                queryCreateDialog.hide();
+                                controller.show("queryTab", e.preference, e.parentObject);
+                            });
+                            queryCreateDialogForm.on("cancel", function (e)
+                            {
+                                queryCreateDialog.hide();
+                            });
+                            queryCreateDialog = new Dialog({title: "Create query", content: queryCreateDialogForm});
+                            queryCreateDialogForm.loadScope(function ()
+                            {
+                                queryCreateDialog.show();
+                            });
+                        });
+                    });
+            }
+            else
+            {
+                queryCreateDialogForm.loadScope(function ()
+                {
+                    queryCreateDialog.show();
+                });
+            }
+        },
+        showQueryOpenDialog: function (e)
+        {
+
+        },
+        init: function (controller, treeView)
+        {
+            this.controller = controller;
+            this.management = new Management("", util.xhrErrorHandler);
+            var that = this;
+            var management = this.management;
+
+            var authenticationSuccessCallback = function (data)
+            {
+                if (data.user)
+                {
+                    var userName = entities.encode(String(data.user));
+                    var controlButton = registry.byId("authenticatedUserControls");
+                    if (controlButton)
+                    {
+                        controlButton.set("label", userName);
+                        controlButton.domNode.style.display = '';
+                    }
+                    registry.byId("login").domNode.style.display = "inline";
+                    management.init(function ()
+                    {
+                        updater.registerUpdateIntervalListener(management.userPreferences);
+                        controller.init(management);
+                        treeView.create(getContextPath() + 'service/structure',
+                            management,
+                            query('div[qpid-type="treeView"]')[0]);
+                        dijit.Tooltip.defaultPosition =
+                            ["after-centered",
+                             "below-centered"];
+                    });
+                }
+                else
+                {
+                    alert("User identifier is not found! Re-authenticate!");
+                    that.logout();
+                }
+            };
+
+            management.authenticate()
+                .then(authenticationSuccessCallback);
+        },
+        logout: function ()
+        {
+            window.location = "logout";
         }
 
     };

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Management.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Management.js?rev=1750594&r1=1750593&r2=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Management.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Management.js Tue Jun 28 23:25:46 2016
@@ -189,6 +189,15 @@ define(["dojo/_base/lang",
             return this.submit(requestOptions);
         };
 
+        Management.prototype.put = function (request, data)
+        {
+            var requestOptions = merge(request, {
+                method: "PUT",
+                data: data
+            });
+            return this.submit(requestOptions);
+        };
+
         Management.prototype.del = function (request)
         {
             var requestOptions = merge(request, {method: "DELETE"});
@@ -618,5 +627,31 @@ define(["dojo/_base/lang",
             return this.get(request);
         };
 
+        Management.prototype.savePreference = function(parentObject, preference)
+        {
+           var url =  this.buildPreferenceUrl(parentObject, preference.type, preference.name);
+           return this.put({url: url}, preference);
+        };
+
+
+        Management.prototype.loadPreference = function(parentObject, type, name)
+        {
+           var url =  this.buildPreferenceUrl(parentObject, type, name);
+           return this.get({url: url});
+        };
+
+        Management.prototype.deletePreference = function(parentObject, type, name)
+        {
+           var url =  this.buildPreferenceUrl(parentObject, type, name);
+           return this.del({url: url});
+        };
+
+        Management.prototype.buildPreferenceUrl = function (parentObject, type, name)
+        {
+            return this.objectToURL(parentObject) + "/userpreferences/"
+                                       + encodeURIComponent(encodeURIComponent(type))
+                                       + "/" + encodeURIComponent(encodeURIComponent(name));
+        };
+
         return Management;
     });

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/QueryTab.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/QueryTab.js?rev=1750594&r1=1750593&r2=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/QueryTab.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/QueryTab.js Tue Jun 28 23:25:46 2016
@@ -26,23 +26,46 @@ define(["dojo/parser",
         "qpid/common/util",
         "qpid/common/formatter",
         "dojo/text!showQueryTab.html",
-        "qpid/management/query/QueryBuilder",
+        "qpid/management/query/QueryWidget",
         "dojo/dom-construct",
         "dojo/domReady!"],
-    function (parser, query, registry, entities, properties, util, formatter, template, QueryBuilder, domConstruct)
+    function (parser, query, registry, entities, properties, util, formatter, template, QueryWidget, domConstruct)
     {
+        function getPath(parentObject)
+        {
+            if (parentObject)
+            {
+                var type = parentObject.type.charAt(0).toUpperCase() + parentObject.type.substring(1);
+                var val = parentObject.name;
+                for (var i = parentObject.parent; i && i.name; i = i.parent)
+                {
+                    val = i.name + "/" + val;
+                }
+                return type + ":" + val;
+            }
+            return "";
+        }
 
-        function QueryTab(name, parent, controller)
+        function QueryTab(data, parent, controller)
         {
-            this.name = name;
             this.controller = controller;
             this.management = controller.management;
             this.parent = parent;
+            this.preference = data;
         }
 
-        QueryTab.prototype.getTitle = function ()
+        QueryTab.prototype.getTitle = function (changed)
         {
-            return "Query";
+            var category = "";
+            if (this.preference && this.preference.value && this.preference.value.category)
+            {
+                category = this.preference.value.category;
+                category = category.charAt(0).toUpperCase() + category.substring(1);
+            }
+            var name = this.preference.id ? this.preference.name : "New";
+            var prefix = this.preference.id && !changed ? "" : "*";
+            var path = this.parent && this.parent.name ? " (" + getPath(this.parent)+ ")" : "";
+            return prefix + category + " query:" + name + path;
         };
 
         QueryTab.prototype.open = function (contentPane)
@@ -62,12 +85,31 @@ define(["dojo/parser",
 
         QueryTab.prototype.onOpen = function (containerNode)
         {
-            this.queryEditorNode = query(".queryEditorNode", containerNode)[0];
-            this.queryBuilder = new QueryBuilder({
+            this.queryWidgetNode = query(".queryWidgetNode", containerNode)[0];
+            this.queryWidget = new QueryWidget({
                 management: this.management,
                 parentObject: this.parent,
+                preference: this.preference,
                 controller: this.controller
-            }, this.queryEditorNode);
+            }, this.queryWidgetNode);
+            var that = this;
+            this.queryWidget.on("save", function(e)
+            {
+                that.preference = e.preference;
+                var title = that.getTitle();
+                that.contentPane.set("title", title);
+            });
+            this.queryWidget.on("change", function(e)
+            {
+                var changed = !util.equals(this.preference, e.preference);
+                var title = that.getTitle(changed);
+                that.contentPane.set("title", title);
+            });
+            this.queryWidget.on("delete", function(e)
+            {
+                that.destroy();
+            });
+            this.queryWidget.startup();
         };
 
         QueryTab.prototype.close = function ()
@@ -80,6 +122,7 @@ define(["dojo/parser",
             this.close();
             this.contentPane.onClose();
             this.controller.tabContainer.removeChild(this.contentPane);
+            this.queryWidget.destroyRecursive();
             this.contentPane.destroyRecursive();
         };
 

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=1750594&r1=1750593&r2=1750594&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 Tue Jun 28 23:25:46 2016
@@ -102,6 +102,7 @@ define(["dojo/dom",
 
         controller.viewedObjects = {};
 
+        // TODO: find a better way how to pass business object into a tab instead of passing it as a name
         controller.show = function (objType, name, parent, objectId)
         {
 
@@ -120,8 +121,8 @@ define(["dojo/dom",
             }
 
             var that = this;
-            var objId = (parent ? generateName(parent) + "/" : "") + objType + ":" + (name ? name : "-"
-                        + dojox.uuid.generateRandomUuid());
+            var objId = (parent ? generateName(parent) + "/" : "") + objType + ":" +
+                         (name &&  typeof name === 'string' ? name : "-" + dojox.uuid.generateRandomUuid());
 
             var obj = this.viewedObjects[objId];
             if (obj)
@@ -153,7 +154,7 @@ define(["dojo/dom",
                     });
                     this.tabContainer.addChild(contentPane);
                     var userPreferences = this.management.userPreferences;
-                    if (objType != "broker" && name)
+                    if (objType != "broker" && name &&  typeof name === 'string')
                     {
                         var preferencesCheckBox = new dijit.form.CheckBox({
                             checked: userPreferences.isTabStored(obj.tabData),

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js?rev=1750594&r1=1750593&r2=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js Tue Jun 28 23:25:46 2016
@@ -21,350 +21,23 @@
 
 define(["dojo/_base/declare",
         "dojo/_base/lang",
-        "dojo/_base/array",
         "dojo/json",
         "dojo/dom-construct",
-        "dojo/text!query/OptionsPanel.html",
-        "dgrid/OnDemandGrid",
-        "dgrid/Keyboard",
-        "dgrid/Selection",
-        "dgrid/Selector",
-        "dgrid/extensions/DijitRegistry",
-        "dgrid/extensions/Pagination",
-        "dstore/Memory",
+        "qpid/management/query/OptionsPanel",
         "dijit/popup",
         "dojo/Evented",
         "dijit/TooltipDialog",
-        "dijit/layout/ContentPane",
-        "dijit/form/Button",
-        "dijit/form/ValidationTextBox",
-        "dijit/form/CheckBox",
         "dijit/_WidgetBase",
-        "dijit/_TemplatedMixin",
-        "dijit/_WidgetsInTemplateMixin",
         "dojo/domReady!"],
     function (declare,
               lang,
-              array,
               json,
               domConstruct,
-              template,
-              Grid,
-              Keyboard,
-              Selection,
-              Selector,
-              DijitRegistry,
-              Pagination,
-              Memory,
+              OptionsPanel,
               popup,
               Evented)
     {
 
-        var Summary = declare(null, {
-            showFooter: true,
-            buildRendering: function ()
-            {
-                this.inherited(arguments);
-                this.summaryAreaNode = domConstruct.create('div', {
-                    className: 'dgrid-status',
-                    role: 'row',
-                    style: {
-                        overflow: 'hidden',
-                        display: 'none'
-                    }
-                }, this.footerNode);
-                this.totalLabelNode = domConstruct.create('span', {
-                    innerHTML: "Total: "
-                }, this.summaryAreaNode);
-                this.totalValueNode = domConstruct.create('span', {
-                    innerHTML: "0"
-                }, this.summaryAreaNode);
-            },
-            setTotal: function (total)
-            {
-                if (total > 0)
-                {
-                    this.totalValueNode.innerHTML = total;
-                    this.summaryAreaNode.style.display = "block";
-                }
-                else
-                {
-                    this.summaryAreaNode.style.display = "none";
-                }
-            }
-        });
-
-        var OptionsPanel = declare("qpid.management.query.OptionsPanel",
-            [dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin],
-            {
-                /**
-                 * dijit._TemplatedMixin enforced fields
-                 */
-                //Strip out the apache comment header from the template html as comments unsupported.
-                templateString: template.replace(/<!--[\s\S]*?-->/g, ""),
-
-                /**
-                 * template attach points
-                 */
-                search: null,
-                clearButton: null,
-                selectOptions: null,
-                doneButton: null,
-                cancelButton: null,
-
-                /**
-                 * widget fields which can be set via constructor arguments or #set("data",{...})
-                 */
-                idProperty: "id",
-                nameProperty: "name",
-                store: null,
-                items: null,
-
-                /**
-                 * widget inner fields
-                 */
-                _optionsGrid: null,
-                _descending: false,
-                _selectedItems: null,
-                _selectedIds: null,
-
-                postCreate: function ()
-                {
-                    this.inherited(arguments);
-                    this._postCreate();
-                },
-                startup: function ()
-                {
-                    this.inherited(arguments);
-                    this._optionsGrid.startup();
-                },
-                _postCreate: function ()
-                {
-                    this._selectedItems = [];
-                    this._selectedIds = {};
-                    this.clearButton.on("click", lang.hitch(this, this._onClear));
-                    this.search.on("change", lang.hitch(this, this._searchChanged));
-                    this.search.on("keyUp", lang.hitch(this, function (evt)
-                    {
-                        if (evt.keyCode == dojo.keys.ENTER && this.search.value)
-                        {
-                            this._applyFilter();
-                        }
-                    }));
-                    this._toggleClearButtons();
-                    this._buildOptionsGrid();
-                    this._selectionChanged();
-                },
-                _buildOptionsGrid: function ()
-                {
-                    var CustomGrid = declare([Grid, Keyboard, Selector, Summary]);
-                    if (!this.store)
-                    {
-                        this.store = new Memory({
-                            data: this.items || [],
-                            idProperty: this.idProperty
-                        });
-                    }
-                    var grid = new CustomGrid({
-                        columns: this._getOptionColumns(),
-                        collection: this.store,
-                        selectionMode: 'multiple',
-                        cellNavigation: true,
-                        allowSelectAll: true,
-                        minRowsPerPage: this.items ? this.items.length : 100,
-                        deselectOnRefresh: false
-                    }, this.optionsGrid);
-                    grid.on('dgrid-select', lang.hitch(this, this._gridSelected));
-                    grid.on('dgrid-deselect', lang.hitch(this, this._gridDeselected));
-                    grid.on('dgrid-sort', lang.hitch(this, function (event)
-                    {
-                        this._descending = event.sort[0].descending
-                    }));
-                    grid.setTotal(this.items ? this.items.length : 0);
-                    this._optionsGrid = grid;
-                },
-                _gridSelected: function (event)
-                {
-                    for (var i = 0; i < event.rows.length; ++i)
-                    {
-                        var item = event.rows[i].data;
-                        var id = item[this.idProperty];
-                        if (!this._selectedIds[id])
-                        {
-                            this._selectedItems.push(item);
-                            this._selectedIds[id] = true;
-                        }
-                    }
-                    this._selectionChanged();
-                },
-                _gridDeselected: function (event)
-                {
-                    for (var i = 0; i < event.rows.length; ++i)
-                    {
-                        var id = event.rows[i].id;
-                        for (var j = 0; j < this._selectedItems.length; ++j)
-                        {
-                            if (this._selectedItems[j][this.idProperty] === id)
-                            {
-                                this._selectedItems.splice(j, 1);
-                                delete this._selectedIds[id];
-                                break;
-                            }
-                        }
-                    }
-                    this._selectionChanged();
-                },
-                _setDataAttr: function (data)
-                {
-                    if (data.idProperty)
-                    {
-                        this.idProperty = data.idProperty;
-                    }
-
-                    if (data.nameProperty)
-                    {
-                        this.nameProperty = data.nameProperty;
-                    }
-
-                    var store;
-                    if (data.items)
-                    {
-                        store = new Memory({
-                            data: data.items,
-                            idProperty: this.idProperty
-                        });
-                        this.items = data.items;
-                    }
-
-                    if (store)
-                    {
-                        this.store = store;
-                        this._optionsGrid.set("columns", this._getOptionColumns());
-                        this._optionsGrid.set("minRowsPerPage", data.items ? data.items.length : 100);
-                        this._optionsGrid.set("sort", [{
-                            property: this.nameProperty,
-                            descending: this._descending
-                        }]);
-                        this._applyFilter();
-                        this._optionsGrid.setTotal(this.items ? this.items.length : 0);
-                    }
-
-                    if (data.selected)
-                    {
-                        this._selectGrid(data.selected);
-                    }
-                },
-                _findItemById: function (items, idValue)
-                {
-                    for (var i = 0; i < items.length; ++i)
-                    {
-                        if (items[i][this.idProperty] === idValue)
-                        {
-                            return items[i];
-                        }
-                    }
-                    return null;
-                },
-                _selectGrid: function (selected)
-                {
-                    var items = [];
-                    if (selected && selected.length && !selected[0].hasOwnProperty(this.idProperty))
-                    {
-                        for (var i = 0; i < selected.length; ++i)
-                        {
-                            var item = this._findItemById(this.items, selected[i]);
-                            if (item)
-                            {
-                                items.push(item);
-                            }
-                        }
-                    }
-                    else
-                    {
-                        items = lang.clone(selected);
-                    }
-
-                    var selectedItems = lang.clone(this._selectedItems);
-                    for (var i = 0; i < selectedItems.length; ++i)
-                    {
-                        var currentItem = selectedItems[i];
-                        var item = this._findItemById(items, currentItem[this.idProperty]);
-                        if (!item)
-                        {
-                            this._optionsGrid.deselect(currentItem);
-                        }
-                    }
-                    for (var i = 0; i < items.length; ++i)
-                    {
-                        var currentItem = items[i];
-                        var item = this._findItemById(this._selectedItems, currentItem[this.idProperty]);
-                        if (!item)
-                        {
-                            this._optionsGrid.select(currentItem);
-                        }
-                    }
-                    this._selectedItems = items;
-                },
-                _onClear: function ()
-                {
-                    this.search.set("value", "");
-                },
-                _applyFilter: function ()
-                {
-                    if (this.search.value)
-                    {
-                        var searchRegExp = new RegExp(".*" + this.search.value + ".*", "i");
-                        var filter = {};
-                        filter[this.nameProperty] = searchRegExp;
-                        this._optionsGrid.set("collection", this.store.filter(filter));
-                    }
-                    else
-                    {
-                        this._optionsGrid.set("collection", this.store);
-                    }
-                },
-                _toggleClearButtons: function ()
-                {
-                    this.clearButton.set("disabled", !this.search.value);
-                },
-                _searchChanged: function ()
-                {
-                    this._toggleClearButtons();
-                    this.defer(this._applyFilter);
-                },
-                _selectionChanged: function (event)
-                {
-                    this.doneButton.set("disabled", this._selectedItems.length === 0);
-                },
-                _getOptionColumns: function ()
-                {
-                    var columns = {
-                        selected: {
-                            label: 'All',
-                            selector: 'checkbox'
-                        }
-                    };
-                    columns[this.nameProperty] = {
-                        label: "Name",
-                        sortable: true
-                    }
-                    return columns;
-                },
-                _getSelectedItemsAttr: function ()
-                {
-                    return lang.clone(this._selectedItems);
-                },
-                _reset: function (items)
-                {
-                    this._onClear();
-
-                    if (items)
-                    {
-                        this._selectGrid(items);
-                    }
-                }
-            });
-
         return declare("qpid.management.query.DropDownSelect", [dijit._WidgetBase, Evented], {
             _selectButton: null,
             _optionsDialog: null,
@@ -378,7 +51,7 @@ define(["dojo/_base/declare",
             },
             _postCreate: function ()
             {
-                this._optionsPanel = new OptionsPanel({}, this._createDomNode());
+                this._optionsPanel = new OptionsPanel({showButtons: true, showSummary: true}, this._createDomNode());
                 this._optionsDialog = new dijit.TooltipDialog({content: this._optionsPanel}, this._createDomNode());
                 this._selectButton = new dijit.form.DropDownButton({
                     label: this.label || "Select",
@@ -409,7 +82,7 @@ define(["dojo/_base/declare",
             {
                 this._selectedItems = this._optionsPanel.get("selectedItems");
                 popup.close(this._optionsDialog);
-                this._optionsPanel._reset();
+                this._optionsPanel.resetItems();
                 this.emit("change", this._selectedItems);
             },
             _hideAndResetSearch: function ()
@@ -419,7 +92,7 @@ define(["dojo/_base/declare",
             },
             _resetSearch: function ()
             {
-                this._optionsPanel._reset(this._selectedItems);
+                this._optionsPanel.resetItems(this._selectedItems);
             },
             _setDisabledAttr: function (value)
             {
@@ -431,7 +104,7 @@ define(["dojo/_base/declare",
             },
             _onShow: function ()
             {
-                this._optionsPanel._optionsGrid.resize();
+                this._optionsPanel.resizeGrid();
             }
         });
     });

Copied: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js (from r1750360, qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js)
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js?p2=qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js&p1=qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js&r1=1750360&r2=1750594&rev=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/DropDownSelect.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js Tue Jun 28 23:25:46 2016
@@ -32,16 +32,13 @@ define(["dojo/_base/declare",
         "dgrid/extensions/DijitRegistry",
         "dgrid/extensions/Pagination",
         "dstore/Memory",
-        "dijit/popup",
         "dojo/Evented",
-        "dijit/TooltipDialog",
         "dijit/layout/ContentPane",
         "dijit/form/Button",
-        "dijit/form/ValidationTextBox",
-        "dijit/form/CheckBox",
         "dijit/_WidgetBase",
         "dijit/_TemplatedMixin",
         "dijit/_WidgetsInTemplateMixin",
+        "qpid/management/query/SearchTextBox",
         "dojo/domReady!"],
     function (declare,
               lang,
@@ -56,7 +53,6 @@ define(["dojo/_base/declare",
               DijitRegistry,
               Pagination,
               Memory,
-              popup,
               Evented)
     {
 
@@ -94,8 +90,8 @@ define(["dojo/_base/declare",
             }
         });
 
-        var OptionsPanel = declare("qpid.management.query.OptionsPanel",
-            [dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin],
+        return declare("qpid.management.query.OptionsPanel",
+            [dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin, Evented],
             {
                 /**
                  * dijit._TemplatedMixin enforced fields
@@ -107,7 +103,6 @@ define(["dojo/_base/declare",
                  * template attach points
                  */
                 search: null,
-                clearButton: null,
                 selectOptions: null,
                 doneButton: null,
                 cancelButton: null,
@@ -142,7 +137,6 @@ define(["dojo/_base/declare",
                 {
                     this._selectedItems = [];
                     this._selectedIds = {};
-                    this.clearButton.on("click", lang.hitch(this, this._onClear));
                     this.search.on("change", lang.hitch(this, this._searchChanged));
                     this.search.on("keyUp", lang.hitch(this, function (evt)
                     {
@@ -151,13 +145,18 @@ define(["dojo/_base/declare",
                             this._applyFilter();
                         }
                     }));
-                    this._toggleClearButtons();
                     this._buildOptionsGrid();
                     this._selectionChanged();
+                    this.buttons.style.display = this.showButtons ? '' : 'none';
                 },
                 _buildOptionsGrid: function ()
                 {
-                    var CustomGrid = declare([Grid, Keyboard, Selector, Summary]);
+                    var constructors = [Grid, Keyboard, Selector];
+                    if (this.showSummary)
+                    {
+                        constructors.push(Summary);
+                    }
+                    var CustomGrid = declare(constructors);
                     if (!this.store)
                     {
                         this.store = new Memory({
@@ -180,7 +179,10 @@ define(["dojo/_base/declare",
                     {
                         this._descending = event.sort[0].descending
                     }));
-                    grid.setTotal(this.items ? this.items.length : 0);
+                    if (this.showSummary)
+                    {
+                        grid.setTotal(this.items ? this.items.length : 0);
+                    }
                     this._optionsGrid = grid;
                 },
                 _gridSelected: function (event)
@@ -246,7 +248,10 @@ define(["dojo/_base/declare",
                             descending: this._descending
                         }]);
                         this._applyFilter();
-                        this._optionsGrid.setTotal(this.items ? this.items.length : 0);
+                        if (this.showSummary)
+                        {
+                            this._optionsGrid.setTotal(this.items ? this.items.length : 0);
+                        }
                     }
 
                     if (data.selected)
@@ -256,6 +261,10 @@ define(["dojo/_base/declare",
                 },
                 _findItemById: function (items, idValue)
                 {
+                    if (!items)
+                    {
+                        return null;
+                    }
                     for (var i = 0; i < items.length; ++i)
                     {
                         if (items[i][this.idProperty] === idValue)
@@ -304,6 +313,7 @@ define(["dojo/_base/declare",
                         }
                     }
                     this._selectedItems = items;
+                    this._selectionChanged();
                 },
                 _onClear: function ()
                 {
@@ -323,18 +333,14 @@ define(["dojo/_base/declare",
                         this._optionsGrid.set("collection", this.store);
                     }
                 },
-                _toggleClearButtons: function ()
-                {
-                    this.clearButton.set("disabled", !this.search.value);
-                },
                 _searchChanged: function ()
                 {
-                    this._toggleClearButtons();
                     this.defer(this._applyFilter);
                 },
                 _selectionChanged: function (event)
                 {
                     this.doneButton.set("disabled", this._selectedItems.length === 0);
+                    this.emit("change", {value: lang.clone(this._selectedItems)});
                 },
                 _getOptionColumns: function ()
                 {
@@ -347,14 +353,18 @@ define(["dojo/_base/declare",
                     columns[this.nameProperty] = {
                         label: "Name",
                         sortable: true
-                    }
+                    };
                     return columns;
                 },
                 _getSelectedItemsAttr: function ()
                 {
                     return lang.clone(this._selectedItems);
                 },
-                _reset: function (items)
+                _getValueAttr: function ()
+                {
+                    return lang.clone(this._selectedItems);
+                },
+                resetItems: function (items)
                 {
                     this._onClear();
 
@@ -362,76 +372,11 @@ define(["dojo/_base/declare",
                     {
                         this._selectGrid(items);
                     }
+                },
+                resizeGrid: function ()
+                {
+                    this._optionsGrid.resize();
                 }
             });
 
-        return declare("qpid.management.query.DropDownSelect", [dijit._WidgetBase, Evented], {
-            _selectButton: null,
-            _optionsDialog: null,
-            _optionsPanel: null,
-            _selectedItems: null,
-
-            postCreate: function ()
-            {
-                this.inherited(arguments);
-                this._postCreate();
-            },
-            _postCreate: function ()
-            {
-                this._optionsPanel = new OptionsPanel({}, this._createDomNode());
-                this._optionsDialog = new dijit.TooltipDialog({content: this._optionsPanel}, this._createDomNode());
-                this._selectButton = new dijit.form.DropDownButton({
-                    label: this.label || "Select",
-                    dropDown: this._optionsDialog
-                }, this._createDomNode());
-                this._optionsPanel.doneButton.on("click", lang.hitch(this, this._onSelectionDone));
-                this._optionsPanel.cancelButton.on("click", lang.hitch(this, this._hideAndResetSearch));
-                this._optionsDialog.on("hide", lang.hitch(this, this._resetSearch));
-                this._optionsDialog.on("show", lang.hitch(this, this._onShow));
-                this._selectButton.startup();
-                this._optionsPanel.startup();
-                this._optionsDialog.startup();
-            },
-            _createDomNode: function ()
-            {
-                return domConstruct.create("span", null, this.domNode);
-            },
-            _setDataAttr: function (data)
-            {
-                this._optionsPanel.set("data", data);
-                this._selectedItems = this._optionsPanel.get("selectedItems");
-            },
-            _getSelectedItemsAttr: function ()
-            {
-                return this._optionsPanel.get("selectedItems");
-            },
-            _onSelectionDone: function ()
-            {
-                this._selectedItems = this._optionsPanel.get("selectedItems");
-                popup.close(this._optionsDialog);
-                this._optionsPanel._reset();
-                this.emit("change", this._selectedItems);
-            },
-            _hideAndResetSearch: function ()
-            {
-                popup.close(this._optionsDialog);
-                this._resetSearch();
-            },
-            _resetSearch: function ()
-            {
-                this._optionsPanel._reset(this._selectedItems);
-            },
-            _setDisabledAttr: function (value)
-            {
-                this._selectButton.set("disabled", value);
-            },
-            _getDisabledAttr: function ()
-            {
-                return this._selectButton.get("disabled")
-            },
-            _onShow: function ()
-            {
-                this._optionsPanel._optionsGrid.resize();
-            }
-        });
     });

Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryCreateDialogForm.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryCreateDialogForm.js?rev=1750594&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryCreateDialogForm.js (added)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryCreateDialogForm.js Tue Jun 28 23:25:46 2016
@@ -0,0 +1,183 @@
+/*
+ *
+ * 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/declare",
+        "dojo/_base/lang",
+        "dojo/text!query/QueryCreateDialogForm.html",
+        "dojo/Evented",
+        "dojo/store/Memory",
+        "dijit/form/Form",
+        "dijit/form/Button",
+        "dijit/form/FilteringSelect",
+        "dijit/form/ComboBox",
+        "dijit/_WidgetBase",
+        "dijit/_TemplatedMixin",
+        "dijit/_WidgetsInTemplateMixin",
+        "dojox/validate/us",
+        "dojox/validate/web",
+        "dojo/domReady!"], function (declare, lang, template, Evented, Memory)
+{
+    var getCategoryMetadata = function (management, value)
+    {
+        if (value)
+        {
+            var category = value.charAt(0)
+                               .toUpperCase() + value.substring(1);
+            return management.metadata.metadata[category];
+        }
+        else
+        {
+            return undefined;
+        }
+    };
+
+    return declare("qpid.management.query.QueryCreateDialogForm",
+        [dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin, Evented],
+        {
+            /**
+             * dijit._TemplatedMixin enforced fields
+             */
+            //Strip out the apache comment header from the template html as comments unsupported.
+            templateString: template.replace(/<!--[\s\S]*?-->/g, ""),
+
+            management: null,
+
+            /**
+             * template attach points
+             */
+            scope: null,
+            category: null,
+            okButton: null,
+            cancelButton: null,
+            createQueryForm: null,
+
+            postCreate: function ()
+            {
+                this.inherited(arguments);
+                this._postCreate();
+            },
+            // TODO eliminate duplication and avoid knowledge of management.
+            loadScope: function (scopeCallback)
+            {
+                var result = this.management.query({
+                    select: "id, $parent.name as parentName, name",
+                    category: "virtualhost"
+                });
+                var that = this;
+                result.then(function (data)
+                    {
+                        that._scopeDataLoaded(data.results, scopeCallback);
+                    },
+                    function (error)
+                    {
+                        that._scopeDataLoaded([], scopeCallback);
+                    });
+            },
+            _scopeDataLoaded: function (data, scopeCallback)
+            {
+                var brokerItem = {id: "broker", name: "Broker"};
+                var defaultValue = undefined;
+                var items = [brokerItem];
+                this._scopeModelObjects = {};
+                this._scopeModelObjects[brokerItem.id] = {type: "broker"};
+                for (var i = 0; i < data.length; i++)
+                {
+                    var name = data[i][2];
+                    var parentName = data[i][1];
+                    items.push({
+                        id: data[i][0],
+                        name: "VH:" + parentName + "/" + name
+                    });
+                    this._scopeModelObjects[data[i][0]] = {
+                        name: name,
+                        type: "virtualhost",
+                        parent: {
+                            name: parentName,
+                            type: "virtualhostnode",
+                            parent: {type: "broker"}
+                        }
+                    };
+                }
+
+                var scopeStore = new Memory({
+                    data: items,
+                    idProperty: 'id'
+                });
+                this.scope.set("store", scopeStore);
+                if (defaultValue)
+                {
+                    this.scope.set("value", defaultValue.id);
+                    this.scope.set("disabled", true);
+                }
+                else
+                {
+                    this.scope.set("value", brokerItem.id);
+                }
+                this._onChange();
+                if (scopeCallback)
+                {
+                    scopeCallback();
+                }
+            },
+            _postCreate: function ()
+            {
+                this.cancelButton.on("click", lang.hitch(this, this._onCancel));
+                this.okButton.on("click", lang.hitch(this, this._onFormSubmit));
+                this.scope.on("change", lang.hitch(this, this._onChange));
+                this.category.on("change", lang.hitch(this, this._onChange));
+            },
+            _onCancel: function (data)
+            {
+                this.emit("cancel");
+            },
+            _onChange: function (e)
+            {
+                var invalid = !getCategoryMetadata(this.management, this.category.value)
+                              || !this._scopeModelObjects[this.scope.value];
+                this.okButton.set("disabled", invalid);
+            },
+            _onFormSubmit: function (e)
+            {
+                if (this.createQueryForm.validate())
+                {
+                    var category = this.category.value;
+                    if (getCategoryMetadata(this.management, category))
+                    {
+                        var data = {
+                            preference: {value: {category: category}},
+                            parentObject: this._scopeModelObjects[this.scope.value]
+                        };
+                        this.emit("create", data);
+                    }
+                    else
+                    {
+                        alert('Specified category does not exist. Please enter valid category');
+                    }
+                }
+                else
+                {
+                    alert('Form contains invalid data.  Please correct first');
+                }
+                return false;
+            }
+        });
+
+});

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryGrid.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryGrid.js?rev=1750594&r1=1750593&r2=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryGrid.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryGrid.js Tue Jun 28 23:25:46 2016
@@ -33,7 +33,6 @@ define(["dojo/_base/declare",
         "dgrid/extensions/DijitRegistry",
         "qpid/management/query/QueryStore",
         "dojo/keys",
-        'dojo/promise/all',
         "qpid/common/util"],
     function (declare,
               lang,
@@ -50,7 +49,6 @@ define(["dojo/_base/declare",
               DijitRegistry,
               QueryStore,
               keys,
-              all,
               util)
     {
 
@@ -75,35 +73,16 @@ define(["dojo/_base/declare",
         }
 
         var TrackableQueryStore = declare(QueryStore,
-                                          {
-                                              /*
-                                                 adding method track
-                                                 enables tracking of add, update and delete events
-                                              */
-                                              track:      function()
-                                                          {
-                                                              return this;
-                                                          },
-                                              /*
-                                                 override fetchRange to emit 'fetchCompleted' event
-                                              */
-                                              fetchRange: function (kwArgs)
-                                                          {
-                                                              var queryResults = this.inherited(arguments);
-                                                              all({results: queryResults,
-                                                                   totalLength: queryResults.totalLength})
-                                                              .then(lang.hitch(this,
-                                                                               function(data)
-                                                                               {
-                                                                                  this.emit("fetchCompleted",
-                                                                                              {start: kwArgs.start,
-                                                                                               end: kwArgs.end,
-                                                                                               results: data.results,
-                                                                                               totalLength: data.totalLength});
-                                                                               }));
-                                                              return queryResults;
-                                                          }
-                                          });
+            {
+                /*
+                 adding method track
+                 enables tracking of add, update and delete events
+                 */
+                track: function ()
+                {
+                    return this;
+                }
+            });
 
         var QueryGrid = declare("qpid.management.query.QueryGrid",
             [Grid, Keyboard, Selection, Pagination, DijitRegistry, ColumnResizer],
@@ -164,18 +143,18 @@ define(["dojo/_base/declare",
                     {
                         on.emit(this.domNode, 'queryCompleted', event);
                     }));
-                    if (this.detectChanges)
+                    this._store.on('fetchCompleted', lang.hitch(this, function (event)
                     {
-                        /*
-                          Handle 'fetchCompleted' event
-                          and detect changes in row data.
-                          Emit 'add', 'delete', 'update' events
-                          for changed rows
-                        */
-                        this._store.on('fetchCompleted', lang.hitch(this, function (event)
+                        this._start = event.start;
+                        this._end = event.end;
+                        if (this.detectChanges)
                         {
-                            this._start = event.start;
-                            this._end = event.end;
+                            /*
+                             Handle 'fetchCompleted' event
+                             and detect changes in row data.
+                             Emit 'add', 'delete', 'update' events
+                             for changed rows
+                             */
                             if (this._updatingData)
                             {
                                 try
@@ -193,10 +172,10 @@ define(["dojo/_base/declare",
                                 this._currentResults = results;
                                 this._currentResultsIdToIndexMap = createIdToIndexMap(results, this._store.idProperty);
                             }
-                        }));
-                    }
+                        }
+                    }));
                 },
-                updateData: function()
+                updateData: function ()
                 {
                     if (this.detectChanges && this._end)
                     {
@@ -250,7 +229,18 @@ define(["dojo/_base/declare",
                 {
                     return lang.clone(this._sort);
                 },
-                _buildOrderBy: function(sort)
+                getQuery: function ()
+                {
+                    return {
+                        select: this._store.selectClause,
+                        where: this._store.where,
+                        orderBy: this._store.orderBy,
+                        category: this._store.category,
+                        offset: this._start,
+                        limit: this._end - this._start
+                    };
+                },
+                _buildOrderBy: function (sort)
                 {
                     var orderByExpression = "";
                     if (sort && sort.length)

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryStore.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryStore.js?rev=1750594&r1=1750593&r2=1750594&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryStore.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/QueryStore.js Tue Jun 28 23:25:46 2016
@@ -25,7 +25,9 @@ define(['dojo/_base/lang',
         "dojo/json",
         'dstore/Store',
         'dstore/QueryResults',
-        "dojo/Deferred"], function (lang, declare, Evented, json, Store, QueryResults, Deferred)
+        'dojo/promise/all',
+        "dojo/Deferred"],
+function (lang, declare, Evented, json, Store, QueryResults, all, Deferred)
 {
 
     return declare("qpid.management.query.QueryStore", [Store, Evented], {
@@ -46,7 +48,20 @@ define(['dojo/_base/lang',
 
         fetchRange: function (kwArgs)
         {
-            return this._request(kwArgs);
+            var queryResults = this._request(kwArgs);
+            all({results: queryResults, totalLength: queryResults.totalLength})
+                .then(lang.hitch(this,
+                    function (data)
+                    {
+                        this.emit("fetchCompleted",
+                            {
+                                start: kwArgs.start,
+                                end: kwArgs.end,
+                                results: data.results,
+                                totalLength: data.totalLength
+                            });
+                    }));
+            return queryResults;
         },
 
         _request: function (kwArgs)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message