mirror of
https://github.com/grafana/grafana.git
synced 2025-09-20 02:18:56 +08:00
28 lines
678 B
TypeScript
28 lines
678 B
TypeScript
import { css } from '@emotion/css';
|
|
import React from 'react';
|
|
|
|
import { TagList, useStyles2 } from '@grafana/ui';
|
|
import { Matcher } from 'app/plugins/datasource/alertmanager/types';
|
|
|
|
import { matcherToOperator } from '../../utils/alertmanager';
|
|
|
|
type MatchersProps = { matchers: Matcher[] };
|
|
|
|
export const Matchers = ({ matchers }: MatchersProps) => {
|
|
const styles = useStyles2(getStyles);
|
|
return (
|
|
<div>
|
|
<TagList
|
|
className={styles.tags}
|
|
tags={matchers.map((matcher) => `${matcher.name}${matcherToOperator(matcher)}${matcher.value}`)}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const getStyles = () => ({
|
|
tags: css`
|
|
justify-content: flex-start;
|
|
`,
|
|
});
|