mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-11 08:38:24 +00:00
refactor(ui): inline the one-team check for the Spend Per Tag card
singleTeamId had one caller and its unit test repeated what EntityUsage.test.tsx already checks through the page, so the module and its test are removed.
This commit is contained in:
parent
9b986fb517
commit
64a186594d
3 changed files with 1 additions and 15 deletions
|
|
@ -55,7 +55,6 @@ import { Panel, Segmented, Sparkline, Stat } from "../overview/Primitives";
|
|||
import TopModelView from "./TopModelView";
|
||||
import TeamTagSpendCard from "./TeamTagSpendCard";
|
||||
import TeamUserSpendCard from "./TeamUserSpendCard";
|
||||
import { singleTeamId } from "./teamTagSpend";
|
||||
import { ProviderSpendBreakdown } from "./SpendByProvider";
|
||||
|
||||
const BRAND = "#2b3fd6";
|
||||
|
|
@ -363,7 +362,7 @@ const EntityUsage: React.FC<EntityUsageProps> = ({
|
|||
const filterSlot = entityFilterSlots[entityType];
|
||||
|
||||
const capitalizedEntityLabel = entityType.charAt(0).toUpperCase() + entityType.slice(1);
|
||||
const tagSpendTeamId = entityType === "team" ? singleTeamId(selectedTags) : null;
|
||||
const tagSpendTeamId = entityType === "team" && selectedTags.length === 1 ? selectedTags[0] : null;
|
||||
const showFlatCost = entityType === "team" && hasFlatCost(spendData.metadata);
|
||||
const showPtuHours = entityType === "team" && hasPtuHours(spendData.metadata);
|
||||
const userSpendTeamIds = useMemo(
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { singleTeamId } from "./teamTagSpend";
|
||||
|
||||
describe("singleTeamId", () => {
|
||||
it("is the team only when exactly one is selected", () => {
|
||||
expect(singleTeamId(["team-a"])).toBe("team-a");
|
||||
expect(singleTeamId([])).toBeNull();
|
||||
expect(singleTeamId(["team-a", "team-b"])).toBeNull();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export const singleTeamId = (selectedTeamIds: readonly string[]): string | null =>
|
||||
selectedTeamIds.length === 1 ? selectedTeamIds[0] : null;
|
||||
Loading…
Add table
Reference in a new issue