Add ServerLED page

Added ability to turn on/off Indicator LED.

Signed-off-by: Suren Neware <sneware9@in.ibm.com>
Change-Id: Ia59eb0214530906dea840ff18ff22fc913870bb9
diff --git a/src/components/AppNavigation/AppNavigation.vue b/src/components/AppNavigation/AppNavigation.vue
index ef88adb..f98db35 100644
--- a/src/components/AppNavigation/AppNavigation.vue
+++ b/src/components/AppNavigation/AppNavigation.vue
@@ -40,7 +40,7 @@
               <b-nav-item to="/control/reboot-bmc">
                 {{ $t('appNavigation.rebootBmc') }}
               </b-nav-item>
-              <b-nav-item href="javascript:void(0)">
+              <b-nav-item to="/control/server-led">
                 {{ $t('appNavigation.serverLed') }}
               </b-nav-item>
               <b-nav-item to="/control/server-power-operations">
diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index 5824e5fa..ff57c5d 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -268,6 +268,10 @@
       "upperCritical": "Upper critical"
     }
   },
+  "pageServerLed": {
+    "serverLedSubTitle": "Server indicator LED",
+    "serverLedTitle": "LED light control"
+  },
   "pageServerPowerOperations": {
     "currentStatus": "Current status",
     "hostOsBootSettings": "Host OS boot settings",
diff --git a/src/router/index.js b/src/router/index.js
index c3d4439..44c3246 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -64,6 +64,14 @@
         }
       },
       {
+        path: '/control/server-led',
+        name: 'server-led',
+        component: () => import('@/views/Control/ServerLed'),
+        meta: {
+          title: 'appPageTitle.serverLed'
+        }
+      },
+      {
         path: '/control/server-power-operations',
         name: 'server-power-operations',
         component: () => import('@/views/Control/ServerPowerOperations'),
diff --git a/src/store/index.js b/src/store/index.js
index 364e16c..ad55030 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -14,6 +14,7 @@
 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 @@
     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 0000000..c690d7c
--- /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;
diff --git a/src/views/Control/ServerLed/ServerLed.vue b/src/views/Control/ServerLed/ServerLed.vue
new file mode 100644
index 0000000..1b1c24a
--- /dev/null
+++ b/src/views/Control/ServerLed/ServerLed.vue
@@ -0,0 +1,52 @@
+<template>
+  <b-container fluid="xl">
+    <page-title />
+    <b-row>
+      <b-col md="12">
+        <page-section :section-title="$t('pageServerLed.serverLedTitle')">
+          <b-form-group :label="$t('pageServerLed.serverLedSubTitle')">
+            <b-form-checkbox
+              v-model="indicatorLED"
+              name="check-button"
+              value="Lit"
+              unchecked-value="Off"
+              switch
+            >
+              <span v-if="indicatorLED !== 'Off' && indicatorLED">
+                {{ $t('global.status.on') }}
+              </span>
+              <span v-else>
+                {{ $t('global.status.off') }}
+              </span>
+            </b-form-checkbox>
+          </b-form-group>
+        </page-section>
+      </b-col>
+    </b-row>
+  </b-container>
+</template>
+
+<script>
+import PageTitle from '../../../components/Global/PageTitle';
+import PageSection from '../../../components/Global/PageSection';
+
+export default {
+  name: 'ServerLed',
+  components: { PageTitle, PageSection },
+  computed: {
+    indicatorLED: {
+      get() {
+        return this.$store.getters['serverLed/getIndicatorValue'];
+      },
+      set(newValue) {
+        if (newValue) {
+          this.$store.dispatch('serverLed/saveIndicatorLedValue', newValue);
+        }
+      }
+    }
+  },
+  created() {
+    this.$store.dispatch('serverLed/getIndicatorValue');
+  }
+};
+</script>
diff --git a/src/views/Control/ServerLed/index.js b/src/views/Control/ServerLed/index.js
new file mode 100644
index 0000000..1926dae
--- /dev/null
+++ b/src/views/Control/ServerLed/index.js
@@ -0,0 +1,2 @@
+import ServerLed from './ServerLed.vue';
+export default ServerLed;