Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions oas_docs/bundle.serverless.json
Original file line number Diff line number Diff line change
Expand Up @@ -46211,7 +46211,7 @@
"tags": [
"maintenance-window"
],
"x-state": "Generally available; added in 9.1.0"
"x-state": "Generally available"
}
},
"/api/maintenance_window/{id}": {
Expand Down Expand Up @@ -46257,7 +46257,7 @@
"tags": [
"maintenance-window"
],
"x-state": "Generally available; added in 9.1.0"
"x-state": "Generally available"
},
"get": {
"description": "[Required authorization] Route required privileges: read-maintenance-window.",
Expand Down Expand Up @@ -46453,7 +46453,7 @@
"tags": [
"maintenance-window"
],
"x-state": "Generally available; added in 9.1.0"
"x-state": "Generally available"
},
"patch": {
"description": "[Required authorization] Route required privileges: write-maintenance-window.",
Expand Down Expand Up @@ -46790,7 +46790,7 @@
"tags": [
"maintenance-window"
],
"x-state": "Generally available; added in 9.1.0"
"x-state": "Generally available"
}
},
"/api/maintenance_window/{id}/_archive": {
Expand Down Expand Up @@ -46998,7 +46998,7 @@
"tags": [
"maintenance-window"
],
"x-state": "Generally available; added in 9.1.0"
"x-state": "Generally available"
}
},
"/api/maintenance_window/{id}/_unarchive": {
Expand Down Expand Up @@ -47206,7 +47206,7 @@
"tags": [
"maintenance-window"
],
"x-state": "Generally available; added in 9.1.0"
"x-state": "Generally available"
}
},
"/api/saved_objects/_export": {
Expand Down
12 changes: 6 additions & 6 deletions oas_docs/output/kibana.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42557,7 +42557,7 @@ paths:
summary: Create a maintenance window.
tags:
- maintenance-window
x-state: Generally available; added in 9.1.0
x-state: Generally available
/api/maintenance_window/{id}:
delete:
description: '[Required authorization] Route required privileges: write-maintenance-window.'
Expand Down Expand Up @@ -42588,7 +42588,7 @@ paths:
summary: Delete a maintenance window.
tags:
- maintenance-window
x-state: Generally available; added in 9.1.0
x-state: Generally available
get:
description: '[Required authorization] Route required privileges: read-maintenance-window.'
operationId: get-maintenance-window-id
Expand Down Expand Up @@ -42729,7 +42729,7 @@ paths:
summary: Get maintenance window details.
tags:
- maintenance-window
x-state: Generally available; added in 9.1.0
x-state: Generally available
patch:
description: '[Required authorization] Route required privileges: write-maintenance-window.'
operationId: patch-maintenance-window-id
Expand Down Expand Up @@ -42970,7 +42970,7 @@ paths:
summary: Update a maintenance window.
tags:
- maintenance-window
x-state: Generally available; added in 9.1.0
x-state: Generally available
/api/maintenance_window/{id}/_archive:
post:
description: '[Required authorization] Route required privileges: write-maintenance-window.'
Expand Down Expand Up @@ -43119,7 +43119,7 @@ paths:
summary: Archive a maintenance window.
tags:
- maintenance-window
x-state: Generally available; added in 9.1.0
x-state: Generally available
/api/maintenance_window/{id}/_unarchive:
post:
description: '[Required authorization] Route required privileges: write-maintenance-window.'
Expand Down Expand Up @@ -43268,7 +43268,7 @@ paths:
summary: Unarchive a maintenance window.
tags:
- maintenance-window
x-state: Generally available; added in 9.1.0
x-state: Generally available
/api/ml/saved_objects/sync:
get:
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,36 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';
import { EuiHealth } from '@elastic/eui';
import { euiLightVars } from '@kbn/ui-theme';
import { EuiHealth, useEuiTheme, type EuiThemeComputed } from '@elastic/eui';
import type { CSSObject } from '@emotion/react';
import { CRITICALITY_LEVEL_TITLE } from './translations';
import type { CriticalityLevelWithUnassigned } from '../../../../common/entity_analytics/asset_criticality/types';

// below will be updated with new severity color palette & shared security wide severity colors hook creation
export const CRITICALITY_LEVEL_COLOR: Record<CriticalityLevelWithUnassigned, string> = {
extreme_impact: '#E7664C',
high_impact: '#DA8B45',
medium_impact: '#D6BF57',
low_impact: '#54B399',
unassigned: euiLightVars.euiColorMediumShade,
/*
* Map Asset Criticality status to EUI severity color pattern as per spec:
* https://eui.elastic.co/docs/patterns/severity/index.html#use-cases
*/
export const getCriticalityLevelColor = (
euiTheme: EuiThemeComputed,
criticalityLevel: CriticalityLevelWithUnassigned
) => {
const { danger, risk, warning, neutral, unknown } = euiTheme.colors.severity;
const map = {
extreme_impact: danger,
high_impact: risk,
medium_impact: warning,
low_impact: neutral,
unassigned: unknown,
};

return map[criticalityLevel] || map.unassigned;
};

export const AssetCriticalityBadge: React.FC<{
criticalityLevel?: CriticalityLevelWithUnassigned;
style?: React.CSSProperties;
style?: CSSObject;
className?: string;
dataTestSubj?: string;
}> = ({
Expand All @@ -30,11 +42,12 @@ export const AssetCriticalityBadge: React.FC<{
dataTestSubj = 'asset-criticality-badge',
className,
}) => {
const { euiTheme } = useEuiTheme();
return (
<EuiHealth
data-test-subj={dataTestSubj}
color={CRITICALITY_LEVEL_COLOR[criticalityLevel]}
style={style}
color={getCriticalityLevelColor(euiTheme, criticalityLevel)}
css={style}
className={className}
>
{CRITICALITY_LEVEL_TITLE[criticalityLevel]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const AssetCriticalityFilter: React.FC<AssetCriticalityFilterProps> = ({
onChange,
}) => {
const renderItem = useCallback((level: CriticalityLevels) => {
return <AssetCriticalityBadge criticalityLevel={level} style={{ lineHeight: 'inherit' }} />;
return <AssetCriticalityBadge criticalityLevel={level} css={{ lineHeight: 'inherit' }} />;
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,11 @@ const option = (
dropdownDisplay: (
<AssetCriticalityBadge
criticalityLevel={level}
style={{ lineHeight: 'inherit' }}
css={{ lineHeight: 'inherit' }}
dataTestSubj="asset-criticality-modal-select-option"
/>
),
inputDisplay: (
<AssetCriticalityBadge criticalityLevel={level} style={{ lineHeight: 'inherit' }} />
),
inputDisplay: <AssetCriticalityBadge criticalityLevel={level} css={{ lineHeight: 'inherit' }} />,
});

export const assetCriticalityOptions: Array<EuiSuperSelectOption<CriticalityLevelWithUnassigned>> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
*/

import React, { useMemo } from 'react';
import { EuiBadge } from '@elastic/eui';
import { EuiBadge, useEuiTheme } from '@elastic/eui';
import { isString, startCase } from 'lodash/fp';
import type { CriticalityLevel } from '../../../../../../common/entity_analytics/asset_criticality/types';
import { CRITICALITY_LEVEL_COLOR } from '../../../../../entity_analytics/components/asset_criticality';
import { getCriticalityLevelColor } from '../../../../../entity_analytics/components/asset_criticality';

interface Props {
value: string | number | undefined | null;
}

const AssetCriticalityLevelComponent: React.FC<Props> = ({ value }) => {
const color = isString(value) ? CRITICALITY_LEVEL_COLOR[value as CriticalityLevel] : 'normal';
const { euiTheme } = useEuiTheme();
const color = isString(value)
? getCriticalityLevelColor(euiTheme, value as CriticalityLevel)
: 'normal';
const stringValue = isString(value) ? value : '';

const badge = useMemo(
Expand Down