Merge lp:~trapnine/maas/fix-1562107-ip-fail-feedback-1.9 into lp:maas/1.9

Proposed by Jeffrey C Jones
Status: Merged
Approved by: Mike Pontillo
Approved revision: no longer in the source branch.
Merged at revision: 4586
Proposed branch: lp:~trapnine/maas/fix-1562107-ip-fail-feedback-1.9
Merge into: lp:maas/1.9
Diff against target: 105 lines (+40/-5)
3 files modified
src/maasserver/static/js/angular/controllers/node_details_networking.js (+12/-4)
src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js (+24/-0)
src/maasserver/static/partials/node-details.html (+4/-1)
To merge this branch: bzr merge lp:~trapnine/maas/fix-1562107-ip-fail-feedback-1.9
Reviewer Review Type Date Requested Status
Mike Pontillo (community) Approve
Jeffrey C Jones (community) Approve
Review via email: mp+297274@code.launchpad.net

Commit message

Display error messages when saving interface links.

Backport of revision 5113 from trunk.

Description of the change

Display error messages when saving interface links.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Was this fix already on trunk? If so, which revision? If not, has fix that aligns better with the 2.0 code already landed?

review: Needs Information
Revision history for this message
Andres Rodriguez (andreserl) wrote :

This needs to be blocked on
https://code.launchpad.net/~trapnine/maas/fix-1562107-ip-fail-feedback-1.9/+
merge/297274

On Tue, Jun 14, 2016 at 10:14 AM, Mike Pontillo <<email address hidden>
> wrote:

> Review: Needs Information
>
> Was this fix already on trunk? If so, which revision? If not, has fix that
> aligns better with the 2.0 code already landed?
> --
>
> https://code.launchpad.net/~trapnine/maas/fix-1562107-ip-fail-feedback-1.9/+merge/297274
> Your team MAAS Committers is subscribed to branch lp:maas/1.9.
>

--
Andres Rodriguez
Engineering Manager, MAAS
Canonical USA, Inc.

Revision history for this message
Jeffrey C Jones (trapnine) wrote :
review: Approve
Revision history for this message
Jeffrey C Jones (trapnine) wrote :
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.4 MiB)

The attempt to merge lp:~trapnine/maas/fix-1562107-ip-fail-feedback-1.9 into lp:maas/1.9 failed. Below is the output from the failed tests.

