Skip to content
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
1 change: 0 additions & 1 deletion src/assets/styles/bmc/custom/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.bg-success {
background-color: theme-color-light($success) !important;
}
width: 120%;
}

.card-header,
Expand Down
1 change: 0 additions & 1 deletion src/assets/styles/bmc/custom/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.b-table-sticky-header {
max-height: 75vh;
min-height: 100px;
min-width: 116%;
border: 1px solid #efefef;
.table.b-table {
thead {
Expand Down
9 changes: 9 additions & 0 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Memory from '@/views/ResourceManagement/Memory';
import Power from '@/views/ResourceManagement/Power';
import PowerRestorePolicy from '@/views/Settings/PowerRestorePolicy';
import ConcurrentMaintenance from '../views/HardwareStatus/ConcurrentMaintenance/ConcurrentMaintenance.vue';
import PcieTopology from '../views/HardwareStatus/PcieTopology/PcieTopology.vue';
import IBMiServiceFunctions from '@/views/Logs/IBMiServiceFunctions';
import Notices from '@/views/Notices/Notices.vue';
import Sessions from '@/views/SecurityAndAccess/Sessions';
Expand Down Expand Up @@ -92,6 +93,14 @@ export const routes = [
title: i18n.global.t('appPageTitle.inventory'),
},
},
{
path: '/hardware-status/pcie-topology',
name: 'pcie-topology',
component: PcieTopology,
meta: {
title: i18n.global.t('appPageTitle.pcieTopology'),
},
},
{
path: '/hardware-status/inventory',
name: 'inventory',
Expand Down
3 changes: 2 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import FabricAdaptersStore from './modules/HardwareStatus/FabricAdaptersStore';
import SystemParametersStore from './modules/ResourceManagement/SystemParametersStore';
import CertificatesStore from './modules/SecurityAndAccess/CertificatesStore';
import UserManagementStore from './modules/SecurityAndAccess/UserManagementStore';

import PcieTopologyStore from './modules/HardwareStatus/PcieTopologyStore.js';
// ... (export use other stores)
export {
EventLogStore,
Expand Down Expand Up @@ -60,4 +60,5 @@ export {
SystemParametersStore,
CertificatesStore,
UserManagementStore,
PcieTopologyStore
};
10 changes: 10 additions & 0 deletions src/store/modules/Authentication/AuthenticationStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ export const AuthenticationStore = defineStore('authentication', {
const headers = {
'X-Xsrf-Token': cookies.get('X-XSRF-TOKEN'),
};
Cookies.remove('XSRF-TOKEN');
Cookies.remove('IsAuthenticated');
localStorage.removeItem('storedModelType');
localStorage.removeItem('storedUsername');
localStorage.removeItem('storedCurrentUser');
localStorage.removeItem('storedHmcManagedValue');
localStorage.removeItem('storedLanguage');
this.xsrfCookie = undefined;
this.isAuthenticatedCookie = undefined;
return api
.post('/logout', { data: [] }, { headers: headers })
.then(() => {
Expand All @@ -73,6 +82,7 @@ export const AuthenticationStore = defineStore('authentication', {
console.log(error);
this.logoutRemove();
});

},
getUserInfo(username) {
return api
Expand Down
43 changes: 43 additions & 0 deletions src/store/modules/GlobalStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,23 @@ export const GlobalStore = defineStore('global', {
username: localStorage.getItem('storedUsername'),
isAuthorized: true,
userPrivilege: null,
currentUser: JSON.parse(localStorage.getItem('storedCurrentUser')),
}),
getters: {
bootProgressGetter: (state) => state.bootProgress,
isInPhypStandby: (state) =>
// SystemHardwareInitializationComplete and after is "PHYP in standby"
state.bootProgress === 'SystemHardwareInitializationComplete' ||
state.bootProgress === 'SetupEntered' ||
state.bootProgress === 'OSBootStarted' ||
state.bootProgress === 'OSRunning',
isOSRunningGetter: (state) => state.bootProgress === 'OSRunning',
getIsUtcDisplay: (state) => state.isUtcDisplay,
safeModeGetter: (state) => state.safeMode,
serverStatusGetter: (state) => state.serverStatus,
currentUserGetter: (state) => state.currentUser,
isServiceUser: (state) =>
state.currentUser?.RoleId === 'OemIBMServiceAgent' || !state.currentUser,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state currentUser is neither initialised nor assigned a value anywhere in the file. getCurrentUser() and getAccountService() functions need to be included from older file. Or directly state userPrivilege can be used as well to get the role id of the user.

},
actions: {
async getBmcTime() {
Expand All @@ -65,6 +75,9 @@ export const GlobalStore = defineStore('global', {
})
.catch((error) => console.log(error));
},
setCurrentUser (currentUsr) {
this.currentUser = currentUsr
},
getSystemInfo() {
api
.get('/redfish/v1/Systems/system')
Expand Down Expand Up @@ -102,6 +115,36 @@ export const GlobalStore = defineStore('global', {
return Promise.reject();
});
},
getCurrentUser(
username = localStorage.getItem('storedUsername')
) {
if (localStorage.getItem('storedCurrentUser')) return;
return api
.get(`/redfish/v1/AccountService/Accounts/${username}`)
.then(({ data }) => {
this.setCurrentUser(data)
localStorage.setItem(
'storedCurrentUser',
JSON.stringify(this.currentUser)
);
})
.catch((error) => {
console.log(error);
return this.getAccountService();
});
},
getAccountService() {
return api
.get('/redfish/v1/AccountService')
.then((response) => {
if (response.data?.LDAP?.RemoteRoleMapping?.length > 0) {
return Promise.resolve();
}
})
.catch(() => {
return Promise.reject();
});
},
async getBootProgress() {
api
.get('/redfish/v1/Systems/system')
Expand Down
162 changes: 87 additions & 75 deletions src/store/modules/HardwareStatus/PcieTopologyStore.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import api from '@/store/api';
import i18n from '@/i18n';
import { defineStore } from 'pinia';

const PcieTopologyStore = {
export const PcieTopologyStore = defineStore('pcieTopologyStore',{
namespaced: true,
state: {
state: ()=>({
entries: [],
},
}),
getters: {
entries: (state) => state.entries,
entriesGetter: (state) => state.entries,
},
mutations: {
setEntries: (state, data) => {
state.entries = data.map((pcie) => {
actions: {
setEntries(data){
this.entries = data.map((pcie) => {
return {
id: pcie?.linkId,
resetLinkAvailable: pcie?.resetLinkAvailable,
Expand All @@ -33,9 +34,7 @@ const PcieTopologyStore = {
};
});
},
},
actions: {
async resetTheLink(_, requestBody) {
async resetTheLink(requestBody) {
const body = {
Oem: {
IBM: {
Expand Down Expand Up @@ -69,7 +68,7 @@ const PcieTopologyStore = {
console.error('Error', error);
});
},
async getTopologyScreen({ commit }) {
async getTopologyScreen() {
let chassisMembers = [];
let pcieDeviceMembers = [];
let procMembers = [];
Expand Down Expand Up @@ -1125,16 +1124,17 @@ const PcieTopologyStore = {
});
});
rows.push(row);
commit('setEntries', rows);
// commit('setEntries', rows);
this.setEntries(rows)
}
});
});
},
async getLedValue(_, requestBody) {
async getLedValue(requestBody) {
const uri = requestBody.uri;
return await api.get(uri);
},
async updateLedValue(_, requestBody) {
async updateLedValue(requestBody) {
await api.all(
[''].map(async () => {
if (requestBody.type === 'ioSlots') {
Expand Down Expand Up @@ -1179,78 +1179,90 @@ const PcieTopologyStore = {
}),
);
},
async getAllLedValues(_, selectedObj) {
async getAllLedValues(selectedObj) {
let returningObj = {
pcieBridge: [],
localPortLocation: [],
remotePortLocation: [],
ioSlots: [],
};
await api.all(
[''].map(async () => {
if (selectedObj.pcieBridge?.uri) {
await api.get(selectedObj.pcieBridge?.uri).then(({ data }) => {
returningObj.pcieBridge.push({

const fetchPcieBridge = async () => {
if (selectedObj.pcieBridge?.uri) {
const { data } = await api.get(selectedObj.pcieBridge?.uri);
returningObj.pcieBridge.push({
led: data.LocationIndicatorActive,
locationNumber: data.Location?.PartLocation?.ServiceLabel,
uri: data['@odata.id'],
});
}
};

const fetchLocalPorts = async () => {
if (selectedObj.localPortLocation.length > 0) {
await Promise.all(
selectedObj.localPortLocation.map(async (local) => {
const { data } = await api.get(local.uri);
returningObj.localPortLocation.push({
led: data.LocationIndicatorActive,
locationNumber: data.Location?.PartLocation?.ServiceLabel,
uri: data['@odata.id'],
});
});
}
if (selectedObj.localPortLocation.length > 0) {
await api.all(
selectedObj.localPortLocation.map(async (local) => {
await api.get(local.uri).then(({ data }) => {
returningObj.localPortLocation.push({
led: data.LocationIndicatorActive,
locationNumber: data.Location?.PartLocation?.ServiceLabel,
uri: data['@odata.id'],
});
});
}),
);
}
if (selectedObj.remotePortLocation.length > 0) {
await api.all(
selectedObj.remotePortLocation.map(async (local) => {
await api.get(local.uri).then(({ data }) => {
returningObj.remotePortLocation.push({
led: data.LocationIndicatorActive,
locationNumber: data.Location?.PartLocation?.ServiceLabel,
uri: data['@odata.id'],
});
});
}),
);
}
if (selectedObj.ioSlots.length > 0) {
await api.all(
selectedObj.ioSlots.map(async (ioSlot) => {
api.get(ioSlot.uri).then(async (ioSlotResponse) => {
const tempSlots = ioSlotResponse.data.Slots;
await api.all(
tempSlots.map((tempSlot) => {
if (
tempSlot.Location?.PartLocation?.ServiceLabel ===
ioSlot.locationNumber
) {
returningObj.ioSlots.push({
led: tempSlot.LocationIndicatorActive,
locationNumber: ioSlot.locationNumber,
uri: ioSlot.uri,
});
}
}),
);
});
}),
);
}
}),
);
})
);
}
};

const fetchRemotePorts = async () => {
if (selectedObj.remotePortLocation.length > 0) {
await Promise.all(
selectedObj.remotePortLocation.map(async (local) => {
const { data } = await api.get(local.uri);
returningObj.remotePortLocation.push({
led: data.LocationIndicatorActive,
locationNumber: data.Location?.PartLocation?.ServiceLabel,
uri: data['@odata.id'],
});
})
);
}
};

const fetchIoSlots = async () => {
if (selectedObj.ioSlots.length > 0) {
await Promise.all(
selectedObj.ioSlots.map(async (ioSlot) => {
const ioSlotResponse = await api.get(ioSlot.uri);
const tempSlots = ioSlotResponse.data.Slots;
await Promise.all(
tempSlots.map((tempSlot) => {
if (
tempSlot.Location?.PartLocation?.ServiceLabel ===
ioSlot.locationNumber
) {
returningObj.ioSlots.push({
led: tempSlot.LocationIndicatorActive,
locationNumber: ioSlot.locationNumber,
uri: ioSlot.uri,
});
}
})
);
})
);
}
};

await Promise.all([
fetchPcieBridge(),
fetchLocalPorts(),
fetchRemotePorts(),
fetchIoSlots(),
]);

return returningObj;
},
}
},
};
});

export default PcieTopologyStore;
7 changes: 6 additions & 1 deletion src/views/HardwareStatus/Inventory/Inventory.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<b-container fluid="xl">
<b-container fluid="xl" class="inventory-container">
<page-title :title="$t('appPageTitle.inventory')" />

<!-- Service indicators -->
Expand Down Expand Up @@ -413,3 +413,8 @@ onBeforeMount(() => {
getAllInfo('created');
});
</script>
<style scoped>
.inventory-container{
min-width: 90%;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,5 @@ function toggleLampTestSwitch(lampTestState) {
}
</script>
<style lang="scss" scoped>
.form-background {
width: 120%;
}

</style>
Loading