Merge ~blake-rouse/maas:fix-service-status-card into maas:master

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: 781c4295a02013549fc539f6cd8c24c566da9033
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~blake-rouse/maas:fix-service-status-card
Merge into: maas:master
Diff against target: 37 lines (+16/-1)
2 files modified
src/maasserver/static/js/angular/directives/controller_status.js (+1/-1)
src/maasserver/static/js/angular/directives/tests/test_controller_status.js (+15/-0)
Reviewer Review Type Date Requested Status
Mike Pontillo (community) Approve
MAAS Lander unittests Pending
Review via email: mp+343464@code.launchpad.net

Commit message

Fixes LP: #1763147 - Fix controller status watcher to be recursive.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) 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/directives/controller_status.js b/src/maasserver/static/js/angular/directives/controller_status.js
index e72607b..2100fb3 100644
--- a/src/maasserver/static/js/angular/directives/controller_status.js
+++ b/src/maasserver/static/js/angular/directives/controller_status.js
@@ -89,7 +89,7 @@ angular.module('MAAS').directive('maasControllerStatus', [
89 // Watch the services array and the services on the controller,89 // Watch the services array and the services on the controller,
90 // if any changes then update the status.90 // if any changes then update the status.
91 $scope.$watch("controller.service_ids", updateStatusClass);91 $scope.$watch("controller.service_ids", updateStatusClass);
92 $scope.$watchCollection("services", updateStatusClass);92 $scope.$watch("services", updateStatusClass, true);
9393
94 // Update on creation.94 // Update on creation.
95 updateStatusClass();95 updateStatusClass();
diff --git a/src/maasserver/static/js/angular/directives/tests/test_controller_status.js b/src/maasserver/static/js/angular/directives/tests/test_controller_status.js
index 3e77bff..20999e9 100644
--- a/src/maasserver/static/js/angular/directives/tests/test_controller_status.js
+++ b/src/maasserver/static/js/angular/directives/tests/test_controller_status.js
@@ -146,4 +146,19 @@ describe("maasControllerStatus", function() {
146 var directive = compileDirective();146 var directive = compileDirective();
147 expect(directive.isolateScope().serviceClass).toBe("success");147 expect(directive.isolateScope().serviceClass).toBe("success");
148 });148 });
149
150 it("update service status updates service class", function() {
151 var services = [
152 makeService("dead")
153 ];
154 ServicesManager._items.push.apply(
155 ServicesManager._items, services);
156 $scope.controller = makeController(services);
157 var directive = compileDirective();
158 expect(directive.isolateScope().serviceClass).toBe("power-error");
159
160 services[0].status = "running";
161 $scope.$digest();
162 expect(directive.isolateScope().serviceClass).toBe("success");
163 });
149});164});

Subscribers

People subscribed via source and target branches