mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-30 17:14:54 +01:00
Clarify the advanced connection tile
Add the Custom Gateway subtitle and use the muted icon color. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
45a841bc74
commit
527e3bad26
4 files changed
+9
-9
No files matched your search
@@ -156,7 +156,7 @@ describe("AgentProviderConnection reuse", () => {
|
||||
content: <div>Advanced connection picker</div>,
|
||||
});
|
||||
const modeLabels = () => Array.from(host.querySelectorAll('[role="radio"]')).map(button => button.textContent);
|
||||
expect(modeLabels()).toEqual(["OpenAISubscription", "OpenAIAPI key", "Advanced"]);
|
||||
expect(modeLabels()).toEqual(["OpenAISubscription", "OpenAIAPI key", "AdvancedCustom Gateway"]);
|
||||
expect(host.querySelector('[aria-label="Saved subscription"]')).not.toBeNull();
|
||||
expect(host.textContent).not.toContain("Advanced connection picker");
|
||||
expect(host.textContent).not.toContain("instead");
|
||||
@@ -164,12 +164,12 @@ describe("AgentProviderConnection reuse", () => {
|
||||
expect(host.querySelector('[aria-label="Saved API key"]')).not.toBeNull();
|
||||
expect(host.querySelector('[role="radio"][aria-checked="true"]')?.textContent).toBe("OpenAIAPI key");
|
||||
expect(host.querySelector('[aria-label="Saved subscription"]')).toBeNull();
|
||||
expect(modeLabels()).toEqual(["OpenAISubscription", "OpenAIAPI key", "Advanced"]);
|
||||
expect(modeLabels()).toEqual(["OpenAISubscription", "OpenAIAPI key", "AdvancedCustom Gateway"]);
|
||||
click("Advanced");
|
||||
expect(host.textContent).toContain("Advanced connection picker");
|
||||
expect(host.querySelector('[role="radio"][aria-checked="true"]')?.textContent).toBe("Advanced");
|
||||
expect(host.querySelector('[role="radio"][aria-checked="true"]')?.textContent).toBe("AdvancedCustom Gateway");
|
||||
expect(host.querySelector("select")).toBeNull();
|
||||
expect(modeLabels()).toEqual(["OpenAISubscription", "OpenAIAPI key", "Advanced"]);
|
||||
expect(modeLabels()).toEqual(["OpenAISubscription", "OpenAIAPI key", "AdvancedCustom Gateway"]);
|
||||
const useConnection = Array.from(host.querySelectorAll("button")).find(button => button.textContent?.includes("Use connection"))!;
|
||||
expect(useConnection.disabled).toBe(true);
|
||||
click("OpenAISubscription");
|
||||
@@ -202,7 +202,7 @@ describe("AgentProviderConnection reuse", () => {
|
||||
expect(input.value).toBe("fixture-key");
|
||||
const apiTile = host.querySelector<HTMLElement>('[role="radio"][aria-checked="true"]')!;
|
||||
flushSync(() => apiTile.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowRight", bubbles: true })));
|
||||
expect(host.querySelector('[role="radio"][aria-checked="true"]')?.textContent).toBe("Advanced");
|
||||
expect(host.querySelector('[role="radio"][aria-checked="true"]')?.textContent).toBe("AdvancedCustom Gateway");
|
||||
expect(host.querySelectorAll('[role="radio"]')).toHaveLength(3);
|
||||
});
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ export function AgentProviderConnection({
|
||||
sources={advancedConnection ? [
|
||||
{ id: "subscription", label: provider, icon: <AdapterMark type={adapterType} />, credentialMode: "subscription" },
|
||||
{ id: "api", label: provider, icon: <AdapterMark type={adapterType} />, credentialMode: "api" },
|
||||
{ id: "advanced", label: "Advanced", icon: <Cable className="size-6" />, credentialMode: null },
|
||||
{ id: "advanced", label: "Advanced", icon: <Cable className="size-6 text-muted-foreground" />, credentialMode: "advanced" },
|
||||
] : [
|
||||
{
|
||||
id: adapterType,
|
||||
|
||||
@@ -35,7 +35,7 @@ export type ModelSource = {
|
||||
const CREDENTIAL_TAG_LABEL: Record<ModelConnectionMode, string> = {
|
||||
subscription: "Subscription",
|
||||
api: "API key",
|
||||
advanced: "Advanced",
|
||||
advanced: "Custom Gateway",
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -184,10 +184,10 @@ export const NewAgentConnectionModes: Story = {
|
||||
await expect(canvas.getByRole("combobox", { name: "Saved subscription" })).toBeVisible();
|
||||
await userEvent.click(canvas.getByRole("radio", { name: "OpenAI API key" }));
|
||||
await waitFor(() => expect(canvas.getByPlaceholderText("Enter API key here")).toBeVisible());
|
||||
await userEvent.click(canvas.getByRole("radio", { name: "Advanced" }));
|
||||
await userEvent.click(canvas.getByRole("radio", { name: "Advanced Custom Gateway" }));
|
||||
await expect(canvas.queryByPlaceholderText("Enter API key here")).not.toBeInTheDocument();
|
||||
await expect(canvas.getAllByRole("radio")).toHaveLength(3);
|
||||
await expect(canvas.getByRole("radio", { name: "Advanced" })).toBeChecked();
|
||||
await expect(canvas.getByRole("radio", { name: "Advanced Custom Gateway" })).toBeChecked();
|
||||
await expect(canvas.getByRole("button", { name: "Use connection" })).toBeDisabled();
|
||||
await userEvent.click(canvas.getByRole("combobox", { name: "Connection" }));
|
||||
await userEvent.click(within(canvasElement.ownerDocument.body).getByRole("option", { name: "Company OpenRouter" }));
|
||||
|
||||
Reference in new issue
Block a user