From 9d40e308fb33d5cef91deb8d78451ab021614898 Mon Sep 17 00:00:00 2001 From: Dixsie Wolmers Date: Thu, 13 Feb 2020 13:29:40 -0600 Subject: Update overview events table and overview network layout - Convert events list group to bootstrap table - Add ethernet interfaces to overview using redfish Signed-off-by: Dixsie Wolmers Change-Id: I633f03ba4a65358861664a869b35adf5358c45e6 --- .../modules/Configuration/NetworkSettingsStore.js | 50 ++++++++++------------ 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'src/store') diff --git a/src/store/modules/Configuration/NetworkSettingsStore.js b/src/store/modules/Configuration/NetworkSettingsStore.js index ee58a77b..3b1f2320 100644 --- a/src/store/modules/Configuration/NetworkSettingsStore.js +++ b/src/store/modules/Configuration/NetworkSettingsStore.js @@ -3,40 +3,36 @@ import api from '../../api'; const NetworkSettingsStore = { namespaced: true, state: { - networkData: null, - ipAddress: '--', - macAddress: '--' + ethernetData: [] }, getters: { - networkData: state => state.networkData, - ipAddress: state => state.ipAddress, - macAddress: state => state.macAddress + ethernetData: state => state.ethernetData }, mutations: { - setNetworkData: (state, networkData) => (state.networkData = networkData), - setIpAddress: (state, ipAddress) => (state.ipAddress = ipAddress), - setMacAddress: (state, macAddress) => (state.macAddress = macAddress) + setEthernetData: (state, ethernetData) => + (state.ethernetData = ethernetData) }, actions: { - getNetworkData({ commit }) { + getEthernetData({ commit }) { api - .get('/xyz/openbmc_project/network/enumerate') - .then(response => { - const networkData = response.data.data; - const ipAddresses = []; - const interfaceId = /eth[0-9]/; - for (let key in networkData) { - if (key.includes('ipv4')) { - ipAddresses.push(networkData[key].Address); - } - if ( - key.match(interfaceId) && - networkData[key].MACAddress !== undefined - ) { - commit('setMacAddress', networkData[key].MACAddress); - } - } - commit('setIpAddress', ipAddresses); + .get('/redfish/v1/Managers/bmc/EthernetInterfaces') + .then(response => + response.data.Members.map( + ethernetInterface => ethernetInterface['@odata.id'] + ) + ) + .then(ethernetInterfaceIds => + api.all( + ethernetInterfaceIds.map(ethernetInterface => + api.get(ethernetInterface) + ) + ) + ) + .then(ethernetInterfaces => { + const ethernetData = ethernetInterfaces.map( + ethernetInterface => ethernetInterface.data + ); + commit('setEthernetData', ethernetData); }) .catch(error => { console.log('Network Data:', error); -- cgit v1.2.3