From 87ea5cb3c2615bd085949f15c1acce2e9e111b85 Mon Sep 17 00:00:00 2001 From: Paul Tavares Date: Wed, 16 Jun 2021 14:24:18 -0400 Subject: [PATCH] code review suggestion --- .../view/hooks/use_endpoint_action_items.tsx | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks/use_endpoint_action_items.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks/use_endpoint_action_items.tsx index a24c747a83ae29..7c38c935a0b9f3 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks/use_endpoint_action_items.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks/use_endpoint_action_items.tsx @@ -60,45 +60,45 @@ export const useEndpointActionItems = ( selected_endpoint: endpointId, }); - const isolationActions = isIsolated // Un-isolate is always available to users regardless of license level - ? [ - { - 'data-test-subj': 'unIsolateLink', - icon: 'logoSecurity', - key: 'unIsolateHost', - navigateAppId: MANAGEMENT_APP_ID, - navigateOptions: { - path: endpointUnIsolatePath, - }, - href: formatUrl(endpointUnIsolatePath), - children: ( - - ), - }, - ] - : isPlatinumPlus // For Platinum++ licenses, users also have ability to isolate - ? [ - { - 'data-test-subj': 'isolateLink', - icon: 'logoSecurity', - key: 'isolateHost', - navigateAppId: MANAGEMENT_APP_ID, - navigateOptions: { - path: endpointIsolatePath, - }, - href: formatUrl(endpointIsolatePath), - children: ( - - ), - }, - ] - : []; + const isolationActions = []; + + if (isIsolated) { + // Un-isolate is always available to users regardless of license level + isolationActions.push({ + 'data-test-subj': 'unIsolateLink', + icon: 'logoSecurity', + key: 'unIsolateHost', + navigateAppId: MANAGEMENT_APP_ID, + navigateOptions: { + path: endpointUnIsolatePath, + }, + href: formatUrl(endpointUnIsolatePath), + children: ( + + ), + }); + } else if (isPlatinumPlus) { + // For Platinum++ licenses, users also have ability to isolate + isolationActions.push({ + 'data-test-subj': 'isolateLink', + icon: 'logoSecurity', + key: 'isolateHost', + navigateAppId: MANAGEMENT_APP_ID, + navigateOptions: { + path: endpointIsolatePath, + }, + href: formatUrl(endpointIsolatePath), + children: ( + + ), + }); + } return [ ...isolationActions,