mirror of https://github.com/Lissy93/dashy.git
🩹 Rounds numbers in gl-alerts widget (#454)
This commit is contained in:
parent
e8cee3bd4d
commit
e194d741ac
|
@ -39,6 +39,7 @@ export default {
|
||||||
filters: {},
|
filters: {},
|
||||||
methods: {
|
methods: {
|
||||||
processData(alertData) {
|
processData(alertData) {
|
||||||
|
const round = (num) => ((num && typeof num === 'number') ? Math.round(num) : num);
|
||||||
if (!alertData || alertData.length === 0) {
|
if (!alertData || alertData.length === 0) {
|
||||||
this.noResults = true;
|
this.noResults = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -51,8 +52,9 @@ export default {
|
||||||
lasted: alert[1] ? getTimeDifference(alert[0] * 1000, alert[1] * 1000) : 'Ongoing',
|
lasted: alert[1] ? getTimeDifference(alert[0] * 1000, alert[1] * 1000) : 'Ongoing',
|
||||||
severity: alert[2],
|
severity: alert[2],
|
||||||
category: alert[3],
|
category: alert[3],
|
||||||
value: alert[5],
|
value: round(alert[5]),
|
||||||
minMax: `Min: ${alert[4]}%<br>Avg: ${alert[5]}%<br>Max: ${alert[6]}%`,
|
minMax: `Min: ${round(alert[4])}%<br>Avg: `
|
||||||
|
+ `${round(alert[5])}%<br>Max: ${round(alert[6])}%`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.alerts = alerts;
|
this.alerts = alerts;
|
||||||
|
|
Loading…
Reference in New Issue