mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 20:05:06 +03:00
## Problem We used to have a `_Shadcn_` suffix for all the shadcn form components because we also had `formik` form components. This is not needed anymore. ## Solution - Remove the suffix - Update all usages
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import { UseFormReturn } from 'react-hook-form'
|
|
import { FormField, Input, Separator, SheetSection } from 'ui'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
|
|
import { CreateQueueForm } from './CreateQueueSheet.schema'
|
|
|
|
export function PartitionConfigFields({ form }: { form: UseFormReturn<CreateQueueForm> }) {
|
|
const queueType = form.watch('values.type')
|
|
|
|
if (queueType !== 'partitioned') return null
|
|
|
|
return (
|
|
<>
|
|
<SheetSection className="flex flex-col gap-3">
|
|
<FormField
|
|
control={form.control}
|
|
name="values.partitionInterval"
|
|
render={({ field: { ref, ...rest } }) => (
|
|
<FormItemLayout
|
|
label="Partition interval"
|
|
description="Number of messages per partition"
|
|
className="gap-1"
|
|
>
|
|
<Input
|
|
{...rest}
|
|
type="number"
|
|
placeholder="10000"
|
|
actions={<p className="text-foreground-light pr-2">messages</p>}
|
|
/>
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
<FormField
|
|
control={form.control}
|
|
name="values.retentionInterval"
|
|
render={({ field: { ref, ...rest } }) => (
|
|
<FormItemLayout
|
|
label="Retention interval"
|
|
description="Partitions older than this many messages behind the latest will be dropped"
|
|
className="gap-1"
|
|
>
|
|
<Input
|
|
{...rest}
|
|
type="number"
|
|
placeholder="100000"
|
|
actions={<p className="text-foreground-light pr-2">messages</p>}
|
|
/>
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
</SheetSection>
|
|
<Separator />
|
|
</>
|
|
)
|
|
}
|