Preliminary dns provider create working modal

This commit is contained in:
Jamie Curnow 2022-06-01 13:45:31 +04:00
parent b221446bb0
commit d44f75af1b
4 changed files with 36 additions and 9 deletions

View File

@ -48,6 +48,7 @@ func List() []Provider {
getDNSCx(), getDNSCx(),
getDNSCyon(), getDNSCyon(),
getDNSDgon(), getDNSDgon(),
getDNSMe(),
getDNSDNSimple(), getDNSDNSimple(),
getDNSDa(), getDNSDa(),
getDNSDp(), getDNSDp(),
@ -68,17 +69,16 @@ func List() []Provider {
getDNSLinodeV4(), getDNSLinodeV4(),
getDNSLoopia(), getDNSLoopia(),
getDNSLua(), getDNSLua(),
getDNSMe(),
getDNSNamecom(), getDNSNamecom(),
getDNSNamesilo(), getDNSNamesilo(),
getDNSOne(),
getDNSYandex(),
getDNSSelectel(), getDNSSelectel(),
getDNSServercow(), getDNSServercow(),
getDNSTele3(), getDNSTele3(),
getDNSOne(),
getDNSPDNS(), getDNSPDNS(),
getDNSUnoeuro(), getDNSUnoeuro(),
getDNSVscale(), getDNSVscale(),
getDNSYandex(),
getDNSDNZilore(), getDNSDNZilore(),
getDNSZonomi(), getDNSZonomi(),
} }

View File

@ -33,7 +33,7 @@ func getDNSDa() Provider {
}, },
{ {
Name: "Insecure", Name: "Insecure",
Type: "boolean", Type: "bool",
MetaKey: "insecure", MetaKey: "insecure",
EnvKey: "DA_Api_Insecure", EnvKey: "DA_Api_Insecure",
}, },

View File

@ -131,6 +131,9 @@
"acmesh.dns_yandex": { "acmesh.dns_yandex": {
"defaultMessage": "pdd.yandex.ru" "defaultMessage": "pdd.yandex.ru"
}, },
"acmesh.dns_zilore": {
"defaultMessage": "Zilore"
},
"acmesh.dns_zonomi": { "acmesh.dns_zonomi": {
"defaultMessage": "Zonomi" "defaultMessage": "Zonomi"
}, },
@ -231,7 +234,7 @@
"defaultMessage": "Change Password" "defaultMessage": "Change Password"
}, },
"column.acmesh-name": { "column.acmesh-name": {
"defaultMessage": "Acme.sh Plugin" "defaultMessage": "Acme.sh Provider"
}, },
"column.description": { "column.description": {
"defaultMessage": "Description" "defaultMessage": "Description"
@ -297,11 +300,14 @@
"defaultMessage": "Disabled" "defaultMessage": "Disabled"
}, },
"dns-provider.acmesh-name": { "dns-provider.acmesh-name": {
"defaultMessage": "Acme.sh Name" "defaultMessage": "Acme.sh Provider"
}, },
"dns-provider.create": { "dns-provider.create": {
"defaultMessage": "Create DNS Provider" "defaultMessage": "Create DNS Provider"
}, },
"dns-provider.name": {
"defaultMessage": "Name"
},
"dns-providers.title": { "dns-providers.title": {
"defaultMessage": "DNS Providers" "defaultMessage": "DNS Providers"
}, },

View File

@ -27,6 +27,7 @@ import { PrettyButton } from "components";
import { Formik, Form, Field } from "formik"; import { Formik, Form, Field } from "formik";
import { useSetDNSProvider, useDNSProvidersAcmesh } from "hooks"; import { useSetDNSProvider, useDNSProvidersAcmesh } from "hooks";
import { intl } from "locale"; import { intl } from "locale";
import { validateString } from "modules/Validations";
interface DNSProviderCreateModalProps { interface DNSProviderCreateModalProps {
isOpen: boolean; isOpen: boolean;
@ -56,9 +57,6 @@ function DNSProviderCreateModal({
payload: DNSProvider, payload: DNSProvider,
{ setErrors, setSubmitting }: any, { setErrors, setSubmitting }: any,
) => { ) => {
console.log("PAYLOAD:", payload);
// return;
// TODO: filter out the meta object and only include items that apply to the acmesh provider selected // TODO: filter out the meta object and only include items that apply to the acmesh provider selected
const showErr = (msg: string) => { const showErr = (msg: string) => {
@ -137,6 +135,29 @@ function DNSProviderCreateModal({
<ModalCloseButton /> <ModalCloseButton />
<ModalBody> <ModalBody>
<Stack spacing={4}> <Stack spacing={4}>
<Field name="name" validate={validateString(1, 100)}>
{({ field, form }: any) => (
<FormControl
isRequired
isInvalid={form.errors.name && form.touched.name}>
<FormLabel htmlFor="name">
{intl.formatMessage({
id: "dns-provider.name",
})}
</FormLabel>
<Input
{...field}
id="name"
placeholder={intl.formatMessage({
id: "dns-provider.name",
})}
/>
<FormErrorMessage>
{form.errors.name}
</FormErrorMessage>
</FormControl>
)}
</Field>
<Field name="acmeshName"> <Field name="acmeshName">
{({ field, form }: any) => ( {({ field, form }: any) => (
<FormControl <FormControl