Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: lock the backend configuration box when its stored text could not be read

Only a 404 means nothing is stored. Any other failed read used to leave an empty,
editable box with save enabled, so saving one line replaced a configuration that
was never read. The box now stays locked behind an error with a retry button.
The decision is a small tested function, and the swarm-ui doc describes it.
This commit is contained in:
iris 2026-11-25 19:21:46 +01:00 • committed by mara
commit c7e559a09e

View file

@ -76,6 +76,20 @@ export function backendEnvUrl(hive: string, agent: string): string {
return `${agentBase(hive, agent)}/backend-env`;
}
/**
* What a read of the stored backend configuration answered: `stored` (200),
* `none` (404, nothing is stored, so an empty box is right) or `failed` (any
* other answer, which must not unlock the box: a save would replace text that
* was never read).
*/
export function configReadKind(
status: number,
ok: boolean,
): "stored" | "none" | "failed" {
if (ok) return "stored";
return status === 404 ? "none" : "failed";
}
/** GET (is any stored), PUT and DELETE target for the agent's backend secrets. */
export function backendSecretsUrl(hive: string, agent: string): string {
return `${agentBase(hive, agent)}/backend-secrets`;