|
|
|
|
@@ -24,20 +24,24 @@ export default class Bars extends PIXI.Graphics {
|
|
|
|
|
const cpuHeight = barHeight / bars.resources.cpu.capacity
|
|
|
|
|
bars.interactive = true
|
|
|
|
|
bars.lineStyle(0, 0xaaffaa, 1)
|
|
|
|
|
bars.beginFill(getBarColor(bars.resources.cpu.requested, bars.resources.cpu.capacity), 1)
|
|
|
|
|
bars.drawRect(5, 110 - bars.resources.cpu.requested * cpuHeight, 2.5, bars.resources.cpu.requested * cpuHeight)
|
|
|
|
|
bars.beginFill(getBarColor(bars.resources.cpu.requested, bars.resources.cpu.capacity - bars.resources.cpu.reserved), 1)
|
|
|
|
|
bars.drawRect(5, 110 - (bars.resources.cpu.requested + bars.resources.cpu.reserved) * cpuHeight, 2.5, (bars.resources.cpu.requested + bars.resources.cpu.reserved) * cpuHeight)
|
|
|
|
|
bars.beginFill(getBarColor(bars.resources.cpu.used, bars.resources.cpu.capacity), 1)
|
|
|
|
|
bars.drawRect(7.5, 110 - bars.resources.cpu.used * cpuHeight, 2.5, bars.resources.cpu.used * cpuHeight)
|
|
|
|
|
bars.endFill()
|
|
|
|
|
bars.lineStyle(1, App.current.theme.primaryColor, 1)
|
|
|
|
|
bars.drawRect(5, 110 - bars.resources.cpu.reserved * cpuHeight, 5, bars.resources.cpu.reserved * cpuHeight)
|
|
|
|
|
|
|
|
|
|
// Memory
|
|
|
|
|
const scale = bars.resources.memory.capacity / barHeight
|
|
|
|
|
bars.lineStyle(0, 0xaaffaa, 1)
|
|
|
|
|
bars.beginFill(getBarColor(bars.resources.memory.requested, bars.resources.memory.capacity), 1)
|
|
|
|
|
bars.drawRect(14, 110 - bars.resources.memory.requested / scale, 2.5, bars.resources.memory.requested / scale)
|
|
|
|
|
bars.beginFill(getBarColor(bars.resources.memory.requested, bars.resources.memory.capacity - bars.resources.memory.reserved), 1)
|
|
|
|
|
bars.drawRect(14, 110 - (bars.resources.memory.requested + bars.resources.memory.reserved) / scale, 2.5, (bars.resources.memory.requested + bars.resources.memory.reserved) / scale)
|
|
|
|
|
bars.beginFill(getBarColor(bars.resources.memory.used, bars.resources.memory.capacity), 1)
|
|
|
|
|
bars.drawRect(16.5, 110 - bars.resources.memory.used / scale, 2.5, bars.resources.memory.used / scale)
|
|
|
|
|
bars.endFill()
|
|
|
|
|
bars.lineStyle(1, App.current.theme.primaryColor, 1)
|
|
|
|
|
bars.drawRect(14, 110 - bars.resources.memory.reserved / scale, 5, bars.resources.memory.reserved / scale)
|
|
|
|
|
|
|
|
|
|
bars.lineStyle(1, App.current.theme.primaryColor, 1)
|
|
|
|
|
for (var i = 0; i < bars.resources.cpu.capacity; i++) {
|
|
|
|
|
@@ -48,14 +52,16 @@ export default class Bars extends PIXI.Graphics {
|
|
|
|
|
|
|
|
|
|
bars.on('mouseover', function () {
|
|
|
|
|
let s = 'CPU: \n'
|
|
|
|
|
const {capacity: cpuCap, requested: cpuReq, used: cpuUsed} = bars.resources.cpu
|
|
|
|
|
const {capacity: cpuCap, reserved: cpuRes, requested: cpuReq, used: cpuUsed} = bars.resources.cpu
|
|
|
|
|
s += '\t\t Capacity : ' + cpuCap + '\n'
|
|
|
|
|
s += '\t\t Reserved : ' + cpuRes.toFixed(2) + '\n'
|
|
|
|
|
s += '\t\t Requested : ' + cpuReq.toFixed(2) + '\n'
|
|
|
|
|
s += '\t\t Used : ' + cpuUsed.toFixed(2) + '\n'
|
|
|
|
|
s += '\nMemory: \n'
|
|
|
|
|
|
|
|
|
|
const {capacity: memCap, requested: memReq, used: memUsed} = bars.resources.memory
|
|
|
|
|
const {capacity: memCap, reserved: memRes, requested: memReq, used: memUsed} = bars.resources.memory
|
|
|
|
|
s += '\t\t Capacity : ' + (memCap / FACTORS.Gi).toFixed(2) + ' GiB\n'
|
|
|
|
|
s += '\t\t Reserved : ' + (memRes / FACTORS.Gi).toFixed(2) + ' GiB\n'
|
|
|
|
|
s += '\t\t Requested : ' + (memReq / FACTORS.Gi).toFixed(2) + ' GiB\n'
|
|
|
|
|
s += '\t\t Used : ' + (memUsed / FACTORS.Gi).toFixed(2) + ' GiB\n'
|
|
|
|
|
|
|
|
|
|
|