mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
feat(ui): link the Organization cell on the Virtual Keys page too
Same treatment as User, Team and Created By in the previous commit: the Organization column rendered the alias as dead text, so it now goes through IdentityCell with an orgDetailHref. Claude-Session: https://claude.ai/code/session_01NfwfQhamRNnSqgXMUjf3h4
This commit is contained in:
parent
71d1bfb70a
commit
5ea2f96982
2 changed files with 23 additions and 8 deletions
|
|
@ -476,12 +476,14 @@ it("should display 'Default Proxy Admin' for user_id when value is 'default_user
|
|||
describe("entity links out of the key rows", () => {
|
||||
const keyRow = async () => (await screen.findByText("Test Key Alias")).closest("tr") as HTMLElement;
|
||||
|
||||
const enableCreatedByColumn = async (user: ReturnType<typeof userEvent.setup>) => {
|
||||
const enableColumn = async (user: ReturnType<typeof userEvent.setup>, title: string) => {
|
||||
await user.click(screen.getByRole("button", { name: "Columns" }));
|
||||
await user.click(await screen.findByText("Created By"));
|
||||
await user.click(await screen.findByText(title));
|
||||
await user.keyboard("{Escape}");
|
||||
};
|
||||
|
||||
const enableCreatedByColumn = (user: ReturnType<typeof userEvent.setup>) => enableColumn(user, "Created By");
|
||||
|
||||
it("points the User and Team cells at their detail pages", async () => {
|
||||
renderWithProviders(<VirtualKeysTable />);
|
||||
|
||||
|
|
@ -493,6 +495,19 @@ describe("entity links out of the key rows", () => {
|
|||
expect(within(row).getByRole("link", { name: "Test Team" })).toHaveAttribute("href", "/ui/teams?team=team-1");
|
||||
});
|
||||
|
||||
it("points the Organization cell at the org's detail page", async () => {
|
||||
mockUseKeys.mockReturnValue(keysResult([{ ...mockKey, org_id: "org-1" }]));
|
||||
const user = userEvent.setup();
|
||||
renderWithProviders(<VirtualKeysTable />);
|
||||
await enableColumn(user, "Organization");
|
||||
|
||||
const row = await keyRow();
|
||||
expect(within(row).getByRole("link", { name: "Test Organization" })).toHaveAttribute(
|
||||
"href",
|
||||
"/ui/organizations?org=org-1",
|
||||
);
|
||||
});
|
||||
|
||||
it("points the Created By cell at the creator's detail page", async () => {
|
||||
mockUseKeys.mockReturnValue(
|
||||
keysResult([
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
StatusBadge,
|
||||
type StatusTone,
|
||||
} from "@/components/shared/table_cells";
|
||||
import { teamDetailHref, userDetailHref } from "@/utils/entityLinks";
|
||||
import { orgDetailHref, teamDetailHref, userDetailHref } from "@/utils/entityLinks";
|
||||
import { DEFAULT_PROXY_ADMIN_USER_ID } from "@/utils/sentinels";
|
||||
|
||||
import DefaultProxyAdminTag from "../common_components/DefaultProxyAdminTag";
|
||||
|
|
@ -218,12 +218,12 @@ export const getKeyTableColumns = ({
|
|||
const orgId = info.getValue() as string | null;
|
||||
if (!orgId) return "-";
|
||||
const org = organizations.find((o) => o.organization_id === orgId);
|
||||
const displayValue = org?.organization_alias || orgId;
|
||||
const width = info.cell.column.getSize();
|
||||
return (
|
||||
<span className="font-mono text-xs truncate block" style={{ maxWidth: width, overflow: "hidden" }}>
|
||||
{displayValue}
|
||||
</span>
|
||||
<IdentityCell
|
||||
title={org?.organization_alias || orgId}
|
||||
titleClassName={ENTITY_CELL_TITLE_CLASSES}
|
||||
href={orgDetailHref(orgId)}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue