feat(mcp): enhance form UX with default apps and JSON formatter
- Enable all apps (Claude, Codex, Gemini) by default when adding MCP servers - Improve config label with clearer wording: "Full JSON configuration or use [Config Wizard]" - Add JSON format button to beautify configuration with 2-space indentation - Update tests to reflect new default behavior - Clean up redundant explicit prop passing This provides a more streamlined experience by enabling all apps out of the box and making it easier to format JSON configurations.
This commit is contained in:
@@ -139,7 +139,6 @@ describe("McpFormModal", () => {
|
||||
onClose={onClose}
|
||||
existingIds={[]}
|
||||
defaultFormat="json"
|
||||
defaultEnabledApps={["claude"]}
|
||||
{...rest}
|
||||
/>,
|
||||
);
|
||||
@@ -211,8 +210,8 @@ describe("McpFormModal", () => {
|
||||
},
|
||||
apps: {
|
||||
claude: true,
|
||||
codex: false,
|
||||
gemini: false,
|
||||
codex: true,
|
||||
gemini: true,
|
||||
},
|
||||
});
|
||||
expect(onSave).toHaveBeenCalledTimes(1);
|
||||
@@ -291,6 +290,11 @@ command = "run"
|
||||
it("TOML 模式下缺少命令时展示错误提示并阻止提交", async () => {
|
||||
const { onSave } = renderForm({ defaultFormat: "toml" });
|
||||
|
||||
// 填写 ID 字段
|
||||
fireEvent.change(screen.getByPlaceholderText("mcp.form.titlePlaceholder"), {
|
||||
target: { value: "test-toml" },
|
||||
});
|
||||
|
||||
const configTextarea = screen.getByPlaceholderText(
|
||||
"mcp.form.tomlPlaceholder",
|
||||
) as HTMLTextAreaElement;
|
||||
@@ -317,6 +321,7 @@ type = "stdio"
|
||||
enabled: true,
|
||||
description: "Old desc",
|
||||
server: { type: "stdio", command: "old" },
|
||||
apps: { claude: true, codex: false, gemini: false },
|
||||
} as McpServer;
|
||||
|
||||
const { onSave } = renderForm({
|
||||
@@ -371,6 +376,18 @@ type = "stdio"
|
||||
expect(claudeCheckbox.checked).toBe(true);
|
||||
fireEvent.click(claudeCheckbox);
|
||||
|
||||
const codexCheckbox = screen.getByLabelText(
|
||||
"mcp.unifiedPanel.apps.codex",
|
||||
) as HTMLInputElement;
|
||||
expect(codexCheckbox.checked).toBe(true);
|
||||
fireEvent.click(codexCheckbox);
|
||||
|
||||
const geminiCheckbox = screen.getByLabelText(
|
||||
"mcp.unifiedPanel.apps.gemini",
|
||||
) as HTMLInputElement;
|
||||
expect(geminiCheckbox.checked).toBe(true);
|
||||
fireEvent.click(geminiCheckbox);
|
||||
|
||||
fireEvent.click(screen.getByText("common.add"));
|
||||
|
||||
await waitFor(() => expect(upsertMock).toHaveBeenCalledTimes(1));
|
||||
|
||||
Reference in New Issue
Block a user