Skip to content

Commit 7341b61

Browse files
authored
Fix checkbox (IBM#935)
Signed-off-by: Madhav Kandukuri <[email protected]>
1 parent 6d4d9f5 commit 7341b61

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

mcpgateway/static/admin.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5215,6 +5215,15 @@ async function testTool(toolId) {
52155215
});
52165216

52175217
wrapper.appendChild(input);
5218+
5219+
if (itemTypes.includes("boolean")) {
5220+
const hidden = document.createElement("input");
5221+
hidden.type = "hidden";
5222+
hidden.name = keyValidation.value;
5223+
hidden.value = "false";
5224+
wrapper.appendChild(hidden);
5225+
}
5226+
52185227
wrapper.appendChild(delBtn);
52195228
return wrapper;
52205229
}
@@ -5258,6 +5267,7 @@ async function testTool(toolId) {
52585267
fieldInput.type = "number";
52595268
} else if (prop.type === "boolean") {
52605269
fieldInput.type = "checkbox";
5270+
fieldInput.value = "true";
52615271
} else {
52625272
fieldInput = document.createElement("textarea");
52635273
fieldInput.rows = 1;
@@ -5284,6 +5294,15 @@ async function testTool(toolId) {
52845294
}
52855295

52865296
fieldDiv.appendChild(fieldInput);
5297+
if (prop.default !== undefined) {
5298+
if (fieldInput.type === "checkbox") {
5299+
const hiddenInput = document.createElement("input");
5300+
hiddenInput.type = "hidden";
5301+
hiddenInput.value = "false";
5302+
hiddenInput.name = keyValidation.value;
5303+
fieldDiv.appendChild(hiddenInput);
5304+
}
5305+
}
52875306
}
52885307

52895308
container.appendChild(fieldDiv);

0 commit comments

Comments
 (0)