forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Endpoint][Host Isolation] Isolation status badge …
…from alert details (elastic#102274)
- Loading branch information
Showing
8 changed files
with
140 additions
and
14 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
x-pack/plugins/security_solution/public/common/components/endpoint/agent_status.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiBadge } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { HostStatus } from '../../../../common/endpoint/types'; | ||
import { HOST_STATUS_TO_BADGE_COLOR } from '../../../management/pages/endpoint_hosts/view/host_constants'; | ||
|
||
export const AgentStatus = React.memo(({ hostStatus }: { hostStatus: HostStatus }) => { | ||
return ( | ||
<EuiBadge | ||
color={hostStatus != null ? HOST_STATUS_TO_BADGE_COLOR[hostStatus] : 'warning'} | ||
data-test-subj="rowHostStatus" | ||
className="eui-textTruncate" | ||
> | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.list.hostStatusValue" | ||
defaultMessage="{hostStatus, select, healthy {Healthy} unhealthy {Unhealthy} updating {Updating} offline {Offline} inactive {Inactive} other {Unhealthy}}" | ||
values={{ hostStatus }} | ||
/> | ||
</EuiBadge> | ||
); | ||
}); | ||
|
||
AgentStatus.displayName = 'AgentStatus'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
.../security_solution/public/timelines/components/timeline/body/renderers/agent_statuses.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiFlexGroup, EuiFlexItem } 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'; | ||
|
||
export const AgentStatuses = React.memo( | ||
({ | ||
fieldName, | ||
contextId, | ||
eventId, | ||
value, | ||
}: { | ||
fieldName: string; | ||
contextId: string; | ||
eventId: string; | ||
value: string; | ||
}) => { | ||
const { isIsolated, agentStatus } = useHostIsolationStatus({ agentId: value }); | ||
const isolationFieldName = 'host.isolation'; | ||
return ( | ||
<EuiFlexGroup gutterSize="none"> | ||
<EuiFlexItem grow={false}> | ||
<DefaultDraggable | ||
field={fieldName} | ||
id={`event-details-value-default-draggable-${contextId}-${eventId}-${fieldName}-${value}`} | ||
tooltipContent={fieldName} | ||
value={`${agentStatus}`} | ||
> | ||
<AgentStatus hostStatus={agentStatus} /> | ||
</DefaultDraggable> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<DefaultDraggable | ||
field={isolationFieldName} | ||
id={`event-details-value-default-draggable-${contextId}-${eventId}-${isolationFieldName}-${value}`} | ||
tooltipContent={isolationFieldName} | ||
value={`${isIsolated}`} | ||
> | ||
<EndpointHostIsolationStatus isIsolated={isIsolated} /> | ||
</DefaultDraggable> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
} | ||
); | ||
|
||
AgentStatuses.displayName = 'AgentStatuses'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters