dashboard: interface statistics: format traffic counters

This commit is contained in:
Stephan de Wit 2024-04-08 14:24:41 +02:00
parent 70867a40fd
commit 832f6f796d
1 changed files with 7 additions and 8 deletions

View File

@ -140,17 +140,16 @@ export default class InterfaceStatistics extends BaseWidget {
tooltip: {
callbacks: {
label: (tooltipItem) => {
const idx = this.labels.indexOf(tooltipItem.label);
let obj = this.rawData[tooltipItem.label];
let result = [
`${tooltipItem.label}`,
`${this.translations.bytesin}: ${obj["bytes received"]}`,
`${this.translations.bytesout}: ${obj["bytes transmitted"]}`,
`${this.translations.packetsin}: ${obj["packets received"]}`,
`${this.translations.packetsout}: ${obj["packets transmitted"]}`,
`${this.translations.errorsin}: ${obj["input errors"]}`,
`${this.translations.errorsout}: ${obj["output errors"]}`,
`${this.translations.collisions}: ${obj["collisions"]}`,
`${this.translations.bytesin}: ${byteFormat(obj["bytes received"])}`,
`${this.translations.bytesout}: ${byteFormat(obj["bytes transmitted"])}`,
`${this.translations.packetsin}: ${parseInt(obj["packets received"]).toLocaleString()}`,
`${this.translations.packetsout}: ${parseInt(obj["packets transmitted"]).toLocaleString()}`,
`${this.translations.errorsin}: ${parseInt(obj["input errors"]).toLocaleString()}`,
`${this.translations.errorsout}: ${parseInt(obj["output errors"]).toLocaleString()}`,
`${this.translations.collisions}: ${parseInt(obj["collisions"]).toLocaleString()}`,
];
return result;
}