diff options
author | Sukanya Pandey <sukapan1@in.ibm.com> | 2020-10-28 08:08:00 +0300 |
---|---|---|
committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-11-12 22:02:34 +0300 |
commit | 2f6d5520fd63c516684c753efcde54d493aa8c5f (patch) | |
tree | 41f910c48f2f2786986ea0f84754e69fe225f482 | |
parent | 7e6fc97fc9eafad3c3fdd279648ed0a707f6ba34 (diff) | |
download | webui-vue-2f6d5520fd63c516684c753efcde54d493aa8c5f.tar.xz |
Delete all selected event logs
-Earlier all the event logs were deleted ID wise.
-Now when all logs are selected then below API will be called to delete all the logs.
-API : '/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog'.
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: Ib7026a4fe3c324e6a998be747325f379a944f1c8
-rw-r--r-- | src/store/modules/Health/EventLogStore.js | 12 | ||||
-rw-r--r-- | src/views/Health/EventLogs/EventLogs.vue | 14 |
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); + } + } }); } }, |