diff --git a/x-pack/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.test.tsx b/x-pack/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.test.tsx
index f0ef8f8d00da7..fb18a3a6a4459 100644
--- a/x-pack/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.test.tsx
+++ b/x-pack/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.test.tsx
@@ -157,4 +157,31 @@ describe('HostAlertsTable', () => {
},
]);
});
+
+ it('should render cellActions when count is bigger than zero', () => {
+ mockUseHostAlertsItemsReturn({
+ items: [parsedVulnerableHostsAlertsResult[0]],
+ });
+ const { getAllByTestId } = renderComponent();
+
+ expect(getAllByTestId('cellActions-renderContent-host.name').length).toBe(5);
+ });
+
+ it('should not render cellActions when count is zero', () => {
+ mockUseHostAlertsItemsReturn({
+ items: [
+ {
+ hostName: 'Host-342m5gl1g2',
+ totalAlerts: 100,
+ critical: 0,
+ high: 0,
+ low: 0,
+ medium: 0,
+ },
+ ],
+ });
+ const { getAllByTestId } = renderComponent();
+
+ expect(getAllByTestId('cellActions-renderContent-host.name').length).toBe(1);
+ });
});
diff --git a/x-pack/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.tsx b/x-pack/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.tsx
index 5a3d2462e3e9a..8ac908bad945a 100644
--- a/x-pack/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.tsx
+++ b/x-pack/plugins/security_solution/public/overview/components/detection_response/host_alerts_table/host_alerts_table.tsx
@@ -179,30 +179,33 @@ const getTableColumns: GetTableColumns = (handleClick) => [
name: i18n.STATUS_CRITICAL_LABEL,
render: (count: number, { hostName }) => (
-
- handleClick({ hostName, severity: 'critical' })}
+ {count > 0 ? (
+
-
-
-
+ handleClick({ hostName, severity: 'critical' })}
+ >
+
+
+
+ ) : (
+
+ )}
),
},
@@ -211,29 +214,30 @@ const getTableColumns: GetTableColumns = (handleClick) => [
name: i18n.STATUS_HIGH_LABEL,
render: (count: number, { hostName }) => (
-
- handleClick({ hostName, severity: 'high' })}
+ {count > 0 ? (
+
-
-
-
+ handleClick({ hostName, severity: 'high' })}>
+
+
+
+ ) : (
+
+ )}
),
},
@@ -242,29 +246,30 @@ const getTableColumns: GetTableColumns = (handleClick) => [
name: i18n.STATUS_MEDIUM_LABEL,
render: (count: number, { hostName }) => (
-
- handleClick({ hostName, severity: 'medium' })}
+ {count > 0 ? (
+
-
-
-
+ handleClick({ hostName, severity: 'medium' })}>
+
+
+
+ ) : (
+
+ )}
),
},
@@ -273,29 +278,30 @@ const getTableColumns: GetTableColumns = (handleClick) => [
name: i18n.STATUS_LOW_LABEL,
render: (count: number, { hostName }) => (
-
- handleClick({ hostName, severity: 'low' })}
+ {count > 0 ? (
+
-
-
-
+ handleClick({ hostName, severity: 'low' })}>
+
+
+
+ ) : (
+
+ )}
),
},
diff --git a/x-pack/plugins/security_solution/public/overview/components/detection_response/user_alerts_table/user_alerts_table.tsx b/x-pack/plugins/security_solution/public/overview/components/detection_response/user_alerts_table/user_alerts_table.tsx
index 875556f12fb8d..d63e5b88e3660 100644
--- a/x-pack/plugins/security_solution/public/overview/components/detection_response/user_alerts_table/user_alerts_table.tsx
+++ b/x-pack/plugins/security_solution/public/overview/components/detection_response/user_alerts_table/user_alerts_table.tsx
@@ -176,30 +176,33 @@ const getTableColumns: GetTableColumns = (handleClick) => [
name: i18n.STATUS_CRITICAL_LABEL,
render: (count: number, { userName }) => (
-
- handleClick({ userName, severity: 'critical' })}
+ {count > 0 ? (
+
-
-
-
+ handleClick({ userName, severity: 'critical' })}
+ >
+
+
+
+ ) : (
+
+ )}
),
},
@@ -208,29 +211,30 @@ const getTableColumns: GetTableColumns = (handleClick) => [
name: i18n.STATUS_HIGH_LABEL,
render: (count: number, { userName }) => (
-
- handleClick({ userName, severity: 'high' })}
+ {count > 0 ? (
+
-
-
-
+ handleClick({ userName, severity: 'high' })}>
+
+
+
+ ) : (
+
+ )}
),
},
@@ -239,29 +243,30 @@ const getTableColumns: GetTableColumns = (handleClick) => [
name: i18n.STATUS_MEDIUM_LABEL,
render: (count: number, { userName }) => (
-
- handleClick({ userName, severity: 'medium' })}
+ {count > 0 ? (
+
-
-
-
+ handleClick({ userName, severity: 'medium' })}>
+
+
+
+ ) : (
+
+ )}
),
},
@@ -270,29 +275,30 @@ const getTableColumns: GetTableColumns = (handleClick) => [
name: i18n.STATUS_LOW_LABEL,
render: (count: number, { userName }) => (
-
- handleClick({ userName, severity: 'low' })}
+ {count > 0 ? (
+
-
-
-
+ handleClick({ userName, severity: 'low' })}>
+
+
+
+ ) : (
+
+ )}
),
},