feat(webui): inline editing for per-repo allow_concurrent/max_retries/review_enabled
Adds PATCH /api/config/repos/{owner}/{name}, a dedicated seam distinct
from the generic dotted-key PATCH /api/config path: a repository is
one element of []config.Repo, not a flat key. Traced the mechanism
before adding any new plumbing -- overlay.Nest/ApplyOverlayValues
already handle "repos" as a single whole-slice key with no dot, so
the fix is a webui handler plus a bootstrap seam that reads the
daemon's live, untrimmed Repos (never webui.RepoView, which omits
Preflight/TestGlob), mutates the one matched field via the pure
applyRepoFieldUpdate helper, and republishes through the existing
UpdateConfig(ctx, {"repos": repos}) path unchanged.
config-row.js's row() gains an opts.save override so an edit can be
redirected to a different persistence call. The repositories table
renders an autosaving checkbox for the two booleans and a
save-on-blur/Enter input for max_retries, via api.configRepoUpdate.
Closes archie-core-b6ew.6, and with it archie-core-b6ew.
This commit is contained in:
1 parent
a444253209
commit
a4fbd8d6ef
12 files changed
+427
-20
No files matched your search
@@ -107,6 +107,40 @@ test("a structured field in a schema section renders no card of its own here", a
|
||||
// storage, web). A literal key string in the source is exactly the
|
||||
// regression archie-core-b6ew.3 removed -- a hardcoded row(...) call
|
||||
// re-appearing for one field while the rest stay generic.
|
||||
// archie-core-b6ew.6: repositories gained inline editors for
|
||||
// allow_concurrent/max_retries/review_enabled. The shim's addEventListener
|
||||
// is a no-op (see ui/test/shim.js), so the save round trip itself is not
|
||||
// exercisable here -- this pins the structural half: the right initial
|
||||
// control with the right initial value renders per repo, matching the
|
||||
// existing config-row.test.js convention of testing structure, not the
|
||||
// live event round trip.
|
||||
test("repositories render a checkbox and a text input reflecting each repo's current field values", async () => {
|
||||
const root = await renderSettings({
|
||||
repositories: [
|
||||
{ owner: "acme", name: "widget", base: "main", allow_concurrent: true, max_retries: 3, review_enabled: false },
|
||||
],
|
||||
});
|
||||
|
||||
const checkboxes = [];
|
||||
const textInputs = [];
|
||||
const walk = (node) => {
|
||||
for (const c of node.childNodes || []) {
|
||||
if (c.tagName === "INPUT" && c.attrs.type === "checkbox") checkboxes.push(c);
|
||||
if (c.tagName === "INPUT" && c.attrs.type === "text") textInputs.push(c);
|
||||
walk(c);
|
||||
}
|
||||
};
|
||||
walk(root);
|
||||
|
||||
assert.equal(checkboxes.length, 2, "allow_concurrent and review_enabled should each render a checkbox");
|
||||
assert.equal(checkboxes[0].attrs.checked, "", "allow_concurrent=true should render checked");
|
||||
assert.equal(checkboxes[1].attrs.checked, undefined, "review_enabled=false should render unchecked");
|
||||
assert.ok(
|
||||
textInputs.some((i) => i.attrs.value === "3"),
|
||||
"max_retries' current value should populate a text input",
|
||||
);
|
||||
});
|
||||
|
||||
test("settings.js contains no literal field-specific branch for the generically-rendered sections", () => {
|
||||
const genericFieldKeys = [
|
||||
"bot_user", "bot_email", "\"label\"", "forge.type", "forge.host", "diff_cap_lines",
|
||||
|
||||
Reference in new issue
Block a user