Author: rgodfrey
Date: Wed May  6 14:02:19 2015
New Revision: 1677992

URL: http://svn.apache.org/r1677992
Log:
QPID-6530 : : [Java Broker] Enable connection close from the Web Management UI 
(applied patch by Lorenz Quack)

Modified:
    
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js
    
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showConnection.html

Modified: 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js?rev=1677992&r1=1677991&r2=1677992&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js
 (original)
+++ 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js
 Wed May  6 14:02:19 2015
@@ -21,6 +21,7 @@
 define(["dojo/parser",
         "dojo/query",
         "dojo/_base/connect",
+        "dijit/registry",
         "qpid/common/properties",
         "qpid/common/updater",
         "qpid/common/util",
@@ -29,7 +30,7 @@ define(["dojo/parser",
         "dojox/html/entities",
         "dojo/text!showConnection.html",
         "dojo/domReady!"],
-       function (parser, query, connect, properties, updater, util, formatter, 
UpdatableStore, entities, template) {
+       function (parser, query, connect, registry, properties, updater, util, 
formatter, UpdatableStore, entities, template) {
 
            function Connection(name, parent, controller) {
                this.name = name;
@@ -46,12 +47,23 @@ define(["dojo/parser",
            Connection.prototype.open = function(contentPane) {
                var that = this;
                this.contentPane = contentPane;
-
-                            contentPane.containerNode.innerHTML = template;
+                            var containerNode = contentPane.containerNode;
+                            containerNode.innerHTML = template;
                             
parser.parse(contentPane.containerNode).then(function(instances)
                             {
                                 that.connectionUpdater = new 
ConnectionUpdater(contentPane.containerNode, that.modelObj, that.controller);
                                 
that.connectionUpdater.update(function(){updater.add( that.connectionUpdater 
);});
+
+                                that.closeButton = 
registry.byNode(query(".closeButton", containerNode)[0]);
+                                that.closeButton.on("click",
+                                     function(e)
+                                     {
+                                       if (confirm("Are you sure you want to 
close the connection?"))
+                                       {
+                                         that.management.remove(that.modelObj, 
{}, function(result){ that.destroy(); } );
+                                       }
+                                     });
+
                             });
            };
 
@@ -59,6 +71,13 @@ define(["dojo/parser",
                updater.remove( this.connectionUpdater );
            };
 
+           Connection.prototype.destroy = function()
+           {
+             this.contentPane.onClose();
+             this.controller.tabContainer.removeChild(this.contentPane);
+             this.contentPane.destroyRecursive();
+           }
+
            function ConnectionUpdater(containerNode, connectionObj, controller)
            {
                var that = this;

Modified: 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showConnection.html
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showConnection.html?rev=1677992&r1=1677991&r2=1677992&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showConnection.html
 (original)
+++ 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/showConnection.html
 Wed May  6 14:02:19 2015
@@ -84,6 +84,10 @@
             <div class="transport"></div>
         </div>
     </div>
+    <div class="dijitDialogPaneActionBar">
+        <button data-dojo-type="dijit.form.Button" class="closeButton" 
data-dojo-props="iconClass: 'dijitIconDelete'">Close</button>
+    </div>
+
     <div class="clear"/>
 
     <br/>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to