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

@ -9,6 +9,7 @@ import {
backendSecretsUrl,
checkApiKey,
checkLink,
configReadKind,
deleteUrl,
linkBody,
linkUrl,
@ -98,3 +99,11 @@ test("a key the controller would refuse is caught first, and a plain one is not"
assert.notEqual(checkApiKey(bad), null, bad);
}
});
test("only a 404 means no configuration is stored; any other failure locks the box", () => {
assert.equal(configReadKind(200, true), "stored");
assert.equal(configReadKind(404, false), "none");
assert.equal(configReadKind(500, false), "failed");
assert.equal(configReadKind(403, false), "failed");
assert.equal(configReadKind(0, false), "failed");
});