mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
refactor(ui): move the model team selector into ModelTeamSelect to keep ModelInfoEditForm under the eslint line cap
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
This commit is contained in:
parent
6db76b5f39
commit
790c3ab71b
2 changed files with 35 additions and 24 deletions
|
|
@ -28,6 +28,7 @@ import type { Team } from "./key_team_helpers/key_list";
|
|||
import type { CredentialItem } from "./networking";
|
||||
import NumericalInput from "./shared/numerical_input";
|
||||
import type { Tag } from "./tag_management/types";
|
||||
import { ModelTeamSelect } from "./view_model/ModelTeamSelect";
|
||||
import VectorStoreSelector from "./vector_store_management/VectorStoreSelector";
|
||||
import { formatPtuUtcDisplay, utcIsoToPickerValue } from "../utils/ptuDatetime";
|
||||
import { isMaskedSecret } from "../utils/maskedSecretUtils";
|
||||
|
|
@ -810,30 +811,9 @@ const ModelInfoEditForm: React.FC<ModelInfoEditFormProps> = ({
|
|||
<FieldLabel>Team</FieldLabel>
|
||||
{isEditing ? (
|
||||
<FormField control={form.control} name="team_id">
|
||||
{({ id, value, onChange, onBlur }) => {
|
||||
const items = (teams ?? []).map((team) => ({
|
||||
value: team.team_id,
|
||||
label: team.team_alias ? `${team.team_alias} (${team.team_id})` : team.team_id,
|
||||
}));
|
||||
return (
|
||||
<Select
|
||||
items={items}
|
||||
value={(value as string | undefined) || null}
|
||||
onValueChange={(selected: string | null) => onChange(selected ?? "")}
|
||||
>
|
||||
<SelectTrigger id={id} className="w-full" onBlur={onBlur}>
|
||||
<SelectValue placeholder="Select a team" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{items.map((item) => (
|
||||
<SelectItem key={item.value} value={item.value}>
|
||||
{item.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
);
|
||||
}}
|
||||
{({ id, value, onChange, onBlur }) => (
|
||||
<ModelTeamSelect id={id} value={value} onChange={onChange} onBlur={onBlur} teams={teams} />
|
||||
)}
|
||||
</FormField>
|
||||
) : (
|
||||
<Display>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import type { Team } from "../key_team_helpers/key_list";
|
||||
|
||||
interface ModelTeamSelectProps {
|
||||
id: string;
|
||||
value: string | undefined;
|
||||
onChange: (teamId: string) => void;
|
||||
onBlur: () => void;
|
||||
teams: Team[] | null;
|
||||
}
|
||||
|
||||
export const ModelTeamSelect: React.FC<ModelTeamSelectProps> = ({ id, value, onChange, onBlur, teams }) => {
|
||||
const items = (teams ?? []).map((team) => ({
|
||||
value: team.team_id,
|
||||
label: team.team_alias ? `${team.team_alias} (${team.team_id})` : team.team_id,
|
||||
}));
|
||||
return (
|
||||
<Select items={items} value={value || null} onValueChange={(selected: string | null) => onChange(selected ?? "")}>
|
||||
<SelectTrigger id={id} className="w-full" onBlur={onBlur}>
|
||||
<SelectValue placeholder="Select a team" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{items.map((item) => (
|
||||
<SelectItem key={item.value} value={item.value}>
|
||||
{item.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue