NewReceiverView.tsx 774 B

123456789101112131415161718192021
  1. import React, { FC } from 'react';
  2. import { AlertManagerCortexConfig } from 'app/plugins/datasource/alertmanager/types';
  3. import { GRAFANA_RULES_SOURCE_NAME } from '../../utils/datasource';
  4. import { CloudReceiverForm } from './form/CloudReceiverForm';
  5. import { GrafanaReceiverForm } from './form/GrafanaReceiverForm';
  6. interface Props {
  7. config: AlertManagerCortexConfig;
  8. alertManagerSourceName: string;
  9. }
  10. export const NewReceiverView: FC<Props> = ({ alertManagerSourceName, config }) => {
  11. if (alertManagerSourceName === GRAFANA_RULES_SOURCE_NAME) {
  12. return <GrafanaReceiverForm alertManagerSourceName={alertManagerSourceName} config={config} />;
  13. } else {
  14. return <CloudReceiverForm alertManagerSourceName={alertManagerSourceName} config={config} />;
  15. }
  16. };