@orsetra/shared-ui 1.10.8 → 1.10.9
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.
|
@@ -324,12 +324,11 @@ function Sidebar({ currentMenu, sidebarMenus = {}, main_base_url = "", sectionLa
|
|
|
324
324
|
? item.id === activeItemId
|
|
325
325
|
: (pathname === itemPath || pathname.startsWith(`${itemPath}/`))
|
|
326
326
|
|
|
327
|
-
// Resolved
|
|
328
|
-
//
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
const
|
|
332
|
-
const resolvedHref = templateResolution ? templateResolution.href : item.href
|
|
327
|
+
// Resolved unconditionally so middle-click/right-click (which bypass onClick) never
|
|
328
|
+
// navigate to a literal "${envAlias}"-style unresolved URL.
|
|
329
|
+
const templateResolution = resolveTemplateVars(item.href)
|
|
330
|
+
const isDisabled = !templateResolution.isResolved
|
|
331
|
+
const resolvedHref = templateResolution.href
|
|
333
332
|
|
|
334
333
|
const handleClick = (e: React.MouseEvent) => {
|
|
335
334
|
if (isDisabled) {
|
|
@@ -383,8 +382,10 @@ function Sidebar({ currentMenu, sidebarMenus = {}, main_base_url = "", sectionLa
|
|
|
383
382
|
) : (
|
|
384
383
|
<Link
|
|
385
384
|
key={item.id}
|
|
386
|
-
href={
|
|
385
|
+
href={isDisabled ? "#" : resolvedHref}
|
|
387
386
|
onClick={handleClick}
|
|
387
|
+
aria-disabled={isDisabled}
|
|
388
|
+
title={isDisabled ? "Select a project/environment first" : undefined}
|
|
388
389
|
className={linkCls}
|
|
389
390
|
>
|
|
390
391
|
{linkContent}
|