Added space for unprovisioned pods only if there are no master nodes

This commit is contained in:
Matthew Casperson
2019-03-19 09:29:06 +10:00
parent b7d1522ea1
commit a1fcd1c623

View File

@@ -29,11 +29,10 @@ export default class Cluster extends PIXI.Graphics {
const left = 10
const top = 20
const padding = 5
const initialMasterHeight = 15
let masterX = left
let masterY = top
let masterWidth = 0
let masterHeight = initialMasterHeight
let masterHeight = 0
let workerX = left
let workerY = top
let workerWidth = 0
@@ -51,7 +50,7 @@ export default class Cluster extends PIXI.Graphics {
masterY += nodeBox.height + padding
masterHeight += nodeBox.height + padding
}
if (masterHeight == initialMasterHeight) {
if (masterHeight == 0) {
masterHeight = nodeBox.height + padding
}
nodeBox.x = masterX
@@ -78,16 +77,25 @@ export default class Cluster extends PIXI.Graphics {
nodeBox.y += masterHeight
}
if (masterX === left) {
masterX = workerX
}
/*
Place unassigned pods to the left of the master nodes, or
to the left of the worker nodes if there were no masters.
*/
var unassignedX = masterX === left ? workerX : masterX
for (const pod of Object.values(this.cluster.unassigned_pods)) {
var podBox = Pod.getOrCreate(pod, this, this.tooltip)
podBox.x = masterX
var podBox = Pod.getOrCreate(pod, this, this.tooltip, this.menu)
podBox.x = unassignedX
podBox.y = masterY
podBox.draw()
this.addChild(podBox)
masterX += 20
unassignedX += 20
}
masterWidth = Math.max(masterX, masterWidth)
masterWidth = Math.max(unassignedX, masterWidth)
workerWidth = Math.max(workerX, workerWidth)
this.lineStyle(2, App.current.theme.primaryColor, 1)