mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix(web-ui): render Accounts schema node properly (#35380)
Co-authored-by: stakeswky <64798754+stakeswky@users.noreply.github.com> Co-authored-by: liuxiaopai-ai <73659136+liuxiaopai-ai@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -427,17 +427,35 @@ describe("config form renderer", () => {
|
||||
expect(analysis.unsupportedPaths).not.toContain("channels");
|
||||
});
|
||||
|
||||
it("flags additionalProperties true", () => {
|
||||
it("treats additionalProperties true as editable map fields", () => {
|
||||
const schema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
extra: {
|
||||
accounts: {
|
||||
type: "object",
|
||||
additionalProperties: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
const analysis = analyzeConfigSchema(schema);
|
||||
expect(analysis.unsupportedPaths).toContain("extra");
|
||||
expect(analysis.unsupportedPaths).not.toContain("accounts");
|
||||
|
||||
const onPatch = vi.fn();
|
||||
const container = document.createElement("div");
|
||||
render(
|
||||
renderConfigForm({
|
||||
schema: analysis.schema,
|
||||
uiHints: {},
|
||||
unsupportedPaths: analysis.unsupportedPaths,
|
||||
value: { accounts: { default: { enabled: true } } },
|
||||
onPatch,
|
||||
}),
|
||||
container,
|
||||
);
|
||||
|
||||
const removeButton = container.querySelector(".cfg-map__item-remove");
|
||||
expect(removeButton).not.toBeNull();
|
||||
removeButton?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
||||
expect(onPatch).toHaveBeenCalledWith(["accounts"], {});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -79,7 +79,8 @@ function normalizeSchemaNode(
|
||||
normalized.properties = normalizedProps;
|
||||
|
||||
if (schema.additionalProperties === true) {
|
||||
unsupported.add(pathLabel);
|
||||
// Treat `true` as an untyped map schema so dynamic object keys can still be edited.
|
||||
normalized.additionalProperties = {};
|
||||
} else if (schema.additionalProperties === false) {
|
||||
normalized.additionalProperties = false;
|
||||
} else if (schema.additionalProperties && typeof schema.additionalProperties === "object") {
|
||||
|
||||
Reference in New Issue
Block a user