refactor(types): rename AppType to AppId for semantic clarity
Rename `AppType` to `AppId` across the entire frontend codebase to better reflect its purpose as an application identifier rather than a type category. This aligns frontend naming with backend command parameter conventions. Changes: - Rename type `AppType` to `AppId` in src/lib/api/types.ts - Remove `AppType` export from src/lib/api/index.ts - Update all component props from `appType` to `appId` (43 files) - Update all variable names from `appType` to `appId` - Synchronize documentation (CHANGELOG, refactoring plans) - Update test files and MSW mocks BREAKING CHANGE: `AppType` type is no longer exported. Use `AppId` instead. All component props have been renamed from `appType` to `appId`.
This commit is contained in:
@@ -61,7 +61,7 @@ describe("AddProviderDialog", () => {
|
||||
<AddProviderDialog
|
||||
open
|
||||
onOpenChange={handleOpenChange}
|
||||
appType="claude"
|
||||
appId="claude"
|
||||
onSubmit={handleSubmit}
|
||||
/>,
|
||||
);
|
||||
@@ -97,7 +97,7 @@ describe("AddProviderDialog", () => {
|
||||
<AddProviderDialog
|
||||
open
|
||||
onOpenChange={vi.fn()}
|
||||
appType="claude"
|
||||
appId="claude"
|
||||
onSubmit={handleSubmit}
|
||||
/>,
|
||||
);
|
||||
|
||||
@@ -114,7 +114,7 @@ const renderForm = (props?: Partial<React.ComponentProps<typeof McpFormModal>>)
|
||||
const onClose = overrideOnClose ?? vi.fn();
|
||||
render(
|
||||
<McpFormModal
|
||||
appType="claude"
|
||||
appId="claude"
|
||||
onSave={onSave}
|
||||
onClose={onClose}
|
||||
existingIds={[]}
|
||||
@@ -260,7 +260,7 @@ const renderForm = (props?: Partial<React.ComponentProps<typeof McpFormModal>>)
|
||||
});
|
||||
|
||||
it("TOML 模式下自动提取 ID 并成功保存", async () => {
|
||||
const { onSave } = renderForm({ appType: "codex" });
|
||||
const { onSave } = renderForm({ appId: "codex" });
|
||||
|
||||
const configTextarea = screen.getByPlaceholderText(
|
||||
"mcp.form.tomlPlaceholder",
|
||||
@@ -288,7 +288,7 @@ command = "run"
|
||||
});
|
||||
|
||||
it("TOML 模式下缺少命令时展示错误提示并阻止提交", async () => {
|
||||
const { onSave } = renderForm({ appType: "codex" });
|
||||
const { onSave } = renderForm({ appId: "codex" });
|
||||
|
||||
const configTextarea = screen.getByPlaceholderText(
|
||||
"mcp.form.tomlPlaceholder",
|
||||
@@ -319,7 +319,7 @@ type = "stdio"
|
||||
} as McpServer;
|
||||
|
||||
const { onSave } = renderForm({
|
||||
appType: "claude",
|
||||
appId: "claude",
|
||||
editingId: "existing",
|
||||
initialData,
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ describe("ProviderList Component", () => {
|
||||
<ProviderList
|
||||
providers={{}}
|
||||
currentProviderId=""
|
||||
appType="claude"
|
||||
appId="claude"
|
||||
onSwitch={vi.fn()}
|
||||
onEdit={vi.fn()}
|
||||
onDelete={vi.fn()}
|
||||
@@ -150,7 +150,7 @@ describe("ProviderList Component", () => {
|
||||
<ProviderList
|
||||
providers={{}}
|
||||
currentProviderId=""
|
||||
appType="claude"
|
||||
appId="claude"
|
||||
onSwitch={vi.fn()}
|
||||
onEdit={vi.fn()}
|
||||
onDelete={vi.fn()}
|
||||
@@ -189,7 +189,7 @@ describe("ProviderList Component", () => {
|
||||
<ProviderList
|
||||
providers={{ a: providerA, b: providerB }}
|
||||
currentProviderId="b"
|
||||
appType="claude"
|
||||
appId="claude"
|
||||
isEditMode
|
||||
onSwitch={handleSwitch}
|
||||
onEdit={handleEdit}
|
||||
|
||||
Reference in New Issue
Block a user