From d44f75af1b9ccbe08e5fe8103359513835d6059a Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Wed, 1 Jun 2022 13:45:31 +0400 Subject: [PATCH] Preliminary dns provider create working modal --- backend/internal/dnsproviders/common.go | 6 ++--- backend/internal/dnsproviders/dns_da.go | 2 +- frontend/src/locale/src/en.json | 10 +++++-- .../src/modals/DNSProviderCreateModal.tsx | 27 ++++++++++++++++--- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/backend/internal/dnsproviders/common.go b/backend/internal/dnsproviders/common.go index a740c99..700924d 100644 --- a/backend/internal/dnsproviders/common.go +++ b/backend/internal/dnsproviders/common.go @@ -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(), } diff --git a/backend/internal/dnsproviders/dns_da.go b/backend/internal/dnsproviders/dns_da.go index 91fc73c..7133a0e 100644 --- a/backend/internal/dnsproviders/dns_da.go +++ b/backend/internal/dnsproviders/dns_da.go @@ -33,7 +33,7 @@ func getDNSDa() Provider { }, { Name: "Insecure", - Type: "boolean", + Type: "bool", MetaKey: "insecure", EnvKey: "DA_Api_Insecure", }, diff --git a/frontend/src/locale/src/en.json b/frontend/src/locale/src/en.json index 507ff6c..c5f44aa 100644 --- a/frontend/src/locale/src/en.json +++ b/frontend/src/locale/src/en.json @@ -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" }, diff --git a/frontend/src/modals/DNSProviderCreateModal.tsx b/frontend/src/modals/DNSProviderCreateModal.tsx index e176fae..832db91 100644 --- a/frontend/src/modals/DNSProviderCreateModal.tsx +++ b/frontend/src/modals/DNSProviderCreateModal.tsx @@ -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({ + + {({ field, form }: any) => ( + + + {intl.formatMessage({ + id: "dns-provider.name", + })} + + + + {form.errors.name} + + + )} + {({ field, form }: any) => (