summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/store/modules/Health/EventLogStore.js12
-rw-r--r--src/views/Health/EventLogs/EventLogs.vue14
2 files changed, 25 insertions, 1 deletions
diff --git a/src/store/modules/Health/EventLogStore.js b/src/store/modules/Health/EventLogStore.js
index bf1de2f4..cdfb358a 100644
--- a/src/store/modules/Health/EventLogStore.js
+++ b/src/store/modules/Health/EventLogStore.js
@@ -59,6 +59,18 @@ const EventLogStore = {
console.log('Event Log Data:', error);
});
},
+ async deleteAllEventLogs({ dispatch }, data) {
+ return await api
+ .post(
+ '/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog'
+ )
+ .then(() => dispatch('getEventLogData'))
+ .then(() => i18n.tc('pageEventLogs.toast.successDelete', data))
+ .catch((error) => {
+ console.log(error);
+ throw new Error(i18n.tc('pageEventLogs.toast.errorDelete', data));
+ });
+ },
async deleteEventLogs({ dispatch }, uris = []) {
const promises = uris.map((uri) =>
api.delete(uri).catch((error) => {
diff --git a/src/views/Health/EventLogs/EventLogs.vue b/src/views/Health/EventLogs/EventLogs.vue
index 90f589a3..b4a47120 100644
--- a/src/views/Health/EventLogs/EventLogs.vue
+++ b/src/views/Health/EventLogs/EventLogs.vue
@@ -353,7 +353,19 @@ export default {
}
)
.then((deleteConfirmed) => {
- if (deleteConfirmed) this.deleteLogs(uris);
+ if (deleteConfirmed) {
+ if (this.selectedRows.length === this.allLogs.length) {
+ this.$store
+ .dispatch(
+ 'eventLog/deleteAllEventLogs',
+ this.selectedRows.length
+ )
+ .then((message) => this.successToast(message))
+ .catch(({ message }) => this.errorToast(message));
+ } else {
+ this.deleteLogs(uris);
+ }
+ }
});
}
},