2
0
Эх сурвалжийг харах

fix sidebar location indicator on expanded objects

Justin Rhee 3 жил өмнө
parent
commit
9a31f525e6

+ 16 - 17
dashboard/src/main/home/sidebar/ClusterSection.tsx

@@ -47,7 +47,7 @@ export const ClusterSection: React.FC<Props> = ({
             targetClusterName={cluster?.name}
             targetClusterName={cluster?.name}
             active={
             active={
               currentCluster.id === clusterId &&
               currentCluster.id === clusterId &&
-              window.location.pathname === "/applications"
+              window.location.pathname.startsWith("/applications")
             }
             }
           >
           >
             <Img src={monoweb} />
             <Img src={monoweb} />
@@ -58,7 +58,7 @@ export const ClusterSection: React.FC<Props> = ({
             targetClusterName={cluster?.name}
             targetClusterName={cluster?.name}
             active={
             active={
               currentCluster.id === clusterId &&
               currentCluster.id === clusterId &&
-              window.location.pathname === "/jobs"
+              window.location.pathname.startsWith("/jobs")
             }
             }
           >
           >
             <Img src={monojob} />
             <Img src={monojob} />
@@ -69,7 +69,7 @@ export const ClusterSection: React.FC<Props> = ({
             targetClusterName={cluster?.name}
             targetClusterName={cluster?.name}
             active={
             active={
               currentCluster.id === clusterId &&
               currentCluster.id === clusterId &&
-              window.location.pathname === "/env-groups"
+              window.location.pathname.startsWith("/env-groups")
             }
             }
           >
           >
             <Img src={sliders} />
             <Img src={sliders} />
@@ -83,7 +83,7 @@ export const ClusterSection: React.FC<Props> = ({
                 targetClusterName={cluster?.name}
                 targetClusterName={cluster?.name}
                 active={
                 active={
                   currentCluster.id === clusterId &&
                   currentCluster.id === clusterId &&
-                  window.location.pathname === "/databases"
+                  window.location.pathname.startsWith("/databases")
                 }
                 }
               >
               >
                 <Icon className="material-icons-outlined">storage</Icon>
                 <Icon className="material-icons-outlined">storage</Icon>
@@ -96,7 +96,7 @@ export const ClusterSection: React.FC<Props> = ({
               targetClusterName={cluster?.name}
               targetClusterName={cluster?.name}
               active={
               active={
                 currentCluster.id === clusterId &&
                 currentCluster.id === clusterId &&
-                window.location.pathname === "/stacks"
+                window.location.pathname.startsWith("/stacks")
               }
               }
             >
             >
               <Icon className="material-icons-outlined">lan</Icon>
               <Icon className="material-icons-outlined">lan</Icon>
@@ -109,7 +109,7 @@ export const ClusterSection: React.FC<Props> = ({
               targetClusterName={cluster?.name}
               targetClusterName={cluster?.name}
               active={
               active={
                 currentCluster.id === clusterId &&
                 currentCluster.id === clusterId &&
-                window.location.pathname === "/preview-environments"
+                window.location.pathname.startsWith("/preview-environments")
               }
               }
             >
             >
               <InlineSVGWrapper
               <InlineSVGWrapper
@@ -128,7 +128,7 @@ export const ClusterSection: React.FC<Props> = ({
             targetClusterName={cluster?.name}
             targetClusterName={cluster?.name}
             active={
             active={
               currentCluster.id === clusterId &&
               currentCluster.id === clusterId &&
-              window.location.pathname === "/cluster-dashboard"
+              window.location.pathname.startsWith("/cluster-dashboard")
             }
             }
           >
           >
             <Icon className="material-icons">device_hub</Icon>
             <Icon className="material-icons">device_hub</Icon>
@@ -145,16 +145,15 @@ export const ClusterSection: React.FC<Props> = ({
         onClick={() => setIsExpanded(!isExpanded)}
         onClick={() => setIsExpanded(!isExpanded)}
         active={
         active={
           !isExpanded &&
           !isExpanded &&
-          cluster.id === currentCluster.id &&
-          [
-            "/cluster-dashboard",
-            "/preview-environments",
-            "/stacks",
-            "/databases",
-            "/env-groups",
-            "/jobs",
-            "/applications",
-          ].includes(window.location.pathname)
+          cluster.id === currentCluster.id && (
+            window.location.pathname.startsWith("/cluster-dashboard") ||
+            window.location.pathname.startsWith("/preview-environments") ||
+            window.location.pathname.startsWith("/stacks") ||
+            window.location.pathname.startsWith("/databases") ||
+            window.location.pathname.startsWith("/env-groups") ||
+            window.location.pathname.startsWith("/jobs") ||
+            window.location.pathname.startsWith("/applications")
+          )
         }
         }
       >
       >
         <LinkWrapper>
         <LinkWrapper>