#71 fix pod sorting

This commit is contained in:
Henning Jacobs
2016-12-27 19:12:01 +01:00
parent 30efa50174
commit 9f7e9f52bd
2 changed files with 8 additions and 3 deletions

View File

@@ -169,7 +169,7 @@ export default class App {
this.sorterFn = items[0].value this.sorterFn = items[0].value
const app = this const app = this
const selectBox = new SelectBox(items, this.sorterFn, function(value) { const selectBox = new SelectBox(items, this.sorterFn, function(value) {
app.sorterFn = value app.changeSorting(value)
}) })
selectBox.x = 265 selectBox.x = 265
selectBox.y = 3 selectBox.y = 3
@@ -344,6 +344,11 @@ export default class App {
this.renderer.render(this.stage) this.renderer.render(this.stage)
} }
changeSorting(newSortFunction) {
this.sorterFn = newSortFunction
this.update(this.clusters)
}
switchTheme(newTheme) { switchTheme(newTheme) {
this.theme = Theme.get(newTheme) this.theme = Theme.get(newTheme)
this.draw() this.draw()

View File

@@ -81,7 +81,7 @@ export default class Node extends PIXI.Graphics {
bars.y = 1 bars.y = 1
nodeBox.addChild(bars.draw()) nodeBox.addChild(bars.draw())
nodeBox.addPods(App.sorterFn) nodeBox.addPods(App.current.sorterFn)
return nodeBox return nodeBox
} }
@@ -89,7 +89,7 @@ export default class Node extends PIXI.Graphics {
const nodeBox = this const nodeBox = this
let px = 24 let px = 24
let py = 20 let py = 20
const pods = sorterFn !== 'undefined' ? this.node.pods.sort(sorterFn) : this.node.pods const pods = this.node.pods.sort(sorterFn)
for (const pod of pods) { for (const pod of pods) {
if (pod.namespace != 'kube-system') { if (pod.namespace != 'kube-system') {
const podBox = Pod.getOrCreate(pod, this.cluster, this.tooltip) const podBox = Pod.getOrCreate(pod, this.cluster, this.tooltip)