Merge lp:~blake-rouse/maas/fix-1400849 into lp:~maas-committers/maas/trunk

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: no longer in the source branch.
Merged at revision: 3413
Proposed branch: lp:~blake-rouse/maas/fix-1400849
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 192 lines (+40/-25)
7 files modified
src/maasserver/static/js/node_check.js (+16/-7)
src/maasserver/static/js/node_views.js (+6/-1)
src/maasserver/static/js/tests/test_node_check.html (+1/-1)
src/maasserver/static/js/tests/test_node_check.js (+1/-1)
src/maasserver/static/js/tests/test_node_views.html (+1/-0)
src/maasserver/static/js/tests/test_node_views.js (+13/-2)
src/maasserver/templates/maasserver/node_view.html (+2/-13)
To merge this branch: bzr merge lp:~blake-rouse/maas/fix-1400849
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+244227@code.launchpad.net

Commit message

Fix PowerCheckWidget to still be shown when the node page action view is reloaded.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Lgtm!

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (21.9 KiB)

The attempt to merge lp:~blake-rouse/maas/fix-1400849 into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 http://security.ubuntu.com trusty-security Release [62.0 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [62.0 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [55.9 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [17.4 kB]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [171 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [75.4 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [147 kB]
Get:10 http://security.ubuntu.com trusty-security/main Translation-en [84.4 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [94.2 kB]
Get:12 http://security.ubuntu.com trusty-security/universe Translation-en [41.2 kB]
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [376 kB]
Get:14 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [226 kB]
Get:15 http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en [173 kB]
Get:16 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en [114 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,702 kB in 3s (503 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb curl daemontools debhelper dh-apport distro-info dnsutils firefox freeipmi-tools gjs ipython isc-dhcp-common libjs-raphael libjs-yui3-full libjs-yui3-min libpq-dev make pep8 postgresql pyflakes python-amqplib python-bzrlib python-celery python-convoy python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-mimeparse python-mock python-netaddr python-netifaces python-nose python-oauth python-oops python-oops-amqp python-oops-datedir-repo p...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/static/js/node_check.js'
2--- src/maasserver/static/js/node_check.js 2014-09-23 07:06:58 +0000
3+++ src/maasserver/static/js/node_check.js 2014-12-09 21:40:15 +0000
4@@ -52,9 +52,6 @@
5 .setAttribute('name', 'action')
6 .setAttribute('value', 'check-powerstate')
7 .set('text', 'Check power state');
8- // Add action button.
9- this.form = this.get('srcNode');
10- this.form.insert(this.button, 'after');
11 // Store initial conditions.
12 this.initial_background = this.button.getStyle('background');
13 this.initial_color = this.button.getStyle('color');
14@@ -71,10 +68,6 @@
15 .setStyle('right', '70px')
16 .setStyle('margin', '0')
17 .set('src', MAAS_config.uris.statics + 'img/spinner_grey.gif');
18- this.button
19- .insert(this.status_check, "after");
20- this.button
21- .insert(this.error_msg, "after");
22 },
23
24 bindUI: function() {
25@@ -167,6 +160,22 @@
26 this.button
27 .setStyle('color', this.initial_color);
28 this.spinnerNode.remove();
29+ },
30+
31+ render: function() {
32+ this.button.remove();
33+ this.status_check.remove();
34+ this.error_msg.remove();
35+ var srcNode = this.get('srcNode');
36+ var formActions = srcNode.one('form#node_actions');
37+ if (Y.Lang.isValue(formActions)) {
38+ formActions.insert(this.button, 'after');
39+ this.button
40+ .insert(this.status_check, "after");
41+ this.button
42+ .insert(this.error_msg, "after");
43+ }
44+ this.bindUI();
45 }
46
47 });
48
49=== modified file 'src/maasserver/static/js/node_views.js'
50--- src/maasserver/static/js/node_views.js 2014-12-09 15:51:13 +0000
51+++ src/maasserver/static/js/node_views.js 2014-12-09 21:40:15 +0000
52@@ -537,6 +537,10 @@
53 this.srcNode = Y.one(config.srcNode);
54 this.eventList = Y.one(config.eventList);
55 this.actionView = Y.one(config.actionView);
56+ this.powerChecker = new Y.maas.node_check.PowerCheckWidget({
57+ srcNode: config.actionView,
58+ system_id: config.system_id
59+ });
60 },
61
62 /**
63@@ -581,6 +585,7 @@
64 Y.maas.utils.updateElements(elements, this.node);
65 this.renderEventList();
66 this.renderActionView();
67+ this.powerChecker.render();
68 },
69
70 /**
71@@ -671,5 +676,5 @@
72
73 }, '0.1', {'requires': [
74 'view', 'io', 'maas.enums', 'maas.node', 'maas.node_add',
75- 'maas.nodes_chart', 'maas.morph', 'maas.utils', 'anim']}
76+ 'maas.nodes_chart', 'maas.node_check', 'maas.morph', 'maas.utils', 'anim']}
77 );
78
79=== modified file 'src/maasserver/static/js/tests/test_node_check.html'
80--- src/maasserver/static/js/tests/test_node_check.html 2014-09-23 07:06:58 +0000
81+++ src/maasserver/static/js/tests/test_node_check.html 2014-12-09 21:40:15 +0000
82@@ -27,7 +27,7 @@
83 <span id="suite">maas.node_check.tests</span>
84 <script type="text/x-template" id="template">
85 <div id="placeholder">
86- <form id="form">
87+ <form id="node_actions">
88 </form>
89 </div>
90 </script>
91
92=== modified file 'src/maasserver/static/js/tests/test_node_check.js'
93--- src/maasserver/static/js/tests/test_node_check.js 2014-09-23 07:06:58 +0000
94+++ src/maasserver/static/js/tests/test_node_check.js 2014-12-09 21:40:15 +0000
95@@ -20,7 +20,7 @@
96 },
97
98 createWidget: function(system_id) {
99- var selector = '#form';
100+ var selector = '#placeholder';
101 var widget = new module.PowerCheckWidget(
102 {srcNode: selector, system_id: system_id});
103 this.addCleanup(function() { widget.destroy(); });
104
105=== modified file 'src/maasserver/static/js/tests/test_node_views.html'
106--- src/maasserver/static/js/tests/test_node_views.html 2014-12-09 15:51:13 +0000
107+++ src/maasserver/static/js/tests/test_node_views.html 2014-12-09 21:40:15 +0000
108@@ -16,6 +16,7 @@
109 <script type="text/javascript" src="../node.js"></script>
110 <script type="text/javascript" src="../node_add.js"></script>
111 <script type="text/javascript" src="../nodes_chart.js"></script>
112+ <script type="text/javascript" src="../node_check.js"></script>
113 <script type="text/javascript" src="../os_distro_select.js"></script>
114 <script type="text/javascript" src="../power_parameters.js"></script>
115 <!-- The module under test -->
116
117=== modified file 'src/maasserver/static/js/tests/test_node_views.js'
118--- src/maasserver/static/js/tests/test_node_views.js 2014-12-09 15:51:13 +0000
119+++ src/maasserver/static/js/tests/test_node_views.js 2014-12-09 21:40:15 +0000
120@@ -814,7 +814,7 @@
121 }
122 ]
123 },
124- action_view: '<div id="action_content"></div>'
125+ action_view: '<form id="node_actions"></form>'
126 };
127 },
128
129@@ -878,11 +878,14 @@
130 view.srcNode.one('#owner').hasClass('hidden'),
131 "The owner div was not hidden.");
132 Y.Assert.areEqual(
133- 1, view.srcNode.one('#action_view').all('div').size(),
134+ 1, view.srcNode.one('#action_view').all('form').size(),
135 "The content of action_view was not placed.");
136 Y.Assert.areEqual(
137 1, view.srcNode.one('#events_list').all('table').size(),
138 "The table was not created in events_list.");
139+ Y.Assert.isObject(
140+ view.powerChecker,
141+ "Failed to load PowerCheckWidget.");
142 },
143
144 testRender_updates_field_data: function() {
145@@ -998,6 +1001,14 @@
146 'Full node event log (' + view.node.events.total + ' events).',
147 view.srcNode.one('#events_list').one('a').get('text'),
148 "The event list more link has incorrect text.");
149+ },
150+
151+ testRender_renders_PowerCheckWidget: function() {
152+ var view = this.makeNodeView();
153+ view.render();
154+ Y.Assert.isObject(
155+ view.actionView.one('button[value="check-powerstate"]'),
156+ "Failed to render the PowerCheckWidget.");
157 }
158
159 }));
160
161=== modified file 'src/maasserver/templates/maasserver/node_view.html'
162--- src/maasserver/templates/maasserver/node_view.html 2014-12-09 15:51:13 +0000
163+++ src/maasserver/templates/maasserver/node_view.html 2014-12-09 21:40:15 +0000
164@@ -68,18 +68,6 @@
165 }
166 });
167 });
168- YUI().use('maas.node_check', function (Y) {
169- Y.on('domready', function() {
170- var action_form_selector = 'form#node_actions';
171- if (Y.one(action_form_selector)) {
172- var nodecheck = new Y.maas.node_check.PowerCheckWidget({
173- srcNode: action_form_selector,
174- system_id: '{{node.system_id}}'
175- });
176- nodecheck.render();
177- }
178- });
179- });
180 YUI().use(
181 'maas.node', 'maas.node_views', 'maas.shortpoll',
182 function (Y) {
183@@ -87,7 +75,8 @@
184 var view = new Y.maas.node_views.NodeView({
185 srcNode: 'body',
186 eventList: '#node_event_list',
187- actionView: '#sidebar'
188+ actionView: '#sidebar',
189+ system_id: '{{node.system_id}}'
190 });
191 var poller = new Y.maas.shortpoll.ShortPollManager({
192 uri: "{% url 'node-view' node.system_id %}"