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:
parent
ff7215a4b1
commit
c7e559a09e
1 changed files with 66 additions and 7 deletions
|
|
@ -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");
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue