Merge lp:~newell-jensen/maas/fix-1619262 into lp:maas/trunk

Proposed by Newell Jensen on 2016-10-05
Status: Merged
Approved by: Newell Jensen on 2016-10-05
Approved revision: 5434
Merged at revision: 5451
Proposed branch: lp:~newell-jensen/maas/fix-1619262
Merge into: lp:maas/trunk
Diff against target: 39 lines (+6/-0)
2 files modified
src/maasserver/static/js/angular/controllers/subnet_details.js (+2/-0)
src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js (+4/-0)
To merge this branch: bzr merge lp:~newell-jensen/maas/fix-1619262
Reviewer Review Type Date Requested Status
Gavin Panella (community) 2016-10-05 Approve on 2016-10-05
Review via email: mp+307656@code.launchpad.net

Commit message

Reload the subnet when an IP range is deleted.

To post a comment you must log in.
Gavin Panella (allenap) wrote :

I think there's something missing from the test, but it's a small thing, so +1.

review: Approve
lp:~newell-jensen/maas/fix-1619262 updated on 2016-10-05
5434. By Newell Jensen on 2016-10-05

Update unit test.

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/subnet_details.js'
2--- src/maasserver/static/js/angular/controllers/subnet_details.js 2016-09-29 16:39:50 +0000
3+++ src/maasserver/static/js/angular/controllers/subnet_details.js 2016-10-05 18:40:30 +0000
4@@ -326,6 +326,8 @@
5 $scope.ipRangeConfirmDelete = function() {
6 IPRangesManager.deleteItem($scope.deleteIPRange).then(function() {
7 $scope.deleteIPRange = null;
8+ // Reload the subnet after deleting the IP range.
9+ $scope.subnet = SubnetsManager.getItem($scope.subnet.id);
10 });
11 };
12
13
14=== modified file 'src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js'
15--- src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js 2016-09-29 16:39:50 +0000
16+++ src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js 2016-10-05 18:40:30 +0000
17@@ -565,12 +565,15 @@
18
19 it("calls deleteItem and clears deleteIPRange on resolve", function() {
20 var controller = makeController();
21+ var subnet = makeSubnet();
22 var range = {};
23+ $scope.subnet = subnet;
24 $scope.deleteIPRange = range;
25
26 var defer = $q.defer();
27 spyOn(IPRangesManager, "deleteItem").and.returnValue(
28 defer.promise);
29+ spyOn(SubnetsManager, "getItem");
30 $scope.ipRangeConfirmDelete();
31
32 expect(IPRangesManager.deleteItem).toHaveBeenCalledWith(range);
33@@ -578,6 +581,7 @@
34 $scope.$digest();
35
36 expect($scope.deleteIPRange).toBeNull();
37+ expect(SubnetsManager.getItem).toHaveBeenCalledWith(subnet.id);
38 });
39 });
40