Matchers.tsx 690 B

123456789101112131415161718192021222324252627
  1. import { css } from '@emotion/css';
  2. import React, { FC } from 'react';
  3. import { TagList, useStyles2 } from '@grafana/ui';
  4. import { Matcher } from 'app/plugins/datasource/alertmanager/types';
  5. import { matcherToOperator } from '../../utils/alertmanager';
  6. type MatchersProps = { matchers: Matcher[] };
  7. export const Matchers: FC<MatchersProps> = ({ matchers }) => {
  8. const styles = useStyles2(getStyles);
  9. return (
  10. <div>
  11. <TagList
  12. className={styles.tags}
  13. tags={matchers.map((matcher) => `${matcher.name}${matcherToOperator(matcher)}${matcher.value}`)}
  14. />
  15. </div>
  16. );
  17. };
  18. const getStyles = () => ({
  19. tags: css`
  20. justify-content: flex-start;
  21. `,
  22. });