Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(gateway): make model columns adjustable (#17367)

Tobias Wochinger2287745f72e3
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/GatewayApiKeysPage.clienttest.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/GatewayApiKeysPage.clienttest.tsx
deleted file mode 100644
index 63a96ef365..0000000000
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/GatewayApiKeysPage.clienttest.tsx
+++ /dev/null
@@ -1,147 +0,0 @@
-import { fireEvent, render, screen } from "@testing-library/react";
-import type { ReactNode } from "react";
-
-vi.mock("next/router", () => ({
- useRouter: () => ({ query: {}, push: vi.fn() }),
-}));
-
-const { fetchNextPage, queryState } = vi.hoisted(() => {
- const fetchNextPage = vi.fn();
- return {
- fetchNextPage,
- queryState: {
- isPending: false,
- isError: false,
- isFetchingNextPage: false,
- hasNextPage: true,
- data: {
- pages: [
- {
- data: [
- {
- metadata: { environment: "production", region: "eu" },
- apiKey: {
- id: "gateway-key-1",
- publicKey: "pk-lf-gateway",
- displaySecretKey: "sk-lf-...cdef",
- note: "Production app",
- createdAt: new Date("2026-09-04T12:00:00.000Z"),
- },
- },
- ],
- nextCursor: "gateway-key-1",
- },
- ],
- },
- fetchNextPage,
- refetch: vi.fn(),
- },
- };
-});
-
-vi.mock("@/src/utils/api", () => {
- const mutation = () => ({
- isPending: false,
- isError: false,
- mutateAsync: vi.fn(),
- });
- return {
- api: {
- aiGateway: {
- listApiKeys: {
- useInfiniteQuery: () => queryState,
- },
- createApiKey: { useMutation: mutation },
- revokeApiKey: { useMutation: mutation },
- },
- useUtils: () => ({
- aiGateway: {
- listApiKeys: { invalidate: vi.fn() },
- },
- }),
- },
- reportNonTrpcError: vi.fn(),
- reportTrpcErrorWithoutToast: vi.fn(),
- };
-});
-
-vi.mock("@/src/components/ui/CodeJsonViewer", () => ({
- CodeView: ({ content }: { content: string }) => <pre>{content}</pre>,
-}));
-
-vi.mock("@/src/components/ui/InfoTooltip/InfoTooltip", () => ({
- InfoTooltip: ({
- label,
- children,
- }: {
- label: string;
- children: ReactNode;
- }) => <span aria-label={label}>{children}</span>,
-}));
-
-import { TooltipProvider } from "@/src/components/ui/tooltip";
-
-import { GatewayApiKeysPage } from "./GatewayApiKeysPage";
-
-// The page renders tooltips for overflowing metadata badges, which Radix only
-// allows inside a provider (the app supplies one globally in `_app`).
-const page = () => (
- <TooltipProvider>
- <GatewayApiKeysPage organizationId="org-1" />
- </TooltipProvider>
-);
-
-describe("GatewayApiKeysPage", () => {
- beforeEach(() => {
- queryState.isPending = false;
- queryState.isError = false;
- queryState.isFetchingNextPage = false;
- queryState.hasNextPage = true;
- fetchNextPage.mockClear();
- });
-
- it("lists only the masked gateway key", () => {
- render(page());
-
- expect(screen.getByText("sk-lf-...cdef")).toBeInTheDocument();
- expect(screen.queryByText("pk-lf-gateway")).not.toBeInTheDocument();
- });
-
- it("adds metadata entries in the expandable editor", () => {
- render(page());
-
- fireEvent.click(screen.getByRole("button", { name: "Create gateway key" }));
-
- const metadataTrigger = screen.getByRole("button", {
- name: /Metadata \(optional\)/,
- });
- expect(
- screen.queryByRole("textbox", { name: "Metadata key" }),
- ).not.toBeInTheDocument();
-
- fireEvent.click(metadataTrigger);
- fireEvent.change(screen.getByRole("textbox", { name: "Metadata key" }), {
- target: { value: "team" },
- });
- fireEvent.change(screen.getByRole("textbox", { name: "Metadata value" }), {
- target: { value: "checkout" },
- });
- expect(metadataTrigger).toHaveTextContent("1 set");
-
- fireEvent.click(screen.getByRole("button", { name: "Add metadata" }));
- expect(
- screen.getAllByRole("textbox", { name: "Metadata key" }),
- ).toHaveLength(2);
- });
-
- it("loads the next page and exposes its pending state", () => {
- const { rerender } = render(page());
-
- fireEvent.click(screen.getByRole("button", { name: "Load more" }));
- expect(fetchNextPage).toHaveBeenCalledOnce();
-
- queryState.isFetchingNextPage = true;
- rerender(page());
- expect(screen.getByRole("button", { name: "Load more" })).toBeDisabled();
- });
-});
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/GatewayApiKeysPage.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/GatewayApiKeysPage.tsx
index 281d5d3400..5a6d963d6d 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/GatewayApiKeysPage.tsx
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/GatewayApiKeysPage.tsx
@@ -55,7 +55,7 @@ export function GatewayApiKeysPage({
{({ openDialog }) => (
<Button onClick={openDialog}>
<Plus className="mr-1.5 size-4" />
- Create gateway key
+ Create key
</Button>
)}
</CreateGatewayApiKeyDialogController>
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GatewayApiKeysView/GatewayApiKeysView.stories.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GatewayApiKeysView/GatewayApiKeysView.stories.tsx
index 25e84eacb5..32cd85d79e 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GatewayApiKeysView/GatewayApiKeysView.stories.tsx
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GatewayApiKeysView/GatewayApiKeysView.stories.tsx
@@ -39,7 +39,7 @@ const manyApiKeys = Array.from({ length: 30 }, (_, index) => ({
})) satisfies ComponentProps<typeof GatewayApiKeysView>["apiKeys"];
const actions = {
- createAction: <Button onClick={onCreate}>Create gateway key</Button>,
+ createAction: <Button onClick={onCreate}>Create key</Button>,
renderRevokeAction: (apiKeyId: string) => (
<Button variant="ghost" onClick={() => onRevoke(apiKeyId)}>
Revoke
diff --git a/web/src/features/ai-gateway/components/GatewayModelsPage/components/GatewayModelsView/GatewayModelsView.tsx b/web/src/features/ai-gateway/components/GatewayModelsPage/components/GatewayModelsView/GatewayModelsView.tsx
index 59e1f94974..f55f464ca0 100644
--- a/web/src/features/ai-gateway/components/GatewayModelsPage/components/GatewayModelsView/GatewayModelsView.tsx
+++ b/web/src/features/ai-gateway/components/GatewayModelsPage/components/GatewayModelsView/GatewayModelsView.tsx
@@ -35,8 +35,7 @@ const columns: LangfuseColumnDef<GatewayModelRow, unknown>[] = [
accessorKey: "id",
id: "id",
header: "Model",
- size: 300,
- isFlexWidth: true,
+ size: 200,
cell: ({ row }) => (
<span className="block truncate font-mono" title={row.original.id}>
{row.original.id}