From 98bb24ebe5411a25440f9748168b72272304d50e Mon Sep 17 00:00:00 2001
From: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Date: Tue, 6 Oct 2020 10:00:19 -0700
Subject: Add two file firmware update

Adds the ability to upload separate Host and BMC firmware images through
the GUI. By default, the two file firmware update page will be shown.
Changes to the .env configurations will enable the single file upload
page. The IBM env is configured to allow single file firmware update.

Two file upload features:
 - File upload through local workstation or tftp server
 - Reboot from backup BMC image
 - Does not have ability to reboot from backup host image
 - Does not implement checks in GUI for host status, which is the
   same as what we have in phosphor-webui

Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: Ibf2a2d9ffc3952dd5a5454c723350c61d9f91c3e
---
 src/views/Overview/Overview.vue | 59 ++++++++++++++++++++++++++---------------
 1 file changed, 37 insertions(+), 22 deletions(-)

(limited to 'src/views/Overview/Overview.vue')

diff --git a/src/views/Overview/Overview.vue b/src/views/Overview/Overview.vue
index 13998297..27a599b9 100644
--- a/src/views/Overview/Overview.vue
+++ b/src/views/Overview/Overview.vue
@@ -104,28 +104,41 @@ export default {
     PageSection
   },
   mixins: [LoadingBarMixin],
-  computed: mapState({
-    server: state => state.system.systems[0],
-    bmcFirmwareVersion: state => state.firmware?.activeFirmware.version,
-    powerCapValue: state => state.powerControl.powerCapValue,
-    powerConsumptionValue: state => state.powerControl.powerConsumptionValue,
-    serverManufacturer() {
-      if (this.server) return this.server.manufacturer || '--';
-      return '--';
-    },
-    serverModel() {
-      if (this.server) return this.server.model || '--';
-      return '--';
-    },
-    serverSerialNumber() {
-      if (this.server) return this.server.serialNumber || '--';
-      return '--';
-    },
-    hostFirmwareVersion() {
-      if (this.server) return this.server.firmwareVersion || '--';
-      return '--';
+  data() {
+    return {
+      firmwareStoreModuleName: this.$store.hasModule('firmwareSingleImage')
+        ? 'firmwareSingleImage'
+        : 'firmware'
+    };
+  },
+  computed: {
+    ...mapState({
+      server: state => state.system.systems[0],
+      powerCapValue: state => state.powerControl.powerCapValue,
+      powerConsumptionValue: state => state.powerControl.powerConsumptionValue,
+      serverManufacturer() {
+        if (this.server) return this.server.manufacturer || '--';
+        return '--';
+      },
+      serverModel() {
+        if (this.server) return this.server.model || '--';
+        return '--';
+      },
+      serverSerialNumber() {
+        if (this.server) return this.server.serialNumber || '--';
+        return '--';
+      },
+      hostFirmwareVersion() {
+        if (this.server) return this.server.firmwareVersion || '--';
+        return '--';
+      }
+    }),
+    bmcFirmwareVersion() {
+      return this.$store.getters[
+        `${this.firmwareStoreModuleName}/bmcFirmwareCurrentVersion`
+      ];
     }
-  }),
+  },
   created() {
     this.startLoader();
     const quicklinksPromise = new Promise(resolve => {
@@ -139,7 +152,9 @@ export default {
     });
     Promise.all([
       this.$store.dispatch('system/getSystem'),
-      this.$store.dispatch('firmware/getSystemFirwareVersion'),
+      this.$store.dispatch(
+        `${this.firmwareStoreModuleName}/getFirmwareInformation`
+      ),
       this.$store.dispatch('powerControl/getPowerControl'),
       quicklinksPromise,
       networkPromise,
-- 
cgit v1.2.3

