fix: use AAAA and A info the record dialog

This commit is contained in:
Aarnav Tale 2025-05-04 14:47:20 -04:00
parent 9e0450b15b
commit 1c88fe55cb
No known key found for this signature in database

View File

@ -9,6 +9,7 @@ interface Props {
} }
export default function AddRecord({ records }: Props) { export default function AddRecord({ records }: Props) {
const [type, setType] = useState<'A' | 'AAAA' | string>('A');
const [name, setName] = useState(''); const [name, setName] = useState('');
const [ip, setIp] = useState(''); const [ip, setIp] = useState('');
@ -23,7 +24,12 @@ export default function AddRecord({ records }: Props) {
return ( return (
<Dialog> <Dialog>
<Dialog.Button>Add DNS record</Dialog.Button> <Dialog.Button>Add DNS record</Dialog.Button>
<Dialog.Panel> <Dialog.Panel
onSubmit={() => {
setName('');
setIp('');
}}
>
<Dialog.Title>Add DNS record</Dialog.Title> <Dialog.Title>Add DNS record</Dialog.Title>
<Dialog.Text> <Dialog.Text>
Enter the domain and IP address for the new DNS record. Enter the domain and IP address for the new DNS record.
@ -34,7 +40,10 @@ export default function AddRecord({ records }: Props) {
isRequired isRequired
label="Record Type" label="Record Type"
name="record_type" name="record_type"
defaultInputValue="A" defaultInputValue={type}
onSelectionChange={(v) => {
if (v) setType(v.toString() as 'A' | 'AAAA');
}}
> >
<Select.Item key="A">A</Select.Item> <Select.Item key="A">A</Select.Item>
<Select.Item key="AAAA">AAAA</Select.Item> <Select.Item key="AAAA">AAAA</Select.Item>
@ -50,7 +59,9 @@ export default function AddRecord({ records }: Props) {
<Input <Input
isRequired isRequired
label="IP Address" label="IP Address"
placeholder="101.101.101.101" placeholder={
type === 'AAAA' ? '2001:db8::ff00:42:8329' : '101.101.101.101'
}
name="record_value" name="record_value"
onChange={setIp} onChange={setIp}
isInvalid={isDuplicate} isInvalid={isDuplicate}