feat(ui): cut the users page over to the /ui/users path route (#30334)

ViewUserDashboard renders from app/(dashboard)/users/page.tsx via useAuthorized
and useTeams instead of the legacy ?page=users switch arm. The keys and setKeys
props were declared but never destructured by the component, so they are removed
from the interface rather than wired into the wrapper.
This commit is contained in:
ryan-crabbe-berri 2026-06-12 18:19:31 -07:00 • committed by GitHub
parent 6f8e6adf23
commit 0dc203bd65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 28 additions and 15 deletions

View file

@ -39,6 +39,7 @@ export const MIGRATED_E2E_PAGES: Record<string, string> = {
new_usage: "usage",
agents: "agents",
"router-settings": "router-settings",
users: "users",
};
export const MIGRATED_E2E_SEGMENTS: string[] = [...new Set(Object.values(MIGRATED_E2E_PAGES))];

View file

@ -13,7 +13,6 @@ import PassThroughSettings from "@/components/pass_through_settings";
import { SurveyPrompt, SurveyModal, ClaudeCodePrompt, ClaudeCodeModal } from "@/components/survey";
import Usage from "@/components/usage";
import UserDashboard from "@/components/user_dashboard";
import ViewUserDashboard from "@/components/view_users";
import { useAuth } from "@/contexts/AuthContext";
import {
buildLoginUrlWithReturn,
@ -323,16 +322,6 @@ function CreateKeyPageContent() {
premiumUser={premiumUser}
teams={teams}
/>
) : page == "users" ? (
<ViewUserDashboard
userID={userID}
userRole={userRole}
token={token}
keys={keys}
teams={teams}
accessToken={accessToken}
setKeys={setKeys}
/>
) : page == "teams" ? (
<OldTeams
teams={teams}

View file

@ -0,0 +1,19 @@
"use client";
import ViewUserDashboard from "@/components/view_users";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
import { useTeams } from "@/app/(dashboard)/hooks/teams/useTeams";
export default function UsersPage() {
const { accessToken, token, userRole, userId } = useAuthorized();
const { data: teams } = useTeams();
return (
<ViewUserDashboard
userID={userId}
userRole={userRole}
token={token}
teams={teams ?? null}
accessToken={accessToken}
/>
);
}

View file

@ -66,11 +66,9 @@ describe("ViewUserDashboard", () => {
const defaultProps = {
accessToken: "test-token",
token: "test-token",
keys: null,
userRole: "Admin",
userID: "admin-user-id",
teams: [],
setKeys: vi.fn(),
};
beforeEach(() => {

View file

@ -34,11 +34,9 @@ const { Text, Title } = Typography;
interface ViewUserDashboardProps {
accessToken: string | null;
token: string | null;
keys: any[] | null;
userRole: string | null;
userID: string | null;
teams: any[] | null;
setKeys: React.Dispatch<React.SetStateAction<object[] | null>>;
orgAdminOrgIds?: Array<{ organization_id: string; organization_alias: string }> | null;
}

View file

@ -119,6 +119,13 @@ describe("migratedHref / legacyPageHref", () => {
expect(MIGRATED_PAGES.agents).toBe("agents");
expect(MIGRATED_PAGES["router-settings"]).toBe("router-settings");
});
it("maps the users id to its route", async () => {
vi.doMock("@/components/networking", () => ({ serverRootPath: "/" }));
const { MIGRATED_PAGES } = await import("./migratedPages");
expect(MIGRATED_PAGES.users).toBe("users");
});
});
describe("dev server (NODE_ENV=development)", () => {

View file

@ -42,6 +42,7 @@ export const MIGRATED_PAGES: Record<string, string> = {
new_usage: "usage",
agents: "agents",
"router-settings": "router-settings",
users: "users",
};
function uiBase(): string {