launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06384
[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:30:24 +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:30:24 +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:30:24 +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/testing/testing.js'
--- src/maasserver/static/js/testing/testing.js 2012-02-09 14:56:14 +0000
+++ src/maasserver/static/js/testing/testing.js 2012-02-15 19:30:24 +0000
@@ -60,7 +60,7 @@
mockSuccess: function(response, module) {
var mockXhr = {};
- mockXhr.io = function(url, cfg) {
+ mockXhr.send = function(url, cfg) {
var out = {};
out.response = response;
cfg.on.success('4', out);
=== 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:30:24 +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);
@@ -70,7 +70,7 @@
testNodeidPopulation: function() {
var mockXhr = new Y.Base();
- mockXhr.io = function(url, cfg) {
+ mockXhr.send = function(url, cfg) {
cfg.on.success(3, {response: Y.JSON.stringify({system_id: 3})});
};
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:30:24 +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 'src/maasserver/static/js/tests/test_prefs.js'
--- src/maasserver/static/js/tests/test_prefs.js 2012-02-14 10:31:49 +0000
+++ src/maasserver/static/js/tests/test_prefs.js 2012-02-15 19:30:24 +0000
@@ -47,7 +47,7 @@
// A click on the delete link calls the API to delete a token.
var mockXhr = new Y.Base();
var fired = false;
- mockXhr.io = function(url, cfg) {
+ mockXhr.send = function(url, cfg) {
fired = true;
Y.Assert.areEqual(MAAS_config.uris.account_handler, url);
Y.Assert.areEqual(
@@ -67,7 +67,7 @@
// If the API call to delete a token fails, an error is displayed.
var mockXhr = new Y.Base();
var fired = false;
- mockXhr.io = function(url, cfg) {
+ mockXhr.send = function(url, cfg) {
fired = true;
cfg.on.failure(3);
};
@@ -88,7 +88,7 @@
// corresponding row is deleted.
var mockXhr = new Y.Base();
var fired = false;
- mockXhr.io = function(url, cfg) {
+ mockXhr.send = function(url, cfg) {
fired = true;
cfg.on.success(3);
};
@@ -118,7 +118,7 @@
// create a token.
var mockXhr = new Y.Base();
var fired = false;
- mockXhr.io = function(url, cfg) {
+ mockXhr.send = function(url, cfg) {
fired = true;
Y.Assert.areEqual(MAAS_config.uris.account_handler, url);
Y.Assert.areEqual(
@@ -138,7 +138,7 @@
// If the API call to create a token fails, an error is displayed.
var mockXhr = new Y.Base();
var fired = false;
- mockXhr.io = function(url, cfg) {
+ mockXhr.send = function(url, cfg) {
fired = true;
cfg.on.failure(3);
};
@@ -159,7 +159,7 @@
// corresponding row is added.
var mockXhr = new Y.Base();
var fired = false;
- mockXhr.io = function(url, cfg) {
+ mockXhr.send = function(url, cfg) {
fired = true;
var response = {
consumer_key: 'consumer_key',
=== modified file 'templates/module.js'
--- templates/module.js 2012-02-06 14:27:01 +0000
+++ templates/module.js 2012-02-15 19:30:24 +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' ]}
);