Merge ~ltrager/maas:lp1750160 into maas: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)
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.

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

comments inline.

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://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/1657/console
COMMIT: 6f85a208971c44b12ade7b2d8e1c9d12473d71f8

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

Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/maasserver/static/js/angular/controllers/node_details.js b/src/maasserver/static/js/angular/controllers/node_details.js
index 7bce8bc..9431f12 100644
--- a/src/maasserver/static/js/angular/controllers/node_details.js
+++ b/src/maasserver/static/js/angular/controllers/node_details.js
@@ -33,7 +33,8 @@ angular.module('MAAS').controller('NodeDetailsController', [
33 option: null,33 option: null,
34 allOptions: null,34 allOptions: null,
35 availableOptions: [],35 availableOptions: [],
36 error: null36 error: null,
37 showing_confirmation: false
37 };38 };
38 $scope.power_types = GeneralManager.getData("power_types");39 $scope.power_types = GeneralManager.getData("power_types");
39 $scope.osinfo = GeneralManager.getData("osinfo");40 $scope.osinfo = GeneralManager.getData("osinfo");
@@ -525,12 +526,14 @@ angular.module('MAAS').controller('NodeDetailsController', [
525 $scope.action.optionChanged = function() {526 $scope.action.optionChanged = function() {
526 // Clear the action error.527 // Clear the action error.
527 $scope.action.error = null;528 $scope.action.error = null;
529 $scope.action.showing_confirmation = false;
528 };530 };
529531
530 // Cancel the action.532 // Cancel the action.
531 $scope.actionCancel = function() {533 $scope.actionCancel = function() {
532 $scope.action.option = null;534 $scope.action.option = null;
533 $scope.action.error = null;535 $scope.action.error = null;
536 $scope.action.showing_confirmation = false;
534 };537 };
535538
536 // Perform the action.539 // Perform the action.
@@ -586,6 +589,11 @@ angular.module('MAAS').controller('NodeDetailsController', [
586 extra.testing_scripts.push('none');589 extra.testing_scripts.push('none');
587 }590 }
588 } else if($scope.action.option.name === "test") {591 } else if($scope.action.option.name === "test") {
592 if($scope.node.status_code === 6 &&
593 !$scope.action.showing_confirmation) {
594 $scope.action.showing_confirmation = true;
595 return;
596 }
589 // Set the test options.597 // Set the test options.
590 extra.enable_ssh = $scope.commissionOptions.enableSSH;598 extra.enable_ssh = $scope.commissionOptions.enableSSH;
591 extra.testing_scripts = [];599 extra.testing_scripts = [];
@@ -611,6 +619,7 @@ angular.module('MAAS').controller('NodeDetailsController', [
611 }619 }
612 $scope.action.option = null;620 $scope.action.option = null;
613 $scope.action.error = null;621 $scope.action.error = null;
622 $scope.action.showing_confirmation = false;
614 $scope.osSelection.$reset();623 $scope.osSelection.$reset();
615 $scope.commissionOptions.enableSSH = false;624 $scope.commissionOptions.enableSSH = false;
616 $scope.commissionOptions.skipNetworking = false;625 $scope.commissionOptions.skipNetworking = false;
diff --git a/src/maasserver/static/js/angular/controllers/nodes_list.js b/src/maasserver/static/js/angular/controllers/nodes_list.js
index fce5e35..cfe4e17 100644
--- a/src/maasserver/static/js/angular/controllers/nodes_list.js
+++ b/src/maasserver/static/js/angular/controllers/nodes_list.js
@@ -57,7 +57,9 @@ angular.module('MAAS').controller('NodesListController', [
57 $scope.tabs.nodes.actionProgress = {57 $scope.tabs.nodes.actionProgress = {
58 total: 0,58 total: 0,
59 completed: 0,59 completed: 0,
60 errors: {}60 errors: {},
61 showing_confirmation: false,
62 affected_nodes: 0
61 };63 };
62 $scope.tabs.nodes.osSelection = {64 $scope.tabs.nodes.osSelection = {
63 osystem: null,65 osystem: null,
@@ -98,7 +100,9 @@ angular.module('MAAS').controller('NodesListController', [
98 $scope.tabs.devices.actionProgress = {100 $scope.tabs.devices.actionProgress = {
99 total: 0,101 total: 0,
100 completed: 0,102 completed: 0,
101 errors: {}103 errors: {},
104 showing_confirmation: false,
105 affected_nodes: 0
102 };106 };
103 $scope.tabs.devices.zoneSelection = null;107 $scope.tabs.devices.zoneSelection = null;
104108
@@ -126,7 +130,9 @@ angular.module('MAAS').controller('NodesListController', [
126 $scope.tabs.controllers.actionProgress = {130 $scope.tabs.controllers.actionProgress = {
127 total: 0,131 total: 0,
128 completed: 0,132 completed: 0,
129 errors: {}133 errors: {},
134 showing_confirmation: false,
135 affected_nodes: 0
130 };136 };
131 $scope.tabs.controllers.zoneSelection = null;137 $scope.tabs.controllers.zoneSelection = null;
132 $scope.tabs.controllers.syncStatuses = {};138 $scope.tabs.controllers.syncStatuses = {};
@@ -156,7 +162,9 @@ angular.module('MAAS').controller('NodesListController', [
156 $scope.tabs.switches.actionProgress = {162 $scope.tabs.switches.actionProgress = {
157 total: 0,163 total: 0,
158 completed: 0,164 completed: 0,
159 errors: {}165 errors: {},
166 showing_confirmation: false,
167 affected_nodes: 0
160 };168 };
161 $scope.tabs.switches.osSelection = {169 $scope.tabs.switches.osSelection = {
162 osystem: null,170 osystem: null,
@@ -309,6 +317,8 @@ angular.module('MAAS').controller('NodesListController', [
309 var progress = $scope.tabs[tab].actionProgress;317 var progress = $scope.tabs[tab].actionProgress;
310 progress.completed = progress.total = 0;318 progress.completed = progress.total = 0;
311 progress.errors = {};319 progress.errors = {};
320 progress.showing_confirmation = false;
321 progress.affected_nodes = 0;
312 }322 }
313323
314 // Add error to action progress and group error messages by nodes.324 // Add error to action progress and group error messages by nodes.
@@ -599,6 +609,19 @@ angular.module('MAAS').controller('NodesListController', [
599 extra.testing_scripts.push('none');609 extra.testing_scripts.push('none');
600 }610 }
601 } else if($scope.tabs[tab].actionOption.name === "test") {611 } else if($scope.tabs[tab].actionOption.name === "test") {
612 if(!$scope.tabs[tab].actionProgress.showing_confirmation) {
613 var progress = $scope.tabs[tab].actionProgress;
614 for(i=0;i<$scope.tabs[tab].selectedItems.length;i++) {
615 if($scope.tabs[tab].selectedItems[i].status_code === 6)
616 {
617 progress.showing_confirmation = true;
618 progress.affected_nodes++;
619 }
620 }
621 if($scope.tabs[tab].actionProgress.affected_nodes != 0) {
622 return;
623 }
624 }
602 // Set the test options.625 // Set the test options.
603 extra.enable_ssh = (626 extra.enable_ssh = (
604 $scope.tabs[tab].commissionOptions.enableSSH);627 $scope.tabs[tab].commissionOptions.enableSSH);
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
index 6044827..b786b50 100644
--- a/src/maasserver/static/js/angular/controllers/tests/test_node_details.js
+++ b/src/maasserver/static/js/angular/controllers/tests/test_node_details.js
@@ -195,6 +195,7 @@ describe("NodeDetailsController", function() {
195 expect($scope.action.allOptions).toBeNull();195 expect($scope.action.allOptions).toBeNull();
196 expect($scope.action.availableOptions).toEqual([]);196 expect($scope.action.availableOptions).toEqual([]);
197 expect($scope.action.error).toBeNull();197 expect($scope.action.error).toBeNull();
198 expect($scope.action.showing_confirmation).toBe(false);
198 expect($scope.osinfo).toBe(GeneralManager.getData("osinfo"));199 expect($scope.osinfo).toBe(GeneralManager.getData("osinfo"));
199 expect($scope.power_types).toBe(GeneralManager.getData("power_types"));200 expect($scope.power_types).toBe(GeneralManager.getData("power_types"));
200 expect($scope.osSelection.osystem).toBeNull();201 expect($scope.osSelection.osystem).toBeNull();
@@ -918,6 +919,13 @@ describe("NodeDetailsController", function() {
918 $scope.actionCancel();919 $scope.actionCancel();
919 expect($scope.action.error).toBeNull();920 expect($scope.action.error).toBeNull();
920 });921 });
922
923 it("resets showing_confirmation", function() {
924 var controller = makeController();
925 $scope.action.showing_confirmation = true;
926 $scope.actionCancel();
927 expect($scope.action.showing_confirmation).toBe(false);
928 });
921 });929 });
922930
923 describe("actionGo", function() {931 describe("actionGo", function() {
@@ -1063,6 +1071,20 @@ describe("NodeDetailsController", function() {
1063 });1071 });
1064 });1072 });
10651073
1074 it("sets showing_confirmation with testOptions", function() {
1075 var controller = makeController();
1076 spyOn(MachinesManager, "performAction").and.returnValue(
1077 $q.defer().promise);
1078 node.status_code = 6;
1079 $scope.node = node;
1080 $scope.action.option = {
1081 name: "test"
1082 };
1083 $scope.actionGo();
1084 expect($scope.action.showing_confirmation).toBe(true);
1085 expect(MachinesManager.performAction).not.toHaveBeenCalled();
1086 });
1087
1066 it("calls performAction with releaseOptions", function() {1088 it("calls performAction with releaseOptions", function() {
1067 var controller = makeController();1089 var controller = makeController();
1068 spyOn(MachinesManager, "performAction").and.returnValue(1090 spyOn(MachinesManager, "performAction").and.returnValue(
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
index 35430a7..f49aa4a 100644
--- a/src/maasserver/static/js/angular/controllers/tests/test_nodes_list.js
+++ b/src/maasserver/static/js/angular/controllers/tests/test_nodes_list.js
@@ -1182,10 +1182,18 @@ describe("NodesListController", function() {
1182 makeInteger(0, 10);1182 makeInteger(0, 10);
1183 $scope.tabs[tab].actionProgress.errors[makeName("error")] =1183 $scope.tabs[tab].actionProgress.errors[makeName("error")] =
1184 [{}];1184 [{}];
1185 $scope.tabs[tab].actionProgress.showing_confirmation =
1186 true;
1187 $scope.tabs[tab].actionProgress.affected_nodes =
1188 makeInteger(0, 10);
1185 $scope.actionCancel(tab);1189 $scope.actionCancel(tab);
1186 expect($scope.tabs[tab].actionProgress.total).toBe(0);1190 expect($scope.tabs[tab].actionProgress.total).toBe(0);
1187 expect($scope.tabs[tab].actionProgress.completed).toBe(0);1191 expect($scope.tabs[tab].actionProgress.completed).toBe(0);
1188 expect($scope.tabs[tab].actionProgress.errors).toEqual({});1192 expect($scope.tabs[tab].actionProgress.errors).toEqual({});
1193 expect($scope.tabs[
1194 tab].actionProgress.showing_confirmation).toBe(false);
1195 expect($scope.tabs[
1196 tab].actionProgress.affected_nodes).toBe(0);
1189 });1197 });
1190 });1198 });
11911199
@@ -1566,6 +1574,26 @@ describe("NodesListController", function() {
1566 });1574 });
1567 });1575 });
15681576
1577 it("sets showing_confirmation with testOptions",
1578 function() {
1579 var controller = makeController();
1580 var object = makeObject("nodes");
1581 object.status_code = 6;
1582 var spy = spyOn(
1583 $scope.tabs.nodes.manager,
1584 "performAction").and.returnValue(
1585 $q.defer().promise);
1586 $scope.tabs.nodes.actionOption = { name: "test" };
1587 $scope.tabs.nodes.selectedItems = [object];
1588 $scope.actionGo("nodes");
1589 expect($scope.tabs[
1590 "nodes"].actionProgress.showing_confirmation).toBe(
1591 true);
1592 expect($scope.tabs[
1593 "nodes"].actionProgress.affected_nodes).toBe(1);
1594 expect(spy).not.toHaveBeenCalled();
1595 });
1596
1569 it("calls performAction with releaseOptions",1597 it("calls performAction with releaseOptions",
1570 function() {1598 function() {
1571 var controller = makeController();1599 var controller = makeController();
diff --git a/src/maasserver/static/partials/node-details.html b/src/maasserver/static/partials/node-details.html
index e7a3380..8d71466 100755
--- a/src/maasserver/static/partials/node-details.html
+++ b/src/maasserver/static/partials/node-details.html
@@ -187,6 +187,17 @@
187 </form>187 </form>
188 </div>188 </div>
189 </div>189 </div>
190 <div class="row ng-hide" data-ng-show="action.showing_confirmation && action.option.name === 'test'">
191 <div class="col-12">
192 <p>
193 <i class="p-icon--warning">Warning:</i> Node is currently deployed. Are you sure you want to continue to test hardware?
194 </p>
195 <div class="u-align--right">
196 <button class="p-button--base" data-ng-click="actionCancel()">No</button>
197 <button class="p-button--neutral" data-ng-click="actionGo()">Yes</button>
198 </div>
199 </div>
200 </div>
190 <div class="row ng-hide" data-ng-show="isActionError()">201 <div class="row ng-hide" data-ng-show="isActionError()">
191 <!-- XXX blake_r 2015-02-19 - Need to add e2e test. -->202 <!-- XXX blake_r 2015-02-19 - Need to add e2e test. -->
192 <div class="col-12">203 <div class="col-12">
diff --git a/src/maasserver/static/partials/nodes-list.html b/src/maasserver/static/partials/nodes-list.html
index da2b251..fea51bd 100644
--- a/src/maasserver/static/partials/nodes-list.html
+++ b/src/maasserver/static/partials/nodes-list.html
@@ -262,7 +262,17 @@
262 </p>262 </p>
263 </div>263 </div>
264 </section>264 </section>
265265 <section class="page-header__section row u-no-margin--top ng-hide" data-ng-show="tabs[tab].actionProgress.showing_confirmation">
266 <div class="col-12">
267 <p>
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?
269 </p>
270 <div class="u-align--right">
271 <button class="p-button--base" data-ng-click="actionCancel(tab)">No</button>
272 <button class="p-button--neutral" data-ng-click="actionGo(tab)">Yes</button>
273 </div>
274 </div>
275 </section>
266 <!-- XXX ricgard 2016-06-16 - Need to add e2e test. -->276 <!-- XXX ricgard 2016-06-16 - Need to add e2e test. -->
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 <div class="col-12">278 <div class="col-12">

Subscribers

People subscribed via source and target branches