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

[Visual Refresh] behindText datavis and severity color cleanup #206061

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,29 @@ export function getColorForAgentStatus(
agentStatus: SimplifiedAgentStatus,
euiTheme: EuiThemeComputed<{}>
): string {
const isAmsterdam = euiTheme.themeName === 'EUI_THEME_AMSTERDAM';

switch (agentStatus) {
case 'healthy':
return euiTheme.colors.backgroundFilledSuccess;
return isAmsterdam
? euiTheme.colors.vis.euiColorVisBehindText0
: euiTheme.colors.backgroundFilledSuccess;
case 'offline':
return euiTheme.colors.lightShade;
case 'inactive':
return euiTheme.colors.darkShade;
case 'unhealthy':
return euiTheme.colors.backgroundFilledWarning;
return isAmsterdam
? euiTheme.colors.vis.euiColorVisBehindText5
: euiTheme.colors.backgroundFilledWarning;
case 'orphaned':
return euiTheme.colors.backgroundFilledWarning;
return isAmsterdam
? euiTheme.colors.vis.euiColorVisBehindText5
: euiTheme.colors.backgroundFilledWarning;
case 'updating':
return euiTheme.colors.backgroundFilledPrimary;
return isAmsterdam
? euiTheme.colors.vis.euiColorVisBehindText1
: euiTheme.colors.backgroundFilledPrimary;
case 'unenrolled':
return euiTheme.colors.backgroundBaseDisabled;
case 'uninstalled':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ function insertHighlighting(result: FormattedQuestionAnsweringResult, inputText:
const ResultBadge: FC<PropsWithChildren<unknown>> = ({ children }) => {
const { euiTheme } = useEuiTheme();
const euiFontSizeXS = useEuiFontSize('xs').fontSize;
const isAmsterdam = euiTheme.flags.hasVisColorAdjustment;

// For Amsterdam, use a `_behindText` variant. Borealis doesn't need it because of updated contrasts.
const badgeColor = euiTheme.flags.hasVisColorAdjustment
? // @ts-expect-error _behindText is not defined in EuiThemeComputed after Borealis update
euiTheme.colors.vis.euiColorVis5_behindText
// For Amsterdam, use a `behindText` variant. Borealis doesn't need it because of updated contrasts.
const badgeColor = isAmsterdam
? euiTheme.colors.vis.euiColorVisBehindText5
: euiTheme.colors.vis.euiColorVis9;

return (
Expand All @@ -74,9 +74,7 @@ const ResultBadge: FC<PropsWithChildren<unknown>> = ({ children }) => {
marginRight: ICON_PADDING,
marginTop: `-${ICON_PADDING}`,
// For Amsterdam, add a border to the badge to improve contrast with the background.
...(euiTheme.flags.hasVisColorAdjustment
? { border: `1px solid ${euiTheme.colors.vis.euiColorVis5}` }
: {}),
...(isAmsterdam ? { border: `1px solid ${euiTheme.colors.vis.euiColorVis5}` } : {}),
fontSize: euiFontSizeXS,
padding: '0px 6px',
pointerEvents: 'none',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ export function getServiceHealthStatusColor(
euiTheme: EuiThemeComputed,
status: ServiceHealthStatus
) {
const isAmsterdam = euiTheme.themeName === 'EUI_THEME_AMSTERDAM';

switch (status) {
case ServiceHealthStatus.healthy:
return euiTheme.colors.success;
return isAmsterdam
? euiTheme.colors.vis.euiColorVis0
: euiTheme.colors.vis.euiColorVisSuccess0;
case ServiceHealthStatus.warning:
return euiTheme.colors.warning;
return isAmsterdam ? euiTheme.colors.vis.euiColorVis5 : euiTheme.colors.vis.euiColorVis9;
case ServiceHealthStatus.critical:
return euiTheme.colors.danger;
return isAmsterdam
? euiTheme.colors.vis.euiColorVis9
: euiTheme.colors.vis.euiColorSeverity14;
case ServiceHealthStatus.unknown:
return euiTheme.colors.mediumShade;
}
Expand All @@ -54,13 +60,21 @@ export function getServiceHealthStatusBadgeColor(
euiTheme: EuiThemeComputed,
status: ServiceHealthStatus
) {
const isAmsterdam = euiTheme.themeName === 'EUI_THEME_AMSTERDAM';

switch (status) {
case ServiceHealthStatus.healthy:
return euiTheme.colors.success;
return isAmsterdam
? euiTheme.colors.vis.euiColorVisBehindText0
: euiTheme.colors.vis.euiColorVisSuccess0;
case ServiceHealthStatus.warning:
return euiTheme.colors.warning;
return isAmsterdam
? euiTheme.colors.vis.euiColorVisBehindText5
: euiTheme.colors.vis.euiColorVis9;
case ServiceHealthStatus.critical:
return euiTheme.colors.danger;
return isAmsterdam
? euiTheme.colors.vis.euiColorVisBehindText9
: euiTheme.colors.vis.euiColorSeverity12;
case ServiceHealthStatus.unknown:
return euiTheme.colors.mediumShade;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
EuiSkeletonText,
EuiText,
EuiTitle,
euiPaletteColorBlindBehindText,
useEuiTheme,
} from '@elastic/eui';
import { RECORDS_FIELD } from '@kbn/exploratory-view-plugin/public';
Expand Down Expand Up @@ -148,7 +147,7 @@ export const MonitorAlerts = ({
...(locationFilter ?? []),
],
color: isAmsterdam
? euiPaletteColorBlindBehindText()[7]
? euiTheme.colors.vis.euiColorVisBehindText7
: euiTheme.colors.vis.euiColorVis7,
},
]}
Expand Down Expand Up @@ -203,7 +202,7 @@ export const MonitorAlerts = ({
...(locationFilter ?? []),
],
color: isAmsterdam
? euiPaletteColorBlindBehindText()[0]
? euiTheme.colors.vis.euiColorVisBehindText0
: euiTheme.colors.vis.euiColorVis0,
},
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
* 2.0.
*/
import { Chart, Metric, MetricTrendShape, Settings } from '@elastic/charts';
import {
EuiPanel,
EuiSpacer,
EuiThemeComputed,
euiPaletteColorBlindBehindText,
useEuiTheme,
} from '@elastic/eui';
import { EuiPanel, EuiSpacer, EuiThemeComputed, useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
Expand Down Expand Up @@ -49,13 +43,13 @@ export const getColor = (euiTheme: EuiThemeComputed, isEnabled: boolean, status?

switch (status) {
case 'down':
return isAmsterdam ? euiPaletteColorBlindBehindText()[9] : euiTheme.colors.danger;
return isAmsterdam ? euiTheme.colors.vis.euiColorVisBehindText9 : euiTheme.colors.danger;
case 'up':
return isAmsterdam ? euiPaletteColorBlindBehindText()[0] : euiTheme.colors.success;
return isAmsterdam ? euiTheme.colors.vis.euiColorVisBehindText0 : euiTheme.colors.success;
case 'unknown':
return euiTheme.colors.ghost;
default:
return isAmsterdam ? euiPaletteColorBlindBehindText()[0] : euiTheme.colors.success;
return isAmsterdam ? euiTheme.colors.vis.euiColorVisBehindText0 : euiTheme.colors.success;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ export function useStatusByLocation({

return useMemo(() => {
const getColor = (status: string) => {
const isAmsterdam = euiTheme.themeName === 'EUI_THEME_AMSTERDAM';

switch (status) {
case 'up':
return euiTheme.colors.success;
return isAmsterdam ? euiTheme.colors.vis.euiColorVis0 : euiTheme.colors.success;
case 'down':
return euiTheme.colors.vis.euiColorVis6;
return isAmsterdam ? euiTheme.colors.vis.euiColorVis9 : euiTheme.colors.vis.euiColorVis6;
default:
return euiTheme.colors.backgroundBaseSubdued;
}
Expand Down Expand Up @@ -113,8 +115,11 @@ export function useStatusByLocation({
data?.aggregations?.locations.buckets,
loading,
monitorLocations,
euiTheme.themeName,
euiTheme.colors.success,
euiTheme.colors.vis.euiColorVis0,
euiTheme.colors.vis.euiColorVis6,
euiTheme.colors.vis.euiColorVis9,
euiTheme.colors.backgroundBaseSubdued,
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ const getPingStatusLabel = (status: string, ping: Ping) => {

export const PingStatusColumn = ({ pingStatus, item }: Props) => {
const theme = useEuiTheme();
const dangerBehindText = theme.euiTheme.colors.textDanger;
const isAmsterdam = theme.euiTheme.themeName === 'EUI_THEME_AMSTERDAM';

const dangerBehindText = isAmsterdam
? theme.euiTheme.colors.vis.euiColorVisBehindText9
: theme.euiTheme.colors.vis.euiColorVis6;

const timeStamp = moment(item.timestamp);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ export const StatusBadge = ({
summaryError?: PingError;
}) => {
const theme = useEuiTheme();
const dangerBehindText = theme.euiTheme.colors.textDanger;
const isAmsterdam = theme.euiTheme.themeName === 'EUI_THEME_AMSTERDAM';

const dangerBehindText = isAmsterdam
? theme.euiTheme.colors.vis.euiColorVisBehindText9
: theme.euiTheme.colors.vis.euiColorVis6;

if (status === STATUS.UP) {
return (
Expand Down