Repository: qpid-broker-j
Updated Branches:
  refs/heads/7.0.x de8098430 -> 969f7a3c6


QPID-8101: [Broker-J] [WMC] Add ability to close more than one connection at 
once

(cherry picked from commit fbca8f16e36d84fc0fc3291ca9937b31ed8a73a4)


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/969f7a3c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/969f7a3c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/969f7a3c

Branch: refs/heads/7.0.x
Commit: 969f7a3c64556a5adbdf74b6564358a51ebe3009
Parents: de80984
Author: Keith Wall <kw...@apache.org>
Authored: Tue Feb 20 12:33:29 2018 +0000
Committer: Alex Rudyy <oru...@apache.org>
Committed: Thu Feb 22 12:15:07 2018 +0000

----------------------------------------------------------------------
 .../src/main/java/resources/css/common.css      |  3 +-
 .../resources/js/qpid/management/VirtualHost.js | 52 +++++++++++++-------
 .../main/java/resources/showVirtualHost.html    |  1 +
 3 files changed, 38 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/969f7a3c/broker-plugins/management-http/src/main/java/resources/css/common.css
----------------------------------------------------------------------
diff --git 
a/broker-plugins/management-http/src/main/java/resources/css/common.css 
b/broker-plugins/management-http/src/main/java/resources/css/common.css
index bc92699..cac53f6 100644
--- a/broker-plugins/management-http/src/main/java/resources/css/common.css
+++ b/broker-plugins/management-http/src/main/java/resources/css/common.css
@@ -522,7 +522,8 @@ td.advancedSearchField, col.autoWidth {
 
 .claro.qpid .dgrid-header .dgrid-cell { font-weight: normal; }
 
-.virtualHostConnections .field-name { width: 20%; }
+.virtualHostConnections .field-selected { width: 2em; }
+.virtualHostConnections .field-name { width: auto; }
 .virtualHostConnections .field-principal { width: 10% }
 .virtualHostConnections .field-port { width: 10% }
 .virtualHostConnections .field-transport { width: 10% }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/969f7a3c/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js
----------------------------------------------------------------------
diff --git 
a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js
 
b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js
index 11fc134..dd7a2fc 100644
--- 
a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js
+++ 
b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js
@@ -89,7 +89,9 @@ define(["dojo/parser",
                     var deleteQueueButton = query(".deleteQueueButton", 
containerNode)[0];
                     registry.byNode(deleteQueueButton).on("click", function 
(evt)
                     {
-                        
that._deleteSelectedItems(that.vhostUpdater.queuesGrid, "queue", "queue");
+                        that._deleteSelectedItems(that.vhostUpdater.queuesGrid,
+                                                  {type: "queue", parent: 
this.modelObj},
+                                                  "delete", "queue");
                     });
 
                     var addExchangeButton = query(".addExchangeButton", 
containerNode)[0];
@@ -101,7 +103,17 @@ define(["dojo/parser",
                     var deleteExchangeButton = query(".deleteExchangeButton", 
containerNode)[0];
                     registry.byNode(deleteExchangeButton).on("click", function 
(evt)
                     {
-                        
that._deleteSelectedItems(that.vhostUpdater.exchangesGrid, "exchange", 
"exchange");
+                        
that._deleteSelectedItems(that.vhostUpdater.exchangesGrid,
+                                                 {type: "exchange", parent: 
that.modelObj},
+                                                 "delete", "exchange");
+                    });
+
+                    var closeConnectionButton = 
query(".closeConnectionButton", containerNode)[0];
+                    registry.byNode(closeConnectionButton).on("click", 
function (evt)
+                    {
+                        
that._deleteSelectedItems(that.vhostUpdater.connectionsGrid,
+                                                  {type: "connection"},
+                                                  "close", "connection");
                     });
 
                     var addLoggerButtonNode = query(".addVirtualHostLogger", 
contentPane.containerNode)[0];
@@ -115,7 +127,9 @@ define(["dojo/parser",
                     var deleteLoggerButton = 
registry.byNode(deleteLoggerButtonNode);
                     deleteLoggerButton.on("click", function (evt)
                     {
-                        
that._deleteSelectedItems(that.vhostUpdater.virtualHostLoggersGrid, 
"virtualhostlogger", "virtual host logger");
+                        
that._deleteSelectedItems(that.vhostUpdater.virtualHostLoggersGrid,
+                                                  {type: "virtualhostlogger", 
parent: that.modelObj},
+                                                  "delete", "virtual host 
logger");
                     });
 
                     that.stopButton = registry.byNode(query(".stopButton", 
containerNode)[0]);
@@ -175,7 +189,7 @@ define(["dojo/parser",
                 });
         };
 
-        VirtualHost.prototype._deleteSelectedItems = function(dgrid, category, 
friendlyCategoryName)
+        VirtualHost.prototype._deleteSelectedItems = function (dgrid, 
modelObj, friendlyAction, friendlyCategoryName)
         {
             var selected = [];
             var selection = dgrid.selection;
@@ -188,18 +202,15 @@ define(["dojo/parser",
             }
             if (selected.length > 0)
             {
-                var ending = selected.length > 1 ? "s " : " ";
-                if (confirm(lang.replace("Are you sure you want to delete {0} 
{1}{2}from virtual host '{3}'?",
-                        [selected.length,
-                         entities.encode(String(friendlyCategoryName || 
category )),
-                         ending,
-                         entities.encode(String(this.modelObj.name))])))
+                var plural = selected.length === 1 ? "" : "s";
+                if (confirm(lang.replace("Are you sure you want to {0} {1} 
{2}{3}?",
+                        [friendlyAction,
+                         selected.length,
+                         entities.encode(friendlyCategoryName),
+                         plural])))
                 {
                     this.management
-                        .remove({
-                            type: category,
-                            parent: this.modelObj
-                        }, {"id": selected})
+                        .remove(modelObj, {"id": selected})
                         .then(lang.hitch(this, function (responseData)
                         {
                             dgrid.clearSelection();
@@ -352,17 +363,24 @@ define(["dojo/parser",
             this.exchangesGrid.on('rowBrowsed', 
function(event){controller.showById(event.id);});
             this.exchangesGrid.startup();
 
-            this.connectionsGrid = new QueryGrid({
+            this.connectionsGrid = new CustomGrid({
                 detectChanges: true,
                 rowsPerPage: 10,
-                selectionMode: 'none',
                 transformer: lang.hitch(this, this._transformConnectionData),
                 management: this.management,
                 parentObject: this.modelObj,
                 category: "Connection",
                 selectClause: "id, name, principal, port.name AS port, 
transport, sessionCount, messagesIn, bytesIn, messagesOut, bytesOut",
                 orderBy: "name",
-                columns: [{
+                selectionMode: 'none',
+                deselectOnRefresh: false,
+                allowSelectAll: true,
+                columns: [
+                {
+                    field: "selected",
+                    label: 'All',
+                    selector: 'checkbox'
+                }, {
                     label: "Name",
                     field: "name"
                 }, {

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/969f7a3c/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html
----------------------------------------------------------------------
diff --git 
a/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html 
b/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html
index 8ae1a69..9be2a60 100644
--- 
a/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html
+++ 
b/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html
@@ -125,6 +125,7 @@
         <br/>
         <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 
'Connections'" class="virtualHostConnections">
             <div class="connections"></div>
+            <button data-dojo-type="dijit.form.Button" 
class="closeConnectionButton">Close Connection</button>
         </div>
         <br/>
         <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual 
Host Loggers'"  class="virtualHostLoggers">


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

Reply via email to