@skyhook-io/radar-app 0.1.5 → 0.1.6
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.
package/package.json
CHANGED
|
@@ -120,10 +120,24 @@ export function ResourcesView({ namespaces, selectedResource, onResourceClick, o
|
|
|
120
120
|
const openLogs = useOpenLogs()
|
|
121
121
|
const openWorkloadLogs = useOpenWorkloadLogs()
|
|
122
122
|
|
|
123
|
-
// Navigation adapter
|
|
123
|
+
// Navigation adapter. k8s-ui constructs paths from `basePath` (which
|
|
124
|
+
// includes the router basename so they line up with window.location.pathname
|
|
125
|
+
// for path-equality checks) and from `window.location.pathname` directly.
|
|
126
|
+
// React Router's navigate() applies the basename itself, so handing it a
|
|
127
|
+
// path that already contains the basename double-prefixes it
|
|
128
|
+
// (e.g. /c/abc/c/abc/resources/pods). Under that URL, getViewFromPath()
|
|
129
|
+
// sees 'c' as the first segment and falls through to 'home' — which
|
|
130
|
+
// manifests as "click a resource → bounced to the home dashboard" in
|
|
131
|
+
// any host that mounts RadarApp under a non-empty basename (Radar Cloud).
|
|
132
|
+
// Strip the basename here so react-router can re-apply it cleanly.
|
|
124
133
|
const handleNavigate = useMemo(() => {
|
|
134
|
+
const base = getBasename()
|
|
125
135
|
return (path: string, options?: { replace?: boolean }) => {
|
|
126
|
-
|
|
136
|
+
let p = path
|
|
137
|
+
if (base && (p === base || p.startsWith(base + '/') || p.startsWith(base + '?'))) {
|
|
138
|
+
p = p.slice(base.length) || '/'
|
|
139
|
+
}
|
|
140
|
+
navigate(p, { replace: options?.replace })
|
|
127
141
|
}
|
|
128
142
|
}, [navigate])
|
|
129
143
|
|