summaryrefslogtreecommitdiff
path: root/src/env/store
diff options
context:
space:
mode:
Diffstat (limited to 'src/env/store')
-rw-r--r--src/env/store/Dumps/DumpsStore.js117
-rw-r--r--src/env/store/ibm.js2
2 files changed, 1 insertions, 118 deletions
diff --git a/src/env/store/Dumps/DumpsStore.js b/src/env/store/Dumps/DumpsStore.js
deleted file mode 100644
index 3b91354b..00000000
--- a/src/env/store/Dumps/DumpsStore.js
+++ /dev/null
@@ -1,117 +0,0 @@
-import api, { getResponseCount } from '@/store/api';
-import i18n from '@/i18n';
-
-const DumpsStore = {
- namespaced: true,
- state: {
- bmcDumps: [],
- },
- getters: {
- bmcDumps: (state) => state.bmcDumps,
- },
- mutations: {
- setBmcDumps: (state, dumps) => {
- state.bmcDumps = dumps.map((dump) => ({
- data: dump.AdditionalDataURI,
- dateTime: new Date(dump.Created),
- dumpType: dump.Name,
- id: dump.Id,
- location: dump['@odata.id'],
- size: dump.AdditionalDataSizeBytes,
- }));
- },
- },
- actions: {
- async getBmcDumps({ commit }) {
- return await api
- .get('/redfish/v1/Managers/bmc/LogServices/Dump/Entries')
- .then(({ data = {} }) => commit('setBmcDumps', data.Members || []))
- .catch((error) => console.log(error));
- },
- async createBmcDump() {
- return await api
- .post(
- '/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData',
- {
- DiagnosticDataType: 'Manager',
- OEMDiagnosticDataType: '',
- }
- )
- .catch((error) => {
- console.log(error);
- throw new Error(i18n.t('pageDumps.toast.errorStartBmcDump'));
- });
- },
- async createSystemDump() {
- return await api
- .post(
- '/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.CollectDiagnosticData',
- {
- DiagnosticDataType: 'OEM',
- OEMDiagnosticDataType: 'System',
- }
- )
- .catch((error) => {
- console.log(error);
- throw new Error(i18n.t('pageDumps.toast.errorStartSystemDump'));
- });
- },
- async deleteDumps({ dispatch }, dumps) {
- const promises = dumps.map(({ location }) =>
- api.delete(location).catch((error) => {
- console.log(error);
- return error;
- })
- );
- return await api
- .all(promises)
- .then((response) => {
- dispatch('getBmcDumps');
- return response;
- })
- .then(
- api.spread((...responses) => {
- const { successCount, errorCount } = getResponseCount(responses);
- const toastMessages = [];
-
- if (successCount) {
- const message = i18n.tc(
- 'pageDumps.toast.successDeleteDump',
- successCount
- );
- toastMessages.push({ type: 'success', message });
- }
-
- if (errorCount) {
- const message = i18n.tc(
- 'pageDumps.toast.errorDeleteDump',
- errorCount
- );
- toastMessages.push({ type: 'error', message });
- }
-
- return toastMessages;
- })
- );
- },
- async deleteAllDumps({ commit, state }) {
- const totalDumpCount = state.bmcDumps.length;
- return await api
- .post(
- '/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog'
- )
- .then(() => {
- commit('setBmcDumps', []);
- return i18n.tc('pageDumps.toast.successDeleteDump', totalDumpCount);
- })
- .catch((error) => {
- console.log(error);
- throw new Error(
- i18n.tc('pageDumps.toast.errorDeleteDump', totalDumpCount)
- );
- });
- },
- },
-};
-
-export default DumpsStore;
diff --git a/src/env/store/ibm.js b/src/env/store/ibm.js
index 980236fc..ff20b9cf 100644
--- a/src/env/store/ibm.js
+++ b/src/env/store/ibm.js
@@ -1,5 +1,5 @@
import store from '@/store';
-import DumpsStore from './Dumps/DumpsStore';
+import DumpsStore from '@/store/modules/Health/DumpsStore';
store.unregisterModule('virtualMedia');