expose global "app" object

This commit is contained in:
Henning Jacobs
2016-12-20 19:08:18 +01:00
parent 60784ceb4f
commit 63b6f63538
7 changed files with 92 additions and 85 deletions

View File

@@ -65,7 +65,7 @@ export default class Node extends PIXI.Graphics {
getResourceUsage() {
const resources = {}
for (var key of Object.keys(this.node.status.capacity)) {
for (const key of Object.keys(this.node.status.capacity)) {
resources[key] = {
'capacity': this.parseResource(this.node.status.capacity[key]),
'requested': 0,
@@ -73,20 +73,21 @@ export default class Node extends PIXI.Graphics {
}
}
if (this.node.usage) {
for (var key of Object.keys(this.node.usage)) {
for (const key of Object.keys(this.node.usage)) {
resources[key]['used'] = this.parseResource(this.node.usage[key])
}
}
for (var pod of this.node.pods) {
for (var container of pod.containers) {
for (const pod of this.node.pods) {
for (const container of pod.containers) {
if (container.resources && container.resources.requests) {
for (var key of Object.keys(container.resources.requests)) {
for (const key of Object.keys(container.resources.requests)) {
resources[key].requested += this.parseResource(container.resources.requests[key])
}
}
}
}
resources['pods'].requested = this.node.pods.length
resources['pods'].used = this.node.pods.length
return resources
}
@@ -96,9 +97,9 @@ export default class Node extends PIXI.Graphics {
topHandle.beginFill(0xaaaaff, 1)
topHandle.drawRect(0, 0, 105, 15)
topHandle.endFill()
var text = new PIXI.Text(this.node.name, {fontSize: 10, fill: 0x000000})
const text = new PIXI.Text(this.node.name, {fontSize: 10, fill: 0x000000})
text.cacheAsBitmap = true
var mask = new PIXI.Graphics()
const mask = new PIXI.Graphics()
mask.beginFill(0x0)
mask.drawRect(0, 0, 100, 15)
mask.endFill()
@@ -147,14 +148,12 @@ export default class Node extends PIXI.Graphics {
nodeBox.beginFill(this.getBarColor(resources.memory.used, resources.memory.capacity), 1)
nodeBox.drawRect(16.5, 110 - resources.memory.used/scale, 2.5, resources.memory.used/scale)
nodeBox.endFill()
var text = new PIXI.Text('', {fontSize: 10, fill: 0xffffff})
nodeBox.addChild(text)
var px = 24
var py = 20
for (var pod of this.node.pods) {
for (const pod of this.node.pods) {
if (pod.namespace != 'kube-system') {
var podBox = new Pod(pod, this.tooltip)
const podBox = new Pod(pod, this.tooltip)
podBox.x = px
podBox.y = py
nodeBox.addChild(podBox.draw())
@@ -166,11 +165,11 @@ export default class Node extends PIXI.Graphics {
}
}
var px = 24
var py = 100
for (var pod of this.node.pods) {
px = 24
py = 100
for (const pod of this.node.pods) {
if (pod.namespace == 'kube-system') {
var podBox = new Pod(pod, this.tooltip)
const podBox = new Pod(pod, this.tooltip)
podBox.x = px
podBox.y = py
nodeBox.addChild(podBox.draw())