fix(ui): link Virtual Keys hint through the migrated /ui route

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yassin 2026-08-28 00:19:29 +00:00
parent eb0e3f8c18
commit 3ec3933c1f
2 changed files with 21 additions and 2 deletions

View file

@ -9,6 +9,7 @@ import { STATUS_COLUMN_ID, toServerSortField } from "./ModelsTableColumns";
const mockModelDeleteCall = vi.fn().mockResolvedValue({}); const mockModelDeleteCall = vi.fn().mockResolvedValue({});
const mockModelPatchUpdateCall = vi.fn().mockResolvedValue({}); const mockModelPatchUpdateCall = vi.fn().mockResolvedValue({});
vi.mock("@/components/networking", () => ({ vi.mock("@/components/networking", () => ({
serverRootPath: "/",
modelDeleteCall: (...args: unknown[]) => mockModelDeleteCall(...args), modelDeleteCall: (...args: unknown[]) => mockModelDeleteCall(...args),
modelPatchUpdateCall: (...args: unknown[]) => mockModelPatchUpdateCall(...args), modelPatchUpdateCall: (...args: unknown[]) => mockModelPatchUpdateCall(...args),
})); }));
@ -335,6 +336,23 @@ describe("AllModelsTab", () => {
expect(screen.getByText(/create a Virtual Key without selecting a team/i)).toBeInTheDocument(); expect(screen.getByText(/create a Virtual Key without selecting a team/i)).toBeInTheDocument();
}); });
it("links the Virtual Keys page through the migrated /ui route", () => {
render(<AllModelsTab {...defaultProps} />);
expect(screen.getByRole("link", { name: "Virtual Keys page" })).toHaveAttribute("href", "/ui/api-keys");
});
it("links the team hint's Virtual Keys page through the migrated /ui route", async () => {
const user = userEvent.setup();
render(<AllModelsTab {...defaultProps} />);
await user.click(screen.getByTestId("models-team-select"));
await user.click(await screen.findByRole("option", { name: "Engineering" }));
await screen.findByText(/select Team as "Engineering"/i);
expect(screen.getByRole("link", { name: "Virtual Keys page" })).toHaveAttribute("href", "/ui/api-keys");
});
it("names the selected team in the hint", async () => { it("names the selected team in the hint", async () => {
const user = userEvent.setup(); const user = userEvent.setup();
render(<AllModelsTab {...defaultProps} />); render(<AllModelsTab {...defaultProps} />);

View file

@ -7,6 +7,7 @@ import DeleteResourceModal from "@/components/common_components/DeleteResourceMo
import ModelSettingsModal from "@/components/model_dashboard/ModelSettingsModal/ModelSettingsModal"; import ModelSettingsModal from "@/components/model_dashboard/ModelSettingsModal/ModelSettingsModal";
import { ModelData } from "@/components/model_dashboard/types"; import { ModelData } from "@/components/model_dashboard/types";
import { toast } from "@/lib/toast"; import { toast } from "@/lib/toast";
import { migratedHref } from "@/utils/migratedPages";
import { modelDeleteCall, modelPatchUpdateCall } from "@/components/networking"; import { modelDeleteCall, modelPatchUpdateCall } from "@/components/networking";
import { useQueryClient } from "@tanstack/react-query"; import { useQueryClient } from "@tanstack/react-query";
import { useDebouncedCallback } from "@tanstack/react-pacer/debouncer"; import { useDebouncedCallback } from "@tanstack/react-pacer/debouncer";
@ -301,7 +302,7 @@ const AllModelsTab = ({
{selectedTeamValue === PERSONAL_TEAM_VALUE ? ( {selectedTeamValue === PERSONAL_TEAM_VALUE ? (
<span> <span>
To access these models, create a Virtual Key without selecting a team on the{" "} To access these models, create a Virtual Key without selecting a team on the{" "}
<a href="/public?login=success&page=api-keys" className="font-medium text-info hover:underline"> <a href={migratedHref("api-keys")} className="font-medium text-info hover:underline">
Virtual Keys page Virtual Keys page
</a> </a>
. .
@ -309,7 +310,7 @@ const AllModelsTab = ({
) : ( ) : (
<span> <span>
To access these models, create a Virtual Key and select Team as &quot;{teamAccessLabel}&quot; on the{" "} To access these models, create a Virtual Key and select Team as &quot;{teamAccessLabel}&quot; on the{" "}
<a href="/public?login=success&page=api-keys" className="font-medium text-info hover:underline"> <a href={migratedHref("api-keys")} className="font-medium text-info hover:underline">
Virtual Keys page Virtual Keys page
</a> </a>
. .