@skyhook-io/radar-app 1.8.1 → 1.8.3
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 +1 -1
- package/src/App.tsx +167 -56
- package/src/RadarApp.tsx +18 -1
- package/src/api/client.ts +173 -6
- package/src/components/NamespaceSwitcher.tsx +52 -30
- package/src/components/curl/ServiceCurlButton.tsx +445 -0
- package/src/components/gitops/GitOpsView.tsx +1 -10
- package/src/components/helm/HelmReleaseDrawer.tsx +802 -44
- package/src/components/helm/HelmView.tsx +85 -16
- package/src/components/helm/ManifestDiffViewer.tsx +15 -4
- package/src/components/helm/OwnedResources.tsx +14 -50
- package/src/components/helm/RevisionHistory.tsx +50 -2
- package/src/components/helm/TrackChartSourceDialog.tsx +141 -0
- package/src/components/helm/ValuesViewer.tsx +41 -11
- package/src/components/home/TrafficSummary.tsx +2 -2
- package/src/components/home/mcpToolCatalog.ts +10 -10
- package/src/components/nav/PrimaryNavRail.tsx +1 -1
- package/src/components/portforward/PortForwardButton.tsx +69 -25
- package/src/components/portforward/PortForwardManager.tsx +18 -4
- package/src/components/resources/ResourcesView.tsx +42 -1
- package/src/components/resources/renderers/PodRenderer.tsx +7 -2
- package/src/components/resources/renderers/ServiceRenderer.tsx +54 -8
- package/src/components/ui/ShortcutHelpOverlay.tsx +1 -1
- package/src/components/ui/UpdateNotification.tsx +5 -10
- package/src/components/ui/command-items.ts +1 -1
- package/src/components/workload/WorkloadView.tsx +52 -7
- package/src/context/ConnectionContext.tsx +29 -2
- package/src/contexts/CapabilitiesContext.tsx +8 -0
- package/src/hooks/useDocumentTitle.ts +25 -0
- package/src/main.tsx +5 -3
- package/src/utils/auditBadges.ts +53 -0
- package/src/utils/navigation.ts +5 -3
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { useState, useEffect, useCallback, useMemo, useRef } from 'react'
|
|
|
2
2
|
import { flushSync } from 'react-dom'
|
|
3
3
|
import { useRefreshAnimation } from './hooks/useRefreshAnimation'
|
|
4
4
|
import { startViewTransitionSafe } from '@skyhook-io/k8s-ui/utils/view-transition'
|
|
5
|
+
import { englishPlural } from '@skyhook-io/k8s-ui/utils/pluralize'
|
|
5
6
|
import { useQueryClient } from '@tanstack/react-query'
|
|
6
7
|
import { useNavigate, useLocation, useSearchParams, useNavigationType, NavigationType } from 'react-router-dom'
|
|
7
8
|
import { HomeView } from './components/home/HomeView'
|
|
@@ -44,10 +45,12 @@ import { ShortcutHelpOverlay } from './components/ui/ShortcutHelpOverlay'
|
|
|
44
45
|
import { CommandPalette } from './components/ui/CommandPalette'
|
|
45
46
|
import { DiagnosticsOverlay } from './components/ui/DiagnosticsOverlay'
|
|
46
47
|
import { useEventSource } from './hooks/useEventSource'
|
|
47
|
-
import { debugNamespaceLog, useNamespaces, useNamespaceScope, useSetActiveNamespace, useSwitchContext, useAuthMe } from './api/client'
|
|
48
|
+
import { debugNamespaceLog, useNamespaces, useNamespaceScope, useSetActiveNamespace, useSwitchContext, useAuthMe, useAudit } from './api/client'
|
|
49
|
+
import { buildAuditSeverityMap } from './utils/auditBadges'
|
|
48
50
|
import { routePath, apiUrl, getAuthHeaders, getCredentialsMode } from './api/config'
|
|
49
51
|
import { KeyboardShortcutProvider, useRegisterShortcut, useRegisterShortcuts } from './hooks/useKeyboardShortcuts'
|
|
50
52
|
import { useAnimatedUnmount } from './hooks/useAnimatedUnmount'
|
|
53
|
+
import { useDocumentTitle } from './hooks/useDocumentTitle'
|
|
51
54
|
import radarLoadingIcon from '@skyhook-io/k8s-ui/assets/radar/radar-icon-loading.svg'
|
|
52
55
|
import { RefreshCw, Network, List, Clock, Package, Sun, Moon, Activity, Home, Star, Search, Bug, SquareTerminal, ShieldCheck, GitBranch, HelpCircle } from 'lucide-react'
|
|
53
56
|
import { useTheme } from './context/ThemeContext'
|
|
@@ -56,7 +59,7 @@ import { LargeClusterNamespacePicker } from './components/shared/LargeClusterNam
|
|
|
56
59
|
import { SettingsDialog } from './components/settings/SettingsDialog'
|
|
57
60
|
import { MyPermissionsDialog } from './components/settings/MyPermissionsDialog'
|
|
58
61
|
import type { TopologyNode, GroupingMode, MainView, SelectedResource, SelectedHelmRelease, NodeKind, TopologyMode, Topology, K8sEvent } from './types'
|
|
59
|
-
import { kindToPlural, openExternal, apiVersionToGroup, buildWorkloadPath, searchHitToSelectedResource } from './utils/navigation'
|
|
62
|
+
import { kindToPlural, pluralToKind, openExternal, apiVersionToGroup, buildWorkloadPath, searchHitToSelectedResource } from './utils/navigation'
|
|
60
63
|
import { type OmnibarHandle } from './components/ui/Omnibar'
|
|
61
64
|
import { RadarOmnibar } from './components/ui/RadarOmnibar'
|
|
62
65
|
import type { ContextSwitcherHandle } from './components/ContextSwitcher'
|
|
@@ -123,6 +126,54 @@ function getViewFromPath(pathname: string): ExtendedMainView {
|
|
|
123
126
|
return 'home'
|
|
124
127
|
}
|
|
125
128
|
|
|
129
|
+
// Browser tab label for every Radar view, derived from the route URL so it's
|
|
130
|
+
// correct regardless of which component renders it. A detail drawer that opens
|
|
131
|
+
// over a list (?resource=…) is deliberately NOT titled — it's the same page, so
|
|
132
|
+
// it keeps the list's title.
|
|
133
|
+
function radarPageTitle(pathname: string, search = '', apiResources?: { name: string; kind: string; group?: string }[]): string | null {
|
|
134
|
+
const decode = (s: string) => {
|
|
135
|
+
try {
|
|
136
|
+
return decodeURIComponent(s)
|
|
137
|
+
} catch {
|
|
138
|
+
return s
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const capitalize = (text: string) =>
|
|
142
|
+
text ? text.charAt(0).toUpperCase() + text.slice(1) : text
|
|
143
|
+
const pluralKindTitle = (kind: string, resourceName: string) =>
|
|
144
|
+
kind.toLowerCase() === resourceName.toLowerCase() ? kind : englishPlural(kind)
|
|
145
|
+
const pathSegments = pathname.replace(/^\//, '').split('/').filter(Boolean)
|
|
146
|
+
const view = getViewFromPath(pathname)
|
|
147
|
+
|
|
148
|
+
// Full-page resource detail: /workload/<kind>/<ns>/<name> (name may contain '/').
|
|
149
|
+
if (view === 'workload') return pathSegments.slice(3).map(decode).join('/') || null
|
|
150
|
+
// Resources is browsed per-kind: /resources/<kind> → "<Kind>" (e.g. ConfigMap);
|
|
151
|
+
// bare /resources (before it redirects to a default kind) → "Resources".
|
|
152
|
+
if (view === 'resources') {
|
|
153
|
+
const resourceName = decode(pathSegments[1] ?? '')
|
|
154
|
+
if (!resourceName) return 'Resources'
|
|
155
|
+
const match = apiResources?.find((r) => r.name === resourceName)
|
|
156
|
+
return pluralKindTitle(match?.kind ?? pluralToKind(resourceName), resourceName)
|
|
157
|
+
}
|
|
158
|
+
// GitOps detail is /gitops/detail/<kind>/<ns>/<name> → the resource name;
|
|
159
|
+
// anything else (the list) → "GitOps".
|
|
160
|
+
if (view === 'gitops')
|
|
161
|
+
return pathSegments[1] === 'detail' ? decode(pathSegments[4] ?? '') || 'GitOps' : 'GitOps'
|
|
162
|
+
if (view === 'applications') {
|
|
163
|
+
const appKey = new URLSearchParams(search).get('app')
|
|
164
|
+
if (!appKey) return 'Applications'
|
|
165
|
+
const decoded = decode(appKey)
|
|
166
|
+
const slash = decoded.lastIndexOf('/')
|
|
167
|
+
return slash >= 0 && slash < decoded.length - 1 ? decoded.slice(slash + 1) : decoded
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// The landing view reads "Overview" rather than "Home" in the tab.
|
|
171
|
+
if (view === 'home') return 'Overview'
|
|
172
|
+
// Every other view's label is its id capitalized — getViewFromPath has already
|
|
173
|
+
// normalized aliases (e.g. /audit → 'checks'), so no lookup table is needed.
|
|
174
|
+
return capitalize(view)
|
|
175
|
+
}
|
|
176
|
+
|
|
126
177
|
function AuthBarrier({ authMode }: { authMode: string }) {
|
|
127
178
|
useEffect(() => {
|
|
128
179
|
if (authMode === 'oidc') {
|
|
@@ -133,12 +184,12 @@ function AuthBarrier({ authMode }: { authMode: string }) {
|
|
|
133
184
|
if (authMode === 'oidc') {
|
|
134
185
|
return (
|
|
135
186
|
<div className="flex-1 relative bg-theme-base">
|
|
136
|
-
<div className="
|
|
187
|
+
<div className="absolute inset-0 pointer-events-none">
|
|
137
188
|
<img
|
|
138
189
|
src={radarLoadingIcon}
|
|
139
190
|
alt=""
|
|
140
191
|
aria-hidden
|
|
141
|
-
// Integer offset (
|
|
192
|
+
// Integer offset (50% − 22) — matches the Connecting/Opening splashes;
|
|
142
193
|
// avoids sub-pixel jitter from translate(-50%) on odd-width viewports.
|
|
143
194
|
className="absolute w-11 h-11"
|
|
144
195
|
style={{ left: 'calc(50% - 22px)', top: 'calc(50% - 22px)' }}
|
|
@@ -182,10 +233,10 @@ function AuthBarrier({ authMode }: { authMode: string }) {
|
|
|
182
233
|
// detail to list would otherwise leave the peek orphaned. Only `app` is included
|
|
183
234
|
// (not the whole query) so filter/tab/namespace churn doesn't close the peek.
|
|
184
235
|
function peekOwnerKey(pathname: string, search: string): string {
|
|
185
|
-
return `${pathname}
|
|
236
|
+
return `${pathname}\n${new URLSearchParams(search).get('app') ?? ''}`
|
|
186
237
|
}
|
|
187
238
|
|
|
188
|
-
function AppInner() {
|
|
239
|
+
function AppInner({ manageDocumentTitle = false, documentTitleSuffix }: { manageDocumentTitle?: boolean; documentTitleSuffix?: string }) {
|
|
189
240
|
const navigate = useNavigate()
|
|
190
241
|
const location = useLocation()
|
|
191
242
|
const navigationType = useNavigationType()
|
|
@@ -279,6 +330,18 @@ function AppInner() {
|
|
|
279
330
|
// Get mainView from URL path
|
|
280
331
|
const mainView = getViewFromPath(location.pathname)
|
|
281
332
|
|
|
333
|
+
// Initialize the kind→plural discovery map app-wide (not just on ResourcesView
|
|
334
|
+
// mount) so the omnibar can open a CRD hit with an irregular plural from any
|
|
335
|
+
// view — kindToPlural would otherwise English-guess the route before a
|
|
336
|
+
// resources view has run initNavigationMap().
|
|
337
|
+
const { data: navApiResources } = useAPIResources()
|
|
338
|
+
useEffect(() => { if (navApiResources) initNavigationMap(navApiResources) }, [navApiResources])
|
|
339
|
+
|
|
340
|
+
// One URL-derived tab title for every view (see radarPageTitle). Driving it
|
|
341
|
+
// from the URL — not the mounted component. Off unless the host opts in
|
|
342
|
+
// (standalone passes manageDocumentTitle), so embedders keep title ownership.
|
|
343
|
+
useDocumentTitle(manageDocumentTitle ? radarPageTitle(location.pathname, location.search, navApiResources) : null, documentTitleSuffix)
|
|
344
|
+
|
|
282
345
|
// Workload slug after `/resources/` (defaults to `pods`). Bare `/resources` redirects to `/resources/pods`.
|
|
283
346
|
const normalizedResourcesKindSlug = useMemo(() => {
|
|
284
347
|
const m = location.pathname.match(/^\/resources(?:\/([^/]+))?/)
|
|
@@ -387,15 +450,6 @@ function AppInner() {
|
|
|
387
450
|
const [showSettings, setShowSettings] = useState(false)
|
|
388
451
|
const [showMyPermissions, setShowMyPermissions] = useState(false)
|
|
389
452
|
|
|
390
|
-
// Listen for desktop "open-settings" event from native menu
|
|
391
|
-
useEffect(() => {
|
|
392
|
-
const wailsRuntime = (window as unknown as Record<string, unknown>).runtime as
|
|
393
|
-
| { EventsOn?: (event: string, callback: () => void) => () => void }
|
|
394
|
-
| undefined
|
|
395
|
-
if (!wailsRuntime?.EventsOn) return
|
|
396
|
-
return wailsRuntime.EventsOn('open-settings', () => setShowSettings(true))
|
|
397
|
-
}, [])
|
|
398
|
-
|
|
399
453
|
// Listen for "open-settings" DOM event (used by MCPSetupDialog etc.)
|
|
400
454
|
useEffect(() => {
|
|
401
455
|
const handler = () => setShowSettings(true)
|
|
@@ -535,11 +589,32 @@ function AppInner() {
|
|
|
535
589
|
navigate({ pathname: `/resources/${pluralKind}`, search: newParams.toString() })
|
|
536
590
|
}, [searchParams, navigate])
|
|
537
591
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
592
|
+
const navigateToHelmRelease = useCallback((namespace: string, name: string, storageNamespace?: string) => {
|
|
593
|
+
const newParams = new URLSearchParams()
|
|
594
|
+
const globalNamespaces = searchParams.get('namespaces')
|
|
595
|
+
if (globalNamespaces) {
|
|
596
|
+
newParams.set('namespaces', globalNamespaces)
|
|
597
|
+
}
|
|
598
|
+
newParams.set('release', `${namespace}/${name}`)
|
|
599
|
+
if (storageNamespace) {
|
|
600
|
+
newParams.set('releaseStorage', storageNamespace)
|
|
601
|
+
}
|
|
602
|
+
setSelectedHelmRelease({ namespace, name, storageNamespace })
|
|
603
|
+
if (mainView === 'helm') {
|
|
604
|
+
setSearchParams(newParams, { replace: true })
|
|
605
|
+
return
|
|
606
|
+
}
|
|
607
|
+
navigate({ pathname: '/helm', search: newParams.toString() })
|
|
608
|
+
}, [mainView, searchParams, navigate, setSearchParams])
|
|
609
|
+
|
|
610
|
+
// From the Issues queue: special controller/manager subjects route to their
|
|
611
|
+
// rich detail pages, not the generic resource drawer that's a dead-end for
|
|
612
|
+
// them. Member resources (Pods, Services, …) fall through to resources.
|
|
542
613
|
const navigateFromIssue = useCallback((resource: SelectedResource) => {
|
|
614
|
+
if (resource.kind === 'HelmRelease' && resource.group === 'helm.sh' && resource.namespace) {
|
|
615
|
+
navigateToHelmRelease(resource.namespace, resource.name)
|
|
616
|
+
return
|
|
617
|
+
}
|
|
543
618
|
const gitOpsPath = gitOpsRouteForResource({
|
|
544
619
|
apiVersion: resource.group ? `${resource.group}/v1` : 'v1',
|
|
545
620
|
kind: resource.kind,
|
|
@@ -550,7 +625,7 @@ function AppInner() {
|
|
|
550
625
|
return
|
|
551
626
|
}
|
|
552
627
|
navigateToResourceList(resource)
|
|
553
|
-
}, [navigate, navigateToResourceList])
|
|
628
|
+
}, [navigate, navigateToHelmRelease, navigateToResourceList])
|
|
554
629
|
|
|
555
630
|
// Collapse from expanded WorkloadView back to drawer
|
|
556
631
|
const handleCollapseFromExpanded = useCallback(() => {
|
|
@@ -569,12 +644,6 @@ function AppInner() {
|
|
|
569
644
|
const namespaceSwitcherRef = useRef<NamespaceSwitcherHandle>(null)
|
|
570
645
|
const omnibarRef = useRef<OmnibarHandle>(null)
|
|
571
646
|
|
|
572
|
-
// Initialize the kind→plural discovery map app-wide (not just on ResourcesView
|
|
573
|
-
// mount) so the omnibar can open a CRD hit with an irregular plural from any
|
|
574
|
-
// view — kindToPlural would otherwise English-guess the route before a
|
|
575
|
-
// resources view has run n().
|
|
576
|
-
const { data: navApiResources } = useAPIResources()
|
|
577
|
-
useEffect(() => { if (navApiResources) initNavigationMap(navApiResources) }, [navApiResources])
|
|
578
647
|
const contextSwitcherRef = useRef<ContextSwitcherHandle>(null)
|
|
579
648
|
|
|
580
649
|
// View switching keyboard shortcuts
|
|
@@ -724,6 +793,16 @@ function AppInner() {
|
|
|
724
793
|
// Connection state (for graceful startup)
|
|
725
794
|
const { connection, retry: retryConnection, isRetrying, updateFromSSE: updateConnectionFromSSE } = useConnection()
|
|
726
795
|
|
|
796
|
+
// The app's content surface is ready to show: auth resolved, not mid context-
|
|
797
|
+
// switch, and the cluster connection is live. The main content area gates on
|
|
798
|
+
// exactly this, and so do the overlay drawers — otherwise a deep-link/refresh
|
|
799
|
+
// with `?resource=`/`?release=` renders the drawer on top of the connecting/
|
|
800
|
+
// switching splash, pushing the centered loading logo off-center and showing an
|
|
801
|
+
// empty drawer over a not-yet-loaded view. Gating both on the SAME readiness so
|
|
802
|
+
// a drawer only ever sits over a real content surface.
|
|
803
|
+
const contentReady = !isSwitching && !authMePending &&
|
|
804
|
+
!(authMe?.authEnabled && !authMe?.username) && connection.state === 'connected'
|
|
805
|
+
|
|
727
806
|
// Query client for cache invalidation
|
|
728
807
|
const queryClient = useQueryClient()
|
|
729
808
|
|
|
@@ -986,12 +1065,13 @@ function AppInner() {
|
|
|
986
1065
|
// mutation immediately, which re-introduces the same race. The state→URL
|
|
987
1066
|
// effect propagates state=[] → URL on its own after onSuccess flips state.
|
|
988
1067
|
const clearAllNamespaces = useCallback(() => {
|
|
1068
|
+
if (namespaceScope?.cacheScoped) return
|
|
989
1069
|
if (namespaces.length === 0) return
|
|
990
1070
|
setActiveNamespace.mutate(
|
|
991
1071
|
{ namespaces: [] },
|
|
992
1072
|
{ onSuccess: () => setNamespaces([]) },
|
|
993
1073
|
)
|
|
994
|
-
}, [namespaces.length, setActiveNamespace])
|
|
1074
|
+
}, [namespaceScope?.cacheScoped, namespaces.length, setActiveNamespace])
|
|
995
1075
|
const initialBookmarkReconciledRef = useRef(false)
|
|
996
1076
|
const scopeActives = useMemo(() => namespaceScope?.actives ?? [], [namespaceScope?.actives])
|
|
997
1077
|
const namespaceScopeKey = useMemo(() => namespaceScope ? [...scopeActives].sort().join(',') : null, [namespaceScope, scopeActives])
|
|
@@ -1015,6 +1095,14 @@ function AppInner() {
|
|
|
1015
1095
|
if (!initialBookmarkReconciledRef.current) {
|
|
1016
1096
|
initialBookmarkReconciledRef.current = true
|
|
1017
1097
|
if (!sameAsState && sortedState.length > 0) {
|
|
1098
|
+
if (namespaceScope.cacheScoped && (!namespaceScope.namespaceRescope || sortedState.length !== 1)) {
|
|
1099
|
+
debugNamespaceLog('app:scope-mirror-cache-scope-preserve', {
|
|
1100
|
+
stateNamespaces: sortedState,
|
|
1101
|
+
scopeActives: sortedScope,
|
|
1102
|
+
})
|
|
1103
|
+
setNamespaces(scopeActives)
|
|
1104
|
+
return
|
|
1105
|
+
}
|
|
1018
1106
|
debugNamespaceLog('app:scope-mirror-bookmark-to-server', {
|
|
1019
1107
|
stateNamespaces: sortedState,
|
|
1020
1108
|
scopeActives: sortedScope,
|
|
@@ -1117,6 +1205,12 @@ function AppInner() {
|
|
|
1117
1205
|
})
|
|
1118
1206
|
|
|
1119
1207
|
if (urlNamespaces.join(',') !== namespacesKey) {
|
|
1208
|
+
if (namespaceScope?.cacheScoped && (!namespaceScope.namespaceRescope || urlNamespaces.length !== 1)) {
|
|
1209
|
+
const scopedNamespaces = namespaceScope.actives ?? []
|
|
1210
|
+
debugNamespaceLog('app:url-sync-cache-scope-preserve', { scopedNamespaces })
|
|
1211
|
+
setNamespaces(scopedNamespaces)
|
|
1212
|
+
return
|
|
1213
|
+
}
|
|
1120
1214
|
debugNamespaceLog('app:url-sync-set-namespaces', { nextNamespaces: urlNamespaces })
|
|
1121
1215
|
setNamespaces(urlNamespaces)
|
|
1122
1216
|
if (namespaceScope) {
|
|
@@ -1263,6 +1357,29 @@ function AppInner() {
|
|
|
1263
1357
|
}
|
|
1264
1358
|
}, [displayedTopology, visibleKinds, namespaces, topologyMode])
|
|
1265
1359
|
|
|
1360
|
+
// Cluster Audit findings, joined onto topology nodes by the audit key the
|
|
1361
|
+
// backend stamps on each node (data.auditKey). The graph surfaces DANGER only
|
|
1362
|
+
// (warnings would turn a dense graph into a heatmap); the node component reads
|
|
1363
|
+
// data.auditDanger. Re-runs only when findings change, and copies nodes only
|
|
1364
|
+
// when there are findings to attach — no overhead on clusters with none.
|
|
1365
|
+
const audit = useAudit(namespaces)
|
|
1366
|
+
const auditSeverityMap = useMemo(
|
|
1367
|
+
() => buildAuditSeverityMap(audit.data?.findings, audit.data?.checks),
|
|
1368
|
+
[audit.data?.findings, audit.data?.checks],
|
|
1369
|
+
)
|
|
1370
|
+
const topologyWithAudit = useMemo((): Topology | null => {
|
|
1371
|
+
if (!filteredTopology) return null
|
|
1372
|
+
if (auditSeverityMap.size === 0) return filteredTopology
|
|
1373
|
+
return {
|
|
1374
|
+
...filteredTopology,
|
|
1375
|
+
nodes: filteredTopology.nodes.map(node => {
|
|
1376
|
+
const counts = auditSeverityMap.get(node.data.auditKey as string)
|
|
1377
|
+
if (!counts) return node
|
|
1378
|
+
return { ...node, data: { ...node.data, auditDanger: counts.danger, auditWarning: counts.warning, auditMessages: counts.messages } }
|
|
1379
|
+
}),
|
|
1380
|
+
}
|
|
1381
|
+
}, [filteredTopology, auditSeverityMap])
|
|
1382
|
+
|
|
1266
1383
|
// The graph node id of the currently open resource, used to highlight it on
|
|
1267
1384
|
// the canvas. Looked up from the topology (not reconstructed) because node
|
|
1268
1385
|
// ids are `<lowercaseKind>/<ns>/<name>` with special prefixes for CRD
|
|
@@ -1410,7 +1527,7 @@ function AppInner() {
|
|
|
1410
1527
|
// the bar is full, and the view's primary home is Cloud's fleet
|
|
1411
1528
|
// rail. The view still exists and is reachable via /applications
|
|
1412
1529
|
// and the view-switching shortcuts. Same treatment as Cost below.
|
|
1413
|
-
{ view: 'traffic' as const, icon: Activity, label: 'Traffic' },
|
|
1530
|
+
{ view: 'traffic' as const, icon: Activity, label: 'Live Traffic' },
|
|
1414
1531
|
// Cost is intentionally hidden from the pill bar for now — the view still
|
|
1415
1532
|
// exists and is reachable via /cost, the Home dashboard card, and the
|
|
1416
1533
|
// command palette (⌘K). Remove this comment to restore it.
|
|
@@ -1579,20 +1696,20 @@ function AppInner() {
|
|
|
1579
1696
|
)}
|
|
1580
1697
|
|
|
1581
1698
|
{/* Connecting view — shown during initial connection or retry.
|
|
1582
|
-
Icon is
|
|
1699
|
+
Icon is pane-anchored so its screen position matches the
|
|
1583
1700
|
host hub splash across cross-document transitions. */}
|
|
1584
1701
|
{!isSwitching && !(authMe?.authEnabled && !authMe?.username) && connection.state === 'connecting' && (
|
|
1585
1702
|
<div className="flex-1 relative bg-theme-base">
|
|
1586
|
-
{/* Icon absolutely anchored to
|
|
1703
|
+
{/* Icon absolutely anchored to the pane center. The label block
|
|
1587
1704
|
sits at a fixed offset below — independent of label height
|
|
1588
1705
|
so multi-line messages (context + progress) don't shift the
|
|
1589
1706
|
icon's screen position. */}
|
|
1590
|
-
<div className="
|
|
1707
|
+
<div className="absolute inset-0 pointer-events-none">
|
|
1591
1708
|
<img
|
|
1592
1709
|
src={radarLoadingIcon}
|
|
1593
1710
|
alt=""
|
|
1594
1711
|
aria-hidden
|
|
1595
|
-
// Integer offset (
|
|
1712
|
+
// Integer offset (50% − 22) — avoids sub-pixel jitter from
|
|
1596
1713
|
// `translate(-50%, -50%)` on odd-width viewports.
|
|
1597
1714
|
className="absolute w-11 h-11"
|
|
1598
1715
|
style={{ left: 'calc(50% - 22px)', top: 'calc(50% - 22px)' }}
|
|
@@ -1620,15 +1737,15 @@ function AppInner() {
|
|
|
1620
1737
|
</div>
|
|
1621
1738
|
)}
|
|
1622
1739
|
|
|
1623
|
-
{/* Context switching overlay — icon
|
|
1740
|
+
{/* Context switching overlay — icon pane-anchored, label below. */}
|
|
1624
1741
|
{isSwitching && (
|
|
1625
1742
|
<div className="flex-1 relative bg-theme-base">
|
|
1626
|
-
<div className="
|
|
1743
|
+
<div className="absolute inset-0 pointer-events-none">
|
|
1627
1744
|
<img
|
|
1628
1745
|
src={radarLoadingIcon}
|
|
1629
1746
|
alt=""
|
|
1630
1747
|
aria-hidden
|
|
1631
|
-
// Integer offset (
|
|
1748
|
+
// Integer offset (50% − 22) — avoids sub-pixel jitter from
|
|
1632
1749
|
// `translate(-50%, -50%)` on odd-width viewports.
|
|
1633
1750
|
className="absolute w-11 h-11"
|
|
1634
1751
|
style={{ left: 'calc(50% - 22px)', top: 'calc(50% - 22px)' }}
|
|
@@ -1674,7 +1791,7 @@ function AppInner() {
|
|
|
1674
1791
|
)}
|
|
1675
1792
|
|
|
1676
1793
|
{/* Main content - only show when connected and authenticated */}
|
|
1677
|
-
{
|
|
1794
|
+
{contentReady && <div className="flex-1 flex overflow-hidden">
|
|
1678
1795
|
<ErrorBoundary>
|
|
1679
1796
|
{/* Home dashboard */}
|
|
1680
1797
|
{mainView === 'home' && (
|
|
@@ -1773,7 +1890,7 @@ function AppInner() {
|
|
|
1773
1890
|
|
|
1774
1891
|
<div className="flex-1 relative">
|
|
1775
1892
|
<TopologyGraph
|
|
1776
|
-
topology={
|
|
1893
|
+
topology={topologyWithAudit}
|
|
1777
1894
|
viewMode={topologyMode}
|
|
1778
1895
|
groupingMode={effectiveGroupingMode}
|
|
1779
1896
|
hideGroupHeader={hideGroupHeader}
|
|
@@ -1793,7 +1910,7 @@ function AppInner() {
|
|
|
1793
1910
|
<TopologySearch
|
|
1794
1911
|
nodes={filteredTopology?.nodes ?? []}
|
|
1795
1912
|
allNodes={topology?.nodes}
|
|
1796
|
-
viewModeLabel={topologyMode === 'fleet' ? 'Fleet' : topologyMode === 'traffic' ? '
|
|
1913
|
+
viewModeLabel={topologyMode === 'fleet' ? 'Fleet' : topologyMode === 'traffic' ? 'Network Flow' : 'Resources'}
|
|
1797
1914
|
onNodeSelect={handleNodeClick}
|
|
1798
1915
|
onZoomToNode={(id) => setTopologyFocus((prev) => ({ id, nonce: (prev?.nonce ?? 0) + 1 }))}
|
|
1799
1916
|
// Stack below the namespace breadcrumb (shown only for a single
|
|
@@ -1815,6 +1932,7 @@ function AppInner() {
|
|
|
1815
1932
|
showPolicyEffect={showPolicyEffect}
|
|
1816
1933
|
onShowPolicyEffectChange={setShowPolicyEffect}
|
|
1817
1934
|
showFleetMode={displayedTopology?.nodes?.some(n => FLEET_MODE_KINDS.has(n.kind as NodeKind)) ?? false}
|
|
1935
|
+
onNavigateToTraffic={() => setMainView('traffic')}
|
|
1818
1936
|
/>
|
|
1819
1937
|
</div>
|
|
1820
1938
|
</>
|
|
@@ -1857,17 +1975,7 @@ function AppInner() {
|
|
|
1857
1975
|
<HelmView
|
|
1858
1976
|
namespaces={namespaces}
|
|
1859
1977
|
selectedRelease={selectedHelmRelease}
|
|
1860
|
-
onReleaseClick={
|
|
1861
|
-
setSelectedHelmRelease({ namespace: ns, name, storageNamespace })
|
|
1862
|
-
const params = new URLSearchParams(window.location.search)
|
|
1863
|
-
params.set('release', `${ns}/${name}`)
|
|
1864
|
-
if (storageNamespace) {
|
|
1865
|
-
params.set('releaseStorage', storageNamespace)
|
|
1866
|
-
} else {
|
|
1867
|
-
params.delete('releaseStorage')
|
|
1868
|
-
}
|
|
1869
|
-
setSearchParams(params, { replace: true })
|
|
1870
|
-
}}
|
|
1978
|
+
onReleaseClick={navigateToHelmRelease}
|
|
1871
1979
|
/>
|
|
1872
1980
|
)}
|
|
1873
1981
|
|
|
@@ -1925,7 +2033,7 @@ function AppInner() {
|
|
|
1925
2033
|
<div className="flex-1 relative bg-theme-base">
|
|
1926
2034
|
{/* Viewport-anchored, 17px — identical to the "Connecting" splash so
|
|
1927
2035
|
the mark doesn't move or resize across the takeover hand-off. */}
|
|
1928
|
-
<div className="
|
|
2036
|
+
<div className="absolute inset-0 pointer-events-none">
|
|
1929
2037
|
<img
|
|
1930
2038
|
src={radarLoadingIcon}
|
|
1931
2039
|
alt=""
|
|
@@ -1981,8 +2089,10 @@ function AppInner() {
|
|
|
1981
2089
|
</ErrorBoundary>
|
|
1982
2090
|
</div>}
|
|
1983
2091
|
|
|
1984
|
-
{/* Resource detail drawer — stays mounted, expands to full-screen WorkloadView
|
|
1985
|
-
|
|
2092
|
+
{/* Resource detail drawer — stays mounted, expands to full-screen WorkloadView.
|
|
2093
|
+
Gated on contentReady so it never renders over the connecting/switching
|
|
2094
|
+
splash (which would push the centered logo off-center). */}
|
|
2095
|
+
{contentReady && resourceDrawer.shouldRender && drawerResource && (
|
|
1986
2096
|
<ResourceDetailDrawer
|
|
1987
2097
|
resource={drawerResource}
|
|
1988
2098
|
initialTab={drawerInitialTab}
|
|
@@ -2006,8 +2116,8 @@ function AppInner() {
|
|
|
2006
2116
|
/>
|
|
2007
2117
|
)}
|
|
2008
2118
|
|
|
2009
|
-
{/* Helm release drawer */}
|
|
2010
|
-
{helmDrawer.shouldRender && drawerHelmRelease && (
|
|
2119
|
+
{/* Helm release drawer — same contentReady gate as the resource drawer. */}
|
|
2120
|
+
{contentReady && helmDrawer.shouldRender && drawerHelmRelease && (
|
|
2011
2121
|
<HelmReleaseDrawer
|
|
2012
2122
|
release={drawerHelmRelease}
|
|
2013
2123
|
isOpen={helmDrawer.isOpen}
|
|
@@ -2080,6 +2190,7 @@ function AppInner() {
|
|
|
2080
2190
|
{ onSettled: () => setNamespaces([]) },
|
|
2081
2191
|
)}
|
|
2082
2192
|
onSetNamespaces={(ns) => {
|
|
2193
|
+
if (namespaceScope?.cacheScoped && ns.length !== 1) return
|
|
2083
2194
|
setNamespaces(ns)
|
|
2084
2195
|
setActiveNamespace.mutate({ namespaces: ns })
|
|
2085
2196
|
}}
|
|
@@ -2153,14 +2264,14 @@ function FloatingButtons({ showHelp, showCommandPalette, showDiagnostics, onHelp
|
|
|
2153
2264
|
}
|
|
2154
2265
|
|
|
2155
2266
|
// Main App component wrapped with providers
|
|
2156
|
-
function App() {
|
|
2267
|
+
function App({ manageDocumentTitle = false, documentTitleSuffix }: { manageDocumentTitle?: boolean; documentTitleSuffix?: string }) {
|
|
2157
2268
|
return (
|
|
2158
2269
|
<ConnectionProvider>
|
|
2159
2270
|
<CapabilitiesProvider>
|
|
2160
2271
|
<ContextSwitchProvider>
|
|
2161
2272
|
<DockProvider>
|
|
2162
2273
|
<KeyboardShortcutProvider>
|
|
2163
|
-
<AppInner />
|
|
2274
|
+
<AppInner manageDocumentTitle={manageDocumentTitle} documentTitleSuffix={documentTitleSuffix} />
|
|
2164
2275
|
</KeyboardShortcutProvider>
|
|
2165
2276
|
</DockProvider>
|
|
2166
2277
|
</ContextSwitchProvider>
|
package/src/RadarApp.tsx
CHANGED
|
@@ -70,6 +70,21 @@ export interface RadarAppProps {
|
|
|
70
70
|
* See ./context/NavCustomization for the slot shape.
|
|
71
71
|
*/
|
|
72
72
|
navSlots?: NavCustomization;
|
|
73
|
+
/**
|
|
74
|
+
* Whether Radar may set the browser tab title (`document.title`) per view.
|
|
75
|
+
* Defaults to OFF: embedders keep title ownership without opting out. The
|
|
76
|
+
* standalone binary opts in (`web/src/main.tsx` renders
|
|
77
|
+
* `<RadarApp manageDocumentTitle />`), and any full-page embed that wants
|
|
78
|
+
* Radar's per-view titles can do the same.
|
|
79
|
+
*/
|
|
80
|
+
manageDocumentTitle?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Trailing string appended after the per-view label (only when
|
|
83
|
+
* `manageDocumentTitle` is on). It's the *full* suffix including any
|
|
84
|
+
* separator, so a host can rebrand (`' — My Cloud'`) or drop it (`''`).
|
|
85
|
+
* Defaults to `' · Radar'`.
|
|
86
|
+
*/
|
|
87
|
+
documentTitleSuffix?: string;
|
|
73
88
|
/**
|
|
74
89
|
* Initial route for `router: 'memory'` (ignored for 'browser'). Lets a host
|
|
75
90
|
* deep-link a specific view (e.g. '/topology') without owning the URL bar —
|
|
@@ -116,6 +131,8 @@ export function RadarApp({
|
|
|
116
131
|
router = 'browser',
|
|
117
132
|
queryClient,
|
|
118
133
|
navSlots,
|
|
134
|
+
manageDocumentTitle = false,
|
|
135
|
+
documentTitleSuffix,
|
|
119
136
|
initialPath,
|
|
120
137
|
}: RadarAppProps): React.ReactElement {
|
|
121
138
|
// Apply runtime config during render so module-level singletons are set
|
|
@@ -136,7 +153,7 @@ export function RadarApp({
|
|
|
136
153
|
<QueryClientProvider client={client}>
|
|
137
154
|
<ToastProvider>
|
|
138
155
|
<NavCustomizationProvider value={navSlots}>
|
|
139
|
-
<App />
|
|
156
|
+
<App manageDocumentTitle={manageDocumentTitle} documentTitleSuffix={documentTitleSuffix} />
|
|
140
157
|
</NavCustomizationProvider>
|
|
141
158
|
</ToastProvider>
|
|
142
159
|
</QueryClientProvider>
|