Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Deconfiguration Records page - 1060 #328

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/components/Composables/useTableSelectableComposable.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ const useTableSelectableComposable = () => {
}
};

const toggleSelectRowById = (tableRef, rowIndex, rowSelected, row) => {
if (tableRef && rowIndex !== undefined) {
if (!rowSelected) {
// Find the index of the object to remove
const indexToRemove = selectedRowsList.value.findIndex(
(item) => item.id === row.id,
);

// Check if the object exists in the array
if (indexToRemove !== -1) {
tableRef.unselectRow(rowIndex);
// Remove the object from the array
selectedRowsList.value.splice(indexToRemove, 1);
}
} else {
tableRef.selectRow(rowIndex);
}
}
};

const onRowSelected = (selectedRows, totalRowsCount) => {
if (selectedRows && totalRowsCount !== undefined) {
if (selectedRowsList.value.indexOf(selectedRows) === -1) {
Expand Down Expand Up @@ -65,6 +85,7 @@ const useTableSelectableComposable = () => {
return {
clearSelectedRows,
toggleSelectRow,
toggleSelectRowById,
onRowSelected,
onChangeHeaderCheckbox,
selectedRowsList,
Expand All @@ -73,4 +94,4 @@ const useTableSelectableComposable = () => {
};
};

export default useTableSelectableComposable;
export default useTableSelectableComposable;
9 changes: 9 additions & 0 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import HardwareDeconfiguration from '../views/Settings/HardwareDeconfiguration/H
import HostConsole from '@/views/Operations/HostConsole';
import HostConsoleConsole from '@/views/Operations/HostConsole/HostConsoleConsole.vue';
import CapacityOnDemand from '../views/ResourceManagement/CapacityOnDemand/CapacityOnDemand.vue';
import DeconfigurationRecords from '../views/Logs/DeconfigurationRecords/DeconfigurationRecords.vue';

const roles = {
administrator: 'Administrator',
Expand Down Expand Up @@ -188,6 +189,14 @@ export const routes = [
title: i18n.global.t('appPageTitle.hostConsole'),
},
},
{
path: '/logs/deconfiguration-records',
name: 'deconfiguration-records',
component: DeconfigurationRecords,
meta: {
title: i18n.global.t('appPageTitle.deconfigurationRecords'),
},
},
{
path: '/settings/power-restore-policy',
name: 'power-restore-policy',
Expand Down
2 changes: 2 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import CertificatesStore from './modules/SecurityAndAccess/CertificatesStore';
import UserManagementStore from './modules/SecurityAndAccess/UserManagementStore';
import PcieTopologyStore from './modules/HardwareStatus/PcieTopologyStore.js';
import HardwareDeconfigurationStore from './modules/Settings/HardwareDeconfigurationStore';
import DeconfigurationRecordsStore from './modules/Logs/DeconfigurationRecordsStore.js';
// ... (export use other stores)
export {
EventLogStore,
Expand Down Expand Up @@ -63,4 +64,5 @@ export {
UserManagementStore,
PcieTopologyStore,
HardwareDeconfigurationStore,
DeconfigurationRecordsStore
};
36 changes: 17 additions & 19 deletions src/store/modules/Logs/DeconfigurationRecordsStore.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import api from '@/store/api';
import i18n from '@/i18n';
import { defineStore } from 'pinia';

const DeconfigurationRecordsStore = {
namespaced: true,
state: {
export const DeconfigurationRecordsStore = defineStore('deconfigurationRecordsStore', {
state: () => ({
deconfigRecords: [],
},
}),
getters: {
deconfigRecords: (state) => state.deconfigRecords,
},
mutations: {
setDeconfigurationRecordInfo: (state, deconfigRecords) =>
(state.deconfigRecords = deconfigRecords),
deconfigRecordsGetter: (state) => state.deconfigRecords,
},
actions: {
async getDeconfigurationRecordInfo({ commit }) {
async getDeconfigurationRecordInfo() {
return await api
.get('/redfish/v1/Systems/system/LogServices/HardwareIsolation/Entries')
.then(async ({ data: { Members = [] } = {} }) => {
Expand Down Expand Up @@ -85,29 +81,31 @@ const DeconfigurationRecordsStore = {
severity: Severity,
location: LocationCode,
eventID: eventId,
isSelected: false,
toggleDetails: false,
};
}),
);
commit('setDeconfigurationRecordInfo', deconfigRecords);
this.deconfigRecords = deconfigRecords;
})
.catch((error) => console.log(error));
},
async clearAllEntries({ dispatch }, data) {
async clearAllEntries(data) {
return await api
.post(
'/redfish/v1/Systems/system/LogServices/HardwareIsolation/Actions/LogService.ClearLog',
)
.then(() => dispatch('getDeconfigurationRecordInfo'))
.then(() => this.getDeconfigurationRecordInfo())
.then(() =>
i18n.tc(
i18n.global.t(
'pageDeconfigurationRecords.toast.successDelete',
data.length,
),
)
.catch((error) => {
console.log(error);
throw new Error(
i18n.tc(
i18n.global.t(
'pageDeconfigurationRecords.toast.errorDelete',
data.length,
),
Expand Down Expand Up @@ -141,9 +139,9 @@ const DeconfigurationRecordsStore = {
})
.then(() => {
const message = [
i18n.t('pageDeconfigurationRecords.toast.successStartDownload'),
i18n.global.t('pageDeconfigurationRecords.toast.successStartDownload'),
{
title: i18n.t(
title: i18n.global.t(
'pageDeconfigurationRecords.toast.successStartDownloadTitle',
),
},
Expand All @@ -154,11 +152,11 @@ const DeconfigurationRecordsStore = {
.catch((error) => {
console.log(error);
throw new Error(
i18n.t('pageDeconfigurationRecords.toast.errorStartDownload'),
i18n.global.t('pageDeconfigurationRecords.toast.errorStartDownload'),
);
});
},
},
};
});

export default DeconfigurationRecordsStore;
Loading