← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/maas-io-instance into lp:maas

 

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/maas-io-instance/+merge/93283

Use IO instance instead of Y.io().  Much better than to use a reference to the global YUI object.

YUI doc:
=====================
As of 3.4.0, IO is instantiatiable. An IO instance avails its public and private fields, allowing for customizations as needed.

// Create a new instance of IO.
var io = new IO();

// Send a request using the new IO instance.
// This is analogous to the static method
// Y.io()
io.send(uri, configuration);
=====================
-- 
https://code.launchpad.net/~rvb/maas/maas-io-instance/+merge/93283
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/maas-io-instance into lp:maas.
=== modified file 'src/maasserver/static/js/node_add.js'
--- src/maasserver/static/js/node_add.js	2012-02-14 09:27:34 +0000
+++ src/maasserver/static/js/node_add.js	2012-02-15 19:14:17 +0000
@@ -15,7 +15,7 @@
 module.NODE_ADDED_EVENT = 'nodeAdded';
 
 // Only used to mockup io in tests.
-module._io = Y;
+module._io = new Y.IO();
 
 var AddNodeWidget = function() {
     AddNodeWidget.superclass.constructor.apply(this, arguments);
@@ -207,7 +207,7 @@
                 useDisabled: true
             }
         };
-        var request = module._io.io(
+        var request = module._io.send(
             MAAS_config.uris.nodes_handler, cfg);
     }
 
@@ -281,9 +281,8 @@
         duration: 0.5,
         top: '0px'
     });
-    /* We need to set the focus late as the widget wants to set the focus on 
-       the bounding box.
-    */
+    // We need to set the focus late as the widget wants to set the focus
+    // on the bounding box.
     module._add_node_singleton.get('boundingBox').one('input[type=text]').focus();
 };
 

=== modified file 'src/maasserver/static/js/node_views.js'
--- src/maasserver/static/js/node_views.js	2012-02-10 09:12:00 +0000
+++ src/maasserver/static/js/node_views.js	2012-02-15 19:14:17 +0000
@@ -12,7 +12,7 @@
 var module = Y.namespace('maas.node_views');
 
 // Only used to mockup io in tests.
-module._io = Y;
+module._io = new Y.IO();
 
 /**
  * A base view class to display a set of Nodes (Y.maas.node.Node).
@@ -96,7 +96,7 @@
                 end: Y.bind(self.loadNodesEnded, self)
             }
         };
-        var request = module._io.io(
+        var request = module._io.send(
             MAAS_config.uris.nodes_handler, cfg);
     },
 

=== modified file 'src/maasserver/static/js/prefs.js'
--- src/maasserver/static/js/prefs.js	2012-02-14 14:35:25 +0000
+++ src/maasserver/static/js/prefs.js	2012-02-15 19:14:17 +0000
@@ -12,7 +12,7 @@
 var module = Y.namespace('maas.prefs');
 
 // Only used to mockup io in tests.
-module._io = Y;
+module._io = new Y.IO();
 
 var TokenWidget = function() {
     TokenWidget.superclass.constructor.apply(this, arguments);
@@ -97,7 +97,7 @@
                 }
             }
         };
-        var request = module._io.io(
+        var request = module._io.send(
             MAAS_config.uris.account_handler, cfg);
     },
 
@@ -182,7 +182,7 @@
                 }
             }
         };
-        var request = module._io.io(
+        var request = module._io.send(
             MAAS_config.uris.account_handler, cfg);
     }
 });

=== modified file 'src/maasserver/static/js/tests/test_node_add.js'
--- src/maasserver/static/js/tests/test_node_add.js	2012-02-10 09:12:00 +0000
+++ src/maasserver/static/js/tests/test_node_add.js	2012-02-15 19:14:17 +0000
@@ -17,7 +17,7 @@
         // Silence io.
         var mockXhr = Y.Mock();
         Y.Mock.expect(mockXhr, {
-            method: 'io',
+            method: 'send',
             args: [MAAS_config.uris.nodes_handler, Y.Mock.Value.Any]
         });
         this.mockIO(mockXhr, module);
@@ -56,7 +56,7 @@
     testAddNodeAPICall: function() {
         var mockXhr = Y.Mock();
         Y.Mock.expect(mockXhr, {
-            method: 'io',
+            method: 'send',
             args: [MAAS_config.uris.nodes_handler, Y.Mock.Value.Any]
         });
         this.mockIO(mockXhr, module);

=== modified file 'src/maasserver/static/js/tests/test_node_views.js'
--- src/maasserver/static/js/tests/test_node_views.js	2012-02-09 14:56:14 +0000
+++ src/maasserver/static/js/tests/test_node_views.js	2012-02-15 19:14:17 +0000
@@ -25,7 +25,7 @@
         // nodes.
         var mockXhr = Y.Mock();
         Y.Mock.expect(mockXhr, {
-            method: 'io',
+            method: 'send',
             args: [MAAS_config.uris.nodes_handler, Y.Mock.Value.Any]
         });
         this.mockIO(mockXhr, module);

=== modified file 'templates/module.js'
--- templates/module.js	2012-02-06 14:27:01 +0000
+++ templates/module.js	2012-02-15 19:14:17 +0000
@@ -12,8 +12,7 @@
 var module = Y.namespace('maas.sample');
 
 // Only used to mockup io in tests.
-module._io = Y;
-
+module._io = new Y.IO();
 
 }, '0.1', {'requires': ['view', 'io', 'maas.node' ]}
 );


Follow ups