Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SecuritySolution] Disable agent status filters and timeline interaction #132586

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { AGENT_STATUS_FIELD_NAME } from '../../../../timelines/components/timeli

const FIELDS_WITHOUT_ACTIONS: { [field: string]: boolean } = { [AGENT_STATUS_FIELD_NAME]: true };

const style = { flexGrow: 0 };

export const SummaryValueCell: React.FC<AlertSummaryRow['description']> = ({
data,
eventId,
Expand All @@ -25,32 +27,36 @@ export const SummaryValueCell: React.FC<AlertSummaryRow['description']> = ({
timelineId,
values,
isReadOnly,
}) => (
<>
<FieldValueCell
contextId={timelineId}
data={data}
eventId={eventId}
fieldFromBrowserField={fieldFromBrowserField}
linkValue={linkValue}
isDraggable={isDraggable}
style={{ flexGrow: 0 }}
values={values}
/>
{timelineId !== TimelineId.active && !isReadOnly && !FIELDS_WITHOUT_ACTIONS[data.field] && (
<ActionCell
}) => {
const hoverActionsEnabled = !FIELDS_WITHOUT_ACTIONS[data.field];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 extracting the inline condition and moving it here improves readability
✅ already covered by a unit test


return (
<>
<FieldValueCell
contextId={timelineId}
data={data}
eventId={eventId}
fieldFromBrowserField={fieldFromBrowserField}
linkValue={linkValue}
timelineId={timelineId}
isDraggable={isDraggable}
style={style}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

values={values}
applyWidthAndPadding={false}
hideAddToTimeline={false}
/>
)}
</>
);
{timelineId !== TimelineId.active && !isReadOnly && hoverActionsEnabled && (
<ActionCell
contextId={timelineId}
data={data}
eventId={eventId}
fieldFromBrowserField={fieldFromBrowserField}
linkValue={linkValue}
timelineId={timelineId}
values={values}
applyWidthAndPadding={false}
hideAddToTimeline={false}
/>
)}
</>
);
};

SummaryValueCell.displayName = 'SummaryValueCell';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import { DefaultDraggable } from '../../../../../common/components/draggables';
import { EndpointHostIsolationStatus } from '../../../../../common/components/endpoint/host_isolation';
import { useHostIsolationStatus } from '../../../../../detections/containers/detection_engine/alerts/use_host_isolation_status';
import { AgentStatus } from '../../../../../common/components/endpoint/agent_status';
Expand All @@ -33,48 +32,23 @@ export const AgentStatuses = React.memo(
}) => {
const { isIsolated, agentStatus, pendingIsolation, pendingUnisolation } =
useHostIsolationStatus({ agentId: value });
const isolationFieldName = 'host.isolation';
return (
<EuiFlexGroup gutterSize="none">
{agentStatus !== undefined ? (
<EuiFlexItem grow={false}>
{isDraggable ? (
<DefaultDraggable
field={fieldName}
id={`event-details-value-default-draggable-${contextId}-${eventId}-${fieldName}-${value}`}
fieldType={fieldType}
isAggregatable={isAggregatable}
isDraggable={isDraggable}
tooltipContent={fieldName}
value={`${agentStatus}`}
>
<AgentStatus hostStatus={agentStatus} />
</DefaultDraggable>
) : (
<AgentStatus hostStatus={agentStatus} />
)}
<AgentStatus hostStatus={agentStatus} />
</EuiFlexItem>
) : (
<EuiText>
<p>{EMPTY_STATUS}</p>
</EuiText>
)}
<EuiFlexItem grow={false}>
<DefaultDraggable
field={isolationFieldName}
id={`event-details-value-default-draggable-${contextId}-${eventId}-${isolationFieldName}-${value}`}
fieldType={fieldType}
isAggregatable={isAggregatable}
isDraggable={isDraggable}
tooltipContent={isolationFieldName}
value={`${isIsolated}`}
>
<EndpointHostIsolationStatus
isIsolated={isIsolated}
pendingIsolate={pendingIsolation}
pendingUnIsolate={pendingUnisolation}
/>
</DefaultDraggable>
<EndpointHostIsolationStatus
isIsolated={isIsolated}
pendingIsolate={pendingIsolation}
pendingUnIsolate={pendingUnisolation}
/>
</EuiFlexItem>
</EuiFlexGroup>
);
Expand Down