Add button to clear POST code logs
Utilize '#LogService.ClearLog' action to provide a possibility for the
user to clear POST code logs.
Change-Id: Iadd94b9ebc93bc81b13ee979962103587c939fc7
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
diff --git a/src/store/modules/Logs/PostCodeLogsStore.js b/src/store/modules/Logs/PostCodeLogsStore.js
index ac470ec..836f984 100644
--- a/src/store/modules/Logs/PostCodeLogsStore.js
+++ b/src/store/modules/Logs/PostCodeLogsStore.js
@@ -1,4 +1,5 @@
import api from '@/store/api';
+import i18n from '@/i18n';
const PostCodeLogsStore = {
namespaced: true,
@@ -33,6 +34,22 @@
console.log('POST Codes Log Data:', error);
});
},
+ async deleteAllPostCodeLogs({ dispatch }, data) {
+ return await api
+ .post(
+ '/redfish/v1/Systems/system/LogServices/PostCodes/Actions/LogService.ClearLog'
+ )
+ .then(() => dispatch('getPostCodesLogData'))
+ .then(() =>
+ i18n.tc('pagePostCodeLogs.toast.successDelete', data.length)
+ )
+ .catch((error) => {
+ console.log(error);
+ throw new Error(
+ i18n.tc('pagePostCodeLogs.toast.errorDelete', data.length)
+ );
+ });
+ },
},
};