Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

styling tags, only showing tag column on tags tab

DrQuacks7c5f789b67d9
diff --git a/ui/litellm-dashboard/src/components/entity_usage.tsx b/ui/litellm-dashboard/src/components/entity_usage.tsx
index ee44fd58290..ca6615303e9 100644
--- a/ui/litellm-dashboard/src/components/entity_usage.tsx
+++ b/ui/litellm-dashboard/src/components/entity_usage.tsx
@@ -642,6 +642,7 @@ const EntityUsage: React.FC<EntityUsageProps> = ({
userRole={userRole}
teams={null}
premiumUser={premiumUser}
+ showTags={entityType === "tag"}
/>
</Card>
</Col>
diff --git a/ui/litellm-dashboard/src/components/top_key_view.tsx b/ui/litellm-dashboard/src/components/top_key_view.tsx
index 1c87807d81c..43565330144 100644
--- a/ui/litellm-dashboard/src/components/top_key_view.tsx
+++ b/ui/litellm-dashboard/src/components/top_key_view.tsx
@@ -15,9 +15,10 @@ interface TopKeyViewProps {
userRole: string | null
teams: any[] | null
premiumUser: boolean
+ showTags?: boolean
}
-const TopKeyView: React.FC<TopKeyViewProps> = ({ topKeys, accessToken, userID, userRole, teams, premiumUser }) => {
+const TopKeyView: React.FC<TopKeyViewProps> = ({ topKeys, accessToken, userID, userRole, teams, premiumUser, showTags = false }) => {
const [isModalOpen, setIsModalOpen] = useState<boolean>(false)
const [selectedKey, setSelectedKey] = useState<string | null>(null)
const [keyData, setKeyData] = useState<any | undefined>(undefined)
@@ -64,7 +65,7 @@ const TopKeyView: React.FC<TopKeyViewProps> = ({ topKeys, accessToken, userID, u
}, [isModalOpen])
// Define columns for the table view
- const columns = [
+ const baseColumns = [
{
header: "Key ID",
accessorKey: "api_key",
@@ -88,18 +89,41 @@ const TopKeyView: React.FC<TopKeyViewProps> = ({ topKeys, accessToken, userID, u
accessorKey: "key_alias",
cell: (info: any) => info.getValue() || "-",
},
- {
- header: "Tags",
- accessorKey: "tags",
- cell: (info: any) => info.getValue() || "-",
- },
- {
- header: "Spend (USD)",
- accessorKey: "spend",
- cell: (info: any) => `$${formatNumberWithCommas(info.getValue(), 2)}`,
- },
]
+ const tagsColumn = {
+ header: "Tags",
+ accessorKey: "tags",
+ cell: (info: any) => {
+ const tags = info.getValue() as string[] | undefined;
+ if (!tags || tags.length === 0) {
+ return "-";
+ }
+
+ return (
+ <div className="overflow-hidden">
+ {tags.map((tag, index) => (
+ <Tooltip key={index} title={tag}>
+ <span className="px-2 py-1 bg-gray-100 rounded-full text-xs mr-1">
+ {tag.slice(0, 7)}...
+ </span>
+ </Tooltip>
+ ))}
+ </div>
+ );
+ }
+ }
+
+ const spendColumn = {
+ header: "Spend (USD)",
+ accessorKey: "spend",
+ cell: (info: any) => `$${formatNumberWithCommas(info.getValue(), 2)}`,
+ }
+
+ const columns = showTags
+ ? [...baseColumns, tagsColumn, spendColumn]
+ : [...baseColumns, spendColumn]
+
const processedTopKeys = topKeys.map((k) => ({
...k,
display_key_alias: k.key_alias && k.key_alias.length > 10 ? `${k.key_alias.slice(0, 10)}...` : k.key_alias || "-",
diff --git a/ui/litellm-dashboard/src/components/view_logs/table.tsx b/ui/litellm-dashboard/src/components/view_logs/table.tsx
index c4f620e4413..b49ef30e83f 100644
--- a/ui/litellm-dashboard/src/components/view_logs/table.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/table.tsx
@@ -53,7 +53,7 @@ export function DataTable<TData, TValue>({
return (
<div className="rounded-lg custom-border overflow-x-auto w-full max-w-full box-border">
- <Table className="[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border" style={{minWidth: '800px'}}>
+ <Table className="[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border" style={{minWidth: '400px'}}>
<TableHead>
{table.getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>