#50 indicate pod restarts as red "ticks" and show number in tooltip

This commit is contained in:
Henning Jacobs
2016-12-22 14:08:12 +01:00
parent 9667eebc6a
commit 8778ebfe9d
2 changed files with 16 additions and 0 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ __pycache__
**/node_modules/ **/node_modules/
static/build/ static/build/
*-secret *-secret
npm-debug.log*

View File

@@ -84,6 +84,7 @@ export class Pod extends PIXI.Graphics {
const containerStatuses = this.pod.status.containerStatuses || [] const containerStatuses = this.pod.status.containerStatuses || []
var ready = 0 var ready = 0
var running = 0 var running = 0
var restarts = 0
for (const containerStatus of containerStatuses) { for (const containerStatus of containerStatuses) {
if (containerStatus.ready) { if (containerStatus.ready) {
ready++ ready++
@@ -91,6 +92,7 @@ export class Pod extends PIXI.Graphics {
if (containerStatus.state.running) { if (containerStatus.state.running) {
running++ running++
} }
restarts += containerStatus.restartCount || 0
} }
const allReady = ready >= containerStatuses.length const allReady = ready >= containerStatuses.length
const allRunning = running >= containerStatuses.length const allRunning = running >= containerStatuses.length
@@ -120,6 +122,9 @@ export class Pod extends PIXI.Graphics {
// "CrashLoopBackOff" // "CrashLoopBackOff"
s += ': ' + containerStatus.state[key].reason s += ': ' + containerStatus.state[key].reason
} }
if (containerStatus.restartCount) {
s += ' (' + containerStatus.restartCount + ' restarts)'
}
} }
s += '\nCPU:' s += '\nCPU:'
s += '\n Requested: ' + (resources.cpu.requested / FACTORS.m).toFixed(0) + ' m' s += '\n Requested: ' + (resources.cpu.requested / FACTORS.m).toFixed(0) + ' m'
@@ -181,6 +186,16 @@ export class Pod extends PIXI.Graphics {
} }
newTick = this.terminating newTick = this.terminating
} }
if (restarts) {
this.lineStyle(2, 0xff9999, 1)
for (let i=0; i<Math.min(restarts, 4); i++) {
this.moveTo(10, i*3 - 1)
this.lineTo(10, i*3 + 1)
}
}
if (newTick) { if (newTick) {
this.tick = newTick this.tick = newTick
PIXI.ticker.shared.add(this.tick, this) PIXI.ticker.shared.add(this.tick, this)