You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2016/09/01 14:25:26 UTC

svn commit: r1758782 - in /qpid/java/trunk/broker-plugins/management-http/src/main/java/resources: js/qpid/common/ js/qpid/management/preference/ js/qpid/management/query/ query/

Author: orudyy
Date: Thu Sep  1 14:25:26 2016
New Revision: 1758782

URL: http://svn.apache.org/viewvc?rev=1758782&view=rev
Log:
QPID-7413: [Java Broker, WMC] Display only name for the principals in serialized format

Modified:
    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/common/util.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceBrowserWidget.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceSaveDialogContent.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/OptionsPanel.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/OptionsPanel.html

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=1758782&r1=1758781&r2=1758782&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 Thu Sep  1 14:25:26 2016
@@ -194,7 +194,9 @@ define(["dojo/query",
                              "below-centered"];
                         if (controlButton)
                         {
-                            controlButton.set("label", management.getAuthenticatedUser());
+                            var userName = management.getAuthenticatedUser();
+                            controlButton.set("label", util.toFriendlyUserName(userName));
+                            controlButton.set("title", userName);
                             controlButton.domNode.style.display = '';
                         }
                     });

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js?rev=1758782&r1=1758781&r2=1758782&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js Thu Sep  1 14:25:26 2016
@@ -978,6 +978,15 @@ define(["dojo/_base/xhr",
             return "";
         };
 
+        util.toFriendlyUserName = function(serializedUserName)
+        {
+            var atPosition = serializedUserName.indexOf("@");
+            if (atPosition !== -1)
+            {
+                return serializedUserName.substring(0, atPosition);
+            }
+            return serializedUserName;
+        };
 
         return util;
     });

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceBrowserWidget.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceBrowserWidget.js?rev=1758782&r1=1758781&r2=1758782&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceBrowserWidget.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceBrowserWidget.js Thu Sep  1 14:25:26 2016
@@ -39,6 +39,7 @@ define(["dojo/_base/declare",
         "qpid/common/util",
         "dojo/text!preference/PreferenceBrowserWidget.html",
         "dojo/keys",
+        "dojox/html/entities",
         "dijit/_WidgetBase",
         "dijit/_TemplatedMixin",
         "dijit/_WidgetsInTemplateMixin",
@@ -65,7 +66,8 @@ define(["dojo/_base/declare",
               StoreUpdater,
               util,
               template,
-              keys)
+              keys,
+              entities)
     {
         var empty = new Deferred();
         empty.resolve([]);
@@ -204,11 +206,13 @@ define(["dojo/_base/declare",
                         },
                         owner: {
                             label: "Owner",
-                            sortable: false
+                            sortable: false,
+                            renderCell: this._renderOwner
                         },
                         visibilityList: {
                             label: "Shared with",
-                            sortable: false
+                            sortable: false,
+                            renderCell: this._renderGroups
                         }
                     };
 
@@ -388,6 +392,38 @@ define(["dojo/_base/declare",
                     }
 
                     return items;
+                },
+                _renderOwner: function (object, value, node)
+                {
+                    var friendlyName = value ? util.toFriendlyUserName(value) : "";
+                    node.appendChild(document.createTextNode(friendlyName));
+                    if (value)
+                    {
+                        node.title = entities.encode(value);
+                    }
+                },
+                _renderGroups: function (object, value, node)
+                {
+                    var data = "";
+                    if (value instanceof Array)
+                    {
+                        var title = "";
+                        for (var i = 0; i < value.length; i++)
+                        {
+                            var group = value[i];
+                            var friendlyName = entities.encode(util.toFriendlyUserName(group));
+                            if (i > 0)
+                            {
+                                friendlyName = ", " + friendlyName;
+                                group = ",\n" + group;
+                            }
+
+                            data = data + friendlyName;
+                            title = title + group;
+                        }
+                        node.title = entities.encode(title);
+                    }
+                    node.appendChild(document.createTextNode(data));
                 }
             });
     });

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceSaveDialogContent.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceSaveDialogContent.js?rev=1758782&r1=1758781&r2=1758782&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceSaveDialogContent.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preference/PreferenceSaveDialogContent.js Thu Sep  1 14:25:26 2016
@@ -23,17 +23,23 @@ define(["dojo/_base/declare",
         "dojo/json",
         "dojo/Evented",
         "dojo/text!preference/PreferenceSaveDialogContent.html",
+        "qpid/common/util",
+        "dojox/html/entities",
         "dijit/_WidgetBase",
         "dijit/_TemplatedMixin",
         "dijit/_WidgetsInTemplateMixin",
         "dijit/form/Button",
         "dijit/form/ValidationTextBox",
-        "dijit/form/SimpleTextarea"],
+        "dijit/form/SimpleTextarea",
+        "qpid/management/query/OptionsPanel"
+],
     function (declare,
               lang,
               json,
               Evented,
-              template)
+              template,
+              util,
+              entities)
     {
         return declare([dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin, Evented],
             {
@@ -97,7 +103,7 @@ define(["dojo/_base/declare",
                     {
                         items[j] = {
                             id: userGroups[j],
-                            name: userGroups[j]
+                            name: util.toFriendlyUserName(userGroups[j])
                         };
                     }
                     this.groupChooser.set("data",
@@ -111,7 +117,8 @@ define(["dojo/_base/declare",
                 {
                     this.cancelButton.on("click", lang.hitch(this, this._onCancel));
                     this.name.on("change", lang.hitch(this, this._onChange));
-                    this.form.on("submit", lang.hitch(this, this._onFormSubmit))
+                    this.form.on("submit", lang.hitch(this, this._onFormSubmit));
+                    this.groupChooser.set("renderItem",  this._renderGroup);
                 },
                 _onCancel: function (data)
                 {
@@ -135,7 +142,7 @@ define(["dojo/_base/declare",
                             var selected = this.groupChooser.get("selectedItems");
                             for (var i = 0; i < selected.length; i++)
                             {
-                                groups.push(selected[i].name);
+                                groups.push(selected[i].id);
                             }
                             preference.visibilityList = groups;
                             this.emit("save", {preference: preference});
@@ -149,6 +156,11 @@ define(["dojo/_base/declare",
                     {
                         return false;
                     }
+                },
+                _renderGroup: function (object, value, node)
+                {
+                    node.appendChild(document.createTextNode(value));
+                    node.title = entities.encode(object.id);
                 }
             });
     });

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=1758782&r1=1758781&r2=1758782&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 Thu Sep  1 14:25:26 2016
@@ -51,7 +51,11 @@ define(["dojo/_base/declare",
             },
             _postCreate: function ()
             {
-                this._optionsPanel = new OptionsPanel({showButtons: true, showSummary: true}, this._createDomNode());
+                this._optionsPanel = new OptionsPanel({
+                    showButtons: true,
+                    showSummary: true,
+                    renderItem: this.renderItem
+                }, this._createDomNode());
                 this._optionsDialog = new dijit.TooltipDialog({content: this._optionsPanel}, this._createDomNode());
                 this._selectButton = new dijit.form.DropDownButton({
                     label: this.label || "Select",
@@ -105,6 +109,17 @@ define(["dojo/_base/declare",
             _onShow: function ()
             {
                 this._optionsPanel.resizeGrid();
+            },
+            _setRenderItemAttr: function(renderItem)
+            {
+                if (this._optionsPanel)
+                {
+                    this._optionsPanel.set("renderItem", renderItem);
+                }
+                else
+                {
+                    this.renderItem = renderItem;
+                }
             }
         });
     });

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js?rev=1758782&r1=1758781&r2=1758782&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/query/OptionsPanel.js Thu Sep  1 14:25:26 2016
@@ -33,7 +33,6 @@ define(["dojo/_base/declare",
         "dgrid/extensions/Pagination",
         "dstore/Memory",
         "dojo/Evented",
-        "dojox/html/entities",
         "dijit/layout/ContentPane",
         "dijit/form/Button",
         "dijit/_WidgetBase",
@@ -54,8 +53,7 @@ define(["dojo/_base/declare",
               DijitRegistry,
               Pagination,
               Memory,
-              Evented,
-              entities)
+              Evented)
     {
 
         var Summary = declare(null, {
@@ -116,6 +114,7 @@ define(["dojo/_base/declare",
                 nameProperty: "name",
                 store: null,
                 items: null,
+                renderItem: null, // function to render grid cells
 
                 /**
                  * widget inner fields
@@ -354,13 +353,12 @@ define(["dojo/_base/declare",
                     };
                     columns[this.nameProperty] = {
                         label: "Name",
-                        sortable: true,
-                        renderCell: function(object, value, node)
-                        {
-                            node.appendChild(document.createTextNode(value));
-                            node.title = entities.encode(value);
-                        }
-                };
+                        sortable: true
+                    };
+                    if (this.renderItem)
+                    {
+                        columns[this.nameProperty].renderCell = this.renderItem;
+                    }
                     return columns;
                 },
                 _getSelectedItemsAttr: function ()
@@ -383,6 +381,14 @@ define(["dojo/_base/declare",
                 resizeGrid: function ()
                 {
                     this._optionsGrid.resize();
+                },
+                _setRenderItemAttr: function(renderItem)
+                {
+                    this.renderItem = renderItem;
+                    if (this._optionsGrid != null)
+                    {
+                        this._optionsGrid.set("columns", this._getOptionColumns());
+                    }
                 }
             });
 

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/OptionsPanel.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/OptionsPanel.html?rev=1758782&r1=1758781&r2=1758782&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/OptionsPanel.html (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/query/OptionsPanel.html Thu Sep  1 14:25:26 2016
@@ -24,8 +24,8 @@
                data-dojo-type="qpid/management/query/SearchTextBox"
                data-dojo-props="name: 'column',
                                 intermediateChanges: true,
-                                placeHolder: 'field name',
-                                title: 'Start typing field name'"  type="text"/>
+                                placeHolder: 'search',
+                                title: 'Start typing to search'"  type="text"/>
         <div data-dojo-attach-point="optionsGrid" class="selectGrid"></div>
     </div>
     <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar" data-dojo-attach-point="buttons">



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