Skip to content

Commit cc06d27

Browse files
committed
PR comments, fix quick check failures
1 parent bbe5cbe commit cc06d27

4 files changed

Lines changed: 18 additions & 31 deletions

File tree

x-pack/plugins/security_solution/public/cloud_security_posture/components/misconfiguration/misconfiguration_preview.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const MisconfigurationsPreview = ({ hostName }: { hostName: string }) =>
132132
const failedFindings = data?.count.failed || 0;
133133

134134
const { euiTheme } = useEuiTheme();
135-
const hasMisconfigurationFindingsForThisQuery = passedFindings > 0 || failedFindings > 0;
135+
const hasMisconfigurationFindings = passedFindings > 0 || failedFindings > 0;
136136
const hostNameFilterQuery = useMemo(
137137
() => (hostName ? buildHostNamesFilter([hostName]) : undefined),
138138
[hostName]
@@ -155,11 +155,11 @@ export const MisconfigurationsPreview = ({ hostName }: { hostName: string }) =>
155155
params: {
156156
name: hostName,
157157
isRiskScoreExist,
158-
hasMisconfigurationFindingsForThisQuery,
158+
hasMisconfigurationFindings,
159159
path: { tab: 'csp_insights' },
160160
},
161161
});
162-
}, [hasMisconfigurationFindingsForThisQuery, hostName, isRiskScoreExist, openLeftPanel]);
162+
}, [hasMisconfigurationFindings, hostName, isRiskScoreExist, openLeftPanel]);
163163
const link = useMemo(
164164
() =>
165165
!isPreviewMode
@@ -178,7 +178,7 @@ export const MisconfigurationsPreview = ({ hostName }: { hostName: string }) =>
178178
return (
179179
<ExpandablePanel
180180
header={{
181-
iconType: hasMisconfigurationFindingsForThisQuery ? 'arrowStart' : '',
181+
iconType: hasMisconfigurationFindings ? 'arrowStart' : '',
182182
title: (
183183
<EuiText
184184
size="xs"
@@ -192,12 +192,12 @@ export const MisconfigurationsPreview = ({ hostName }: { hostName: string }) =>
192192
/>
193193
</EuiText>
194194
),
195-
link: hasMisconfigurationFindingsForThisQuery ? link : undefined,
195+
link: hasMisconfigurationFindings ? link : undefined,
196196
}}
197197
data-test-subj={'securitySolutionFlyoutInsightsMisconfigurations'}
198198
>
199199
<EuiFlexGroup gutterSize="none">
200-
{hasMisconfigurationFindingsForThisQuery ? (
200+
{hasMisconfigurationFindings ? (
201201
<MisconfigurationPreviewScore
202202
passedFindings={passedFindings}
203203
failedFindings={failedFindings}

x-pack/plugins/security_solution/public/flyout/entity_details/host_details_left/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('HostDetailsPanel', () => {
6969
name="elastic"
7070
isRiskScoreExist={false}
7171
scopeId={'scopeId'}
72-
hasMisconfigurationFindingsForThisQuery={false}
72+
hasMisconfigurationFindings={false}
7373
/>,
7474
{
7575
wrapper: TestProviders,
@@ -84,7 +84,7 @@ describe('HostDetailsPanel', () => {
8484
name="elastic"
8585
isRiskScoreExist={false}
8686
scopeId={'scopeId'}
87-
hasMisconfigurationFindingsForThisQuery={true}
87+
hasMisconfigurationFindings={true}
8888
/>,
8989
{
9090
wrapper: TestProviders,

x-pack/plugins/security_solution/public/flyout/entity_details/host_details_left/index.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface HostDetailsPanelProps extends Record<string, unknown> {
2222
isRiskScoreExist: boolean;
2323
name: string;
2424
scopeId: string;
25-
hasMisconfigurationFindingsForThisQuery?: boolean;
25+
hasMisconfigurationFindings?: boolean;
2626
path?: {
2727
tab?: EntityDetailsLeftPanelTab;
2828
};
@@ -38,7 +38,7 @@ export const HostDetailsPanel = ({
3838
isRiskScoreExist,
3939
scopeId,
4040
path,
41-
hasMisconfigurationFindingsForThisQuery,
41+
hasMisconfigurationFindings,
4242
}: HostDetailsPanelProps) => {
4343
const [selectedTabId, setSelectedTabId] = useState(
4444
path?.tab === EntityDetailsLeftPanelTab.CSP_INSIGHTS
@@ -53,17 +53,11 @@ export const HostDetailsPanel = ({
5353
: [];
5454

5555
// Determine if the Insights tab should be included
56-
const insightsTab =
57-
hasMisconfigurationFindingsForThisQuery
58-
? [getInsightsInputTab({ name, fieldName: 'host.name' })]
59-
: [];
56+
const insightsTab = hasMisconfigurationFindings
57+
? [getInsightsInputTab({ name, fieldName: 'host.name' })]
58+
: [];
6059
return [[...riskScoreTab, ...insightsTab], EntityDetailsLeftPanelTab.RISK_INPUTS, () => {}];
61-
}, [
62-
isRiskScoreExist,
63-
name,
64-
scopeId,
65-
hasMisconfigurationFindingsForThisQuery,
66-
]);
60+
}, [isRiskScoreExist, name, scopeId, hasMisconfigurationFindings]);
6761

6862
return (
6963
<>

x-pack/plugins/security_solution/public/flyout/entity_details/host_right/index.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export const HostPanel = ({
105105
const passedFindings = data?.count.passed || 0;
106106
const failedFindings = data?.count.failed || 0;
107107

108-
const hasMisconfigurationFindingsForThisQuery = passedFindings > 0 || failedFindings > 0;
108+
const hasMisconfigurationFindings = passedFindings > 0 || failedFindings > 0;
109109

110110
useQueryInspector({
111111
deleteQuery,
@@ -129,18 +129,11 @@ export const HostPanel = ({
129129
scopeId,
130130
isRiskScoreExist,
131131
path: tab ? { tab } : undefined,
132-
hasMisconfigurationFindingsForThisQuery,
132+
hasMisconfigurationFindings,
133133
},
134134
});
135135
},
136-
[
137-
telemetry,
138-
openLeftPanel,
139-
hostName,
140-
scopeId,
141-
isRiskScoreExist,
142-
hasMisconfigurationFindingsForThisQuery,
143-
]
136+
[telemetry, openLeftPanel, hostName, scopeId, isRiskScoreExist, hasMisconfigurationFindings]
144137
);
145138

146139
const openDefaultPanel = useCallback(
@@ -180,7 +173,7 @@ export const HostPanel = ({
180173
<>
181174
<FlyoutNavigation
182175
flyoutIsExpandable={
183-
!isPreviewMode && (isRiskScoreExist || hasMisconfigurationFindingsForThisQuery)
176+
!isPreviewMode && (isRiskScoreExist || hasMisconfigurationFindings)
184177
}
185178
expandDetails={openDefaultPanel}
186179
/>

0 commit comments

Comments
 (0)