From bb6c9c8daf0e2520d98265a14847bd7b55f53e72 Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Sun, 26 Oct 2025 00:28:39 +1000 Subject: [PATCH] Certificates section react work --- frontend/src/api/backend/createCertificate.ts | 1 - .../src/api/backend/testHttpCertificate.ts | 6 +- frontend/src/components/Form/AccessField.tsx | 2 +- .../src/components/Form/DNSProviderFields.tsx | 31 +-- .../src/components/Form/DomainNamesField.tsx | 7 +- .../src/components/Form/LocationsFields.tsx | 2 +- .../src/components/Form/NginxConfigField.tsx | 1 + .../components/Form/SSLCertificateField.tsx | 16 +- .../src/components/Form/SSLOptionsFields.tsx | 4 +- .../Table/Formatter/EventFormatter.tsx | 2 +- frontend/src/locale/lang/en.json | 46 +++-- frontend/src/locale/src/en.json | 136 ++++++++----- .../src/modals/CustomCertificateModal.tsx | 88 ++++++++ frontend/src/modals/DNSCertificateModal.tsx | 89 +++++++++ frontend/src/modals/DeadHostModal.tsx | 2 +- frontend/src/modals/EventDetailsModal.tsx | 20 +- frontend/src/modals/HTTPCertificateModal.tsx | 188 ++++++++++++++++++ frontend/src/modals/ProxyHostModal.tsx | 2 +- frontend/src/modals/RedirectionHostModal.tsx | 2 +- frontend/src/modals/index.ts | 3 + frontend/src/pages/Certificates/Table.tsx | 18 +- .../src/pages/Certificates/TableWrapper.tsx | 32 ++- frontend/src/pages/Dashboard/index.tsx | 6 - .../pages/Nginx/ProxyHosts/TableWrapper.tsx | 13 +- 24 files changed, 596 insertions(+), 121 deletions(-) create mode 100644 frontend/src/modals/CustomCertificateModal.tsx create mode 100644 frontend/src/modals/DNSCertificateModal.tsx create mode 100644 frontend/src/modals/HTTPCertificateModal.tsx diff --git a/frontend/src/api/backend/createCertificate.ts b/frontend/src/api/backend/createCertificate.ts index 57f89478..ea81c44e 100644 --- a/frontend/src/api/backend/createCertificate.ts +++ b/frontend/src/api/backend/createCertificate.ts @@ -4,7 +4,6 @@ import type { Certificate } from "./models"; export async function createCertificate(item: Certificate): Promise { return await api.post({ url: "/nginx/certificates", - // todo: only use whitelist of fields for this data data: item, }); } diff --git a/frontend/src/api/backend/testHttpCertificate.ts b/frontend/src/api/backend/testHttpCertificate.ts index a35d1fce..23dfa4b7 100644 --- a/frontend/src/api/backend/testHttpCertificate.ts +++ b/frontend/src/api/backend/testHttpCertificate.ts @@ -1,10 +1,10 @@ import * as api from "./base"; export async function testHttpCertificate(domains: string[]): Promise> { - return await api.get({ + return await api.post({ url: "/nginx/certificates/test-http", - params: { - domains: domains.join(","), + data: { + domains, }, }); } diff --git a/frontend/src/components/Form/AccessField.tsx b/frontend/src/components/Form/AccessField.tsx index 892c716f..c72ef588 100644 --- a/frontend/src/components/Form/AccessField.tsx +++ b/frontend/src/components/Form/AccessField.tsx @@ -58,7 +58,7 @@ export function AccessField({ name = "accessListId", label = "access-list", id = options?.unshift({ value: 0, label: intl.formatMessage({ id: "access-list.public" }), - subLabel: "No basic auth required", + subLabel: intl.formatMessage({ id: "access-list.public.subtitle" }), icon: , }); diff --git a/frontend/src/components/Form/DNSProviderFields.tsx b/frontend/src/components/Form/DNSProviderFields.tsx index 6f6d963d..fc01e8be 100644 --- a/frontend/src/components/Form/DNSProviderFields.tsx +++ b/frontend/src/components/Form/DNSProviderFields.tsx @@ -1,8 +1,10 @@ +import { IconAlertTriangle } from "@tabler/icons-react"; import { Field, useFormikContext } from "formik"; import { useState } from "react"; import Select, { type ActionMeta } from "react-select"; import type { DNSProvider } from "src/api/backend"; import { useDnsProviders } from "src/hooks"; +import { T } from "src/locale"; import styles from "./DNSProviderFields.module.css"; interface DNSProviderOption { @@ -10,7 +12,11 @@ interface DNSProviderOption { readonly label: string; readonly credentials: string; } -export function DNSProviderFields() { + +interface Props { + showBoundaryBox?: boolean; +} +export function DNSProviderFields({ showBoundaryBox = false }: Props) { const { values, setFieldValue } = useFormikContext(); const { data: dnsProviders, isLoading } = useDnsProviders(); const [dnsProviderId, setDnsProviderId] = useState(null); @@ -31,17 +37,17 @@ export function DNSProviderFields() { })) || []; return ( -
-

- This section requires some knowledge about Certbot and DNS plugins. Please consult the respective - plugins documentation. +

+

+ +

{({ field }: any) => (