launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06426
[Merge] lp:~rvb/maas/maas-bug-934218 into lp:maas
Raphaël Badin has proposed merging lp:~rvb/maas/maas-bug-934218 into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #934214 in Maas: "need to click add node in the add node form to submit it."
https://bugs.launchpad.net/maas/+bug/934214
Bug #934218 in Maas: "show the MAC address valid mask in the MAC description field"
https://bugs.launchpad.net/maas/+bug/934218
For more details, see:
https://code.launchpad.net/~rvb/maas/maas-bug-934218/+merge/93812
This branch fixes two bugs:
- 934218: A field help has been added to the mac address widget on the "Add node" panel.
- 934214: The "Add node" panel is submitted when one presses 'Enter' in the panel.
--
https://code.launchpad.net/~rvb/maas/maas-bug-934218/+merge/93812
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/maas-bug-934218 into lp:maas.
=== modified file 'src/maasserver/static/js/node_add.js'
--- src/maasserver/static/js/node_add.js 2012-02-15 19:12:05 +0000
+++ src/maasserver/static/js/node_add.js 2012-02-20 12:20:47 +0000
@@ -166,6 +166,9 @@
e.preventDefault();
self.addMacField();
});
+ this.get('bodyContent').on('key', function() {
+ self.sendAddNodeRequest();
+ }, 'press:enter');
},
addNode: function(node) {
@@ -283,8 +286,10 @@
});
// 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();
+ module._add_node_singleton.get(
+ 'boundingBox').one('input[type=text]').focus();
};
-}, '0.1', {'requires': ['io', 'node', 'panel', 'event', 'event-custom', 'transition']}
+}, '0.1', {'requires': ['io', 'node', 'panel', 'event', 'event-custom',
+ 'transition']}
);
=== modified file 'src/maasserver/static/js/tests/test_node_add.js'
--- src/maasserver/static/js/tests/test_node_add.js 2012-02-15 19:27:11 +0000
+++ src/maasserver/static/js/tests/test_node_add.js 2012-02-20 12:20:47 +0000
@@ -68,6 +68,22 @@
Y.Mock.verify(mockXhr);
},
+ testAddNodeAPICallEnterPressed: function() {
+ var mockXhr = Y.Mock();
+ Y.Mock.expect(mockXhr, {
+ method: 'send',
+ args: [MAAS_config.uris.nodes_handler, Y.Mock.Value.Any]
+ });
+ this.mockIO(mockXhr, module);
+ module.showAddNodeWidget();
+ var panel = module._add_node_singleton;
+ panel.get('srcNode').one('#id_hostname').set('value', 'host');
+ var form = panel.get('srcNode').one('form');
+ // Simulate 'Enter' being pressed.
+ form.simulate("keypress", { keyCode: 13 });
+ Y.Mock.verify(mockXhr);
+ },
+
testNodeidPopulation: function() {
var mockXhr = new Y.Base();
mockXhr.send = function(url, cfg) {
=== modified file 'src/maasserver/templates/maasserver/snippets.html'
--- src/maasserver/templates/maasserver/snippets.html 2012-02-01 16:57:23 +0000
+++ src/maasserver/templates/maasserver/snippets.html 2012-02-20 12:20:47 +0000
@@ -3,6 +3,7 @@
<label for="id_mac_addresses">Mac address</label>
<input type="text" maxlength="30" name="mac_addresses"
id="id_mac_addresses" />
+ <div class="field-help">e.g AA:BB:CC:DD:EE:FF</div>
</p>
</script>
<script type="text/x-template" id="add-node">