feat(mcp): add update notification badge

This commit is contained in:
Abeautifulsnow authored and GitHub committed 2026-08-05 15:52:20 +08:00
1 parent 7243f5eb06
commit 62624786dc
15 files changed
+279 -3

No files matched your search

@@ -0,0 +1,19 @@
import type { McpServerStatus } from "@/lib/backend/tauri";
let mcpStatusRequestSequence = 0;
let latestMcpStatusRequestId = 0;
export function beginMcpStatusRequest(): number {
latestMcpStatusRequestId = ++mcpStatusRequestSequence;
return latestMcpStatusRequestId;
}
export function isLatestMcpStatusRequest(requestId: number): boolean {
return requestId === latestMcpStatusRequestId;
}
export function mcpUpdateAvailability(status: McpServerStatus): boolean | null {
if (!status.installed) return false;
if (!status.current_version || !status.latest_version) return null;
return status.update_available;
}
@@ -0,0 +1,14 @@
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");
describe("settings page navigation", () => {
it("replays repeated navigation requests for the same tab", () => {
expect(appSource).toContain("settingsNavigationRequestId.value += 1");
expect(appSource).toContain(':navigation-request-id="settingsNavigationRequestId"');
expect(settingsDialogSource).toContain("navigationRequestId?: number;");
expect(settingsDialogSource).toMatch(/watch\(\s*\(\) => props\.navigationRequestId,/);
});
});