fix(plugin): resolve result-view by UI contribution

This commit is contained in:
jearhe authored and GitHub committed 2026-09-20 01:32:23 +08:00
1 parent dc6c9b5c7c
commit 4f3be8ccfb
14 files changed
+337 -16

No files matched your search

@@ -96,6 +96,23 @@ describe("queryStore openPluginWorkbench reuse", () => {
expect(queryStore.tabs.find((t) => t.id === id)?.pluginWorkbench?.context).toEqual({ connectionId: "conn-1" });
});
it("keeps a result-view tab distinct from the plugin's workbench tab", () => {
const queryStore = useQueryStore();
const workbenchId = queryStore.openPluginWorkbench("io.dbx.ssh", "ssh.main", { title: "SSH server", connectionId: "conn-1", context: { connectionId: "conn-1" } });
const resultViewId = queryStore.openPluginWorkbench("io.dbx.ssh", "ssh.erd", {
title: "Graph",
connectionId: "conn-1",
context: { connectionId: "conn-1", sql: "SELECT 1", result: { columns: ["id"], rows: [[1]], truncated: false } },
});
// The tab keeps the entry contribution id: the renderer resolves it as a
// result-view, and the sidebar workbench tab is not reused for it.
expect(resultViewId).not.toBe(workbenchId);
expect(queryStore.tabs.find((tab) => tab.id === resultViewId)?.pluginWorkbench?.contributionId).toBe("ssh.erd");
expect(queryStore.tabs.find((tab) => tab.id === resultViewId)?.pluginWorkbench?.context?.result).toEqual({ columns: ["id"], rows: [[1]], truncated: false });
});
it("numbers same-connection session tabs Termius-style and never backfills", async () => {
const queryStore = useQueryStore();