Ign http://prodstack-zone-1.clouds.archive.ubuntu.com trusty InRelease
Get:1 http://security.ubuntu.com trusty-security InRelease [65.9 kB]
Get:2 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports InRelease
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty Release
Get:3 http://security.ubuntu.com trusty-security/main Sources [117 kB]
Get:4 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/main Sources [277 kB]
Get:5 http://security.ubuntu.com trusty-security/universe Sources [37.3 kB]
Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [493 kB]
Get:7 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/restricted Sources [5,352 B]
Get:8 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/universe Sources [156 kB]
Get:9 http://security.ubuntu.com trusty-security/universe amd64 Packages [130 kB]
Get:10 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/multiverse Sources [5,939 B]
Get:11 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [781 kB]
Get:12 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/restricted amd64 Packages [15.9 kB]
Get:13 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [361 kB]
Get:14 http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/multiverse amd64 Packages [13.2 kB]
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/main Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/restricted Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/universe Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/main Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/restricted Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/multiverse Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/multiverse amd64 Packages
Fetched 2,523 kB in 1s (1,364 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-...

Revision history for this message
Mike Pontillo (mpontillo) wrote :

Looks good, now that I know the fix already landed in trunk. Updated the commit message accordingly.

Revision history for this message
Mike Pontillo (mpontillo) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/static/js/angular/controllers/node_details_networking.js'
2--- src/maasserver/static/js/angular/controllers/node_details_networking.js 2015-11-09 17:37:16 +0000
3+++ src/maasserver/static/js/angular/controllers/node_details_networking.js 2016-06-14 16:17:43 +0000
4@@ -175,6 +175,7 @@
5 $scope.subnets = SubnetsManager.getItems();
6 $scope.interfaces = [];
7 $scope.interfaceLinksMap = {};
8+ $scope.interfaceErrorsByLinkId = {};
9 $scope.originalInterfaces = {};
10 $scope.showingMembers = [];
11 $scope.focusInterface = null;
12@@ -649,6 +650,13 @@
13 return !angular.isObject(nic.subnet);
14 };
15
16+ $scope.getInterfaceError = function(nic) {
17+ if(angular.isDefined(nic.link_id) && nic.link_id >= 0) {
18+ return $scope.interfaceErrorsByLinkId[nic.link_id];
19+ }
20+ return null;
21+ };
22+
23 // Called when the link mode for this interface and link has been
24 // changed.
25 $scope.saveInterfaceLink = function(nic) {
26@@ -660,17 +668,17 @@
27 }
28 if(angular.isDefined(nic.link_id) && nic.link_id >= 0) {
29 params.link_id = nic.link_id;
30+ delete $scope.interfaceErrorsByLinkId[nic.link_id];
31 }
32 if(nic.mode === LINK_MODE.STATIC && nic.ip_address.length > 0) {
33 params.ip_address = nic.ip_address;
34 }
35 return NodesManager.linkSubnet($scope.node, nic.id, params).then(
36 null, function(error) {
37- // XXX blake_r: Just log the error in the console, but
38- // we need to expose this as a better message to the
39- // user.
40 console.log(error);
41-
42+ if(angular.isDefined(nic.link_id) && nic.link_id >= 0) {
43+ $scope.interfaceErrorsByLinkId[nic.link_id] = error;
44+ }
45 // Update the interfaces so it is back to the way it
46 // was before the user changed it.
47 updateInterfaces();
48
49=== modified file 'src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js'
50--- src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js 2015-11-09 17:37:16 +0000
51+++ src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js 2016-06-14 16:17:43 +0000
52@@ -1432,6 +1432,30 @@
53 "ip_address": nic.ip_address
54 });
55 });
56+
57+ it("handles errors", function() {
58+ var controller = makeController();
59+ var nic = {
60+ id: makeInteger(0, 100),
61+ mode: "static",
62+ subnet: { id: makeInteger(0, 100) },
63+ link_id: makeInteger(0, 100),
64+ ip_address: "192.168.122.1"
65+ };
66+ var defer = $q.defer();
67+ spyOn(console, "log");
68+ spyOn(NodesManager, "linkSubnet").and.returnValue(
69+ defer.promise);
70+ $scope.saveInterfaceLink(nic);
71+ defer.reject("error");
72+ $scope.$digest();
73+ // Make sure error is set for UI.
74+ expect($scope.interfaceErrorsByLinkId[nic.link_id]).toBe("error");
75+ expect(console.log).toHaveBeenCalledWith("error");
76+ // Make sure error is cleared on success.
77+ $scope.saveInterfaceLink(nic);
78+ expect($scope.interfaceErrorsByLinkId[nic.link_id]).toBeUndefined();
79+ });
80 });
81
82 describe("subnetChanged", function() {
83
84=== modified file 'src/maasserver/static/partials/node-details.html'
85--- src/maasserver/static/partials/node-details.html 2015-12-03 17:09:21 +0000
86+++ src/maasserver/static/partials/node-details.html 2016-06-14 16:17:43 +0000
87@@ -462,7 +462,7 @@
88 data-ng-options="mode.mode as mode.text for mode in modes | filterLinkModes:interface">
89 </select>
90 </li>
91- <li class="margin-top--ten" data-ng-show="shouldShowIPAddress(interface)">
92+ <li class="margin-top--ten" data-ng-if="shouldShowIPAddress(interface)">
93 <input type="text" class="table__input no-margin-top"
94 data-ng-model="interface.ip_address"
95 data-ng-class="{ invalid: isIPAddressInvalid(interface) }"
96@@ -470,6 +470,9 @@
97 data-ng-focus="setFocusInterface(interface)"
98 data-ng-blur="clearFocusInterface(interface)"
99 data-ng-disabled="interface.mode != 'static'">
100+ <div class="table__data left" data-ng-if="getInterfaceError(interface)">
101+ <span class="icon error"></span> {$ getInterfaceError(interface) $}
102+ </div>
103 </li>
104 </ul>
105 <span class="ng-hide" data-ng-show="isAllNetworkingDisabled() && !interface.discovered[0].ip_address">

Subscribers

People subscribed via source and target branches