dashboard: disk widget: be more consistent with labels

This commit is contained in:
Stephan de Wit 2024-05-13 15:06:17 +02:00
parent 189fb51496
commit fc13a9b34e
2 changed files with 7 additions and 2 deletions

View File

@ -145,6 +145,7 @@ export default class Disk extends BaseWidget {
type: 'bar',
data: {
labels: [],
types: [],
datasets: [
{
// used
@ -189,6 +190,10 @@ export default class Disk extends BaseWidget {
},
tooltip: {
callbacks: {
title: (tooltipItem) => {
let type = this.detailed_chart.config.data.types[tooltipItem[0].dataIndex];
return `${tooltipItem[0].label} [${type}]`;
},
label: (tooltipItem) => {
return `${tooltipItem.dataset.descr}: ${this._formatBytes(tooltipItem.raw)}`;
}
@ -221,7 +226,8 @@ export default class Disk extends BaseWidget {
totals.push(total);
if (init) {
this.detailed_chart.config.data.labels.push(device.device);
this.detailed_chart.config.data.types.push(device.type);
this.detailed_chart.config.data.labels.push(device.mountpoint);
}
this.detailed_chart.config.data.datasets[0].data.push(used);
this.detailed_chart.config.data.datasets[1].data.push(free);

View File

@ -154,7 +154,6 @@ export default class Firewall extends BaseTableWidget {
this._updateChart(data.rid, this.counters[data.rid].label, this.counters[data.rid].count);
if (Object.keys(this.counters).length < this.rotation) {
console.log('updating grid');
this.config.callbacks.updateGrid();
}
}