feat(settings): add update check and MCP uninstall
This commit is contained in:
12 files changed
+189
-9
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const settingsDialogSource = readFileSync(new URL("../../../components/editor/EditorSettingsDialog.vue", import.meta.url), "utf8");
|
||||
const tauriBackendSource = readFileSync(new URL("../../../lib/backend/tauri.ts", import.meta.url), "utf8");
|
||||
const httpBackendSource = readFileSync(new URL("../../../lib/backend/http.ts", import.meta.url), "utf8");
|
||||
|
||||
describe("MCP server management", () => {
|
||||
it("exposes a confirmed uninstall action only for an installed desktop server", () => {
|
||||
expect(settingsDialogSource).toContain('v-if="!isWeb && mcpStatus?.installed"');
|
||||
expect(settingsDialogSource).toContain('window.confirm(t("settings.mcpUninstallConfirm"))');
|
||||
expect(settingsDialogSource).toContain("await uninstallMcpServer()");
|
||||
expect(settingsDialogSource).toContain('t("settings.mcpUninstallCommand")');
|
||||
expect(settingsDialogSource).toContain("copyMcpText('uninstall', mcpUninstallCommand)");
|
||||
expect(tauriBackendSource).toContain('invoke("uninstall_mcp_server")');
|
||||
expect(httpBackendSource).toContain("MCP Server uninstallation is only available in the desktop app.");
|
||||
});
|
||||
});
|
||||
@@ -730,6 +730,7 @@ export const deleteHistoryEntry = forward("deleteHistoryEntry");
|
||||
// Updates
|
||||
export const checkMcpServerStatus = forward("checkMcpServerStatus");
|
||||
export const installMcpServer = forward("installMcpServer");
|
||||
export const uninstallMcpServer = forward("uninstallMcpServer");
|
||||
export const checkForUpdates = forward("checkForUpdates");
|
||||
export const fetchChangelog = forward("fetchChangelog");
|
||||
export const getSystemProxyUrl = forward("getSystemProxyUrl");
|
||||
|
||||
@@ -3879,6 +3879,7 @@ export async function checkMcpServerStatus(): Promise<import("@/lib/backend/taur
|
||||
data_dir: null,
|
||||
install_command: "npm install -g @dbx-app/mcp-server@latest",
|
||||
update_command: "npm install -g @dbx-app/mcp-server@latest",
|
||||
uninstall_command: "npm uninstall -g @dbx-app/mcp-server",
|
||||
error: "MCP Server status is only available in the desktop app.",
|
||||
};
|
||||
}
|
||||
@@ -3887,6 +3888,10 @@ export async function installMcpServer(): Promise<string> {
|
||||
throw new Error("MCP Server installation is only available in the desktop app.");
|
||||
}
|
||||
|
||||
export async function uninstallMcpServer(): Promise<string> {
|
||||
throw new Error("MCP Server uninstallation is only available in the desktop app.");
|
||||
}
|
||||
|
||||
export async function getSystemProxyUrl(): Promise<string | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2035,6 +2035,7 @@ export interface McpServerStatus {
|
||||
data_dir: string | null;
|
||||
install_command: string;
|
||||
update_command: string;
|
||||
uninstall_command: string;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
@@ -2046,6 +2047,10 @@ export async function installMcpServer(): Promise<string> {
|
||||
return invoke("install_mcp_server");
|
||||
}
|
||||
|
||||
export async function uninstallMcpServer(): Promise<string> {
|
||||
return invoke("uninstall_mcp_server");
|
||||
}
|
||||
|
||||
export async function checkForUpdates(locale?: string, source?: UpdateDownloadSource): Promise<UpdateInfo> {
|
||||
return invoke("check_for_updates", { locale, source });
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const appSource = readFileSync(new URL("../../../App.vue", import.meta.url), "utf8");
|
||||
const settingsDialogSource = readFileSync(new URL("../../../components/editor/EditorSettingsDialog.vue", import.meta.url), "utf8");
|
||||
const changelogPanelSource = readFileSync(new URL("../../../components/settings/ChangelogPanel.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("about page update check", () => {
|
||||
it("reuses the toolbar update check and pending state", () => {
|
||||
expect(changelogPanelSource).toContain('"check-updates": []');
|
||||
expect(changelogPanelSource).toContain("@click=\"emit('check-updates')\"");
|
||||
expect(changelogPanelSource).toContain(':disabled="checkingUpdates"');
|
||||
expect(settingsDialogSource).toContain(':checking-updates="props.checkingUpdates"');
|
||||
expect(settingsDialogSource).toContain("@check-updates=\"emit('check-updates')\"");
|
||||
expect(appSource).toContain(':checking-updates="checkingUpdates"');
|
||||
expect(appSource).toContain('@check-updates="checkUpdates()"');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user