PgPartmanCallout.tsx39 lines · main
| 1 | import { useState } from 'react' |
| 2 | import { Button } from 'ui' |
| 3 | import { Admonition } from 'ui-patterns' |
| 4 | |
| 5 | import { usePgPartmanStatus } from '../usePgPartmanStatus' |
| 6 | import { EnableExtensionModal } from '@/components/interfaces/Database/Extensions/EnableExtensionModal' |
| 7 | |
| 8 | export function PgPartmanCallout() { |
| 9 | const { pgPartmanExtension, isAvailable, isInstalled } = usePgPartmanStatus() |
| 10 | const [showEnableModal, setShowEnableModal] = useState(false) |
| 11 | |
| 12 | if (!isAvailable || isInstalled) return null |
| 13 | |
| 14 | return ( |
| 15 | <div className="mx-5 my-2"> |
| 16 | <Admonition |
| 17 | type="tip" |
| 18 | title="pg_partman is now available" |
| 19 | description="Unlock partitioned queues for automatic data retention, lower storage costs, and faster performance at scale." |
| 20 | > |
| 21 | <Button |
| 22 | type="default" |
| 23 | size="tiny" |
| 24 | className="mt-2" |
| 25 | onClick={() => setShowEnableModal(true)} |
| 26 | > |
| 27 | Enable pg_partman |
| 28 | </Button> |
| 29 | </Admonition> |
| 30 | {pgPartmanExtension && ( |
| 31 | <EnableExtensionModal |
| 32 | visible={showEnableModal} |
| 33 | extension={pgPartmanExtension} |
| 34 | onCancel={() => setShowEnableModal(false)} |
| 35 | /> |
| 36 | )} |
| 37 | </div> |
| 38 | ) |
| 39 | } |