From b24a483eda5ca0b0ecdb4f0c61b90d76d0d8e1e0 Mon Sep 17 00:00:00 2001
From: Konstantin Aladyshev <aladyshev22@gmail.com>
Date: Wed, 2 Nov 2022 17:32:04 +0300
Subject: Display DIMM identify LED element only if LED is present

If identify LED for the DIMM module is not present, don't display
control element for it.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: I30f7e3ad9333874bbeb2050c421baf509bb833fc
---
 src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue')

diff --git a/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue b/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue
index 65994810..c05ae734 100644
--- a/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue
+++ b/src/views/HardwareStatus/Inventory/InventoryTableDimmSlot.vue
@@ -53,6 +53,7 @@
       <!-- Toggle identify LED -->
       <template #cell(identifyLed)="row">
         <b-form-checkbox
+          v-if="hasIdentifyLed(row.item.identifyLed)"
           v-model="row.item.identifyLed"
           name="switch"
           switch
@@ -63,6 +64,7 @@
           </span>
           <span v-else> {{ $t('global.status.off') }} </span>
         </b-form-checkbox>
+        <div v-else>--</div>
       </template>
       <template #row-details="{ item }">
         <b-container fluid>
@@ -250,6 +252,9 @@ export default {
         })
         .catch(({ message }) => this.errorToast(message));
     },
+    hasIdentifyLed(identifyLed) {
+      return typeof identifyLed === 'boolean';
+    },
   },
 };
 </script>
-- 
cgit v1.2.3

