Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dev_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
model_list:
- model_name: fake-openai-endpoint
litellm_params:
model: openai/fake-model
api_key: fake-key
api_base: https://exampleopenaiendpoint-production.up.railway.app/

general_settings:
master_key: sk-1234

litellm_settings:
drop_params: True
telemetry: False
Comment on lines +1 to +13

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dev config should be gitignored

This file contains a master_key and api_key. While these are clearly dummy/fake values, committing dev config files to the repo creates a risk pattern — contributors may update this file with real credentials. The .gitignore already excludes config.yaml and various other config files, but dev_config.yaml is not listed.

Consider adding dev_config.yaml to .gitignore to prevent accidental credential leaks.

Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,27 @@ const Sidebar2: React.FC<SidebarProps> = ({ accessToken, userRole, defaultSelect
router.push(href);
};

// Wrap label in <a> so every nav item supports right-click → "Open in new tab"
// and Ctrl/Cmd+click to open in a new tab, while preserving SPA navigation for normal clicks.
const renderNavLink = (label: string, page: string): React.ReactNode => {
const href = toHref(page);
return (
<a
href={href}
onClick={(e) => {
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) {
e.stopPropagation();
return;
}
e.preventDefault();
}}
style={{ color: "inherit", textDecoration: "none" }}
>
{label}
</a>
);
};

return (
<Layout style={{ minHeight: "100vh" }}>
<Sider
Expand Down Expand Up @@ -412,11 +433,11 @@ const Sidebar2: React.FC<SidebarProps> = ({ accessToken, userRole, defaultSelect
items={filteredMenuItems.map((item) => ({
key: item.key,
icon: item.icon,
label: item.label,
label: renderNavLink(item.label, item.page),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parent submenu items get invalid hrefs

renderNavLink is called for all items including parent submenu containers like "Tools" (page: "tools") and "Experimental" (page: "experimental"). These slugs have no entry in routeFor, so they fall through to the default case and produce hrefs like /tools or /experimental — routes that don't correspond to real pages. While normal clicks are fine (parent items expand the submenu and onClick is undefined), right-click "Open in new tab" will navigate to a 404.

Consider skipping the <a> wrapper for items that have children, since they're not navigable:

Suggested change
label: renderNavLink(item.label, item.page),
label: item.children ? item.label : renderNavLink(item.label, item.page),

children: item.children?.map((child) => ({
key: child.key,
icon: child.icon,
label: child.label,
label: renderNavLink(child.label, child.page),
onClick: () => goTo(child.page),
})),
onClick: !item.children ? () => goTo(item.page) : undefined,
Expand Down
44 changes: 42 additions & 2 deletions ui/litellm-dashboard/src/components/leftnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,46 @@ const Sidebar: React.FC<SidebarProps> = ({ setPage, defaultSelectedKey, collapse
setPage(page);
};

// Wrap label in <a> so every nav item supports right-click → "Open in new tab"
// and Ctrl/Cmd+click to open in a new tab, while preserving SPA navigation for normal clicks.
const renderNavLink = (
label: React.ReactNode,
page: string,
externalUrl?: string,
): React.ReactNode => {
if (externalUrl) {
return (
<a
href={externalUrl}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
style={{ color: "inherit", textDecoration: "none" }}
>
{label}
</a>
);
}
const params = new URLSearchParams(window.location.search);
params.set("page", page);
const href = `?${params.toString()}`;
return (
<a
href={href}
onClick={(e) => {
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) {
e.stopPropagation();
return;
}
e.preventDefault();
}}
style={{ color: "inherit", textDecoration: "none" }}
>
{label}
</a>
);
};

// Filter items based on user role and enabled pages for internal users
const filterItemsByRole = (items: MenuItem[]): MenuItem[] => {
const isAdmin = isAdminRole(userRole);
Expand Down Expand Up @@ -469,11 +509,11 @@ const Sidebar: React.FC<SidebarProps> = ({ setPage, defaultSelectedKey, collapse
children: filteredItems.map((item) => ({
key: item.key,
icon: item.icon,
label: item.label,
label: renderNavLink(item.label, item.page, item.external_url),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parent submenu items get invalid hrefs

Same issue as in Sidebar2.tsxrenderNavLink is called for parent items like "Tools", "Experimental", and "Settings" that have children. Right-clicking these and opening in a new tab will navigate to ?page=tools / ?page=experimental, which are submenu containers, not real pages.

Consider skipping the <a> wrapper for items that have children:

Suggested change
label: renderNavLink(item.label, item.page, item.external_url),
label: item.children ? item.label : renderNavLink(item.label, item.page, item.external_url),

children: item.children?.map((child) => ({
key: child.key,
icon: child.icon,
label: child.label,
label: renderNavLink(child.label, child.page, child.external_url),
onClick: () => {
if (child.external_url) {
window.open(child.external_url, "_blank");
Expand Down
Loading