Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/web/ui/src/features/component/HealthLabel.tsx
5318 views
1
import { FC } from 'react';
2
3
import { ComponentHealthState } from './types';
4
5
import styles from './HealthLabel.module.css';
6
7
interface HealthLabelProps {
8
health: ComponentHealthState;
9
}
10
11
export const HealthLabel: FC<HealthLabelProps> = ({ health }) => {
12
const healthMappings = {
13
[ComponentHealthState.HEALTHY]: `${styles.health} ${styles['state-ok']}`,
14
[ComponentHealthState.UNHEALTHY]: `${styles.health} ${styles['state-error']}`,
15
[ComponentHealthState.UNKNOWN]: `${styles.health} ${styles['state-warn']}`,
16
[ComponentHealthState.EXITED]: `${styles.health} ${styles['state-error']}`,
17
};
18
const healthClass = healthMappings[health];
19
20
return <span className={healthClass}>{health}</span>;
21
};
22
23