mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
fix(ui): give each provider a distinct color in Spend by Provider donut
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
bb27bfd9a7
commit
aa2d73e19c
2 changed files with 3 additions and 4 deletions
|
|
@ -216,15 +216,15 @@ describe("SpendByProvider", () => {
|
|||
expect(screen.queryByText("unknown")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders one cyan donut sector per visible provider with the $ total as center label", () => {
|
||||
it("gives every visible provider its own donut color and shows the $ total as center label", () => {
|
||||
const { container } = render(
|
||||
<SpendByProvider loading={false} isDateChanging={false} providerSpend={mockProviderSpend} />,
|
||||
);
|
||||
|
||||
const sectors = container.querySelectorAll(".recharts-pie-sector path");
|
||||
expect(sectors).toHaveLength(2);
|
||||
const fills = new Set(Array.from(sectors).map((sector) => sector.getAttribute("fill")));
|
||||
expect(fills).toEqual(new Set(["var(--color-cyan-500, #06b6d4)"]));
|
||||
const fills = Array.from(sectors).map((sector) => sector.getAttribute("fill"));
|
||||
expect(new Set(fills).size).toBe(fills.length);
|
||||
|
||||
const centerLabels = Array.from(container.querySelectorAll("text.fill-foreground")).map((text) => text.textContent);
|
||||
expect(centerLabels).toContain("$351.25");
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ const SpendByProvider: React.FC<SpendByProviderProps> = ({ loading, isDateChangi
|
|||
index="provider"
|
||||
category="spend"
|
||||
valueFormatter={(value) => `$${formatNumberWithCommas(value, 2)}`}
|
||||
colors={["cyan"]}
|
||||
showLabel
|
||||
startAngle={90}
|
||||
endAngle={-270}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue