sudoModal.tsx 607 B

12345678910111213141516171819202122
  1. import type {ModalOptions} from 'sentry/actionCreators/modal';
  2. import ModalStore from 'sentry/stores/modalStore';
  3. type OpenSudoModalOptions = ModalOptions & {
  4. closeButton?: boolean;
  5. isSuperuser?: boolean;
  6. needsReload?: boolean;
  7. onClose?: () => void;
  8. retryRequest?: () => Promise<any>;
  9. sudo?: boolean;
  10. };
  11. export async function openSudo({
  12. onClose,
  13. closeEvents,
  14. ...args
  15. }: OpenSudoModalOptions = {}) {
  16. const mod = await import('sentry/components/modals/sudoModal');
  17. const {default: Modal} = mod;
  18. ModalStore.openModal(deps => <Modal {...deps} {...args} />, {onClose, closeEvents});
  19. }