diff --git a/x-pack/platform/plugins/private/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.tsx.snap b/x-pack/platform/plugins/private/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.tsx.snap index 096b56da2fe6f..b59d087d0818b 100644 --- a/x-pack/platform/plugins/private/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.tsx.snap +++ b/x-pack/platform/plugins/private/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.tsx.snap @@ -178,7 +178,7 @@ exports[`extend index management ilm summary extension should render a phase def >
= ({ enabled, phase }) => { + const { euiTheme } = useEuiTheme(); + + const isBorealis = euiTheme.themeName === 'EUI_THEME_BOREALIS'; + + const phaseIconColors = { + hot: isBorealis ? euiTheme.colors.vis.euiColorVis6 : euiThemeVars.euiColorVis9_behindText, + warm: isBorealis ? euiTheme.colors.vis.euiColorVis9 : euiThemeVars.euiColorVis5_behindText, + cold: isBorealis ? euiTheme.colors.vis.euiColorVis2 : euiThemeVars.euiColorVis1_behindText, + frozen: euiTheme.colors.vis.euiColorVis4, + delete: euiTheme.colors.darkShade, + }; + return (
{enabled ? ( diff --git a/x-pack/platform/plugins/private/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.scss b/x-pack/platform/plugins/private/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.scss index a69f244a25aea..7fd59bebea9e6 100644 --- a/x-pack/platform/plugins/private/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.scss +++ b/x-pack/platform/plugins/private/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.scss @@ -60,33 +60,17 @@ $ilmTimelineBarHeight: $euiSizeS; &__hotPhase { width: var(--ilm-timeline-hot-phase-width); - - &__colorBar { - background-color: $euiColorVis9; - } } &__warmPhase { width: var(--ilm-timeline-warm-phase-width); - - &__colorBar { - background-color: $euiColorVis5; - } } &__coldPhase { width: var(--ilm-timeline-cold-phase-width); - - &__colorBar { - background-color: $euiColorVis1; - } } &__frozenPhase { width: var(--ilm-timeline-frozen-phase-width); - - &__colorBar { - background-color: $euiColorVis4; - } } } diff --git a/x-pack/platform/plugins/private/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx b/x-pack/platform/plugins/private/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx index b2ee9c2520831..8cdfdf5bc9bf3 100644 --- a/x-pack/platform/plugins/private/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx +++ b/x-pack/platform/plugins/private/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx @@ -5,11 +5,21 @@ * 2.0. */ +/** @jsx jsx */ +// Needed for for testing out the css prop feature. See: https://emotion.sh/docs/css-prop#jsx-pragma +import { css, jsx } from '@emotion/react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import React, { FunctionComponent, memo } from 'react'; -import { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiText, EuiIconTip } from '@elastic/eui'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiTitle, + EuiText, + EuiIconTip, + useEuiTheme, +} from '@elastic/eui'; import { useKibana } from '../../../../../shared_imports'; @@ -135,6 +145,17 @@ export const Timeline: FunctionComponent = memo( : undefined, }; + const { euiTheme } = useEuiTheme(); + + const isBorealis = euiTheme.themeName === 'EUI_THEME_BOREALIS'; + + const timelineIconColors = { + hot: isBorealis ? euiTheme.colors.vis.euiColorVis6 : euiTheme.colors.vis.euiColorVis9, + warm: isBorealis ? euiTheme.colors.vis.euiColorVis9 : euiTheme.colors.vis.euiColorVis5, + cold: isBorealis ? euiTheme.colors.vis.euiColorVis2 : euiTheme.colors.vis.euiColorVis1, + frozen: euiTheme.colors.vis.euiColorVis4, + }; + const phaseAgeInMilliseconds = calculateRelativeFromAbsoluteMilliseconds(absoluteTimings); const widths = calculateWidths(phaseAgeInMilliseconds); @@ -188,7 +209,12 @@ export const Timeline: FunctionComponent = memo( data-test-subj="ilmTimelinePhase-hot" className="ilmTimeline__phasesContainer__phase ilmTimeline__hotPhase" > -
+
= memo( data-test-subj="ilmTimelinePhase-warm" className="ilmTimeline__phasesContainer__phase ilmTimeline__warmPhase" > -
+
= memo( data-test-subj="ilmTimelinePhase-cold" className="ilmTimeline__phasesContainer__phase ilmTimeline__coldPhase" > -
+
= memo( data-test-subj="ilmTimelinePhase-frozen" className="ilmTimeline__phasesContainer__phase ilmTimeline__frozenPhase" > -
+
{ + const { euiTheme } = useEuiTheme(); + + const isBorealis = euiTheme.themeName === 'EUI_THEME_BOREALIS'; + + // Changing the mappings for the phases in Borealis as a mid-term solution. See https://github.com/elastic/kibana/issues/203664#issuecomment-2536593361. + const phaseToIndicatorColors = { + hot: isBorealis ? euiTheme.colors.vis.euiColorVis6 : euiTheme.colors.vis.euiColorVis9, + warm: isBorealis ? euiTheme.colors.vis.euiColorVis9 : euiTheme.colors.vis.euiColorVis5, + cold: isBorealis ? euiTheme.colors.vis.euiColorVis2 : euiTheme.colors.vis.euiColorVis1, + frozen: euiTheme.colors.vis.euiColorVis4, + delete: euiTheme.colors.lightShade, + }; + return (
= { - hot: { - color: euiThemeVars.euiColorVis9, - label: 'Hot', - }, - warm: { - color: euiThemeVars.euiColorVis5, - label: 'Warm', - }, - cold: { - color: euiThemeVars.euiColorVis1, - label: 'Cold', - }, - frozen: { - color: euiThemeVars.euiColorVis4, - label: 'Frozen', - }, - delete: { - color: 'default', - label: 'Delete', - }, -}; - interface Props { index: Index; getUrlForApp: ApplicationStart['getUrlForApp']; @@ -64,6 +40,34 @@ export const IndexLifecycleSummary: FunctionComponent = ({ index, getUrlF // only ILM managed indices render the ILM tab const ilm = ilmData as IlmExplainLifecycleLifecycleExplainManaged; + const { euiTheme } = useEuiTheme(); + + const isBorealis = euiTheme.themeName === 'EUI_THEME_BOREALIS'; + + // Changing the mappings for the phases in Borealis as a mid-term solution. See https://github.com/elastic/kibana/issues/203664#issuecomment-2536593361. + const phaseToBadgeMapping: Record = { + hot: { + color: isBorealis ? euiTheme.colors.vis.euiColorVis6 : euiTheme.colors.vis.euiColorVis9, + label: 'Hot', + }, + warm: { + color: isBorealis ? euiTheme.colors.vis.euiColorVis9 : euiTheme.colors.vis.euiColorVis5, + label: 'Warm', + }, + cold: { + color: isBorealis ? euiTheme.colors.vis.euiColorVis2 : euiTheme.colors.vis.euiColorVis1, + label: 'Cold', + }, + frozen: { + color: euiTheme.colors.vis.euiColorVis4, + label: 'Frozen', + }, + delete: { + color: 'default', + label: 'Delete', + }, + }; + // if ilm.phase is an unexpected value, then display a default badge const phaseBadgeConfig = phaseToBadgeMapping[ilm.phase as Phase] ?? { color: 'default', diff --git a/x-pack/platform/plugins/private/index_lifecycle_management/tsconfig.json b/x-pack/platform/plugins/private/index_lifecycle_management/tsconfig.json index 5f061478f6a5d..34f3e7a95d191 100644 --- a/x-pack/platform/plugins/private/index_lifecycle_management/tsconfig.json +++ b/x-pack/platform/plugins/private/index_lifecycle_management/tsconfig.json @@ -35,13 +35,13 @@ "@kbn/core-http-browser", "@kbn/config-schema", "@kbn/shared-ux-router", - "@kbn/ui-theme", "@kbn/shared-ux-link-redirect-app", "@kbn/index-management-shared-types", "@kbn/react-kibana-context-render", "@kbn/unsaved-changes-prompt", "@kbn/shared-ux-table-persist", "@kbn/index-lifecycle-management-common-shared", + "@kbn/ui-theme", ], "exclude": [ "target/**/*",