← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/maas-bug-936897 into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/maas-bug-936897 into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #936897 in Maas: "Hide/destroy of the "Add node" panel triggers a JavaScript error."
  https://bugs.launchpad.net/maas/+bug/936897

For more details, see:
https://code.launchpad.net/~rvb/maas/maas-bug-936897/+merge/93960

This branch removes the line that binds the "Add node" widget to a click on the "Add node" button a *second time* (line 76 & 77 of the diff).

Drive by fixes:
- fix indentation in js file
- add cleanup to properly destroy the widget created by a test
-- 
https://code.launchpad.net/~rvb/maas/maas-bug-936897/+merge/93960
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/maas-bug-936897 into lp:maas.
=== modified file 'src/maasserver/static/js/node_add.js'
--- src/maasserver/static/js/node_add.js	2012-02-20 12:09:13 +0000
+++ src/maasserver/static/js/node_add.js	2012-02-21 11:03:24 +0000
@@ -253,26 +253,28 @@
     var cfg = {
         headerContent: "Add node",
         buttons: [
-                {
-                    value: 'Add node',
-                    section: 'footer',
-                    action: function (e) {
-                        e.preventDefault();
-                        this.sendAddNodeRequest();
-                    }
-                },
-                {
-                    value: 'Cancel',
-                    section: 'footer',
-                    classNames: 'link-button',
-                    action: function (e) {
-                        e.preventDefault();
-                        this.hidePanel();
-                    }
-                }
-            ],
-        align: {node:'',
-                points: [Y.WidgetPositionAlign.BC, Y.WidgetPositionAlign.TC]},
+            {
+                value: 'Add node',
+                section: 'footer',
+                action: function (e) {
+                    e.preventDefault();
+                    this.sendAddNodeRequest();
+                }
+            },
+            {
+                value: 'Cancel',
+                section: 'footer',
+                classNames: 'link-button',
+                action: function (e) {
+                    e.preventDefault();
+                    this.hidePanel();
+                }
+            }],
+        align: {
+            node:'',
+            points:
+                [Y.WidgetPositionAlign.BC, Y.WidgetPositionAlign.TC]
+            },
         modal: true,
         zIndex: 2,
         visible: true,

=== modified file 'src/maasserver/static/js/tests/test_node_add.js'
--- src/maasserver/static/js/tests/test_node_add.js	2012-02-20 12:09:13 +0000
+++ src/maasserver/static/js/tests/test_node_add.js	2012-02-21 11:03:24 +0000
@@ -91,6 +91,10 @@
         };
         this.mockIO(mockXhr, module);
         module.showAddNodeWidget();
+        this.addCleanup(
+            Y.bind(
+                module._add_node_singleton.destroy,
+                module._add_node_singleton));
         var panel = module._add_node_singleton;
         panel.get('srcNode').one('#id_hostname').set('value', 'host');
         var button = panel.get('srcNode').one('.yui3-button');

=== modified file 'src/maasserver/templates/maasserver/index.html'
--- src/maasserver/templates/maasserver/index.html	2012-02-20 11:26:39 +0000
+++ src/maasserver/templates/maasserver/index.html	2012-02-21 11:03:24 +0000
@@ -26,8 +26,6 @@
           .set('href', '#');
       Y.one('#content').append(add_node_link);
       add_node_link.on('click', Y.maas.node_add.showAddNodeWidget);
-      // Wire up the view to the 'nodeAdded' event.
-      Y.one('#addnode').on('click', Y.maas.node_add.showAddNodeWidget);
     });
   });
   // -->