diff --git a/ui/litellm-dashboard/scripts/eslint-rules/no-ad-hoc-z-index.mjs b/ui/litellm-dashboard/scripts/eslint-rules/no-ad-hoc-z-index.mjs index fbe0fdcf7e5..6af86d2c501 100644 --- a/ui/litellm-dashboard/scripts/eslint-rules/no-ad-hoc-z-index.mjs +++ b/ui/litellm-dashboard/scripts/eslint-rules/no-ad-hoc-z-index.mjs @@ -1,9 +1,30 @@ -const AD_HOC_Z = /^(?:[\w-]+:)*-?z-(?:\d+|\[[^\]]*\]|\([^)]*\))$/; -const POPUP_Z = /^(?:[\w-]+:)*z-popup$/; +const AD_HOC_Z = /^-?z-(?:\d+|\[[^\]]*\]|\([^)]*\))$/; + +const OPENERS = { "[": "]", "(": ")" }; + +const utilityOf = (token) => { + const closers = []; + const lastTopLevelColon = [...token].reduce((found, ch, i) => { + if (closers.length > 0 && ch === closers[closers.length - 1]) { + closers.pop(); + return found; + } + if (ch in OPENERS) { + closers.push(OPENERS[ch]); + return found; + } + return ch === ":" && closers.length === 0 ? i : found; + }, -1); + return token + .slice(lastTopLevelColon + 1) + .replace(/^!/, "") + .replace(/!$/, ""); +}; const classify = (token, allowPopupLayer) => { - if (AD_HOC_Z.test(token)) return "adHoc"; - if (!allowPopupLayer && POPUP_Z.test(token)) return "popupReserved"; + const utility = utilityOf(token); + if (AD_HOC_Z.test(utility)) return "adHoc"; + if (!allowPopupLayer && utility === "z-popup") return "popupReserved"; return null; }; diff --git a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx index 975fbd6d623..df1a51d8e38 100644 --- a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx +++ b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx @@ -246,7 +246,10 @@ const TopKeyView: React.FC = ({ topKeys, teams, showTags = fals )} {isModalOpen && selectedKey && keyData && ( -
+
{/* Close button */}