summaryrefslogtreecommitdiff
path: root/src/store/modules/Overview/OverviewStore.js
diff options
context:
space:
mode:
authorDixsie Wolmers <dixsie@ibm.com>2020-01-23 04:47:56 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-01-29 01:18:05 +0300
commitf65ee346bedb1811e88b12542abce0d18bb5fc32 (patch)
tree04b0a5cc2096a48b9c2b15dc571a1db680802c89 /src/store/modules/Overview/OverviewStore.js
parentdc04feb5596a85619e98d2d594b065e92c8b8fa4 (diff)
downloadwebui-vue-f65ee346bedb1811e88b12542abce0d18bb5fc32.tar.xz
Add store modules needed to support overview view
- Update overview page to get data from store Signed-off-by: Dixsie Wolmers <dixsie@ibm.com> Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: Id2fcad660efc0da5c7b878e872355bf5773c7ed7
Diffstat (limited to 'src/store/modules/Overview/OverviewStore.js')
-rw-r--r--src/store/modules/Overview/OverviewStore.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/store/modules/Overview/OverviewStore.js b/src/store/modules/Overview/OverviewStore.js
new file mode 100644
index 00000000..8d0613ad
--- /dev/null
+++ b/src/store/modules/Overview/OverviewStore.js
@@ -0,0 +1,48 @@
+import api from '../../api';
+
+const OverviewStore = {
+ namespaced: true,
+ state: {
+ serverInfo: null,
+ serverModel: '--',
+ serverManufacturer: '--',
+ serverSerialNumber: '--'
+ },
+ getters: {
+ serverInfo: state => state.serverInfo,
+ serverModel: state => state.serverModel,
+ serverManufacturer: state => state.serverManufacturer,
+ serverSerialNumber: state => state.serverSerialNumber
+ },
+ mutations: {
+ setServerInfo: (state, serverInfo) => (state.serverInfo = serverInfo),
+ setServerModel: (state, serverModel) => (state.serverModel = serverModel),
+ setServerManufacturer: (state, serverManufacturer) =>
+ (state.serverManufacturer = serverManufacturer),
+ setServerSerialNumber: (state, serverSerialNumber) =>
+ (state.serverSerialNumber = serverSerialNumber)
+ },
+ actions: {
+ getServerInfo({ commit }) {
+ api
+ .get('/xyz/openbmc_project/inventory/system')
+ .then(response => {
+ const serverInfo = response.data.data;
+ if (serverInfo.Model) {
+ commit('setServerModel', serverInfo.Model);
+ }
+ if (serverInfo.SerialNumber) {
+ commit('setServerSerialNumber', serverInfo.SerialNumber);
+ }
+ if (serverInfo.Manufacturer) {
+ commit('setServerManufacturer', serverInfo.Manufacturer);
+ }
+ })
+ .catch(error => {
+ console.log(error);
+ });
+ }
+ }
+};
+
+export default OverviewStore;