Skip to content

Commit

Permalink
[SecuritySolution] Disable agent status filters and timeline interact…
Browse files Browse the repository at this point in the history
…ion (elastic#132586)

* fix: disable drag-ability and hover actions for agent statuses

The agent fields cannot be queried with ECS and therefore should not provide Filter In/Out functionality nor should users be able to add their representative fields to timeline investigations. Therefore users should not be able to add them to a timeline query by dragging them.

* chore: make code more readable
  • Loading branch information
janmonschke authored May 20, 2022
1 parent e857b30 commit 46cd729
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 52 deletions.
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];

return (
<>
<FieldValueCell
contextId={timelineId}
data={data}
eventId={eventId}
fieldFromBrowserField={fieldFromBrowserField}
linkValue={linkValue}
timelineId={timelineId}
isDraggable={isDraggable}
style={style}
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

0 comments on commit 46cd729

Please sign in to comment.