From 090c2d44c47f4f68dd70c4c60b576542d7979836 Mon Sep 17 00:00:00 2001 From: SurenNeware Date: Wed, 1 Apr 2020 14:07:27 +0530 Subject: Add ServerLED page Added ability to turn on/off Indicator LED. Signed-off-by: Suren Neware Change-Id: Ia59eb0214530906dea840ff18ff22fc913870bb9 --- src/store/index.js | 4 +++- src/store/modules/Control/ServerLedStore.js | 36 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/store/modules/Control/ServerLedStore.js (limited to 'src/store') diff --git a/src/store/index.js b/src/store/index.js index 364e16c0..ad55030a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -14,6 +14,7 @@ import PowerControlStore from './modules/Control/PowerControlStore'; import NetworkSettingStore from './modules/Configuration/NetworkSettingsStore'; import EventLogStore from './modules/Health/EventLogStore'; import SensorsStore from './modules/Health/SensorsStore'; +import ServerLedStore from './modules/Control/ServerLedStore'; import WebSocketPlugin from './plugins/WebSocketPlugin'; @@ -36,7 +37,8 @@ export default new Vuex.Store({ networkSettings: NetworkSettingStore, eventLog: EventLogStore, sensors: SensorsStore, - sslCertificates: SslCertificatesStore + sslCertificates: SslCertificatesStore, + serverLed: ServerLedStore }, plugins: [WebSocketPlugin] }); diff --git a/src/store/modules/Control/ServerLedStore.js b/src/store/modules/Control/ServerLedStore.js new file mode 100644 index 00000000..c690d7cb --- /dev/null +++ b/src/store/modules/Control/ServerLedStore.js @@ -0,0 +1,36 @@ +import api from '../../api'; + +const ServerLedStore = { + namespaced: true, + state: { + indicatorValue: 'Off' + }, + getters: { + getIndicatorValue: state => state.indicatorValue + }, + mutations: { + setIndicatorValue(state, indicatorValue) { + state.indicatorValue = indicatorValue; + } + }, + actions: { + getIndicatorValue: ({ commit }) => { + api + .get('/redfish/v1/Systems/system') + .then(response => { + commit('setIndicatorValue', response.data.IndicatorLED); + }) + .catch(error => console.log(error)); + }, + saveIndicatorLedValue: ({ commit }, payload) => { + api + .patch('/redfish/v1/Systems/system', { IndicatorLED: payload }) + .then(() => { + commit('setIndicatorValue', payload); + }) + .catch(error => console.log(error)); + } + } +}; + +export default ServerLedStore; -- cgit v1.2.3