once a server has a domain, stop asking for another

A form offering work nobody came to do. Both servers were pointed at, both had
certificates, and the block still showed two empty fields and two buttons — the
second address for one site is the rare case, and it lives in Proxy Manager with
the rest of the picture.

So the field appears only while that server has nothing, and the forward address
goes with them: once both are pointed somewhere it configures nothing.

`min-w-0` on the input, because a flex child refuses to shrink below its content
by default, which is what was pushing "Point here" off the edge of the card.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-29 14:12:17 +01:00
co-authored by Claude Opus 5
parent 3e07ee38c2
commit 0a95647b8e
+27 -5
View File
@@ -283,31 +283,50 @@ export const ProxiesBlock = ({ servers }: { servers: Server[] }) => {
</div>
))}
{/*
Only while there is nothing here.
A server with a domain has been set up, and the field asking for another is a form offering
work nobody came to do — the second address for one site is the rare case, and it lives in
Proxy Manager with the rest of the picture.
`min-w-0` on the input: without it a flex child refuses to shrink below its content, and the
button beside it gets pushed off the edge of the card.
*/}
{mine.length === 0 && (
<div className="flex gap-2">
<Input
value={domains[server.name] ?? ''}
onChange={(event) => setDomains((current) => ({ ...current, [server.name]: event.target.value }))}
placeholder={server.name === 'production' ? 'www.example.com' : 'dev.example.com'}
className="w-full font-mono text-xs"
className="min-w-0 flex-1 font-mono text-xs"
autoComplete="off"
spellCheck={false}
/>
<Button
variant="outline"
size="sm"
className="w-24 shrink-0 justify-center"
className="w-28 shrink-0 justify-center"
onClick={() => void create(server)}
disabled={busy !== null || !server.port || !forwardHost.trim() || !(domains[server.name] ?? '').trim()}
title={server.port ? undefined : 'Set a port for this server first'}
>
{busy === `${server.name}:create` ? <Loader2 className="size-3.5 animate-spin" /> : <Plus className="size-3.5" />}
{busy === `${server.name}:create` ? (
<Loader2 className="size-3.5 animate-spin" />
) : (
<Plus className="size-3.5" />
)}
Point here
</Button>
</div>
)}
</div>
);
};
// Nothing left to point anywhere: every server already has a domain.
const anythingToCreate = servers.some((server) => !(hosts ?? []).some((host) => host.forward_port === server.port));
return (
<Block icon={Globe} title="Domains" hint="Which addresses reach the site, through Nginx Proxy Manager.">
{!hosts ? null : (
@@ -316,8 +335,10 @@ export const ProxiesBlock = ({ servers }: { servers: Server[] }) => {
<Console output={output} failed={failed} />
{/* Shown, not hidden: it is a guess made from other people's configuration, and NPM being in a
container is exactly why `127.0.0.1` would fail in a way that looks like the site is down. */}
{/* Shown while it is still needed, because it is a guess made from other people's configuration
and NPM being in a container is exactly why `127.0.0.1` would fail in a way that looks like
the site is down. Once both servers have a domain it configures nothing, so it goes. */}
{anythingToCreate && (
<div className="flex items-center gap-2 border-t border-border pt-3">
<span className="text-xs text-muted-foreground/70">NPM reaches this machine at</span>
<Input
@@ -328,6 +349,7 @@ export const ProxiesBlock = ({ servers }: { servers: Server[] }) => {
spellCheck={false}
/>
</div>
)}
<p className="text-xs text-muted-foreground/60">
Certificates are proved over DNS with the key Officer holds for the domain, so a name works