Skip to content

Commit fbc282d

Browse files
author
OpenShift Bot
authored
Merge pull request #1223 from spadgett/evicted-pods
Merged by openshift-bot
2 parents 68c6590 + 74b7b71 commit fbc282d

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed

app/scripts/controllers/overview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ angular.module('openshiftConsole')
260260

261261
// Filter out monopods we know we don't want to see
262262
var showMonopod = function(pod) {
263-
// Hide pods in the Succeeded & Terminated phases since these
263+
// Hide pods in the Succeeded & Failed phases since these
264264
// are run once pods that are done.
265265
if (pod.status.phase === 'Succeeded' ||
266-
pod.status.phase === 'Terminated') {
266+
pod.status.phase === 'Failed') {
267267
// TODO we may want to show pods for X amount of time after they have completed
268268
return false;
269269
}

app/scripts/directives/podDonut.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
angular.module('openshiftConsole')
44
.directive('podDonut', function($timeout,
5-
hashSizeFilter,
65
isPullingImageFilter,
76
isTerminatingFilter,
87
podWarningsFilter,
@@ -24,13 +23,15 @@ angular.module('openshiftConsole')
2423
var chart, config;
2524

2625
// The phases to show (in order).
27-
var phases = ["Running", "Not Ready", "Warning", "Failed", "Pulling", "Pending", "Succeeded", "Terminating", "Unknown"];
26+
var phases = ["Running", "Not Ready", "Warning", "Error", "Pulling", "Pending", "Succeeded", "Terminating", "Unknown"];
2827

2928
$scope.chartId = _.uniqueId('pods-donut-chart-');
3029

3130
function updateCenterText() {
32-
var total = hashSizeFilter($scope.pods);
3331
var smallText;
32+
// Don't show failed pods like evicted pods in the donut.
33+
var pods = _.reject($scope.pods, { status: { phase: 'Failed' } });
34+
var total = _.size(pods);
3435
if (!angular.isNumber($scope.desired) || $scope.desired === total) {
3536
smallText = (total === 1) ? "pod" : "pods";
3637
} else {
@@ -75,7 +76,7 @@ angular.module('openshiftConsole')
7576

7677
// Disable the tooltip for empty donuts.
7778
if (id === "Empty") {
78-
return "No pods exist";
79+
return undefined;
7980
}
8081

8182
// Show the count rather than a percentage.
@@ -98,7 +99,7 @@ angular.module('openshiftConsole')
9899
"Not Ready": "#beedf9",
99100
// Use a shade of orange that looks good with overview alerts for warning pods.
100101
Warning: "#f39d3c",
101-
Failed: "#d9534f",
102+
Error: "#d9534f",
102103
Pulling: "#d1d1d1",
103104
Pending: "#ededed",
104105
Succeeded: "#3f9c35",
@@ -119,7 +120,7 @@ angular.module('openshiftConsole')
119120
data.columns.push([phase, countByPhase[phase] || 0]);
120121
});
121122

122-
if (hashSizeFilter(countByPhase) === 0) {
123+
if (_.isEmpty(countByPhase)) {
123124
// Add a dummy group to draw an arc, which we style in CSS.
124125
data.columns.push(["Empty", 1]);
125126
} else {
@@ -152,7 +153,7 @@ angular.module('openshiftConsole')
152153

153154
var warnings = podWarningsFilter(pod);
154155
if (_.some(warnings, { severity: 'error' })) {
155-
return 'Failed';
156+
return 'Error';
156157
} else if (!_.isEmpty(warnings)) {
157158
return 'Warning';
158159
}

dist/scripts/scripts.js

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4648,7 +4648,7 @@ var b = a.spec.scaleRef.name, c = a.spec.scaleRef.kind;
46484648
b && c && (_.has(C, [ c, b ]) || _.set(C, [ c, b ], []), C[c][b].push(a));
46494649
});
46504650
}, $ = function(a) {
4651-
return "Succeeded" !== a.status.phase && "Terminated" !== a.status.phase && (!G(a, "openshift.io/deployer-pod-for.name") && (!F(a, "openshift.io/build.name") && "slave" !== G(a, "jenkins")));
4651+
return "Succeeded" !== a.status.phase && "Failed" !== a.status.phase && (!G(a, "openshift.io/deployer-pod-for.name") && (!F(a, "openshift.io/build.name") && "slave" !== G(a, "jenkins")));
46524652
}, aa = function() {
46534653
if (y && u && w && x) {
46544654
var a = _.toArray(u).concat(_.toArray(w)).concat(_.toArray(x));
@@ -12288,7 +12288,7 @@ msg:"@"
1228812288
},
1228912289
templateUrl:"views/directives/_ellipsis-pulser.html"
1229012290
};
12291-
} ]), angular.module("openshiftConsole").directive("podDonut", [ "$timeout", "hashSizeFilter", "isPullingImageFilter", "isTerminatingFilter", "podWarningsFilter", "numContainersReadyFilter", "Logger", "ChartsService", function(a, b, c, d, e, f, g, h) {
12291+
} ]), angular.module("openshiftConsole").directive("podDonut", [ "$timeout", "isPullingImageFilter", "isTerminatingFilter", "podWarningsFilter", "numContainersReadyFilter", "Logger", "ChartsService", function(a, b, c, d, e, f, g) {
1229212292
return {
1229312293
restrict:"E",
1229412294
scope:{
@@ -12297,39 +12297,43 @@ desired:"=?",
1229712297
idled:"=?"
1229812298
},
1229912299
templateUrl:"views/directives/pod-donut.html",
12300-
link:function(a, g) {
12301-
function i() {
12302-
var c, d = b(a.pods);
12303-
c = angular.isNumber(a.desired) && a.desired !== d ? "scaling to " + a.desired + "..." :1 === d ? "pod" :"pods", a.idled ? h.updateDonutCenterText(g[0], "Idle") :h.updateDonutCenterText(g[0], d, c);
12300+
link:function(a, f) {
12301+
function h() {
12302+
var b, c = _.reject(a.pods, {
12303+
status:{
12304+
phase:"Failed"
1230412305
}
12305-
function j(c) {
12306-
var d = {
12306+
}), d = _.size(c);
12307+
b = angular.isNumber(a.desired) && a.desired !== d ? "scaling to " + a.desired + "..." :1 === d ? "pod" :"pods", a.idled ? g.updateDonutCenterText(f[0], "Idle") :g.updateDonutCenterText(f[0], d, b);
12308+
}
12309+
function i(b) {
12310+
var c = {
1230712311
columns:[]
1230812312
};
12309-
angular.forEach(p, function(a) {
12310-
d.columns.push([ a, c[a] || 0 ]);
12311-
}), 0 === b(c) ? d.columns.push([ "Empty", 1 ]) :d.unload = "Empty", n ? n.load(d) :(o.data.columns = d.columns, n = c3.generate(o)), a.podStatusData = d.columns;
12313+
angular.forEach(o, function(a) {
12314+
c.columns.push([ a, b[a] || 0 ]);
12315+
}), _.isEmpty(b) ? c.columns.push([ "Empty", 1 ]) :c.unload = "Empty", m ? m.load(c) :(n.data.columns = c.columns, m = c3.generate(n)), a.podStatusData = c.columns;
1231212316
}
12313-
function k(a) {
12314-
var b = f(a), c = a.spec.containers.length;
12317+
function j(a) {
12318+
var b = e(a), c = a.spec.containers.length;
1231512319
return b === c;
1231612320
}
12317-
function l(a) {
12318-
if (d(a)) return "Terminating";
12319-
var b = e(a);
12320-
return _.some(b, {
12321+
function k(a) {
12322+
if (c(a)) return "Terminating";
12323+
var e = d(a);
12324+
return _.some(e, {
1232112325
severity:"error"
12322-
}) ? "Failed" :_.isEmpty(b) ? c(a) ? "Pulling" :"Running" !== a.status.phase || k(a) ? _.get(a, "status.phase", "Unknown") :"Not Ready" :"Warning";
12326+
}) ? "Error" :_.isEmpty(e) ? b(a) ? "Pulling" :"Running" !== a.status.phase || j(a) ? _.get(a, "status.phase", "Unknown") :"Not Ready" :"Warning";
1232312327
}
12324-
function m() {
12328+
function l() {
1232512329
var b = {};
1232612330
return angular.forEach(a.pods, function(a) {
12327-
var c = l(a);
12331+
var c = k(a);
1232812332
b[c] = (b[c] || 0) + 1;
1232912333
}), b;
1233012334
}
12331-
var n, o, p = [ "Running", "Not Ready", "Warning", "Failed", "Pulling", "Pending", "Succeeded", "Terminating", "Unknown" ];
12332-
a.chartId = _.uniqueId("pods-donut-chart-"), o = {
12335+
var m, n, o = [ "Running", "Not Ready", "Warning", "Error", "Pulling", "Pending", "Succeeded", "Terminating", "Unknown" ];
12336+
a.chartId = _.uniqueId("pods-donut-chart-"), n = {
1233312337
type:"donut",
1233412338
bindto:"#" + a.chartId,
1233512339
donut:{
@@ -12346,11 +12350,11 @@ width:150
1234612350
legend:{
1234712351
show:!1
1234812352
},
12349-
onrendered:i,
12353+
onrendered:h,
1235012354
tooltip:{
1235112355
format:{
1235212356
value:function(a, b, c) {
12353-
if (a) return "Empty" === c ? "No pods exist" :a;
12357+
if (a && "Empty" !== c) return a;
1235412358
}
1235512359
}
1235612360
},
@@ -12359,14 +12363,14 @@ duration:350
1235912363
},
1236012364
data:{
1236112365
type:"donut",
12362-
groups:[ p ],
12366+
groups:[ o ],
1236312367
order:null,
1236412368
colors:{
1236512369
Empty:"#ffffff",
1236612370
Running:"#00b9e4",
1236712371
"Not Ready":"#beedf9",
1236812372
Warning:"#f39d3c",
12369-
Failed:"#d9534f",
12373+
Error:"#d9534f",
1237012374
Pulling:"#d1d1d1",
1237112375
Pending:"#ededed",
1237212376
Succeeded:"#3f9c35",
@@ -12378,11 +12382,11 @@ enabled:!1
1237812382
}
1237912383
}
1238012384
};
12381-
var q = _.debounce(j, 350, {
12385+
var p = _.debounce(i, 350, {
1238212386
maxWait:500
1238312387
});
12384-
a.$watch(m, q, !0), a.$watchGroup([ "desired", "idled" ], i), a.$on("destroy", function() {
12385-
n && (n = n.destroy());
12388+
a.$watch(l, p, !0), a.$watchGroup([ "desired", "idled" ], h), a.$on("destroy", function() {
12389+
m && (m = m.destroy());
1238612390
});
1238712391
}
1238812392
};

0 commit comments

Comments
 (0)