@acarmisc/backstage-plugin-litellm 0.40.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +49 -23
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.esm.js +44 -18
- package/dist/index.esm.js.map +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1640,6 +1640,7 @@ import DialogTitle from "@mui/material/DialogTitle";
|
|
|
1640
1640
|
import DialogContent from "@mui/material/DialogContent";
|
|
1641
1641
|
import DialogActions from "@mui/material/DialogActions";
|
|
1642
1642
|
import TextField from "@mui/material/TextField";
|
|
1643
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
1643
1644
|
import CircularProgress from "@mui/material/CircularProgress";
|
|
1644
1645
|
import Skeleton2 from "@mui/material/Skeleton";
|
|
1645
1646
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
@@ -1778,6 +1779,7 @@ var init_KeysTable = __esm({
|
|
|
1778
1779
|
const [deleteSubmitting, setDeleteSubmitting] = useState3(false);
|
|
1779
1780
|
const clipboard = useCopyToClipboard();
|
|
1780
1781
|
const [filterText, setFilterText] = useState3("");
|
|
1782
|
+
const [teamFilter, setTeamFilter] = useState3("");
|
|
1781
1783
|
const [sortKey, setSortKey] = useState3("created");
|
|
1782
1784
|
const [sortDirection, setSortDirection] = useState3("desc");
|
|
1783
1785
|
const handleSort = (nextSortKey) => {
|
|
@@ -1788,9 +1790,16 @@ var init_KeysTable = __esm({
|
|
|
1788
1790
|
setSortDirection("asc");
|
|
1789
1791
|
}
|
|
1790
1792
|
};
|
|
1793
|
+
const teamIds = useMemo2(
|
|
1794
|
+
() => [...new Set(keys.map((k) => k.team_id).filter((t) => !!t))].sort(),
|
|
1795
|
+
[keys]
|
|
1796
|
+
);
|
|
1791
1797
|
const filteredKeys = useMemo2(() => {
|
|
1792
1798
|
let result = keys;
|
|
1793
1799
|
result = filterKeysByStatus(result, filter);
|
|
1800
|
+
if (teamFilter) {
|
|
1801
|
+
result = result.filter((k) => k.team_id === teamFilter);
|
|
1802
|
+
}
|
|
1794
1803
|
if (filterText.trim()) {
|
|
1795
1804
|
const q = filterText.toLowerCase();
|
|
1796
1805
|
result = result.filter(
|
|
@@ -1801,7 +1810,7 @@ var init_KeysTable = __esm({
|
|
|
1801
1810
|
const comparison = compareKeys(a, b, sortKey);
|
|
1802
1811
|
return sortDirection === "asc" ? comparison : -comparison;
|
|
1803
1812
|
});
|
|
1804
|
-
}, [keys, filterText, sortKey, sortDirection, filter]);
|
|
1813
|
+
}, [keys, filterText, teamFilter, sortKey, sortDirection, filter]);
|
|
1805
1814
|
const handleOpenEdit = (k) => {
|
|
1806
1815
|
onEditKey(k);
|
|
1807
1816
|
};
|
|
@@ -1860,10 +1869,10 @@ var init_KeysTable = __esm({
|
|
|
1860
1869
|
};
|
|
1861
1870
|
const renderTableBody = () => {
|
|
1862
1871
|
if (loading) {
|
|
1863
|
-
return /* @__PURE__ */ jsx8(TableRow, { children: /* @__PURE__ */ jsx8(TableCell, { colSpan:
|
|
1872
|
+
return /* @__PURE__ */ jsx8(TableRow, { children: /* @__PURE__ */ jsx8(TableCell, { colSpan: 9, sx: { py: 2 }, children: /* @__PURE__ */ jsx8(Skeleton2, { variant: "rounded", height: 140 }) }) });
|
|
1864
1873
|
}
|
|
1865
1874
|
if (filteredKeys.length === 0) {
|
|
1866
|
-
return /* @__PURE__ */ jsx8(TableRow, { children: /* @__PURE__ */ jsx8(TableCell, { colSpan:
|
|
1875
|
+
return /* @__PURE__ */ jsx8(TableRow, { children: /* @__PURE__ */ jsx8(TableCell, { colSpan: 9, children: filterText || teamFilter ? /* @__PURE__ */ jsx8(
|
|
1867
1876
|
EmptyState,
|
|
1868
1877
|
{
|
|
1869
1878
|
message: "No keys match that filter",
|
|
@@ -1907,6 +1916,7 @@ var init_KeysTable = __esm({
|
|
|
1907
1916
|
/* @__PURE__ */ jsx8(Typography5, { variant: "body2", children: key.key_alias || "\u2014" }),
|
|
1908
1917
|
key.blocked && /* @__PURE__ */ jsx8(StatusPill, { label: "Blocked", tone: "danger" })
|
|
1909
1918
|
] }) }),
|
|
1919
|
+
/* @__PURE__ */ jsx8(TableCell, { children: /* @__PURE__ */ jsx8(Typography5, { variant: "body2", color: "text.secondary", children: key.team_id || "\u2014" }) }),
|
|
1910
1920
|
/* @__PURE__ */ jsx8(TableCell, { children: /* @__PURE__ */ jsxs7(Box7, { display: "flex", alignItems: "center", gap: 0.5, children: [
|
|
1911
1921
|
/* @__PURE__ */ jsx8(
|
|
1912
1922
|
Typography5,
|
|
@@ -1999,7 +2009,7 @@ var init_KeysTable = __esm({
|
|
|
1999
2009
|
SectionCard,
|
|
2000
2010
|
{
|
|
2001
2011
|
title: "Virtual Keys",
|
|
2002
|
-
subtitle: loading ? "Loading\u2026" : `${filteredKeys.length}${filterText ? ` of ${keys.length}` : ""} key${filteredKeys.length === 1 ? "" : "s"}`,
|
|
2012
|
+
subtitle: loading ? "Loading\u2026" : `${filteredKeys.length}${filterText || teamFilter ? ` of ${keys.length}` : ""} key${filteredKeys.length === 1 ? "" : "s"}`,
|
|
2003
2013
|
flush: true,
|
|
2004
2014
|
actions: /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
2005
2015
|
/* @__PURE__ */ jsx8(
|
|
@@ -2016,6 +2026,21 @@ var init_KeysTable = __esm({
|
|
|
2016
2026
|
}
|
|
2017
2027
|
}
|
|
2018
2028
|
),
|
|
2029
|
+
/* @__PURE__ */ jsxs7(
|
|
2030
|
+
TextField,
|
|
2031
|
+
{
|
|
2032
|
+
select: true,
|
|
2033
|
+
size: "small",
|
|
2034
|
+
label: "Team",
|
|
2035
|
+
value: teamFilter,
|
|
2036
|
+
onChange: (e) => setTeamFilter(e.target.value),
|
|
2037
|
+
sx: { minWidth: 160 },
|
|
2038
|
+
children: [
|
|
2039
|
+
/* @__PURE__ */ jsx8(MenuItem, { value: "", children: "All teams" }),
|
|
2040
|
+
teamIds.map((id) => /* @__PURE__ */ jsx8(MenuItem, { value: id, children: id }, id))
|
|
2041
|
+
]
|
|
2042
|
+
}
|
|
2043
|
+
),
|
|
2019
2044
|
expiredKeys.length > 0 && /* @__PURE__ */ jsxs7(
|
|
2020
2045
|
Button2,
|
|
2021
2046
|
{
|
|
@@ -2054,6 +2079,7 @@ var init_KeysTable = __esm({
|
|
|
2054
2079
|
/* @__PURE__ */ jsx8(TableContainer, { children: /* @__PURE__ */ jsxs7(Table, { size: "small", sx: dataTableSx, children: [
|
|
2055
2080
|
/* @__PURE__ */ jsx8(TableHead, { children: /* @__PURE__ */ jsxs7(TableRow, { children: [
|
|
2056
2081
|
/* @__PURE__ */ jsx8(TableCell, { sortDirection: sortKey === "alias" ? sortDirection : false, children: /* @__PURE__ */ jsx8(TableSortLabel, { active: sortKey === "alias", direction: sortKey === "alias" ? sortDirection : "asc", onClick: () => handleSort("alias"), children: "Alias" }) }),
|
|
2082
|
+
/* @__PURE__ */ jsx8(TableCell, { children: "Team" }),
|
|
2057
2083
|
/* @__PURE__ */ jsx8(TableCell, { children: "Key ID" }),
|
|
2058
2084
|
/* @__PURE__ */ jsx8(TableCell, { sortDirection: sortKey === "created" ? sortDirection : false, children: /* @__PURE__ */ jsx8(TableSortLabel, { active: sortKey === "created", direction: sortKey === "created" ? sortDirection : "asc", onClick: () => handleSort("created"), children: "Created" }) }),
|
|
2059
2085
|
/* @__PURE__ */ jsx8(TableCell, { sortDirection: sortKey === "expires" ? sortDirection : false, children: /* @__PURE__ */ jsx8(TableSortLabel, { active: sortKey === "expires", direction: sortKey === "expires" ? sortDirection : "asc", onClick: () => handleSort("expires"), children: "Expires" }) }),
|
|
@@ -2472,7 +2498,7 @@ import DialogTitle2 from "@mui/material/DialogTitle";
|
|
|
2472
2498
|
import DialogContent2 from "@mui/material/DialogContent";
|
|
2473
2499
|
import DialogActions2 from "@mui/material/DialogActions";
|
|
2474
2500
|
import TextField2 from "@mui/material/TextField";
|
|
2475
|
-
import
|
|
2501
|
+
import MenuItem2 from "@mui/material/MenuItem";
|
|
2476
2502
|
import Button3 from "@mui/material/Button";
|
|
2477
2503
|
import IconButton3 from "@mui/material/IconButton";
|
|
2478
2504
|
import CircularProgress2 from "@mui/material/CircularProgress";
|
|
@@ -3046,7 +3072,7 @@ var init_KeyFormDialog = __esm({
|
|
|
3046
3072
|
value: generateForm.duration || "30d",
|
|
3047
3073
|
onChange: (e) => setFormData({ duration: e.target.value }),
|
|
3048
3074
|
fullWidth: true,
|
|
3049
|
-
children: DEFAULT_KEY_DURATIONS.map((duration) => /* @__PURE__ */ jsx10(
|
|
3075
|
+
children: DEFAULT_KEY_DURATIONS.map((duration) => /* @__PURE__ */ jsx10(MenuItem2, { value: duration, children: formatDurationLabel(duration) }, duration))
|
|
3050
3076
|
}
|
|
3051
3077
|
),
|
|
3052
3078
|
generateForm.duration && /* @__PURE__ */ jsx10(Typography7, { variant: "caption", color: "text.secondary", children: expiryPreview(generateForm.duration) })
|
|
@@ -3148,7 +3174,7 @@ import Checkbox2 from "@mui/material/Checkbox";
|
|
|
3148
3174
|
import FormControlLabel2 from "@mui/material/FormControlLabel";
|
|
3149
3175
|
import Autocomplete2 from "@mui/material/Autocomplete";
|
|
3150
3176
|
import CircularProgress3 from "@mui/material/CircularProgress";
|
|
3151
|
-
import
|
|
3177
|
+
import MenuItem3 from "@mui/material/MenuItem";
|
|
3152
3178
|
import Box10 from "@mui/material/Box";
|
|
3153
3179
|
import Divider2 from "@mui/material/Divider";
|
|
3154
3180
|
import Typography8 from "@mui/material/Typography";
|
|
@@ -3570,7 +3596,7 @@ var init_ManageTeamDialog = __esm({
|
|
|
3570
3596
|
disabled: submitting || unlimited,
|
|
3571
3597
|
helperText: "Spend-reset period for the team budget",
|
|
3572
3598
|
fullWidth: true,
|
|
3573
|
-
children: durationOptions.map((o) => /* @__PURE__ */ jsx11(
|
|
3599
|
+
children: durationOptions.map((o) => /* @__PURE__ */ jsx11(MenuItem3, { value: o.value, children: o.label }, o.value))
|
|
3574
3600
|
}
|
|
3575
3601
|
)
|
|
3576
3602
|
]
|
|
@@ -3950,7 +3976,7 @@ import Paper5 from "@mui/material/Paper";
|
|
|
3950
3976
|
import Box11 from "@mui/material/Box";
|
|
3951
3977
|
import Typography9 from "@mui/material/Typography";
|
|
3952
3978
|
import TextField4 from "@mui/material/TextField";
|
|
3953
|
-
import
|
|
3979
|
+
import MenuItem4 from "@mui/material/MenuItem";
|
|
3954
3980
|
import Grid from "@mui/material/Grid";
|
|
3955
3981
|
import Alert3 from "@mui/material/Alert";
|
|
3956
3982
|
import Button5 from "@mui/material/Button";
|
|
@@ -4232,7 +4258,7 @@ var init_UsageStats = __esm({
|
|
|
4232
4258
|
value: currentPreset,
|
|
4233
4259
|
onChange: (e) => handlePresetChange(e.target.value),
|
|
4234
4260
|
sx: { minWidth: 160 },
|
|
4235
|
-
children: Object.keys(PRESET_LABELS).map((p) => /* @__PURE__ */ jsx12(
|
|
4261
|
+
children: Object.keys(PRESET_LABELS).map((p) => /* @__PURE__ */ jsx12(MenuItem4, { value: p, children: PRESET_LABELS[p] }, p))
|
|
4236
4262
|
}
|
|
4237
4263
|
);
|
|
4238
4264
|
if (usageError) {
|
|
@@ -4293,8 +4319,8 @@ var init_UsageStats = __esm({
|
|
|
4293
4319
|
onChange: (e) => setSelectedModel(e.target.value),
|
|
4294
4320
|
sx: { minWidth: 220 },
|
|
4295
4321
|
children: [
|
|
4296
|
-
/* @__PURE__ */ jsx12(
|
|
4297
|
-
models.filter((m) => modelsInPeriod.includes(m.model_name)).map((m) => /* @__PURE__ */ jsx12(
|
|
4322
|
+
/* @__PURE__ */ jsx12(MenuItem4, { value: "all", children: "All models" }),
|
|
4323
|
+
models.filter((m) => modelsInPeriod.includes(m.model_name)).map((m) => /* @__PURE__ */ jsx12(MenuItem4, { value: m.model_name, children: m.model_name }, m.model_name))
|
|
4298
4324
|
]
|
|
4299
4325
|
}
|
|
4300
4326
|
)
|
|
@@ -5421,7 +5447,7 @@ import TableHead5 from "@mui/material/TableHead";
|
|
|
5421
5447
|
import TableRow5 from "@mui/material/TableRow";
|
|
5422
5448
|
import TableSortLabel2 from "@mui/material/TableSortLabel";
|
|
5423
5449
|
import Typography13 from "@mui/material/Typography";
|
|
5424
|
-
import
|
|
5450
|
+
import MenuItem5 from "@mui/material/MenuItem";
|
|
5425
5451
|
import Select from "@mui/material/Select";
|
|
5426
5452
|
import FormControl from "@mui/material/FormControl";
|
|
5427
5453
|
import InputLabel from "@mui/material/InputLabel";
|
|
@@ -5560,7 +5586,7 @@ var init_ModelsTable = __esm({
|
|
|
5560
5586
|
value: selectedTeamId,
|
|
5561
5587
|
label: "Team",
|
|
5562
5588
|
onChange: (e) => setSelectedTeamId(e.target.value),
|
|
5563
|
-
children: teams.map((t) => /* @__PURE__ */ jsx16(
|
|
5589
|
+
children: teams.map((t) => /* @__PURE__ */ jsx16(MenuItem5, { value: t.team_id, children: t.team_alias ?? t.team_id }, t.team_id))
|
|
5564
5590
|
}
|
|
5565
5591
|
)
|
|
5566
5592
|
] }),
|
|
@@ -7109,7 +7135,7 @@ import Box19 from "@mui/material/Box";
|
|
|
7109
7135
|
import Typography17 from "@mui/material/Typography";
|
|
7110
7136
|
import FormControl2 from "@mui/material/FormControl";
|
|
7111
7137
|
import Select2 from "@mui/material/Select";
|
|
7112
|
-
import
|
|
7138
|
+
import MenuItem6 from "@mui/material/MenuItem";
|
|
7113
7139
|
import Skeleton7 from "@mui/material/Skeleton";
|
|
7114
7140
|
import { AreaChart as AreaChart3, Area as Area3, XAxis as XAxis3, Tooltip as Tooltip8, ResponsiveContainer as ResponsiveContainer3 } from "recharts";
|
|
7115
7141
|
import { useApi as useApi6 } from "@backstage/core-plugin-api";
|
|
@@ -7239,9 +7265,9 @@ var LiteLLMHomeWidget = ({
|
|
|
7239
7265
|
displayEmpty: true,
|
|
7240
7266
|
inputProps: { "aria-label": "Usage period" },
|
|
7241
7267
|
children: [
|
|
7242
|
-
/* @__PURE__ */ jsx21(
|
|
7243
|
-
/* @__PURE__ */ jsx21(
|
|
7244
|
-
/* @__PURE__ */ jsx21(
|
|
7268
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "today", children: "Today" }),
|
|
7269
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "7d", children: "7d" }),
|
|
7270
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "30d", children: "30d" })
|
|
7245
7271
|
]
|
|
7246
7272
|
}
|
|
7247
7273
|
) })
|