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
backend/internal/dnsproviders
frontend/src

View File

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

View File

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

View File

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

View File

@ -27,6 +27,7 @@ import { PrettyButton } from "components";
import { Formik, Form, Field } from "formik";
import { useSetDNSProvider, useDNSProvidersAcmesh } from "hooks";
import { intl } from "locale";
import { validateString } from "modules/Validations";
interface DNSProviderCreateModalProps {
isOpen: boolean;
@ -56,9 +57,6 @@ function DNSProviderCreateModal({
payload: DNSProvider,
{ 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
const showErr = (msg: string) => {
@ -137,6 +135,29 @@ function DNSProviderCreateModal({
<ModalCloseButton />
<ModalBody>
<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, form }: any) => (
<FormControl