mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
fix(ui): inverted routing-status filter mapping and compact Status column
Selecting "Active" in the Filters drawer sent blocked=true to the server, showing the paused deployments instead of the active ones (and vice versa). The mapping now lives in routingStatusToBlocked() with unit tests, and the Status column is narrower so the row actions stay in view.
This commit is contained in:
parent
5f8705bcdc
commit
d8d6f665ed
4 changed files with 29 additions and 4 deletions
|
|
@ -17,6 +17,7 @@ import { createParser, parseAsInteger, parseAsString, parseAsStringLiteral, useQ
|
|||
import { useCallback, useMemo, useState } from "react";
|
||||
|
||||
import { useModelsInfo } from "../../hooks/models/useModels";
|
||||
import { routingStatusToBlocked } from "../utils/routingStatus";
|
||||
import { transformModelData } from "../utils/modelDataTransformer";
|
||||
import {
|
||||
ALL_MODEL_GROUPS_VALUE,
|
||||
|
|
@ -92,8 +93,7 @@ const AllModelsTab = ({
|
|||
const selectedModelAccessGroupFilter = tableState.access_group || null;
|
||||
const routingStatusFilter =
|
||||
tableState.status === "active" || tableState.status === "paused" ? tableState.status : null;
|
||||
const blockedForQuery: boolean | undefined =
|
||||
routingStatusFilter === null ? undefined : routingStatusFilter === "active";
|
||||
const blockedForQuery: boolean | undefined = routingStatusToBlocked(routingStatusFilter);
|
||||
const pagination = useMemo<PaginationState>(
|
||||
() => ({ pageIndex: tableState.page - 1, pageSize: tableState.page_size }),
|
||||
[tableState.page, tableState.page_size],
|
||||
|
|
|
|||
|
|
@ -461,8 +461,8 @@ export const getModelsTableColumns = ({
|
|||
meta: { title: "Status", skeleton: "badge" },
|
||||
header: ({ column }) => <DataTableSortHeader column={column} title="Status" />,
|
||||
enableSorting: true,
|
||||
size: 110,
|
||||
minSize: 90,
|
||||
size: 90,
|
||||
minSize: 70,
|
||||
cell: ({ row }) => <RoutingStatusCell blocked={row.original.model_info?.blocked} />,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { routingStatusToBlocked } from "./routingStatus";
|
||||
|
||||
describe("routingStatusToBlocked", () => {
|
||||
it.each([
|
||||
["active", false],
|
||||
["paused", true],
|
||||
] as const)("maps %s to blocked=%s", (status, expected) => {
|
||||
expect(routingStatusToBlocked(status)).toBe(expected);
|
||||
});
|
||||
|
||||
it("returns undefined when there is no status filter", () => {
|
||||
expect(routingStatusToBlocked(null)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
export type RoutingStatusFilter = "active" | "paused" | null;
|
||||
|
||||
/**
|
||||
* Maps the URL-state status filter to the `blocked` query param of
|
||||
* `/v2/model/info`: "active" → false (not blocked), "paused" → true,
|
||||
* null → undefined (no filtering).
|
||||
*/
|
||||
export const routingStatusToBlocked = (status: RoutingStatusFilter): boolean | undefined =>
|
||||
status === null ? undefined : status === "paused";
|
||||
Loading…
Add table
Reference in a new issue