AmRootRouteRead.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import React, { FC } from 'react';
  2. import { useStyles2 } from '@grafana/ui';
  3. import { FormAmRoute } from '../../types/amroutes';
  4. import { getGridStyles } from './gridStyles';
  5. export interface AmRootRouteReadProps {
  6. routes: FormAmRoute;
  7. }
  8. export const AmRootRouteRead: FC<AmRootRouteReadProps> = ({ routes }) => {
  9. const styles = useStyles2(getGridStyles);
  10. const receiver = routes.receiver || '-';
  11. const groupBy = routes.groupBy.join(', ') || '-';
  12. const groupWait = routes.groupWaitValue ? `${routes.groupWaitValue}${routes.groupWaitValueType}` : '-';
  13. const groupInterval = routes.groupIntervalValue
  14. ? `${routes.groupIntervalValue}${routes.groupIntervalValueType}`
  15. : '-';
  16. const repeatInterval = routes.repeatIntervalValue
  17. ? `${routes.repeatIntervalValue}${routes.repeatIntervalValueType}`
  18. : '-';
  19. return (
  20. <div className={styles.container}>
  21. <div className={styles.titleCell}>Contact point</div>
  22. <div className={styles.valueCell} data-testid="am-routes-root-receiver">
  23. {receiver}
  24. </div>
  25. <div className={styles.titleCell}>Group by</div>
  26. <div className={styles.valueCell} data-testid="am-routes-root-group-by">
  27. {groupBy}
  28. </div>
  29. <div className={styles.titleCell}>Timings</div>
  30. <div className={styles.valueCell} data-testid="am-routes-root-timings">
  31. Group wait: {groupWait} | Group interval: {groupInterval} | Repeat interval: {repeatInterval}
  32. </div>
  33. </div>
  34. );
  35. };