mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
fix(ui): match the Team ID selector to the backend's proxy-admin-only bypass and show its placeholder
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
21a8289251
commit
f474c331b0
3 changed files with 16 additions and 4 deletions
|
|
@ -816,7 +816,7 @@ const ModelInfoEditForm: React.FC<ModelInfoEditFormProps> = ({
|
|||
return (
|
||||
<Select
|
||||
items={items}
|
||||
value={(value as string) ?? ""}
|
||||
value={(value as string | undefined) || null}
|
||||
onValueChange={(selected: string | null) => onChange(selected ?? "")}
|
||||
>
|
||||
<SelectTrigger id={id} className="w-full" onBlur={onBlur}>
|
||||
|
|
|
|||
|
|
@ -1596,7 +1596,19 @@ describe("ModelInfoView", () => {
|
|||
expect(payload.model_info.team_id).toBe("team-2");
|
||||
});
|
||||
|
||||
it("only offers a team admin the teams they administer", async () => {
|
||||
it("shows the Team ID placeholder for a model with no team", async () => {
|
||||
mockUseTeams.mockReturnValue({
|
||||
data: [{ team_id: "team-1", team_alias: "alpha" }],
|
||||
isLoading: false,
|
||||
error: null,
|
||||
});
|
||||
const user = userEvent.setup();
|
||||
await enterEditMode(user);
|
||||
|
||||
expect(screen.getByText("Select a team")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it.each(["Internal User", "Org Admin"])("only offers a %s the teams they administer", async (userRole) => {
|
||||
mockUseTeams.mockReturnValue({
|
||||
data: [
|
||||
{ team_id: "team-1", team_alias: "alpha", members_with_roles: [{ user_id: "123", role: "admin" }] },
|
||||
|
|
@ -1613,7 +1625,7 @@ describe("ModelInfoView", () => {
|
|||
mockUseModelsInfo.mockReturnValue({ data: { data: [teamModel] }, isLoading: false, error: null });
|
||||
mockModelInfoV1Call.mockResolvedValue({ data: [teamModel] });
|
||||
const user = userEvent.setup();
|
||||
render(<ModelInfoView {...DEFAULT_ADMIN_PROPS} userRole="Internal User" />, { wrapper });
|
||||
render(<ModelInfoView {...DEFAULT_ADMIN_PROPS} userRole={userRole} />, { wrapper });
|
||||
await user.click(await screen.findByRole("button", { name: /edit settings/i }));
|
||||
|
||||
await user.click(await screen.findByText("alpha (team-1)"));
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export const teamsUserCanAssign = (
|
|||
userRole: string | null,
|
||||
userID: string | null,
|
||||
): Team[] | null => {
|
||||
if (teams == null || all_admin_roles.includes(userRole ?? "") || isOrgAdminSessionRole(userRole)) {
|
||||
if (teams == null || isProxyAdminRole(userRole ?? "")) {
|
||||
return teams;
|
||||
}
|
||||
return teams.filter((team) => isUserTeamAdminForSingleTeam(team.members_with_roles, userID ?? ""));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue