import {Fragment, useState} from 'react'; import {Alert} from 'sentry/components/alert'; import {Button} from 'sentry/components/button'; import ErrorBoundary from 'sentry/components/errorBoundary'; import Footer from 'sentry/components/footer'; import {Body, Main} from 'sentry/components/layouts/thirds'; import {t, tct} from 'sentry/locale'; import AlertStore from 'sentry/stores/alertStore'; import {Organization} from 'sentry/types'; import useApi from 'sentry/utils/useApi'; import withOrganization from 'sentry/utils/withOrganization'; type Props = { organization: Organization; children?: React.ReactNode; }; function DeletionInProgress({organization}: Props) { return (
{tct( 'The [organization] organization is currently in the process of being deleted from Sentry.', { organization: {organization.slug}, } )}
); } function DeletionPending({organization}: Props) { const api = useApi(); const [isRestoring, setIsRestoring] = useState(false); const onRestore = async () => { setIsRestoring(true); try { await api.requestPromise(`/organizations/${organization.slug}/`, { method: 'PUT', data: {cancelDeletion: true}, }); window.location.reload(); } catch { setIsRestoring(false); AlertStore.addAlert({ message: 'We were unable to restore this organization. Please try again or contact support.', type: 'error', }); } }; return (

{t('Deletion Scheduled')}

{tct('The [organization] organization is currently scheduled for deletion.', { organization: {organization.slug}, })}

{organization.access.includes('org:admin') ? (

{t( 'Would you like to cancel this process and restore the organization back to the original state?' )}

) : (

{t( 'If this is a mistake, contact an organization owner and ask them to restore this organization.' )}

)}

{t( "Note: Restoration is available until the process begins. Once it does, there's no recovering the data that has been removed." )}

); } function OrganizationDetailsBody({children, organization}: Props) { const status = organization?.status?.id; if (status === 'pending_deletion') { return ; } if (status === 'deletion_in_progress') { return ; } return ( {children}