sentryAppRuleModal.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {Fragment} from 'react';
  2. import {closeModal, ModalRenderProps} from 'app/actionCreators/modal';
  3. import {tct} from 'app/locale';
  4. import SentryAppExternalForm, {
  5. SchemaFormConfig,
  6. } from 'app/views/organizationIntegrations/sentryAppExternalForm';
  7. type Props = ModalRenderProps & {
  8. sentryAppInstallationUuid: string;
  9. appName: string;
  10. config: SchemaFormConfig;
  11. resetValues: {[key: string]: any};
  12. onSubmitSuccess: React.ComponentProps<typeof SentryAppExternalForm>['onSubmitSuccess'];
  13. };
  14. const SentryAppRuleModal = ({
  15. Header,
  16. Body,
  17. sentryAppInstallationUuid,
  18. appName,
  19. config,
  20. resetValues,
  21. onSubmitSuccess,
  22. }: Props) => (
  23. <Fragment>
  24. <Header closeButton>{tct('[name] Settings', {name: appName})}</Header>
  25. <Body>
  26. <SentryAppExternalForm
  27. sentryAppInstallationUuid={sentryAppInstallationUuid}
  28. appName={appName}
  29. config={config}
  30. element="alert-rule-action"
  31. action="create"
  32. onSubmitSuccess={(...params) => {
  33. onSubmitSuccess(...params);
  34. closeModal();
  35. }}
  36. resetValues={{settings: resetValues?.settings}}
  37. />
  38. </Body>
  39. </Fragment>
  40. );
  41. export default SentryAppRuleModal;