Files
supabase/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/ConfirmDisableReadOnlyModal.tsx
Ivan Vasilov 436bdb10ae chore: Move the studio app to apps/studio (#18915)
* Move all studio files from /studio to /apps/studio.

* Move studio specific prettier ignores.

* Fix the ui references from studio.

* Fix the css imports.

* Fix all package.json issues.

* Fix the prettier setup for the studio app.

* Add .turbo folder to prettierignore.

* Fix the github workflows.
2023-11-15 12:38:55 +01:00

54 lines
1.7 KiB
TypeScript

import { useParams } from 'common'
import toast from 'react-hot-toast'
import { Modal } from 'ui'
import { useDisableReadOnlyModeMutation } from 'data/config/project-temp-disable-read-only-mutation'
interface ConfirmDisableReadOnlyModeModalProps {
visible: boolean
onClose: () => void
}
const ConfirmDisableReadOnlyModeModal = ({
visible,
onClose,
}: ConfirmDisableReadOnlyModeModalProps) => {
const { ref } = useParams()
const { mutate: disableReadOnlyMode, isLoading } = useDisableReadOnlyModeMutation({
onSuccess: () => {
toast.success('Successfully disabled read-only mode for 15 minutes')
onClose()
},
})
return (
<Modal
alignFooter="right"
visible={visible}
onCancel={onClose}
loading={isLoading}
confirmText="Disable read-only mode"
header="Confirm to temporarily disable read-only mode"
onConfirm={() => {
if (!ref) return console.error('Project ref is required')
disableReadOnlyMode({ projectRef: ref })
}}
>
<Modal.Content className="py-4 space-y-2">
<p className="text-sm">
This will temporarily allow writes to your database for the{' '}
<span className="text-amber-900">next 15 minutes</span>, during which you can reduce your
database size. After deleting data, you should run a vacuum to reclaim as much space as
possible.
</p>
<p className="text-sm">
If your database size has not been sufficiently reduced after 15 minutes, read-only mode
will be toggled back on. Otherwise, it will stay disabled.
</p>
</Modal.Content>
</Modal>
)
}
export default ConfirmDisableReadOnlyModeModal