Merge ~steverydz/maas:1827155-multiple-machine-deploy-error into maas:master

Proposed by Steve Rydz
Status: Merged
Approved by: Steve Rydz
Approved revision: 5a3253611fd6c94349226996629aec96b508ef62
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~steverydz/maas:1827155-multiple-machine-deploy-error
Merge into: maas:master
Diff against target: 72 lines (+14/-8)
2 files modified
src/maasserver/static/js/angular/controllers/nodes_list.js (+8/-6)
src/maasserver/static/partials/nodes-list.html (+6/-2)
Reviewer Review Type Date Requested Status
Caleb Ellis (community) Approve
Review via email: mp+367346@code.launchpad.net

Commit message

LP: #1827155 - Fix error display when deploying multiple machines

Description of the change

Done:
- Prevented the error from disappearing due to page refresh when deploying two or more machines
- Some minor eslint fixes
- Ran prettier

QA:
- Go to machines list
- Check all machines
- From the "Take action" menu click "Deploy"
- Update your selection so only deployable machines are selected
- Click the deploy button
- See that an error is displayed and it persists until you press the "Cancel" button

Screenshot: https://images.zenhubusercontent.com/5a9d4ee34b5806bc2bc9694d/14258181-b839-4b55-951f-52d9076d8f02

To post a comment you must log in.
Revision history for this message
Caleb Ellis (caleb-ellis) wrote :

LGTM!

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

LANDING
-b 1827155-multiple-machine-deploy-error lp:~steverydz/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED MERGE
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-lander/436163/console

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/static/js/angular/controllers/nodes_list.js b/src/maasserver/static/js/angular/controllers/nodes_list.js
2index f4214d4..4434e03 100644
3--- a/src/maasserver/static/js/angular/controllers/nodes_list.js
4+++ b/src/maasserver/static/js/angular/controllers/nodes_list.js
5@@ -157,7 +157,7 @@ function NodesListController(
6 $scope.tabs.pools.isPoolAction = function(pool, action) {
7 let tab = $scope.tabs.pools;
8 return (
9- (action === undefined || tab.activeTargetAction === action) &&
10+ (angular.isUndefined(action) || tab.activeTargetAction === action) &&
11 tab.activeTarget !== null &&
12 tab.activeTarget.id === pool.id
13 );
14@@ -252,8 +252,8 @@ function NodesListController(
15 $scope.tabs.controllers.newPool = {};
16 $scope.tabs.controllers.syncStatuses = {};
17 $scope.tabs.controllers.addController = false;
18- $scope.tabs.controllers.registerUrl = MAAS_config.register_url;
19- $scope.tabs.controllers.registerSecret = MAAS_config.register_secret;
20+ $scope.tabs.controllers.registerUrl = $window.MAAS_config.register_url;
21+ $scope.tabs.controllers.registerSecret = $window.MAAS_config.register_secret;
22
23 // Switch tab.
24 $scope.tabs.switches = {};
25@@ -796,7 +796,10 @@ function NodesListController(
26 // Set the zone parameter.
27 extra.zone_id = tab.zoneSelection.id;
28 } else if (tab.actionOption.name === "set-pool") {
29- if (tab.poolAction === "create-pool" && tab.newPool.name !== undefined) {
30+ if (
31+ tab.poolAction === "create-pool" &&
32+ angular.isDefined(tab.newPool.name)
33+ ) {
34 // Create the pool and set the action options with
35 // the new pool id.
36 preAction = ResourcePoolsManager.createItem({
37@@ -929,15 +932,14 @@ function NodesListController(
38 function() {
39 tab.actionProgress.completed += 1;
40 node.action_failed = false;
41- updateSelectedItems(tabName);
42 },
43 function(error) {
44 addErrorToActionProgress(tabName, error, node);
45 node.action_failed = true;
46- updateSelectedItems(tabName);
47 }
48 );
49 });
50+ updateSelectedItems(tabName);
51 },
52 function(error) {
53 addErrorToActionProgress(tabName, error);
54diff --git a/src/maasserver/static/partials/nodes-list.html b/src/maasserver/static/partials/nodes-list.html
55index e1fcde0..16bd5c3 100644
56--- a/src/maasserver/static/partials/nodes-list.html
57+++ b/src/maasserver/static/partials/nodes-list.html
58@@ -422,8 +422,12 @@
59 {$ tabs[tab].actionProgress.completed $} of {$ tabs[tab].actionProgress.total $}
60 nodes are transitioning to {$ tabs[tab].actionOption.sentence $}.
61 </p>
62- <div data-ng-repeat="(error, machines) in tabs[tab].actionProgress.errors">
63- <span class="p-icon--error">Error: </span> The {$ tabs[tab].actionOption.title.toLowerCase() $} action for {$ nodes.length $} <span data-ng-pluralize count="nodes.length" when="{'one': 'node', 'other': 'nodes'}"></span> failed with error: {$ error $}
64+ <div class="p-notification--negative" data-ng-repeat="(error, machines) in tabs[tab].actionProgress.errors">
65+ <p class="p-notification__response">
66+ <span class="p-notification__status">Error: </span> The {$ tabs[tab].actionOption.title.toLowerCase() $} action for {$
67+ nodes.length $} <span data-ng-pluralize count="nodes.length" when="{'one': 'node', 'other': 'nodes'}"></span> failed
68+ with error: {$ error $}
69+ </p>
70 </div>
71 </div>
72 </section>

Subscribers

People subscribed via source and target branches