Merge ~ltrager/maas:lp1750160 into maas:master
- Git
- lp:~ltrager/maas
- lp1750160
- Merge into master
Proposed by
Lee Trager
Status: | Merged |
---|---|
Approved by: | Lee Trager |
Approved revision: | d3759239e9fdd2588d2f0b1beeb873dfa810e8bc |
Merge reported by: | MAAS Lander |
Merged at revision: | not available |
Proposed branch: | ~ltrager/maas:lp1750160 |
Merge into: | maas:master |
Diff against target: |
268 lines (+109/-6) 6 files modified
src/maasserver/static/js/angular/controllers/node_details.js (+10/-1) src/maasserver/static/js/angular/controllers/nodes_list.js (+27/-4) src/maasserver/static/js/angular/controllers/tests/test_node_details.js (+22/-0) src/maasserver/static/js/angular/controllers/tests/test_nodes_list.js (+28/-0) src/maasserver/static/partials/node-details.html (+11/-0) src/maasserver/static/partials/nodes-list.html (+11/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Blake Rouse (community) | Approve | ||
MAAS Lander | Needs Fixing | ||
Review via email: mp+338360@code.launchpad.net |
Commit message
LP: #1750160 - Confirm running tests on deployed hardware in the UI.
Description of the change
To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote : | # |
Revision history for this message
MAAS Lander (maas-lander) wrote : | # |
UNIT TESTS
-b lp1750160 lp:~ltrager/maas/+git/maas into -b master lp:~maas-committers/maas
STATUS: FAILED
LOG: http://
COMMIT: 6f85a208971c44b
review:
Needs Fixing
Revision history for this message
Blake Rouse (blake-rouse) wrote : | # |
Code looks good. Need to fix some of Andres comments about the wording. Marking needs fixing only because you need to fix the wording.
review:
Needs Fixing
~ltrager/maas:lp1750160
updated
- 6179dea... by Lee Trager
-
andreserl fixes
- 33e47cf... by Lee Trager
-
Merge branch 'master' into lp1750160
Revision history for this message
Lee Trager (ltrager) wrote : | # |
Messages fixed and replied inline.
~ltrager/maas:lp1750160
updated
- d375923... by Lee Trager
-
blake_r fix
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/src/maasserver/static/js/angular/controllers/node_details.js b/src/maasserver/static/js/angular/controllers/node_details.js | |||
2 | index 7bce8bc..9431f12 100644 | |||
3 | --- a/src/maasserver/static/js/angular/controllers/node_details.js | |||
4 | +++ b/src/maasserver/static/js/angular/controllers/node_details.js | |||
5 | @@ -33,7 +33,8 @@ angular.module('MAAS').controller('NodeDetailsController', [ | |||
6 | 33 | option: null, | 33 | option: null, |
7 | 34 | allOptions: null, | 34 | allOptions: null, |
8 | 35 | availableOptions: [], | 35 | availableOptions: [], |
10 | 36 | error: null | 36 | error: null, |
11 | 37 | showing_confirmation: false | ||
12 | 37 | }; | 38 | }; |
13 | 38 | $scope.power_types = GeneralManager.getData("power_types"); | 39 | $scope.power_types = GeneralManager.getData("power_types"); |
14 | 39 | $scope.osinfo = GeneralManager.getData("osinfo"); | 40 | $scope.osinfo = GeneralManager.getData("osinfo"); |
15 | @@ -525,12 +526,14 @@ angular.module('MAAS').controller('NodeDetailsController', [ | |||
16 | 525 | $scope.action.optionChanged = function() { | 526 | $scope.action.optionChanged = function() { |
17 | 526 | // Clear the action error. | 527 | // Clear the action error. |
18 | 527 | $scope.action.error = null; | 528 | $scope.action.error = null; |
19 | 529 | $scope.action.showing_confirmation = false; | ||
20 | 528 | }; | 530 | }; |
21 | 529 | 531 | ||
22 | 530 | // Cancel the action. | 532 | // Cancel the action. |
23 | 531 | $scope.actionCancel = function() { | 533 | $scope.actionCancel = function() { |
24 | 532 | $scope.action.option = null; | 534 | $scope.action.option = null; |
25 | 533 | $scope.action.error = null; | 535 | $scope.action.error = null; |
26 | 536 | $scope.action.showing_confirmation = false; | ||
27 | 534 | }; | 537 | }; |
28 | 535 | 538 | ||
29 | 536 | // Perform the action. | 539 | // Perform the action. |
30 | @@ -586,6 +589,11 @@ angular.module('MAAS').controller('NodeDetailsController', [ | |||
31 | 586 | extra.testing_scripts.push('none'); | 589 | extra.testing_scripts.push('none'); |
32 | 587 | } | 590 | } |
33 | 588 | } else if($scope.action.option.name === "test") { | 591 | } else if($scope.action.option.name === "test") { |
34 | 592 | if($scope.node.status_code === 6 && | ||
35 | 593 | !$scope.action.showing_confirmation) { | ||
36 | 594 | $scope.action.showing_confirmation = true; | ||
37 | 595 | return; | ||
38 | 596 | } | ||
39 | 589 | // Set the test options. | 597 | // Set the test options. |
40 | 590 | extra.enable_ssh = $scope.commissionOptions.enableSSH; | 598 | extra.enable_ssh = $scope.commissionOptions.enableSSH; |
41 | 591 | extra.testing_scripts = []; | 599 | extra.testing_scripts = []; |
42 | @@ -611,6 +619,7 @@ angular.module('MAAS').controller('NodeDetailsController', [ | |||
43 | 611 | } | 619 | } |
44 | 612 | $scope.action.option = null; | 620 | $scope.action.option = null; |
45 | 613 | $scope.action.error = null; | 621 | $scope.action.error = null; |
46 | 622 | $scope.action.showing_confirmation = false; | ||
47 | 614 | $scope.osSelection.$reset(); | 623 | $scope.osSelection.$reset(); |
48 | 615 | $scope.commissionOptions.enableSSH = false; | 624 | $scope.commissionOptions.enableSSH = false; |
49 | 616 | $scope.commissionOptions.skipNetworking = false; | 625 | $scope.commissionOptions.skipNetworking = false; |
50 | diff --git a/src/maasserver/static/js/angular/controllers/nodes_list.js b/src/maasserver/static/js/angular/controllers/nodes_list.js | |||
51 | index fce5e35..cfe4e17 100644 | |||
52 | --- a/src/maasserver/static/js/angular/controllers/nodes_list.js | |||
53 | +++ b/src/maasserver/static/js/angular/controllers/nodes_list.js | |||
54 | @@ -57,7 +57,9 @@ angular.module('MAAS').controller('NodesListController', [ | |||
55 | 57 | $scope.tabs.nodes.actionProgress = { | 57 | $scope.tabs.nodes.actionProgress = { |
56 | 58 | total: 0, | 58 | total: 0, |
57 | 59 | completed: 0, | 59 | completed: 0, |
59 | 60 | errors: {} | 60 | errors: {}, |
60 | 61 | showing_confirmation: false, | ||
61 | 62 | affected_nodes: 0 | ||
62 | 61 | }; | 63 | }; |
63 | 62 | $scope.tabs.nodes.osSelection = { | 64 | $scope.tabs.nodes.osSelection = { |
64 | 63 | osystem: null, | 65 | osystem: null, |
65 | @@ -98,7 +100,9 @@ angular.module('MAAS').controller('NodesListController', [ | |||
66 | 98 | $scope.tabs.devices.actionProgress = { | 100 | $scope.tabs.devices.actionProgress = { |
67 | 99 | total: 0, | 101 | total: 0, |
68 | 100 | completed: 0, | 102 | completed: 0, |
70 | 101 | errors: {} | 103 | errors: {}, |
71 | 104 | showing_confirmation: false, | ||
72 | 105 | affected_nodes: 0 | ||
73 | 102 | }; | 106 | }; |
74 | 103 | $scope.tabs.devices.zoneSelection = null; | 107 | $scope.tabs.devices.zoneSelection = null; |
75 | 104 | 108 | ||
76 | @@ -126,7 +130,9 @@ angular.module('MAAS').controller('NodesListController', [ | |||
77 | 126 | $scope.tabs.controllers.actionProgress = { | 130 | $scope.tabs.controllers.actionProgress = { |
78 | 127 | total: 0, | 131 | total: 0, |
79 | 128 | completed: 0, | 132 | completed: 0, |
81 | 129 | errors: {} | 133 | errors: {}, |
82 | 134 | showing_confirmation: false, | ||
83 | 135 | affected_nodes: 0 | ||
84 | 130 | }; | 136 | }; |
85 | 131 | $scope.tabs.controllers.zoneSelection = null; | 137 | $scope.tabs.controllers.zoneSelection = null; |
86 | 132 | $scope.tabs.controllers.syncStatuses = {}; | 138 | $scope.tabs.controllers.syncStatuses = {}; |
87 | @@ -156,7 +162,9 @@ angular.module('MAAS').controller('NodesListController', [ | |||
88 | 156 | $scope.tabs.switches.actionProgress = { | 162 | $scope.tabs.switches.actionProgress = { |
89 | 157 | total: 0, | 163 | total: 0, |
90 | 158 | completed: 0, | 164 | completed: 0, |
92 | 159 | errors: {} | 165 | errors: {}, |
93 | 166 | showing_confirmation: false, | ||
94 | 167 | affected_nodes: 0 | ||
95 | 160 | }; | 168 | }; |
96 | 161 | $scope.tabs.switches.osSelection = { | 169 | $scope.tabs.switches.osSelection = { |
97 | 162 | osystem: null, | 170 | osystem: null, |
98 | @@ -309,6 +317,8 @@ angular.module('MAAS').controller('NodesListController', [ | |||
99 | 309 | var progress = $scope.tabs[tab].actionProgress; | 317 | var progress = $scope.tabs[tab].actionProgress; |
100 | 310 | progress.completed = progress.total = 0; | 318 | progress.completed = progress.total = 0; |
101 | 311 | progress.errors = {}; | 319 | progress.errors = {}; |
102 | 320 | progress.showing_confirmation = false; | ||
103 | 321 | progress.affected_nodes = 0; | ||
104 | 312 | } | 322 | } |
105 | 313 | 323 | ||
106 | 314 | // Add error to action progress and group error messages by nodes. | 324 | // Add error to action progress and group error messages by nodes. |
107 | @@ -599,6 +609,19 @@ angular.module('MAAS').controller('NodesListController', [ | |||
108 | 599 | extra.testing_scripts.push('none'); | 609 | extra.testing_scripts.push('none'); |
109 | 600 | } | 610 | } |
110 | 601 | } else if($scope.tabs[tab].actionOption.name === "test") { | 611 | } else if($scope.tabs[tab].actionOption.name === "test") { |
111 | 612 | if(!$scope.tabs[tab].actionProgress.showing_confirmation) { | ||
112 | 613 | var progress = $scope.tabs[tab].actionProgress; | ||
113 | 614 | for(i=0;i<$scope.tabs[tab].selectedItems.length;i++) { | ||
114 | 615 | if($scope.tabs[tab].selectedItems[i].status_code === 6) | ||
115 | 616 | { | ||
116 | 617 | progress.showing_confirmation = true; | ||
117 | 618 | progress.affected_nodes++; | ||
118 | 619 | } | ||
119 | 620 | } | ||
120 | 621 | if($scope.tabs[tab].actionProgress.affected_nodes != 0) { | ||
121 | 622 | return; | ||
122 | 623 | } | ||
123 | 624 | } | ||
124 | 602 | // Set the test options. | 625 | // Set the test options. |
125 | 603 | extra.enable_ssh = ( | 626 | extra.enable_ssh = ( |
126 | 604 | $scope.tabs[tab].commissionOptions.enableSSH); | 627 | $scope.tabs[tab].commissionOptions.enableSSH); |
127 | diff --git a/src/maasserver/static/js/angular/controllers/tests/test_node_details.js b/src/maasserver/static/js/angular/controllers/tests/test_node_details.js | |||
128 | index 6044827..b786b50 100644 | |||
129 | --- a/src/maasserver/static/js/angular/controllers/tests/test_node_details.js | |||
130 | +++ b/src/maasserver/static/js/angular/controllers/tests/test_node_details.js | |||
131 | @@ -195,6 +195,7 @@ describe("NodeDetailsController", function() { | |||
132 | 195 | expect($scope.action.allOptions).toBeNull(); | 195 | expect($scope.action.allOptions).toBeNull(); |
133 | 196 | expect($scope.action.availableOptions).toEqual([]); | 196 | expect($scope.action.availableOptions).toEqual([]); |
134 | 197 | expect($scope.action.error).toBeNull(); | 197 | expect($scope.action.error).toBeNull(); |
135 | 198 | expect($scope.action.showing_confirmation).toBe(false); | ||
136 | 198 | expect($scope.osinfo).toBe(GeneralManager.getData("osinfo")); | 199 | expect($scope.osinfo).toBe(GeneralManager.getData("osinfo")); |
137 | 199 | expect($scope.power_types).toBe(GeneralManager.getData("power_types")); | 200 | expect($scope.power_types).toBe(GeneralManager.getData("power_types")); |
138 | 200 | expect($scope.osSelection.osystem).toBeNull(); | 201 | expect($scope.osSelection.osystem).toBeNull(); |
139 | @@ -918,6 +919,13 @@ describe("NodeDetailsController", function() { | |||
140 | 918 | $scope.actionCancel(); | 919 | $scope.actionCancel(); |
141 | 919 | expect($scope.action.error).toBeNull(); | 920 | expect($scope.action.error).toBeNull(); |
142 | 920 | }); | 921 | }); |
143 | 922 | |||
144 | 923 | it("resets showing_confirmation", function() { | ||
145 | 924 | var controller = makeController(); | ||
146 | 925 | $scope.action.showing_confirmation = true; | ||
147 | 926 | $scope.actionCancel(); | ||
148 | 927 | expect($scope.action.showing_confirmation).toBe(false); | ||
149 | 928 | }); | ||
150 | 921 | }); | 929 | }); |
151 | 922 | 930 | ||
152 | 923 | describe("actionGo", function() { | 931 | describe("actionGo", function() { |
153 | @@ -1063,6 +1071,20 @@ describe("NodeDetailsController", function() { | |||
154 | 1063 | }); | 1071 | }); |
155 | 1064 | }); | 1072 | }); |
156 | 1065 | 1073 | ||
157 | 1074 | it("sets showing_confirmation with testOptions", function() { | ||
158 | 1075 | var controller = makeController(); | ||
159 | 1076 | spyOn(MachinesManager, "performAction").and.returnValue( | ||
160 | 1077 | $q.defer().promise); | ||
161 | 1078 | node.status_code = 6; | ||
162 | 1079 | $scope.node = node; | ||
163 | 1080 | $scope.action.option = { | ||
164 | 1081 | name: "test" | ||
165 | 1082 | }; | ||
166 | 1083 | $scope.actionGo(); | ||
167 | 1084 | expect($scope.action.showing_confirmation).toBe(true); | ||
168 | 1085 | expect(MachinesManager.performAction).not.toHaveBeenCalled(); | ||
169 | 1086 | }); | ||
170 | 1087 | |||
171 | 1066 | it("calls performAction with releaseOptions", function() { | 1088 | it("calls performAction with releaseOptions", function() { |
172 | 1067 | var controller = makeController(); | 1089 | var controller = makeController(); |
173 | 1068 | spyOn(MachinesManager, "performAction").and.returnValue( | 1090 | spyOn(MachinesManager, "performAction").and.returnValue( |
174 | diff --git a/src/maasserver/static/js/angular/controllers/tests/test_nodes_list.js b/src/maasserver/static/js/angular/controllers/tests/test_nodes_list.js | |||
175 | index 35430a7..f49aa4a 100644 | |||
176 | --- a/src/maasserver/static/js/angular/controllers/tests/test_nodes_list.js | |||
177 | +++ b/src/maasserver/static/js/angular/controllers/tests/test_nodes_list.js | |||
178 | @@ -1182,10 +1182,18 @@ describe("NodesListController", function() { | |||
179 | 1182 | makeInteger(0, 10); | 1182 | makeInteger(0, 10); |
180 | 1183 | $scope.tabs[tab].actionProgress.errors[makeName("error")] = | 1183 | $scope.tabs[tab].actionProgress.errors[makeName("error")] = |
181 | 1184 | [{}]; | 1184 | [{}]; |
182 | 1185 | $scope.tabs[tab].actionProgress.showing_confirmation = | ||
183 | 1186 | true; | ||
184 | 1187 | $scope.tabs[tab].actionProgress.affected_nodes = | ||
185 | 1188 | makeInteger(0, 10); | ||
186 | 1185 | $scope.actionCancel(tab); | 1189 | $scope.actionCancel(tab); |
187 | 1186 | expect($scope.tabs[tab].actionProgress.total).toBe(0); | 1190 | expect($scope.tabs[tab].actionProgress.total).toBe(0); |
188 | 1187 | expect($scope.tabs[tab].actionProgress.completed).toBe(0); | 1191 | expect($scope.tabs[tab].actionProgress.completed).toBe(0); |
189 | 1188 | expect($scope.tabs[tab].actionProgress.errors).toEqual({}); | 1192 | expect($scope.tabs[tab].actionProgress.errors).toEqual({}); |
190 | 1193 | expect($scope.tabs[ | ||
191 | 1194 | tab].actionProgress.showing_confirmation).toBe(false); | ||
192 | 1195 | expect($scope.tabs[ | ||
193 | 1196 | tab].actionProgress.affected_nodes).toBe(0); | ||
194 | 1189 | }); | 1197 | }); |
195 | 1190 | }); | 1198 | }); |
196 | 1191 | 1199 | ||
197 | @@ -1566,6 +1574,26 @@ describe("NodesListController", function() { | |||
198 | 1566 | }); | 1574 | }); |
199 | 1567 | }); | 1575 | }); |
200 | 1568 | 1576 | ||
201 | 1577 | it("sets showing_confirmation with testOptions", | ||
202 | 1578 | function() { | ||
203 | 1579 | var controller = makeController(); | ||
204 | 1580 | var object = makeObject("nodes"); | ||
205 | 1581 | object.status_code = 6; | ||
206 | 1582 | var spy = spyOn( | ||
207 | 1583 | $scope.tabs.nodes.manager, | ||
208 | 1584 | "performAction").and.returnValue( | ||
209 | 1585 | $q.defer().promise); | ||
210 | 1586 | $scope.tabs.nodes.actionOption = { name: "test" }; | ||
211 | 1587 | $scope.tabs.nodes.selectedItems = [object]; | ||
212 | 1588 | $scope.actionGo("nodes"); | ||
213 | 1589 | expect($scope.tabs[ | ||
214 | 1590 | "nodes"].actionProgress.showing_confirmation).toBe( | ||
215 | 1591 | true); | ||
216 | 1592 | expect($scope.tabs[ | ||
217 | 1593 | "nodes"].actionProgress.affected_nodes).toBe(1); | ||
218 | 1594 | expect(spy).not.toHaveBeenCalled(); | ||
219 | 1595 | }); | ||
220 | 1596 | |||
221 | 1569 | it("calls performAction with releaseOptions", | 1597 | it("calls performAction with releaseOptions", |
222 | 1570 | function() { | 1598 | function() { |
223 | 1571 | var controller = makeController(); | 1599 | var controller = makeController(); |
224 | diff --git a/src/maasserver/static/partials/node-details.html b/src/maasserver/static/partials/node-details.html | |||
225 | index e7a3380..8d71466 100755 | |||
226 | --- a/src/maasserver/static/partials/node-details.html | |||
227 | +++ b/src/maasserver/static/partials/node-details.html | |||
228 | @@ -187,6 +187,17 @@ | |||
229 | 187 | </form> | 187 | </form> |
230 | 188 | </div> | 188 | </div> |
231 | 189 | </div> | 189 | </div> |
232 | 190 | <div class="row ng-hide" data-ng-show="action.showing_confirmation && action.option.name === 'test'"> | ||
233 | 191 | <div class="col-12"> | ||
234 | 192 | <p> | ||
235 | 193 | <i class="p-icon--warning">Warning:</i> Node is currently deployed. Are you sure you want to continue to test hardware? | ||
236 | 194 | </p> | ||
237 | 195 | <div class="u-align--right"> | ||
238 | 196 | <button class="p-button--base" data-ng-click="actionCancel()">No</button> | ||
239 | 197 | <button class="p-button--neutral" data-ng-click="actionGo()">Yes</button> | ||
240 | 198 | </div> | ||
241 | 199 | </div> | ||
242 | 200 | </div> | ||
243 | 190 | <div class="row ng-hide" data-ng-show="isActionError()"> | 201 | <div class="row ng-hide" data-ng-show="isActionError()"> |
244 | 191 | <!-- XXX blake_r 2015-02-19 - Need to add e2e test. --> | 202 | <!-- XXX blake_r 2015-02-19 - Need to add e2e test. --> |
245 | 192 | <div class="col-12"> | 203 | <div class="col-12"> |
246 | diff --git a/src/maasserver/static/partials/nodes-list.html b/src/maasserver/static/partials/nodes-list.html | |||
247 | index da2b251..fea51bd 100644 | |||
248 | --- a/src/maasserver/static/partials/nodes-list.html | |||
249 | +++ b/src/maasserver/static/partials/nodes-list.html | |||
250 | @@ -262,7 +262,17 @@ | |||
251 | 262 | </p> | 262 | </p> |
252 | 263 | </div> | 263 | </div> |
253 | 264 | </section> | 264 | </section> |
255 | 265 | 265 | <section class="page-header__section row u-no-margin--top ng-hide" data-ng-show="tabs[tab].actionProgress.showing_confirmation"> | |
256 | 266 | <div class="col-12"> | ||
257 | 267 | <p> | ||
258 | 268 | <i class="p-icon--warning">Warning:</i> {$ tabs[tab].actionProgress.affected_nodes $} of {$ tabs[tab].selectedItems.length $} are in a deployed state. Are you sure you want to continue to test hardware? | ||
259 | 269 | </p> | ||
260 | 270 | <div class="u-align--right"> | ||
261 | 271 | <button class="p-button--base" data-ng-click="actionCancel(tab)">No</button> | ||
262 | 272 | <button class="p-button--neutral" data-ng-click="actionGo(tab)">Yes</button> | ||
263 | 273 | </div> | ||
264 | 274 | </div> | ||
265 | 275 | </section> | ||
266 | 266 | <!-- XXX ricgard 2016-06-16 - Need to add e2e test. --> | 276 | <!-- XXX ricgard 2016-06-16 - Need to add e2e test. --> |
267 | 267 | <section class="page-header__section row u-no-margin--top ng-hide" data-ng-show="hasActionsInProgress(tab) || hasActionsFailed(tab)"> | 277 | <section class="page-header__section row u-no-margin--top ng-hide" data-ng-show="hasActionsInProgress(tab) || hasActionsFailed(tab)"> |
268 | 268 | <div class="col-12"> | 278 | <div class="col-12"> |
comments inline.