mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(ui): split the KeyActivityPanel condition chains to bring the lint budget back under its ceiling (#44114)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> #43409 landed three four-condition boolean chains in KeyActivityPanel.tsx, putting local/no-long-condition-chain at 197 against a max of 196, so frontend-lint fails on every PR that touches the dashboard. Name the shared isFiltering && !searching and localOnly && pageRows.length === 0 sub-expressions so each remaining chain has three conditions, and ratchet the max down to the new count of 194. Co-authored-by: yassin <yassin@berri.ai>
This commit is contained in:
parent
1eadd7aba0
commit
2b51f2f941
2 changed files with 6 additions and 4 deletions
|
|
@ -4,7 +4,7 @@
|
|||
"complexity": { "max": 140, "target": 80 },
|
||||
"max-depth": { "max": 70, "target": 30 },
|
||||
"local/no-large-inline-object-arg": { "max": 551, "target": 300 },
|
||||
"local/no-long-condition-chain": { "max": 196, "target": 120 },
|
||||
"local/no-long-condition-chain": { "max": 194, "target": 120 },
|
||||
"testing-library/no-container": { "max": 133, "target": 50 },
|
||||
"testing-library/no-node-access": { "max": 707, "target": 500 },
|
||||
"testing-library/prefer-screen-queries": { "max": 18, "target": 18 }
|
||||
|
|
|
|||
|
|
@ -256,9 +256,10 @@ const KeyActivityPanel: React.FC<KeyActivityPanelProps> = ({
|
|||
const filteredMetrics = useMemo(() => ({ ...searchMetrics, ...localFiltered }), [searchMetrics, localFiltered]);
|
||||
const shownKeys = Object.keys(filteredMetrics).length;
|
||||
const isFiltering = trimmedQuery.length > 0;
|
||||
const searchSettled = isFiltering && !searching;
|
||||
const visibleDetails = detailState?.scope === fetchKeyPage ? detailState.details : {};
|
||||
const keyCountLabel =
|
||||
isFiltering && searchFailed && !searching && shownKeys === 0
|
||||
searchSettled && searchFailed && shownKeys === 0
|
||||
? "Search failed"
|
||||
: keyCountText(searching, isFiltering, shownKeys, total);
|
||||
|
||||
|
|
@ -331,9 +332,10 @@ const KeyActivityPanel: React.FC<KeyActivityPanelProps> = ({
|
|||
const firstPageFailed = failed && pageRows.length === 0;
|
||||
const showNextPageRetry = failed && !firstPageFailed && !isFiltering;
|
||||
const localOnly = searchTerm === null;
|
||||
const pageUnavailable = localOnly && pageRows.length === 0 && (loading || firstPageFailed);
|
||||
const noLocalRows = localOnly && pageRows.length === 0;
|
||||
const pageUnavailable = noLocalRows && (loading || firstPageFailed);
|
||||
const listBody = pageUnavailable || (!isFiltering && pageRows.length === 0) ? emptyListBody : keyList;
|
||||
const noMatches = isFiltering && !searching && !pageUnavailable && shownKeys === 0;
|
||||
const noMatches = searchSettled && !pageUnavailable && shownKeys === 0;
|
||||
const showSearchErrorNote = !noMatches && searchFailed && !searching;
|
||||
const searchRetryButton = (
|
||||
<button type="button" className="font-medium text-foreground underline" onClick={retrySearch}>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue