Skip to content

Commit

Permalink
[APM] Service Inventory Updated the EuiBadge to use the `behind_tex…
Browse files Browse the repository at this point in the history
…t` vars instead of the base colors for the health status badges (#77844)

* Use behind_text colors in health status

* Separated badge color usage from getSeverityColor
  • Loading branch information
ashikmeerankutty authored Oct 2, 2020
1 parent 6c015cf commit e92a4ab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions x-pack/plugins/apm/common/service_health_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ export function getServiceHealthStatusColor(
}
}

export function getServiceHealthStatusBadgeColor(
theme: EuiTheme,
status: ServiceHealthStatus
) {
switch (status) {
case ServiceHealthStatus.healthy:
return theme.eui.euiColorVis0_behindText;
case ServiceHealthStatus.warning:
return theme.eui.euiColorVis5_behindText;
case ServiceHealthStatus.critical:
return theme.eui.euiColorVis9_behindText;
case ServiceHealthStatus.unknown:
return theme.eui.euiColorMediumShade;
}
}

export function getServiceHealthStatusLabel(status: ServiceHealthStatus) {
switch (status) {
case ServiceHealthStatus.critical:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React from 'react';
import { EuiBadge } from '@elastic/eui';
import {
getServiceHealthStatusColor,
getServiceHealthStatusBadgeColor,
getServiceHealthStatusLabel,
ServiceHealthStatus,
} from '../../../../../common/service_health_status';
Expand All @@ -20,7 +20,7 @@ export function HealthBadge({
const theme = useTheme();

return (
<EuiBadge color={getServiceHealthStatusColor(theme, healthStatus)}>
<EuiBadge color={getServiceHealthStatusBadgeColor(theme, healthStatus)}>
{getServiceHealthStatusLabel(healthStatus)}
</EuiBadge>
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e92a4ab

Please sign in to comment.