Add State to DIMM slot inventory summary

Add state information in DIMM slot inventory summary so that users can
know if the DIMM slot has DIMM plugged or not.

Change-Id: Id9b7ebb2079762b354b418d060d4a1223273b50d
Signed-off-by: HuyLe <hule@amperecomputing.com>
diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index 18bb7c6..ab63075 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -439,6 +439,7 @@
             "serviceEnabled": "Service enabled",
             "serviceEntryPointUuid": "Service entry point UUID",
             "sparePartNumber": "Spare part number",
+            "state": "State",
             "statusHealthRollup": "Status (Health rollup)",
             "statusState": "Status (State)",
             "subModel": "Sub model",
diff --git a/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue b/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue
index 196335e..6aa1578 100644
--- a/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue
+++ b/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue
@@ -50,6 +50,13 @@
         <status-icon :status="statusIcon(value)" />
         {{ value }}
       </template>
+
+      <!-- StatusState -->
+      <template #cell(statusState)="{ value }">
+        <status-icon :status="statusStateIcon(value)" />
+        {{ value }}
+      </template>
+
       <!-- Toggle identify LED -->
       <template #cell(identifyLed)="row">
         <b-form-checkbox
@@ -225,6 +232,12 @@
           tdClass: 'text-nowrap',
         },
         {
+          key: 'statusState',
+          label: this.$t('pageInventory.table.state'),
+          formatter: this.dataFormatter,
+          tdClass: 'text-nowrap',
+        },
+        {
           key: 'locationNumber',
           label: this.$t('pageInventory.table.locationNumber'),
           formatter: this.dataFormatter,
@@ -261,6 +274,8 @@
     sortCompare(a, b, key) {
       if (key === 'health') {
         return this.sortStatus(a, b, key);
+      } else if (key === 'statusState') {
+        return this.sortStatusState(a, b, key);
       }
     },
     onFiltered(filteredItems) {
@@ -277,6 +292,20 @@
     hasIdentifyLed(identifyLed) {
       return typeof identifyLed === 'boolean';
     },
+    statusStateIcon(status) {
+      switch (status) {
+        case 'Enabled':
+          return 'success';
+        case 'Absent':
+          return 'warning';
+        default:
+          return '';
+      }
+    },
+    sortStatusState(a, b, key) {
+      const statusState = ['Enabled', 'Absent'];
+      return statusState.indexOf(a[key]) - statusState.indexOf(b[key]);
+    },
   },
 };
 </script>