From 0ae7790917a912e4b9ba40c32d6c1306c0561985 Mon Sep 17 00:00:00 2001 From: Juan Denis Date: Tue, 10 Nov 2026 06:20:35 -0500 Subject: [PATCH] fix(ui): mark required fields and show inline errors in more dialogs Migrates to FormField + Label required + useFieldErrors: - SSL certificates: obtain (domains, email, conditional webroot / wildcard DNS credentials) and upload (domain, certificate, private key) - Queue operations: create group, create queue, send message - Monitors: new monitor (keyword only when the check type needs it) - Status pages: page, component and incident dialogs - Invite user: optional email gets an inline invalid-email error ResourcePicker now exposes aria-required/invalid/describedby inside a FormField, and Domains distinguishes an empty domain from a malformed one. New strings in all locales. --- .../scripts/check-frontend-boundaries.mjs | 2 +- frontend/src/components/DomainField.jsx | 3 +- frontend/src/components/ResourcePicker.jsx | 8 +- .../src/components/settings/InviteModal.jsx | 48 +++-- frontend/src/i18n/locales/ar.json | 9 +- frontend/src/i18n/locales/bn.json | 9 +- frontend/src/i18n/locales/de.json | 9 +- frontend/src/i18n/locales/en.json | 7 + frontend/src/i18n/locales/es.json | 9 +- frontend/src/i18n/locales/fr.json | 9 +- frontend/src/i18n/locales/id.json | 9 +- frontend/src/i18n/locales/it.json | 9 +- frontend/src/i18n/locales/ko.json | 9 +- frontend/src/i18n/locales/pl.json | 9 +- frontend/src/i18n/locales/pt.json | 9 +- frontend/src/i18n/locales/ru.json | 9 +- frontend/src/i18n/locales/th.json | 9 +- frontend/src/i18n/locales/tr.json | 9 +- frontend/src/i18n/locales/vi.json | 9 +- frontend/src/i18n/locales/zh-Hans.json | 9 +- frontend/src/i18n/locales/zh-Hant.json | 9 +- frontend/src/pages/Domains.jsx | 4 +- frontend/src/pages/Monitors.jsx | 86 ++++---- frontend/src/pages/QueueOperations.jsx | 146 ++++++------- frontend/src/pages/SSLCertificates.jsx | 196 +++++++++++------- frontend/src/pages/StatusPages.jsx | 129 +++++++----- 26 files changed, 489 insertions(+), 284 deletions(-) diff --git a/frontend/scripts/check-frontend-boundaries.mjs b/frontend/scripts/check-frontend-boundaries.mjs index e619fa30..982a25b1 100644 --- a/frontend/scripts/check-frontend-boundaries.mjs +++ b/frontend/scripts/check-frontend-boundaries.mjs @@ -240,7 +240,7 @@ const ADOPTION_CEILINGS = [ }, { name: 'hand-rolled form-group blocks (F2: FormField/useForm)', - ceiling: 321, + ceiling: 253, include: (file) => file.startsWith('pages/') || file.startsWith('components/'), pattern: /form-group/g, }, diff --git a/frontend/src/components/DomainField.jsx b/frontend/src/components/DomainField.jsx index 1e992717..ac3c6a7a 100644 --- a/frontend/src/components/DomainField.jsx +++ b/frontend/src/components/DomainField.jsx @@ -44,7 +44,7 @@ function loadBases() { * record at this server (a tunnel route, an edge proxy). * * `onChange` receives the normalized hostname ('' while incomplete) and - * `{ mode, valid, base, label, dnsMode, https }` so the caller can pick the + * `{ mode, valid, empty, base, label, dnsMode, https }` so the caller can pick the * right API (give-subdomain vs create-domain) without re-deriving anything. */ export default function DomainField({ @@ -132,6 +132,7 @@ export default function DomainField({ const info = { mode: activeMode, valid: usable, + empty: !fqdn, base: activeMode === 'subdomain' ? base : null, label: activeMode === 'subdomain' ? label : null, dnsMode: activeMode === 'subdomain' ? baseRow?.dns_mode || null : null, diff --git a/frontend/src/components/ResourcePicker.jsx b/frontend/src/components/ResourcePicker.jsx index 20fd915c..708282c5 100644 --- a/frontend/src/components/ResourcePicker.jsx +++ b/frontend/src/components/ResourcePicker.jsx @@ -6,6 +6,7 @@ import { Button } from './ui/button'; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from './ui/command'; +import { useFieldProps } from './ui/field-context'; import { Popover, PopoverContent, PopoverTrigger } from './ui/popover'; import { useResourceOptions } from '../hooks/useResourceOptions'; import { normalizeResourceRef, resourceKey } from '../utils/resourceRefs'; @@ -34,6 +35,8 @@ export default function ResourcePicker({ id, }) { const { t } = useTranslation(); + // Inside a FormField the trigger reports required/invalid and points at the error. + const fieldProps = useFieldProps({ id }); const [open, setOpen] = useState(false); const [query, setQuery] = useState(''); const search = useResourceOptions({ @@ -108,7 +111,10 @@ export default function ResourcePicker({ }}> + {/* Create Queue Modal */} - setShowQueueModal(false)} title={t('app.queueOperations.createQueue', 'Create queue')}> -
-
- + + + -
-
- - setQueueForm({ ...queueForm, name: e.target.value })} required /> -
-
- - setQueueForm({ ...queueForm, description: e.target.value })} /> -
-
- -