From 20983592cffa5213a37f30724b101a61a7caa550 Mon Sep 17 00:00:00 2001
From: Sivaprabu Ganesan <sivaprabug@ami.com>
Date: Mon, 25 Sep 2023 18:43:10 +0530
Subject: Hide the trashcan icon for DHCP address

When the IPv4 address is in DHCP mode, hide the trashcan icon.
If the address is in static IPv4 mode, the trashcan icon will show
that the user can delete the IPv4 static address.

Change-Id: I27dc8dc64d93b1e2425de6143473a91f7bc0b104
Signed-off-by: Sivaprabu Ganesan <sivaprabug@ami.com>
---
 src/views/Settings/Network/TableIpv4.vue | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'src/views/Settings/Network/TableIpv4.vue')

diff --git a/src/views/Settings/Network/TableIpv4.vue b/src/views/Settings/Network/TableIpv4.vue
index 51f27f8c..8f10d625 100644
--- a/src/views/Settings/Network/TableIpv4.vue
+++ b/src/views/Settings/Network/TableIpv4.vue
@@ -45,7 +45,7 @@
     >
       <template #cell(actions)="{ item, index }">
         <table-row-action
-          v-for="(action, actionIndex) in item.actions"
+          v-for="(action, actionIndex) in filteredActions(item)"
           :key="actionIndex"
           :value="action.value"
           :title="action.title"
@@ -139,6 +139,15 @@ export default {
         return newValue;
       },
     },
+    filteredActions() {
+      return (item) => {
+        if (item.AddressOrigin === 'DHCP') {
+          return item.actions.filter((action) => action.value !== 'delete');
+        } else {
+          return item.actions;
+        }
+      };
+    },
   },
   watch: {
     // Watch for change in tab index
-- 
cgit v1.2.3

