feat(ui): link the Created By cell on the Prompts page (#40753)

The column was plain muted text, so finding out who owns a prompt meant
copying the id into the Users page search box. Route it through
IdentityCell with userDetailHref, which keeps the proxy admin placeholder
unlinked.

Claude-Session: https://claude.ai/code/session_01NfwfQhamRNnSqgXMUjf3h4
This commit is contained in:
ryan-crabbe-berri 2026-09-11 17:49:01 -07:00 committed by GitHub
parent 06964e5603
commit c53f72c764
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 2 deletions

View file

@ -10,6 +10,8 @@ vi.mock("@/components/networking", () => ({
modelHubCall: vi.fn().mockResolvedValue({ data: [] }),
}));
vi.mock("next/navigation", () => ({ useRouter: () => ({ push: vi.fn() }) }));
const mockPrompts: PromptSpec[] = [
{
prompt_id: "prompt-newer",
@ -53,6 +55,15 @@ describe("PromptTable", () => {
}
});
it("links the Created By cell to the creator's detail page, leaving the placeholder unlinked", () => {
const prompts = [mockPrompts[0], { ...mockPrompts[1], created_by: "default_user_id" }];
render(<PromptTable {...defaultProps} promptsList={prompts} />);
expect(screen.getByRole("link", { name: "user-1" })).toHaveAttribute("href", "/ui/users?user=user-1");
expect(screen.getByText("default_user_id")).toBeInTheDocument();
expect(screen.queryByRole("link", { name: "default_user_id" })).not.toBeInTheDocument();
});
it("should display the empty state when data is empty", () => {
render(<PromptTable {...defaultProps} promptsList={[]} />);
expect(screen.getByText("No prompts yet")).toBeInTheDocument();

View file

@ -17,6 +17,7 @@ import {
} from "@/components/ui/dropdown-menu";
import { cn } from "@/lib/cva.config";
import { copyToClipboard } from "@/utils/dataUtils";
import { userDetailHref } from "@/utils/entityLinks";
import { extractModel, getProviderFromModelHub, ModelGroupInfo } from "./prompt_utils";
@ -191,9 +192,16 @@ export const getPromptTableColumns = ({
enableSorting: false,
cell: ({ row }) => {
const createdBy = row.original.created_by;
if (!createdBy) {
return <span className="text-muted-foreground">-</span>;
}
return (
<span className="block max-w-60 truncate text-sm text-muted-foreground" title={createdBy}>
{createdBy || "-"}
<span className="block max-w-60" title={createdBy}>
<IdentityCell
title={createdBy}
titleClassName="font-normal text-muted-foreground"
href={userDetailHref(createdBy)}
/>
</span>
);
},