Skip to content

Commit

Permalink
🩹 Rounds numbers in gl-alerts widget (gchq#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Feb 11, 2022
1 parent e8cee3b commit e194d74
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Widgets/GlAlerts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default {
filters: {},
methods: {
processData(alertData) {
const round = (num) => ((num && typeof num === 'number') ? Math.round(num) : num);
if (!alertData || alertData.length === 0) {
this.noResults = true;
} else {
Expand All @@ -51,8 +52,9 @@ export default {
lasted: alert[1] ? getTimeDifference(alert[0] * 1000, alert[1] * 1000) : 'Ongoing',
severity: alert[2],
category: alert[3],
value: alert[5],
minMax: `Min: ${alert[4]}%<br>Avg: ${alert[5]}%<br>Max: ${alert[6]}%`,
value: round(alert[5]),
minMax: `Min: ${round(alert[4])}%<br>Avg: `
+ `${round(alert[5])}%<br>Max: ${round(alert[6])}%`,
});
});
this.alerts = alerts;
Expand Down

0 comments on commit e194d74

Please # to comment.