Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(plugins): address the review of the rebuilt plugin directory (#666)

Ruben Lütke5dc99029e211
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 86d8744d7d..a9e387c180 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -1564,6 +1564,8 @@
"copy_link_hint_paste": "Oder kopiere diesen Link und füge ihn in die Adressleiste deines Browsers ein.",
"plugin_connected": "{plugin} verbunden",
"connect_named": "{plugin} verbinden",
+ "reconnect_named": "{plugin} neu verbinden",
+ "more_actions_named": "Weitere Aktionen für {plugin}",
"device_flow": "Gerätecode",
"device_step1": "Schritt 1 — kopiere diesen Code",
"device_step2": "Schritt 2 — füge ihn bei {plugin} ein",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 169c7d6ec7..c655e8640b 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -1564,6 +1564,8 @@
"copy_link_hint_paste": "Or copy this link and paste it into your browser's address bar.",
"plugin_connected": "{plugin} connected",
"connect_named": "Connect {plugin}",
+ "reconnect_named": "Reconnect {plugin}",
+ "more_actions_named": "More actions for {plugin}",
"device_flow": "Device flow",
"device_step1": "Step 1 — copy this code",
"device_step2": "Step 2 — paste it on {plugin}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 111bcbc41d..02081ae220 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -1564,6 +1564,8 @@
"copy_link_hint_paste": "O copia este enlace y pégalo en la barra de direcciones de tu navegador.",
"plugin_connected": "{plugin} conectado",
"connect_named": "Conectar {plugin}",
+ "reconnect_named": "Reconectar {plugin}",
+ "more_actions_named": "Más acciones para {plugin}",
"device_flow": "Código de dispositivo",
"device_step1": "Paso 1: copia este código",
"device_step2": "Paso 2: pégalo en {plugin}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/pt.json b/jarvis/ui/web/frontend/src/i18n/locales/pt.json
index 6b00cf2cc9..6c196f425d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/pt.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/pt.json
@@ -1564,6 +1564,8 @@
"copy_link_hint_paste": "Ou copia esta ligação e cola-a na barra de endereço do teu browser.",
"plugin_connected": "{plugin} ligado",
"connect_named": "Ligar {plugin}",
+ "reconnect_named": "Voltar a ligar {plugin}",
+ "more_actions_named": "Mais ações para {plugin}",
"device_flow": "Código de dispositivo",
"device_step1": "Passo 1 — copia este código",
"device_step2": "Passo 2 — cola-o em {plugin}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/zh.json
index 2ab4704c80..0c5fe08305 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/zh.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/zh.json
@@ -1564,6 +1564,8 @@
"copy_link_hint_paste": "或复制此链接并粘贴到浏览器的地址栏中。",
"plugin_connected": "{plugin} 已连接",
"connect_named": "连接 {plugin}",
+ "reconnect_named": "重新连接 {plugin}",
+ "more_actions_named": "{plugin} 的更多操作",
"device_flow": "设备码登录",
"device_step1": "第 1 步——复制此代码",
"device_step2": "第 2 步——在 {plugin} 中粘贴",
diff --git a/jarvis/ui/web/frontend/src/views/PluginsDialog.test.tsx b/jarvis/ui/web/frontend/src/views/PluginsDialog.test.tsx
index e64bf4ff9d..99bba98e78 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsDialog.test.tsx
@@ -71,7 +71,7 @@ it("closes credential setup with Escape without closing the plugin window", asyn
const { onClose } = setup();
const [github] = await pane().findAllByRole("button", { name: "GitHub" });
const row = github.closest("li")!;
- fireEvent.click(within(row).getByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(within(row).getByRole("button", { name: /^Connect / }));
await screen.findByRole("dialog", { name: "Connect GitHub" });
fireEvent.keyDown(document, { key: "Escape" });
await waitFor(() => expect(screen.queryByRole("dialog", { name: "Connect GitHub" })).toBeNull());
@@ -91,3 +91,31 @@ it("closes an open menu with Escape without closing the plugin window", async ()
fireEvent.keyDown(document, { key: "Escape" });
await waitFor(() => expect(onClose).toHaveBeenCalledTimes(1));
});
+
+it("opens a plugin picked in the sidebar even while the community page is open", async () => {
+ vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
+ const url = String(input);
+ if (url.includes("/community")) {
+ return new Response(JSON.stringify({ status: "fresh", revision: 1, generated_at: null, plugins: [], skills: [], agents: [] }));
+ }
+ return new Response(JSON.stringify(catalog));
+ }));
+ const query = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
+ render(<QueryClientProvider client={query}><PluginsDialog onClose={vi.fn()} /></QueryClientProvider>);
+ await pane().findByRole("button", { name: "Gmail" });
+ fireEvent.click(pane().getByRole("button", { name: "Add" }));
+ fireEvent.click(screen.getByRole("menuitem", { name: "From the community marketplace" }));
+ await waitFor(() => {
+ const crumbs = within(pane().getByRole("navigation", { name: "Breadcrumb" }));
+ expect(crumbs.getByText("From the community marketplace").getAttribute("aria-current")).toBe("page");
+ });
+
+ fireEvent.click(installedList().getByRole("button", { name: "Gmail" }));
+
+ // The plugin page replaces the community page instead of the click doing nothing.
+ await waitFor(() => {
+ const crumbs = within(pane().getByRole("navigation", { name: "Breadcrumb" }));
+ expect(crumbs.getByText("Gmail").getAttribute("aria-current")).toBe("page");
+ });
+});
+
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.connectors.test.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.connectors.test.tsx
index 5c915843c8..ddbb56e044 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.connectors.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.connectors.test.tsx
@@ -17,7 +17,7 @@ it("starts instance browser sign-in with an address and no token", async () => {
vi.stubGlobal("fetch", fetcher);
const client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
render(<QueryClientProvider client={client}><PluginsView /></QueryClientProvider>);
- fireEvent.click(await screen.findByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(await screen.findByRole("button", { name: /^Connect / }));
expect(screen.queryByLabelText(/token/i)).toBeNull();
const proceed = screen.getByRole("button", { name: "Continue in browser" }) as HTMLButtonElement;
expect(proceed.disabled).toBe(true);
@@ -65,7 +65,7 @@ function setupLocal(available: boolean) {
it("enables a supported local device without opening an OAuth browser", async () => {
const { fetcher, alerts } = setupLocal(true);
- fireEvent.click(await screen.findByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(await screen.findByRole("button", { name: /^Connect / }));
await screen.findByRole("img", { name: "Connected" });
expect(fetcher.mock.calls.some(([url]) => String(url).endsWith("/amd_gpu/connect/start"))).toBe(true);
expect(alerts).not.toHaveBeenCalled();
@@ -73,7 +73,7 @@ it("enables a supported local device without opening an OAuth browser", async ()
it("keeps an unavailable device disconnected and explains the missing capability", async () => {
const { alerts, fetcher } = setupLocal(false);
- const connect = await screen.findByRole("button", { name: "Connect plugin" });
+ const connect = await screen.findByRole("button", { name: /^Connect / });
expect((connect as HTMLButtonElement).disabled).toBe(true);
expect(screen.getByText("Unsupported on this device")).toBeDefined();
fireEvent.click(connect);
@@ -96,7 +96,7 @@ it("shows a normalized connection error without exposing provider response bodie
const alerts = vi.spyOn(window, "alert").mockImplementation(() => {});
const client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
render(<QueryClientProvider client={client}><PluginsView /></QueryClientProvider>);
- fireEvent.click(await screen.findByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(await screen.findByRole("button", { name: /^Connect / }));
await screen.findByRole("alertdialog", { name: "Connection unavailable" });
expect(screen.getByText(/provider could not be reached/i)).toBeDefined();
expect(screen.queryByText(/PRIVATE PROVIDER BODY/)).toBeNull();
@@ -113,7 +113,7 @@ it("keeps unprovisioned device login pending with an explicit collapsed token al
vi.stubGlobal("fetch", fetcher);
const client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
render(<QueryClientProvider client={client}><PluginsView /></QueryClientProvider>);
- fireEvent.click(await screen.findByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(await screen.findByRole("button", { name: /^Connect / }));
await screen.findByRole("dialog");
expect(screen.getByText(/pending publisher setup/i)).toBeDefined();
const alternative = screen.getByText("Expert token alternative").closest("details");
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
index f03bc58a5c..9ec1535d7e 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.test.tsx
@@ -5,7 +5,6 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import {
matchesNamePrefix,
matchesQuery,
- matchesStatus,
PatConnectDialog,
PkceConnectDialog,
sortPluginsByName,
@@ -209,11 +208,11 @@ describe("PluginsView states connection in connection words", () => {
await screen.findByRole("button", { name: "GitHub" });
expect(screen.getByRole("button", { name: "Vercel" })).toBeDefined();
// The untouched row offers a connection, the connected row names it.
- expect(screen.getByRole("button", { name: "Connect plugin" })).toBeDefined();
+ expect(screen.getByRole("button", { name: /^Connect / })).toBeDefined();
expect(screen.getByRole("img", { name: "Connected" })).toBeDefined();
// Disconnecting sits behind the row's menu, never one stray click away.
expect(screen.queryByRole("menuitem", { name: "Disconnect" })).toBeNull();
- fireEvent.click(screen.getByRole("button", { name: "More actions" }));
+ fireEvent.click(screen.getByRole("button", { name: /^More actions for / }));
expect(screen.getByRole("menuitem", { name: "Disconnect" })).toBeDefined();
// No install wording on connection controls: "Added" read as
// done-before-authed.
@@ -233,7 +232,7 @@ describe("plugin row click-lock", () => {
() => new Promise<void>((resolve) => { release = resolve; }),
);
renderRow("not_connected", onConnect);
- const btn = screen.getByRole("button", { name: "Connect plugin" });
+ const btn = screen.getByRole("button", { name: /^Connect / });
fireEvent.click(btn);
fireEvent.click(btn); // second click while the first is still pending
@@ -243,13 +242,13 @@ describe("plugin row click-lock", () => {
expect(onConnect).toHaveBeenCalledTimes(1);
const busy = await screen.findByRole("button", { name: "Connecting Row Plugin" });
expect((busy as HTMLButtonElement).disabled).toBe(true);
- expect(screen.queryByRole("button", { name: "Connect plugin" })).toBeNull();
+ expect(screen.queryByRole("button", { name: /^Connect / })).toBeNull();
await act(async () => {
release();
});
expect(
- (screen.getByRole("button", { name: "Connect plugin" }) as HTMLButtonElement).disabled,
+ (screen.getByRole("button", { name: /^Connect / }) as HTMLButtonElement).disabled,
).toBe(false);
});
@@ -258,9 +257,9 @@ describe("plugin row click-lock", () => {
renderRow("not_connected", onConnect);
await act(async () => {
- fireEvent.click(screen.getByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(screen.getByRole("button", { name: /^Connect / }));
});
- const btn = screen.getByRole("button", { name: "Connect plugin" });
+ const btn = screen.getByRole("button", { name: /^Connect / });
expect((btn as HTMLButtonElement).disabled).toBe(false);
await act(async () => {
fireEvent.click(btn);
@@ -273,11 +272,27 @@ describe("plugin row click-lock", () => {
// A revoked / expired plugin (status needs_reauth) must NOT look like a never-
// connected one. It surfaces a distinct "Reconnect" affordance that re-runs the
// same connect flow — the one-click repair for a dead token.
+describe("plugin row names", () => {
+ it("names its controls after the plugin and reads its text as the description", () => {
+ renderRow("not_connected", () => {});
+ const row = screen.getByRole("button", { name: "Row Plugin" });
+ const details = document.getElementById(row.getAttribute("aria-describedby") ?? "");
+ expect(details?.textContent).toBe("d");
+ expect(screen.getByRole("button", { name: "Connect Row Plugin" })).toBeDefined();
+ });
+
+ it("names the reconnect and menu controls of a broken row after the plugin", () => {
+ renderRow("needs_reauth", () => {});
+ expect(screen.getByRole("button", { name: "Reconnect Row Plugin" })).toBeDefined();
+ expect(screen.getByRole("button", { name: "More actions for Row Plugin" })).toBeDefined();
+ });
+});
+
describe("plugin row reconnect state", () => {
it("renders a Reconnect button for needs_reauth that triggers onConnect", async () => {
const onConnect = vi.fn(() => Promise.resolve());
renderRow("needs_reauth", onConnect);
- const btn = screen.getByRole("button", { name: "Reconnect plugin" });
+ const btn = screen.getByRole("button", { name: /^Reconnect / });
expect(btn).toBeDefined();
await act(async () => {
fireEvent.click(btn);
@@ -287,15 +302,15 @@ describe("plugin row reconnect state", () => {
it("never shows a plain Connect button or a Connected mark for needs_reauth", () => {
renderRow("needs_reauth", () => {});
- expect(screen.queryByRole("button", { name: "Connect plugin" })).toBeNull();
+ expect(screen.queryByRole("button", { name: /^Connect / })).toBeNull();
expect(screen.queryByRole("img", { name: "Connected" })).toBeNull();
});
it("keeps Disconnect for a connected plugin behind the row menu", () => {
const onDisconnect = vi.fn();
renderRow("connected", () => {}, onDisconnect);
- expect(screen.queryByRole("button", { name: "Connect plugin" })).toBeNull();
- fireEvent.click(screen.getByRole("button", { name: "More actions" }));
+ expect(screen.queryByRole("button", { name: /^Connect / })).toBeNull();
+ fireEvent.click(screen.getByRole("button", { name: /^More actions for / }));
fireEvent.click(screen.getByRole("menuitem", { name: "Disconnect" }));
expect(onDisconnect).toHaveBeenCalledWith("row_plugin");
});
@@ -536,11 +551,11 @@ describe("PluginsView opens the PKCE pre-connect dialog", () => {
// button only exists once the catalog row has actually rendered.
await waitFor(() =>
expect(
- screen.getByRole("button", { name: "Connect plugin" }),
+ screen.getByRole("button", { name: /^Connect / }),
).toBeDefined(),
);
- fireEvent.click(screen.getByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(screen.getByRole("button", { name: /^Connect / }));
await waitFor(() =>
expect(screen.getByRole("dialog")).toBeDefined(),
@@ -617,11 +632,11 @@ describe("PluginsView publishes OAuth success immediately", () => {
renderPluginsView();
await waitFor(() =>
- expect(screen.getByRole("button", { name: "Connect plugin" })).toBeDefined(),
+ expect(screen.getByRole("button", { name: /^Connect / })).toBeDefined(),
);
// A provisioned browser flow opens the provider at once — no intermediate
// setup form. (Unprovisioned flows still show the pre-connect dialog.)
- fireEvent.click(screen.getByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(screen.getByRole("button", { name: /^Connect / }));
await screen.findByText("Gmail connected");
expect(
@@ -693,9 +708,9 @@ describe("PluginsView publishes OAuth success immediately", () => {
renderPluginsView();
await waitFor(() =>
- expect(screen.getByRole("button", { name: "Connect plugin" })).toBeDefined(),
+ expect(screen.getByRole("button", { name: /^Connect / })).toBeDefined(),
);
- fireEvent.click(screen.getByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(screen.getByRole("button", { name: /^Connect / }));
// The pending dialog names the exact address the provider must call
// back — previously it spun silently when the provider never did.
@@ -785,7 +800,7 @@ describe("PluginsView publishes every supported connection path immediately", ()
});
renderPluginsView();
- fireEvent.click(await screen.findByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(await screen.findByRole("button", { name: /^Connect / }));
fireEvent.change(await screen.findByPlaceholderText("Token"), {
target: { value: "test-token" },
});
@@ -817,7 +832,7 @@ describe("PluginsView publishes every supported connection path immediately", ()
);
renderPluginsView();
- fireEvent.click(await screen.findByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(await screen.findByRole("button", { name: /^Connect / }));
await screen.findByText("DCR Service connected");
expect(screen.getByRole("img", { name: "Connected" })).toBeDefined();
@@ -850,7 +865,7 @@ describe("PluginsView publishes every supported connection path immediately", ()
);
renderPluginsView();
- fireEvent.click(await screen.findByRole("button", { name: "Connect plugin" }));
+ fireEvent.click(await screen.findByRole("button", { name: /^Connect / }));
await screen.findByText("Device Service connected");
expect(screen.getByRole("img", { name: "Connected" })).toBeDefined();
@@ -895,15 +910,15 @@ describe("PluginsView keeps revoked plugins visible", () => {
// The directory says which connection broke before anything else.
await screen.findByText("Gmail needs reconnecting");
// Its row is a Reconnect, never a plain "+" as if it was never connected.
- expect(screen.getByRole("button", { name: "Reconnect plugin" })).toBeDefined();
- expect(screen.queryByRole("button", { name: "Connect plugin" })).toBeNull();
+ expect(screen.getByRole("button", { name: /^Reconnect / })).toBeDefined();
+ expect(screen.queryByRole("button", { name: /^Connect / })).toBeNull();
// The installed list still carries it — a dead token does not drop the
// plugin back among the never-connected ones.
fireEvent.click(screen.getByRole("button", { name: "Manage installed plugins" }));
await screen.findByText("Reconnect needed");
expect(screen.getByRole("button", { name: "Gmail" })).toBeDefined();
- expect(screen.getByRole("button", { name: "Reconnect plugin" })).toBeDefined();
+ expect(screen.getByRole("button", { name: /^Reconnect / })).toBeDefined();
});
});
@@ -1172,45 +1187,6 @@ describe("plugin prefix search lists G-starting plugins A-Z", () => {
});
});
-describe("plugin status filter", () => {
- const withStatus = (status: Plugin["status"]): Plugin => ({
- id: "p",
- name: "P",
- description: "d",
- category: "Developer",
- logoSlug: "p",
- authMode: "pat_paste",
- authConfig: { mode: "pat_paste" },
- status,
- longevity: "permanent",
- oauthClientConfigured: false,
- fromMarketplace: false,
- selfUploaded: false,
- });
-
- it("lets everything through on 'all'", () => {
- for (const s of ["connected", "not_connected", "needs_reauth", "error"] as const) {
- expect(matchesStatus(withStatus(s), "all")).toBe(true);
- }
- });
-
- it("separates connected from not connected", () => {
- expect(matchesStatus(withStatus("connected"), "connected")).toBe(true);
- expect(matchesStatus(withStatus("not_connected"), "connected")).toBe(false);
- expect(matchesStatus(withStatus("not_connected"), "not_connected")).toBe(true);
- expect(matchesStatus(withStatus("connected"), "not_connected")).toBe(false);
- });
-
- it("groups needs_reauth and error under 'attention'", () => {
- // Both mean the same thing to the user: listed, but not callable until
- // they act. A connected plugin must not appear in that bucket.
- expect(matchesStatus(withStatus("needs_reauth"), "attention")).toBe(true);
- expect(matchesStatus(withStatus("error"), "attention")).toBe(true);
- expect(matchesStatus(withStatus("connected"), "attention")).toBe(false);
- expect(matchesStatus(withStatus("not_connected"), "attention")).toBe(false);
- });
-});
-
describe("PluginsView search and scope controls", () => {
const search = () => screen.getByRole("searchbox", { name: "Search plugins…" });
@@ -1366,3 +1342,53 @@ describe("PluginsView search and scope controls", () => {
expect(screen.queryByText("Coming soon")).toBeNull();
});
});
+
+describe("PluginsView breadcrumbs", () => {
+ it("returns to the directory home from a plugin opened in search results", async () => {
+ installCatalogFetchMock();
+ renderPluginsView();
+
+ await screen.findByRole("button", { name: "GitHub" });
+ fireEvent.change(screen.getByRole("searchbox", { name: "Search plugins…" }), {
+ target: { value: "deploy" },
+ });
+ fireEvent.click(await screen.findByRole("button", { name: "Vercel" }));
+ const crumbs = within(await screen.findByRole("navigation", { name: "Breadcrumb" }));
+ fireEvent.click(crumbs.getByRole("button", { name: "Plugins" }));
+
+ // The crumb says "Plugins" and leads to the directory, not back into the search.
+ await screen.findByRole("tablist", { name: "Plugin directory" });
+ expect((screen.getByRole("searchbox", { name: "Search plugins…" }) as HTMLInputElement).value).toBe("");
+ expect(screen.getByRole("button", { name: "GitHub" })).toBeDefined();
+ });
+
+ it("closes a section whose last plugin went away while it was open", async () => {
+ const added = {
+ id: "acme",
+ display_name: "Acme",
+ description: "Own connector",
+ category: "Custom",
+ logo_slug: "acme",
+ auth: { mode: "hosted_mcp_open" },
+ status: "not_connected",
+ source: "local",
+ };
+ let reads = 0;
+ (globalThis as unknown as { fetch: typeof fetch }).fetch = vi.fn(async () => {
+ reads += 1;
+ const plugins = reads === 1 ? [...CATALOG.plugins, added] : CATALOG.plugins;
+ return { ok: true, status: 200, json: async () => ({ ...CATALOG, plugins }) };
+ }) as unknown as typeof fetch;
+ renderPluginsView();
+
+ fireEvent.click(await screen.findByRole("tab", { name: "Yours" }));
+ fireEvent.click(screen.getByRole("button", { name: "Show all of Added by you" }));
+ await screen.findByRole("navigation", { name: "Breadcrumb" });
+
+ // The connector is removed elsewhere; the next catalog read no longer has it.
+ fireEvent.click(screen.getByRole("button", { name: "Refresh catalog" }));
+ await screen.findByRole("tablist", { name: "Plugin directory" });
+ expect(screen.queryByRole("navigation", { name: "Breadcrumb" })).toBeNull();
+ expect(screen.getByText("Nothing added yet")).toBeDefined();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/PluginsView.tsx b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
index 75a6ae1ac7..f6f53e6644 100644
--- a/jarvis/ui/web/frontend/src/views/PluginsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/PluginsView.tsx
@@ -563,7 +563,6 @@ function loopbackRedirectUri(plugin: Plugin): string | undefined {
return `http://127.0.0.1:${port}${path}`;
}
-export type StatusFilterId = "all" | "connected" | "not_connected" | "attention";
/** Section order for the store, straight from the catalog. Any category the
* backend serves that the order does not mention is appended, so a new
@@ -638,21 +637,6 @@ export function sortPluginsByName(a: Plugin, b: Plugin): number {
return a.name.localeCompare(b.name, undefined, { sensitivity: "base" });
}
-/** "attention" groups needs_reauth and error: both mean the same thing to the
- * user — this plugin is listed but cannot be called until they act. */
-export function matchesStatus(plugin: Plugin, status: StatusFilterId): boolean {
- switch (status) {
- case "connected":
- return plugin.status === "connected";
- case "not_connected":
- return plugin.status === "not_connected";
- case "attention":
- return plugin.status === "needs_reauth" || plugin.status === "error";
- default:
- return true;
- }
-}
-
/** The order the directory lists its category sections in. A category the
* catalog serves but this list does not name follows in catalog order. */
const DIRECTORY_CATEGORY_ORDER = [
@@ -1197,39 +1181,31 @@ export function PluginsView({
setSelectedId(null);
setSectionId(null);
setManaging(false);
+ setQuery("");
},
};
- // ---- Own HTTP APIs and the community marketplace -------------------------
- if (view === "custom-apis") {
- return shell(<Suspense fallback={<p>{translate("custom_apis.loading")}</p>}>
- <CustomApisView onBack={() => setView("list")} />
- </Suspense>);
- }
-
- if (view === "community") {
- return shell(
- <>
- <Breadcrumbs crumbs={[directoryCrumb, { label: translate("plugins_view.add_community") }]} />
- <div className="mt-6">
- <CommunityTab onInstalled={(name) => void handleFreshInstall(name)} />
- </div>
- </>,
- );
- }
-
// ---- Plugin page ---------------------------------------------------------
+ // Checked before the community and API pages: the sidebar opens a plugin
+ // from wherever the directory currently is.
if (selectedId) {
// The crumb between the directory and the plugin is the list the plugin
// belongs to — the installed list while managing, otherwise its section —
// so the path reads the same however the page was reached.
const home = selectedPlugin ? homeSectionId(selectedPlugin) : null;
const origin: Crumb | null = managing
- ? { label: translate("plugins_view.manage_title"), onClick: () => setSelectedId(null) }
+ ? {
+ label: translate("plugins_view.manage_title"),
+ onClick: () => {
+ setView("list");
+ setSelectedId(null);
+ },
+ }
: home
? {
label: sectionTitle(home),
onClick: () => {
+ setView("list");
setSectionId(home);
setQuery("");
setSelectedId(null);
@@ -1261,6 +1237,24 @@ export function PluginsView({
);
}
+ // ---- Own HTTP APIs and the community marketplace -------------------------
+ if (view === "custom-apis") {
+ return shell(<Suspense fallback={<p>{translate("custom_apis.loading")}</p>}>
+ <CustomApisView onBack={() => setView("list")} />
+ </Suspense>);
+ }
+
+ if (view === "community") {
+ return shell(
+ <>
+ <Breadcrumbs crumbs={[directoryCrumb, { label: translate("plugins_view.add_community") }]} />
+ <div className="mt-6">
+ <CommunityTab onInstalled={(name) => void handleFreshInstall(name)} />
+ </div>
+ </>,
+ );
+ }
+
// ---- Directory -----------------------------------------------------------
return shell(
<PluginBrowse
@@ -1300,7 +1294,7 @@ export function PluginsView({
}
// ---------------------------------------------------------------------------
-// Status vocabulary shared by the table and the detail page
+// Status vocabulary shared by the directory and the plugin page
// ---------------------------------------------------------------------------
function statusTone(status: PluginStatus): "ok" | "off" | "warn" | "error" {
diff --git a/jarvis/ui/web/frontend/src/views/plugins/PluginBrowse.tsx b/jarvis/ui/web/frontend/src/views/plugins/PluginBrowse.tsx
index 85dba5aa58..c79c02eba2 100644
--- a/jarvis/ui/web/frontend/src/views/plugins/PluginBrowse.tsx
+++ b/jarvis/ui/web/frontend/src/views/plugins/PluginBrowse.tsx
@@ -7,7 +7,7 @@
* only decides what is listed and how a row reads. Colours are theme tokens, so
* the page reads the same in light and dark mode.
*/
-import type { ReactNode } from "react";
+import { type ReactNode, useEffect, useId } from "react";
import {
Check,
ChevronRight,
@@ -169,7 +169,7 @@ function RowAction({
return (
<button type="button" onClick={() => void run()} className={ACTION_BUTTON}
disabled={Boolean(plugin.unavailableReason)}
- aria-label={translate("plugins_view.connect_plugin")}
+ aria-label={fill(translate("plugins_view.connect_named"), { plugin: plugin.name })}
title={unavailableReasonText(plugin) ?? translate("plugins_view.connect")}>
<Plus className="h-4 w-4" aria-hidden />
</button>
@@ -219,7 +219,8 @@ function RowAction({
</span>
) : (
<button type="button" onClick={() => void run()} className={cn(ACTION_BUTTON, "text-warning hover:text-warning")}
- aria-label={translate("plugins_view.reconnect_plugin")} title={translate("plugins_view.reconnect")}>
+ aria-label={fill(translate("plugins_view.reconnect_named"), { plugin: plugin.name })}
+ title={translate("plugins_view.reconnect")}>
<RotateCw className="h-4 w-4" aria-hidden />
</button>
)}
@@ -228,7 +229,8 @@ function RowAction({
actions={actions}
trigger={({ open, toggle }) => (
<button type="button" onClick={toggle} aria-haspopup="menu" aria-expanded={open}
- aria-label={translate("plugins_view.more_actions")} title={translate("plugins_view.more_actions")}
+ aria-label={fill(translate("plugins_view.more_actions_named"), { plugin: plugin.name })}
+ title={translate("plugins_view.more_actions")}
className={cn(ACTION_BUTTON, open && "bg-surface-raised text-foreground-strong")}>
<MoreHorizontal className="h-4 w-4" aria-hidden />
</button>
@@ -249,12 +251,14 @@ export function PluginRow({
// One lock per row: the "+" and a menu "Reconnect" can never race into two
// sign-in flows for the same plugin.
const { busy, run } = useConnectLock(() => onConnect(plugin));
+ const detailsId = useId();
return (
<li className="flex min-h-14 items-center gap-1 rounded-xl pr-1.5 transition-colors hover:bg-secondary focus-within:bg-secondary">
<button
type="button"
onClick={() => onOpen(plugin.id)}
aria-label={plugin.name}
+ aria-describedby={detailsId}
className="flex min-w-0 flex-1 items-center gap-3 rounded-xl px-2 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<BrandTile plugin={plugin} size="row" />
@@ -263,18 +267,20 @@ export function PluginRow({
<span className="truncate text-base font-medium text-foreground-strong">{plugin.name}</span>
<OriginMark plugin={plugin} />
</span>
- <span className="block truncate text-sm text-muted-foreground" title={plugin.description}>
- {plugin.description}
- </span>
- {plugin.unavailableReason && (
- <span className="block truncate text-xs text-muted-foreground" title={unavailableReasonText(plugin)}>
- {translate("plugins_view.unsupported_device")}
+ <span id={detailsId} className="block">
+ <span className="block truncate text-sm text-muted-foreground" title={plugin.description}>
+ {plugin.description}
</span>
- )}
- {plugin.status === "needs_reauth" && (
- <span className="block truncate text-xs text-warning"><ReauthExplanation plugin={plugin} inline /></span>
- )}
- <GrantExpiry plugin={plugin} />
+ {plugin.unavailableReason && (
+ <span className="block truncate text-xs text-muted-foreground" title={unavailableReasonText(plugin)}>
+ {translate("plugins_view.unsupported_device")}
+ </span>
+ )}
+ {plugin.status === "needs_reauth" && (
+ <span className="block truncate text-xs text-warning"><ReauthExplanation plugin={plugin} inline /></span>
+ )}
+ <GrantExpiry plugin={plugin} />
+ </span>
</span>
{showStatus && (
<span className="hidden shrink-0 text-sm text-muted-foreground sm:block">{pluginStatusLabel(plugin)}</span>
@@ -287,7 +293,8 @@ export function PluginRow({
function PluginGrid({ plugins, label, single = false, showStatus = false, handlers }: {
plugins: Plugin[];
- label: string;
+ /** Left out where a surrounding region already names the list. */
+ label?: string;
single?: boolean;
showStatus?: boolean;
handlers: PluginRowHandlers;
@@ -344,7 +351,7 @@ function SectionBlock({ section, onOpenSection, handlers }: {
<ChevronRight className="h-4 w-4 text-foreground-faint transition-transform group-hover/heading:text-muted-foreground motion-safe:group-hover/heading:translate-x-0.5" aria-hidden />
</button>
</h3>
- <PluginGrid plugins={section.plugins} label={title} handlers={handlers} />
+ <PluginGrid plugins={section.plugins} handlers={handlers} />
</section>
);
}
@@ -389,6 +396,12 @@ export function PluginBrowse({
const openSection = sectionId
? allSections(plugins, categoryOrder).find((section) => section.id === sectionId) ?? null
: null;
+ // A section that empties while open (its last plugin removed) closes, so
+ // a later plugin of the same kind does not reopen it unasked.
+ const sectionGone = Boolean(sectionId) && !loading && !openSection;
+ useEffect(() => {
+ if (sectionGone) onSection(null);
+ }, [sectionGone, onSection]);
// What needs a reconnect leads the installed list; the rest follows A-Z.
const installed = plugins.filter(isInstalled).sort((a, b) =>
Number(isBroken(b)) - Number(isBroken(a)) || sortPluginsByName(a, b));