Skip to content

Commit

Permalink
[WEBUI] Clear old alert messages in the WebUI #3042
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Dec 22, 2024
1 parent cf56203 commit 0e9e74f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
15 changes: 15 additions & 0 deletions glances/outputs/static/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,21 @@ body {
margin-bottom: 1em;
}

.clear-button {
background-color: $glances-link-hover-color !important;
color: white;
border: none;
text-align: center;
text-decoration: none;
display: inline-block;
transition-duration: 0.4s;
}

.clear-button:hover {
background-color: white;
color: black;
}

#system {
span {
padding-left: 10px;
Expand Down
12 changes: 12 additions & 0 deletions glances/outputs/static/js/components/plugin-alert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<section class="plugin" id="alerts">
<span class="title" v-if="hasAlerts">
Warning or critical alerts (last {{ countAlerts }} entries)
<span>
<button class="clear-button" v-on:click="clear()">Clear alerts</button>
</span>
</span>
<span class="title" v-else>No warning or critical alert detected</span>
<table class="table table-sm table-borderless">
Expand Down Expand Up @@ -105,6 +108,15 @@ export default {
':' + String(date.getMinutes()).padStart(2, '0') +
':' + String(date.getSeconds()).padStart(2, '0') +
'(' + tzString + ')';
},
clear() {
const requestOptions = {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
};
fetch('api/4/events/clear/all', requestOptions)
.then(response => response.json())
.then(data => product.value = data);
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion glances/outputs/static/public/browser.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions glances/outputs/static/public/glances.js

Large diffs are not rendered by default.

0 comments on commit 0e9e74f

Please sign in to comment.