Skip to content

Commit f3ec2a5

Browse files
committed
Update mini donut total in $evalAsync block
Since the function is called in response to chart `onrendered`, it's possible for it to execute outside of a digest loop. This causes the UI to display the wrong number of pods beside the mini donut until the next digest loop.
1 parent d4e91d8 commit f3ec2a5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/scripts/directives/podDonut.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ angular.module('openshiftConsole')
3333
var pods = _.reject($scope.pods, { status: { phase: 'Failed' } });
3434
var total = _.size(pods);
3535
if ($scope.mini) {
36-
$scope.total = total;
36+
$scope.$evalAsync(function() {
37+
$scope.total = total;
38+
});
3739
return;
3840
}
3941

dist/scripts/scripts.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11468,7 +11468,9 @@ status:{
1146811468
phase:"Failed"
1146911469
}
1147011470
}), c = _.size(b);
11471-
if (a.mini) return void (a.total = c);
11471+
if (a.mini) return void a.$evalAsync(function() {
11472+
a.total = c;
11473+
});
1147211474
var d;
1147311475
d = angular.isNumber(a.desired) && a.desired !== c ? "scaling to " + a.desired + "..." :1 === c ? "pod" :"pods", a.idled ? g.updateDonutCenterText(f[0], "Idle") :g.updateDonutCenterText(f[0], c, d);
1147411476
}

0 commit comments

Comments
 (0)