@skyhook-io/radar-app 1.22.1 → 1.22.2
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 +96 -28
- package/src/RadarApp.tsx +5 -0
- package/src/api/client.ts +6 -1
- package/src/api/workloadSource.test.tsx +857 -0
- package/src/api/workloadSource.ts +292 -0
- package/src/components/APIUnreachableBanner.test.tsx +19 -0
- package/src/components/APIUnreachableBanner.tsx +20 -0
- package/src/components/ConnectionErrorView.test.tsx +63 -2
- package/src/components/ConnectionErrorView.tsx +88 -68
- package/src/components/diagnose/ActivityTurn.tsx +6 -4
- package/src/components/diagnose/AssessmentCard.tsx +1 -2
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +7 -0
- package/src/components/diagnose/Home.test.tsx +6 -0
- package/src/components/diagnose/Home.tsx +10 -3
- package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +1 -1
- package/src/components/diagnose/InvestigationEvidencePane.tsx +19 -2
- package/src/components/diagnose/InvestigationFindingsFooter.test.tsx +413 -0
- package/src/components/diagnose/InvestigationView.tsx +120 -23
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +1 -1
- package/src/components/diagnose/investigationState.ts +9 -0
- package/src/components/diagnose/parts.test.tsx +11 -3
- package/src/components/diagnose/toolCallLabel.ts +3 -0
- package/src/components/home/ActivitySummary.tsx +3 -8
- package/src/components/home/ClusterHealthCard.tsx +91 -17
- package/src/components/home/ClusterHealthCard.utilization.test.tsx +187 -0
- package/src/components/home/HomeView.tsx +6 -26
- package/src/components/home/TopologyPreview.test.tsx +31 -30
- package/src/components/home/TopologyPreview.tsx +19 -28
- package/src/components/home/mcpToolCatalog.ts +3 -3
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +5 -4
- package/src/components/resources/renderers/RolloutRenderer.tsx +4 -1
- package/src/components/resources/renderers/WorkloadRenderer.tsx +4 -1
- package/src/components/workload/WorkloadView.tsx +67 -1
- package/src/components/workload/WorkloadView.workloadSource.test.tsx +121 -0
- package/src/context/ConnectionContext.tsx +24 -5
- package/src/context/ConnectionProvider.connectionId.test.tsx +14 -0
- package/src/context/ConnectionProvider.handover.test.tsx +94 -0
- package/src/context/DiagnoseCustomization.tsx +20 -2
- package/src/hooks/useEventSource.test.tsx +275 -4
- package/src/hooks/useEventSource.ts +278 -51
- package/src/index.ts +1 -0
- package/src/utils/navigation.test.ts +1 -6
- package/src/utils/navigation.ts +9 -44
- package/src/utils/network-policy-navigation.test.ts +21 -36
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import { connectionHeaderValue } from './api/connectionBinding'
|
|
|
13
13
|
import { ContextSwitchActions } from './components/ContextSwitchActions'
|
|
14
14
|
import { investigationWorkspaceSearch, isInvestigationWorkspacePath, useDiagnoseLayout } from './components/diagnose/DiagnoseContext'
|
|
15
15
|
import { DiagnoseSurface } from './components/diagnose/DiagnoseSurface'
|
|
16
|
-
import { type IssueTimelineEventTarget, TopologyGraph, TopologySearch, TopologyBreadcrumb, TopologyFilterSidebar, TopologyControls, FreshnessControl, gitOpsRouteForKind, gitOpsRouteForResource, ScopePill, PaneLoader, usePhoneLayout, PHONE_MEDIA_QUERY } from '@skyhook-io/k8s-ui'
|
|
16
|
+
import { type IssueTimelineEventTarget, TopologyGraph, TopologySearch, TopologyBreadcrumb, TopologyFilterSidebar, TopologyControls, FreshnessControl, gitOpsRouteForKind, gitOpsRouteForResource, ScopePill, PaneLoader, usePhoneLayout, PHONE_MEDIA_QUERY, passesKindFilter, isStandaloneReplicaSet } from '@skyhook-io/k8s-ui'
|
|
17
17
|
import { resetNavigationMap } from '@skyhook-io/k8s-ui/utils/navigation'
|
|
18
18
|
import { topologyNodeResourceKind } from '@skyhook-io/k8s-ui/utils/topology-neighborhood'
|
|
19
19
|
import { useAPIResources, findAPIResourceForRoute } from './api/apiResources'
|
|
@@ -57,6 +57,7 @@ import { ConnectionProvider, useConnection, refreshQueriesAfterReconnect } from
|
|
|
57
57
|
import { DisconnectedView, FailedSwitchView } from './components/SwitchAwareConnectionError'
|
|
58
58
|
import { SyncProgressPanel } from './components/SyncProgressPanel'
|
|
59
59
|
import { NoClusterAccessBanner } from './components/NoClusterAccessBanner'
|
|
60
|
+
import { APIUnreachableBanner } from './components/APIUnreachableBanner'
|
|
60
61
|
import { CapabilitiesProvider, useCapabilitiesContext } from './contexts/CapabilitiesContext'
|
|
61
62
|
import { RadarUpgradeProvider } from './context/RadarUpgrade'
|
|
62
63
|
import { UserMenu } from './components/UserMenu'
|
|
@@ -74,6 +75,7 @@ import { DiagnosticsOverlay, type DiagnosticsFocus } from './components/ui/Diagn
|
|
|
74
75
|
import { useEventSource } from './hooks/useEventSource'
|
|
75
76
|
import { useResetViewsOnContextChange } from './hooks/useResetViewsOnContextChange'
|
|
76
77
|
import { debugNamespaceLog, refetchOnResourceEvents, resourceEventKey, useNamespaces, useNamespaceScope, useSetActiveNamespace, isAppliedNamespaceSwitch, useAuthMe, useAuditBadges, useClusterInfo, useCapabilities } from './api/client'
|
|
78
|
+
import { createWorkloadSourceInvalidator, type WorkloadSourceInvalidator } from './api/workloadSource'
|
|
77
79
|
import { buildAuditSeverityMap } from './utils/auditBadges'
|
|
78
80
|
import { isInNamespaceScope, scopeNodesToNamespaces } from './utils/topology-namespace'
|
|
79
81
|
import { routePath, apiUrl, getApiBase, getAuthHeaders, getCredentialsMode, stripBasename } from './api/config'
|
|
@@ -148,7 +150,7 @@ type ExtendedMainView = MainView | 'traffic' | 'cost' | 'capacity' | 'cnpg' | 'v
|
|
|
148
150
|
// Views that have been laid out for phone width (640px and below). The rest
|
|
149
151
|
// keep their desktop width on a phone and scroll sideways; add a view here in
|
|
150
152
|
// the PR that gives it a phone layout.
|
|
151
|
-
const PHONE_READY_VIEWS: ReadonlySet<ExtendedMainView> = new Set<ExtendedMainView>(['issues', 'resources', 'helm', 'home', 'topology', 'capacity'])
|
|
153
|
+
const PHONE_READY_VIEWS: ReadonlySet<ExtendedMainView> = new Set<ExtendedMainView>(['issues', 'resources', 'helm', 'home', 'topology', 'capacity', 'investigations'])
|
|
152
154
|
|
|
153
155
|
// Extract view from URL path
|
|
154
156
|
function getViewFromPath(pathname: string): ExtendedMainView {
|
|
@@ -383,6 +385,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
383
385
|
dismissForNavigation: dismissDiagnoseForNavigation,
|
|
384
386
|
contentGutter,
|
|
385
387
|
maximized: diagnoseMaximized,
|
|
388
|
+
fullWidthForced: diagnoseFillsViewport,
|
|
386
389
|
} = useDiagnoseLayout()
|
|
387
390
|
// Hand off to a host-owned URL. The host's `onHostNavigate` (Radar Cloud's
|
|
388
391
|
// cross-tree swap) navigates same-document so the chrome morphs instead of
|
|
@@ -637,6 +640,10 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
637
640
|
const [showPolicyEffect, setShowPolicyEffect] = useState(false)
|
|
638
641
|
// Topology filter state
|
|
639
642
|
const [visibleKinds, setVisibleKinds] = useState<Set<NodeKind>>(() => new Set(DEFAULT_VISIBLE_KINDS))
|
|
643
|
+
// Whether the user has chosen for ReplicaSets (their toggle, Show all, Hide
|
|
644
|
+
// all). Until then the kind stays off, hiding the ReplicaSets that collapse
|
|
645
|
+
// into a Deployment or Rollout, but standalone ones show.
|
|
646
|
+
const [replicaSetsChosen, setReplicaSetsChosen] = useState(false)
|
|
640
647
|
// Phones start with the filters collapsed to their icon rail: expanded, the
|
|
641
648
|
// panel took two thirds of the width from the graph.
|
|
642
649
|
const [filterSidebarCollapsed, setFilterSidebarCollapsed] = useState(
|
|
@@ -717,6 +724,11 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
717
724
|
// Views with a deliberate phone layout. On a phone every other view keeps
|
|
718
725
|
// its desktop width and scrolls sideways rather than squeezing.
|
|
719
726
|
const phoneScroll = isMobile && !PHONE_READY_VIEWS.has(mainView)
|
|
727
|
+
// Investigations own their responsive panes. A narrow embedded window can
|
|
728
|
+
// have a fine pointer (or a tablet keyboard); the host width is the boundary.
|
|
729
|
+
const investigationFillsHost = embedded && (
|
|
730
|
+
mainView === 'investigations' || (diagnoseOpen && (diagnoseMaximized || diagnoseFillsViewport))
|
|
731
|
+
)
|
|
720
732
|
|
|
721
733
|
// On a history Pop (back/forward) the URL is authoritative. The URL-write
|
|
722
734
|
// effect, running with not-yet-synced state, would otherwise write the stale
|
|
@@ -1175,6 +1187,10 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1175
1187
|
timer: number | null
|
|
1176
1188
|
}>({ updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null })
|
|
1177
1189
|
const timelineInvalidationRef = useRef<{ timer: number | null }>({ timer: null })
|
|
1190
|
+
const workloadSourceInvalidatorRef = useRef<WorkloadSourceInvalidator | null>(null)
|
|
1191
|
+
if (!workloadSourceInvalidatorRef.current) {
|
|
1192
|
+
workloadSourceInvalidatorRef.current = createWorkloadSourceInvalidator()
|
|
1193
|
+
}
|
|
1178
1194
|
|
|
1179
1195
|
const handleK8sEvent = useCallback((event: K8sEvent) => {
|
|
1180
1196
|
// The timeline consumes every frame — including the K8s Event kind the
|
|
@@ -1197,6 +1213,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1197
1213
|
// Skip K8s Event kind — informational, not resource mutations
|
|
1198
1214
|
if (event.kind === 'Event') return
|
|
1199
1215
|
|
|
1216
|
+
workloadSourceInvalidatorRef.current?.handleEvent(queryClient, event)
|
|
1217
|
+
|
|
1200
1218
|
const kind = kindToPluralWithGroup(event.kind, event.group ?? '')
|
|
1201
1219
|
const structural = event.operation === 'add' || event.operation === 'delete'
|
|
1202
1220
|
const applicationWorkload = ['deployments', 'statefulsets', 'daemonsets', 'rollouts'].includes(kind)
|
|
@@ -1310,6 +1328,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1310
1328
|
fastInvalidationRef.current = { changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null }
|
|
1311
1329
|
slowInvalidationRef.current = { updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null }
|
|
1312
1330
|
timelineInvalidationRef.current = { timer: null }
|
|
1331
|
+
workloadSourceInvalidatorRef.current?.reset()
|
|
1313
1332
|
}, [])
|
|
1314
1333
|
|
|
1315
1334
|
// SSE connection for real-time updates — no namespace filter for small/medium clusters (frontend filters).
|
|
@@ -1318,7 +1337,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1318
1337
|
const sseMode = topologyMode === 'fleet' ? 'resources' : topologyMode
|
|
1319
1338
|
// The context this tab's views were last reset for.
|
|
1320
1339
|
const shownContextRef = useRef<string | null>(null)
|
|
1321
|
-
const { topology, connected: eventStreamConnected, connecting: eventStreamConnecting, reconnect: reconnectEventStream, applyContextChange } = useEventSource(namespaces, sseMode as 'resources' | 'traffic', {
|
|
1340
|
+
const { topology, topologyStatus, connected: eventStreamConnected, connecting: eventStreamConnecting, reconnect: reconnectEventStream, applyContextChange } = useEventSource(namespaces, sseMode as 'resources' | 'traffic', {
|
|
1322
1341
|
onContextSwitchComplete: endSwitch,
|
|
1323
1342
|
onContextSwitchProgress: updateProgress,
|
|
1324
1343
|
onContextChanged: (context) => {
|
|
@@ -1335,6 +1354,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1335
1354
|
fastInvalidationRef.current = { changedKinds: new Set(), changedObjects: new Set(), structuralKinds: new Set(), environmentNamespaces: new Set(), environmentPods: new Map(), secretsChanged: false, timer: null }
|
|
1336
1355
|
slowInvalidationRef.current = { updatedKinds: new Set(), gitopsRowsChanged: false, gitopsCountsChanged: false, timer: null }
|
|
1337
1356
|
timelineInvalidationRef.current = { timer: null }
|
|
1357
|
+
workloadSourceInvalidatorRef.current?.reset()
|
|
1338
1358
|
|
|
1339
1359
|
// Close any open drawers/overlays — old cluster's resources don't exist on the new one
|
|
1340
1360
|
// (?full=1 is cleared by the URL reset below).
|
|
@@ -1380,11 +1400,13 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1380
1400
|
onConnectionStateChange: updateConnectionFromSSE,
|
|
1381
1401
|
onDeferredReady: () => {
|
|
1382
1402
|
// Deferred informers (secrets, events, configmaps, etc.) have finished syncing.
|
|
1383
|
-
// Refetch dashboard so counts, warning events, and cert health fill in
|
|
1403
|
+
// Refetch dashboard so counts, warning events, and cert health fill in, and
|
|
1404
|
+
// fetched graphs, which only the Topology screen gets streamed.
|
|
1384
1405
|
queryClient.invalidateQueries({ queryKey: ['dashboard'] })
|
|
1406
|
+
queryClient.invalidateQueries({ queryKey: ['topology'] })
|
|
1385
1407
|
},
|
|
1386
1408
|
onK8sEvent: handleK8sEvent,
|
|
1387
|
-
}, forceNamespaceFilter, showPolicyEffect)
|
|
1409
|
+
}, forceNamespaceFilter, showPolicyEffect, mainView === 'topology')
|
|
1388
1410
|
|
|
1389
1411
|
useContextSwitchOutcome(applyContextChange)
|
|
1390
1412
|
useResetViewsOnContextChange(connection.state, connection.context, shownContextRef, applyContextChange)
|
|
@@ -1395,7 +1417,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1395
1417
|
// to a stale namespace while sidebar/topology show a different one. Small
|
|
1396
1418
|
// clusters never set forceNamespaceFilter and skip this path entirely.
|
|
1397
1419
|
useEffect(() => {
|
|
1398
|
-
const isLarge = forceNamespaceFilter !== undefined ||
|
|
1420
|
+
const isLarge = forceNamespaceFilter !== undefined || topologyStatus?.requiresNamespaceFilter === true
|
|
1399
1421
|
if (!isLarge) return
|
|
1400
1422
|
if (namespaces.length === 0) {
|
|
1401
1423
|
setForceNamespaceFilter(prev => (prev === undefined ? prev : undefined))
|
|
@@ -1407,14 +1429,15 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1407
1429
|
if (cur.length === next.length && cur.every((ns, i) => ns === next[i])) return prev
|
|
1408
1430
|
return [...namespaces]
|
|
1409
1431
|
})
|
|
1410
|
-
}, [namespaces, forceNamespaceFilter,
|
|
1432
|
+
}, [namespaces, forceNamespaceFilter, topologyStatus?.requiresNamespaceFilter])
|
|
1411
1433
|
|
|
1412
1434
|
// Apply live topology updates only when not paused. While paused, buffer the
|
|
1413
|
-
// latest snapshot so we can apply it instantly when the user resumes.
|
|
1435
|
+
// latest snapshot so we can apply it instantly when the user resumes. Leaving
|
|
1436
|
+
// the Topology screen clears the stream's graph; a paused one keeps its buffer.
|
|
1414
1437
|
useEffect(() => {
|
|
1415
1438
|
if (!topologyPaused) {
|
|
1416
1439
|
setDisplayedTopology(topology)
|
|
1417
|
-
} else {
|
|
1440
|
+
} else if (topology) {
|
|
1418
1441
|
pendingTopologyRef.current = topology
|
|
1419
1442
|
}
|
|
1420
1443
|
}, [topology, topologyPaused])
|
|
@@ -1430,9 +1453,20 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1430
1453
|
})
|
|
1431
1454
|
}, [])
|
|
1432
1455
|
|
|
1433
|
-
//
|
|
1434
|
-
//
|
|
1435
|
-
const crdDiscoveryStatus =
|
|
1456
|
+
// CRD discovery status arrives with every topology cycle, as topology_status
|
|
1457
|
+
// on screens that don't draw the graph.
|
|
1458
|
+
const crdDiscoveryStatus = topologyStatus?.crdDiscoveryStatus
|
|
1459
|
+
// Finished discovery adds custom resources to fetched graphs (Timeline,
|
|
1460
|
+
// Applications, a workload's page); only the Topology screen gets its graph
|
|
1461
|
+
// pushed.
|
|
1462
|
+
const previousDiscoveryRef = useRef(crdDiscoveryStatus)
|
|
1463
|
+
useEffect(() => {
|
|
1464
|
+
// Starting discovery isn't broadcast, so a tab may see idle go straight to ready.
|
|
1465
|
+
if ((previousDiscoveryRef.current === 'idle' || previousDiscoveryRef.current === 'discovering') && crdDiscoveryStatus === 'ready') {
|
|
1466
|
+
queryClient.invalidateQueries({ queryKey: ['topology'] })
|
|
1467
|
+
}
|
|
1468
|
+
previousDiscoveryRef.current = crdDiscoveryStatus
|
|
1469
|
+
}, [crdDiscoveryStatus, queryClient])
|
|
1436
1470
|
const clusterConnectionState = connection.state
|
|
1437
1471
|
const clusterConnected = clusterConnectionState === 'connected'
|
|
1438
1472
|
const liveUpdatesDisconnected = clusterConnected && !eventStreamConnected && !eventStreamConnecting
|
|
@@ -1442,9 +1476,11 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1442
1476
|
const syncProgressLabel = connection.syncStatus
|
|
1443
1477
|
? `Loading cluster data — ${connection.syncStatus.criticalSynced + connection.syncStatus.deferredSynced} of ${connection.syncStatus.criticalTotal + connection.syncStatus.deferredTotal} ready`
|
|
1444
1478
|
: 'Connecting'
|
|
1479
|
+
const apiUnreachable = clusterConnected && Boolean(connection.apiUnreachableSince)
|
|
1445
1480
|
const headerConnectionLabel =
|
|
1446
1481
|
clusterConnectionState === 'disconnected' ? 'Disconnected' :
|
|
1447
1482
|
clusterConnectionState === 'connecting' ? syncProgressLabel :
|
|
1483
|
+
apiUnreachable ? "Can't reach the API server" :
|
|
1448
1484
|
liveUpdatesDisconnected ? 'Live updates disconnected' :
|
|
1449
1485
|
clusterLoadState.loading ? `Connected — ${clusterLoadState.message}` :
|
|
1450
1486
|
crdDiscoveryStatus === 'discovering' ? 'Connected — discovering Custom Resources...' :
|
|
@@ -1452,6 +1488,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1452
1488
|
const headerConnectionDisplayLabel =
|
|
1453
1489
|
clusterConnectionState === 'disconnected' ? 'Disconnected' :
|
|
1454
1490
|
clusterConnectionState === 'connecting' ? syncProgressLabel :
|
|
1491
|
+
apiUnreachable ? 'API server unreachable' :
|
|
1455
1492
|
liveUpdatesDisconnected ? 'Live updates disconnected' :
|
|
1456
1493
|
showClusterWarmupLabel ? clusterLoadState.message :
|
|
1457
1494
|
crdDiscoveryStatus === 'discovering' ? 'Discovering Custom Resources…' :
|
|
@@ -1826,7 +1863,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1826
1863
|
// Filter by namespace (client-side) and by visible kinds
|
|
1827
1864
|
const nsSet = namespaces.length > 0 ? new Set(namespaces) : null
|
|
1828
1865
|
const filteredNodes = displayedTopology.nodes.filter(node =>
|
|
1829
|
-
effectiveKinds.has(node.kind) && isInNamespaceScope(node, nsSet)
|
|
1866
|
+
(topologyMode === 'fleet' ? effectiveKinds.has(node.kind) : passesKindFilter(node, effectiveKinds, !replicaSetsChosen)) && isInNamespaceScope(node, nsSet)
|
|
1830
1867
|
)
|
|
1831
1868
|
const filteredNodeIds = new Set(filteredNodes.map(n => n.id))
|
|
1832
1869
|
|
|
@@ -1849,7 +1886,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1849
1886
|
nodes: filteredNodes,
|
|
1850
1887
|
edges: filteredEdges,
|
|
1851
1888
|
}
|
|
1852
|
-
}, [displayedTopology, visibleKinds, namespaces, topologyMode])
|
|
1889
|
+
}, [displayedTopology, visibleKinds, namespaces, topologyMode, replicaSetsChosen])
|
|
1853
1890
|
|
|
1854
1891
|
// Namespace-scoped but NOT kind-filtered: the sidebar derives its kind list
|
|
1855
1892
|
// and visible/hidden footer counts from this prop, so handing it the
|
|
@@ -1861,6 +1898,21 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1861
1898
|
return scopeNodesToNamespaces(displayedTopology.nodes, namespaces)
|
|
1862
1899
|
}, [displayedTopology, namespaces])
|
|
1863
1900
|
|
|
1901
|
+
// ReplicaSets are on screen when the kind is on, or by default when some
|
|
1902
|
+
// are standalone. The sidebar's toggle shows that: it reads "on" when every
|
|
1903
|
+
// ReplicaSet in view is standalone and so shown, keeping Show all available
|
|
1904
|
+
// while any other ReplicaSet (a Rollout's during a transition) is hidden.
|
|
1905
|
+
const replicaSetsShown = useMemo(() => {
|
|
1906
|
+
if (visibleKinds.has('ReplicaSet')) return true
|
|
1907
|
+
if (replicaSetsChosen || topologyMode === 'fleet') return false
|
|
1908
|
+
const inView = filterSidebarNodes.filter(n => n.kind === 'ReplicaSet')
|
|
1909
|
+
return inView.length > 0 && inView.every(isStandaloneReplicaSet)
|
|
1910
|
+
}, [visibleKinds, replicaSetsChosen, topologyMode, filterSidebarNodes])
|
|
1911
|
+
const sidebarKinds = useMemo(
|
|
1912
|
+
() => (replicaSetsShown && !visibleKinds.has('ReplicaSet') ? new Set<NodeKind>([...visibleKinds, 'ReplicaSet']) : visibleKinds),
|
|
1913
|
+
[replicaSetsShown, visibleKinds],
|
|
1914
|
+
)
|
|
1915
|
+
|
|
1864
1916
|
// Cluster Audit findings, joined onto topology nodes by the audit key the
|
|
1865
1917
|
// backend stamps on each node (data.auditKey). Only badge-worthy findings
|
|
1866
1918
|
// reach the graph; the raw auditDanger/auditWarning property names remain at
|
|
@@ -1892,12 +1944,24 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1892
1944
|
// collisions — rebuilding the string can't match those reliably.
|
|
1893
1945
|
const selectedNodeId = useMemo(() => {
|
|
1894
1946
|
if (!selectedResource) return undefined
|
|
1895
|
-
const match = findSelectedTopologyNode(
|
|
1947
|
+
const match = findSelectedTopologyNode(displayedTopology, selectedResource)
|
|
1896
1948
|
return match?.id
|
|
1897
|
-
}, [selectedResource,
|
|
1949
|
+
}, [selectedResource, displayedTopology])
|
|
1898
1950
|
|
|
1899
1951
|
// Filter handlers
|
|
1900
1952
|
const handleToggleKind = useCallback((kind: NodeKind) => {
|
|
1953
|
+
if (kind === 'ReplicaSet') {
|
|
1954
|
+
// The toggle shows what's on screen: on while standalone ReplicaSets
|
|
1955
|
+
// show by default, so the first click hides them.
|
|
1956
|
+
setReplicaSetsChosen(true)
|
|
1957
|
+
setVisibleKinds(prev => {
|
|
1958
|
+
const next = new Set(prev)
|
|
1959
|
+
if (replicaSetsShown) next.delete(kind)
|
|
1960
|
+
else next.add(kind)
|
|
1961
|
+
return next
|
|
1962
|
+
})
|
|
1963
|
+
return
|
|
1964
|
+
}
|
|
1901
1965
|
setVisibleKinds(prev => {
|
|
1902
1966
|
const next = new Set(prev)
|
|
1903
1967
|
if (next.has(kind)) {
|
|
@@ -1907,20 +1971,22 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1907
1971
|
}
|
|
1908
1972
|
return next
|
|
1909
1973
|
})
|
|
1910
|
-
}, [])
|
|
1974
|
+
}, [replicaSetsShown])
|
|
1911
1975
|
|
|
1912
1976
|
const handleShowAllKinds = useCallback(() => {
|
|
1913
1977
|
// Include all static kinds plus any dynamic CRD kinds from the topology
|
|
1914
1978
|
const allKinds = new Set<NodeKind>(ALL_NODE_KINDS)
|
|
1915
|
-
if (
|
|
1916
|
-
for (const node of
|
|
1979
|
+
if (displayedTopology?.nodes) {
|
|
1980
|
+
for (const node of displayedTopology.nodes) {
|
|
1917
1981
|
allKinds.add(node.kind)
|
|
1918
1982
|
}
|
|
1919
1983
|
}
|
|
1984
|
+
setReplicaSetsChosen(true)
|
|
1920
1985
|
setVisibleKinds(allKinds)
|
|
1921
|
-
}, [
|
|
1986
|
+
}, [displayedTopology])
|
|
1922
1987
|
|
|
1923
1988
|
const handleHideAllKinds = useCallback(() => {
|
|
1989
|
+
setReplicaSetsChosen(true)
|
|
1924
1990
|
setVisibleKinds(new Set())
|
|
1925
1991
|
}, [])
|
|
1926
1992
|
|
|
@@ -1939,8 +2005,8 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
1939
2005
|
scroll sideways at desktop width instead (see PHONE_READY_VIEWS). */}
|
|
1940
2006
|
<div
|
|
1941
2007
|
className={`relative flex bg-theme-base ${navCustomization.embedded ? 'h-full min-h-0' : 'h-screen'}`}
|
|
1942
|
-
style={{ minWidth: isMobile && mainView === 'issues'
|
|
1943
|
-
? 0 //
|
|
2008
|
+
style={{ minWidth: investigationFillsHost || (isMobile && mainView === 'issues')
|
|
2009
|
+
? 0 // Embedded investigations fill the host; mobile issue rows adapt beside the rail.
|
|
1944
2010
|
: (isMobile ? 360 : 800) + (showNavRail ? (navRailEffectivePinned ? 176 : 56) : 0) }}
|
|
1945
2011
|
>
|
|
1946
2012
|
{showNavRail && (
|
|
@@ -2004,7 +2070,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2004
2070
|
className={`block w-2.5 h-2.5 shrink-0 rounded-full ${
|
|
2005
2071
|
clusterConnectionState === 'disconnected' || liveUpdatesDisconnected
|
|
2006
2072
|
? 'bg-red-500'
|
|
2007
|
-
:
|
|
2073
|
+
: apiUnreachable
|
|
2074
|
+
? 'bg-amber-400'
|
|
2075
|
+
: clusterConnectionState === 'connecting' || crdDiscoveryStatus === 'discovering' || clusterLoadState.loading
|
|
2008
2076
|
? 'bg-amber-400 animate-pulse'
|
|
2009
2077
|
: 'bg-green-500'
|
|
2010
2078
|
}`}
|
|
@@ -2214,6 +2282,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2214
2282
|
|
|
2215
2283
|
{dismissed && <p className="m-auto text-sm text-theme-text-secondary">{contextSwitch?.phase === 'stopping' ? 'Stopping the switch…' : 'The switch is still running. Resources will appear when the cluster is ready.'}</p>}
|
|
2216
2284
|
{contentReady && <NoClusterAccessBanner />}
|
|
2285
|
+
{contentReady && connection.apiUnreachableSince && <APIUnreachableBanner since={connection.apiUnreachableSince} />}
|
|
2217
2286
|
{/* Main content - only show when connected and authenticated */}
|
|
2218
2287
|
{/* inert while a fullscreen detail overlay covers the views — keeps the
|
|
2219
2288
|
retained background list out of the focus order + a11y tree (the visual
|
|
@@ -2241,7 +2310,6 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2241
2310
|
{!viewsSyncGated && mainView === 'home' && (
|
|
2242
2311
|
<HomeView
|
|
2243
2312
|
namespaces={namespaces}
|
|
2244
|
-
topology={topology}
|
|
2245
2313
|
fallbackClusterLoadState={showHomeClusterLoadFallback ? clusterLoadState : undefined}
|
|
2246
2314
|
onNavigateToView={setMainView}
|
|
2247
2315
|
onNavigateToIssue={takeover.issues ? undefined : (id) => setMainView('issues', { issue: id })}
|
|
@@ -2300,7 +2368,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2300
2368
|
{/* Topology view */}
|
|
2301
2369
|
{!viewsSyncGated && mainView === 'topology' && (
|
|
2302
2370
|
<>
|
|
2303
|
-
{
|
|
2371
|
+
{topologyStatus?.requiresNamespaceFilter && namespaces.length === 0 ? (
|
|
2304
2372
|
/* Large cluster: prompt user to select a namespace */
|
|
2305
2373
|
<div className="flex-1 flex items-center justify-center">
|
|
2306
2374
|
<div className="max-w-md w-full mx-4 text-center">
|
|
@@ -2339,7 +2407,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2339
2407
|
<div className={isMobile && !filterSidebarCollapsed ? 'absolute inset-y-0 left-0 z-20 flex shadow-theme-lg' : 'contents'}>
|
|
2340
2408
|
<TopologyFilterSidebar
|
|
2341
2409
|
nodes={filterSidebarNodes}
|
|
2342
|
-
visibleKinds={
|
|
2410
|
+
visibleKinds={sidebarKinds}
|
|
2343
2411
|
onToggleKind={handleToggleKind}
|
|
2344
2412
|
onShowAll={handleShowAllKinds}
|
|
2345
2413
|
onHideAll={handleHideAllKinds}
|
|
@@ -2384,7 +2452,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2384
2452
|
)}
|
|
2385
2453
|
<TopologySearch
|
|
2386
2454
|
nodes={filteredTopology?.nodes ?? []}
|
|
2387
|
-
allNodes={
|
|
2455
|
+
allNodes={displayedTopology?.nodes}
|
|
2388
2456
|
viewModeLabel={topologyMode === 'fleet' ? 'Fleet' : topologyMode === 'traffic' ? 'Network Flow' : 'Resources'}
|
|
2389
2457
|
onNodeSelect={handleNodeClick}
|
|
2390
2458
|
onZoomToNode={(id) => setTopologyFocus((prev) => ({ id, nonce: (prev?.nonce ?? 0) + 1 }))}
|
|
@@ -2449,7 +2517,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
|
|
|
2449
2517
|
initialViewMode={(searchParams.get('view') as 'list' | 'swimlane') || undefined}
|
|
2450
2518
|
initialFilter={(searchParams.get('filter') as 'all' | 'changes' | 'k8s_events' | 'warnings' | 'unhealthy') || undefined}
|
|
2451
2519
|
initialTimeRange={(searchParams.get('time') as '5m' | '30m' | '1h' | '6h' | '24h' | 'all') || undefined}
|
|
2452
|
-
requiresNamespaceFilter={
|
|
2520
|
+
requiresNamespaceFilter={topologyStatus?.requiresNamespaceFilter && namespaces.length === 0}
|
|
2453
2521
|
availableNamespaces={availableNamespaces}
|
|
2454
2522
|
availableNamespacesError={availableNamespacesError?.message}
|
|
2455
2523
|
onNamespaceSelect={(ns) => {
|
package/src/RadarApp.tsx
CHANGED
|
@@ -51,6 +51,7 @@ import { DiagnoseCustomizationProvider } from "./context/DiagnoseCustomization";
|
|
|
51
51
|
import type {
|
|
52
52
|
RenderDiagnoseAction,
|
|
53
53
|
RenderInvestigationRunActions,
|
|
54
|
+
RenderInvestigationFindingsFooter,
|
|
54
55
|
RenderInvestigationRefusalAction,
|
|
55
56
|
DiagnoseConsentCopy,
|
|
56
57
|
} from "./context/DiagnoseCustomization";
|
|
@@ -135,6 +136,8 @@ export interface RadarAppProps {
|
|
|
135
136
|
renderDiagnoseAction?: RenderDiagnoseAction;
|
|
136
137
|
/** Host-owned controls for the focused investigation; absent in standalone Radar. */
|
|
137
138
|
renderInvestigationRunActions?: RenderInvestigationRunActions;
|
|
139
|
+
/** Host content at the end of the current investigation's Findings pane. */
|
|
140
|
+
renderInvestigationFindingsFooter?: RenderInvestigationFindingsFooter;
|
|
138
141
|
/** Host action beside a refused investigation start or follow-up, e.g. Radar
|
|
139
142
|
* Cloud's "Upgrade" when the organization has used its investigations.
|
|
140
143
|
* Absent in standalone Radar, whose backend sends no refusal details. */
|
|
@@ -243,6 +246,7 @@ export function RadarApp({
|
|
|
243
246
|
documentTitleSuffix,
|
|
244
247
|
renderDiagnoseAction,
|
|
245
248
|
renderInvestigationRunActions,
|
|
249
|
+
renderInvestigationFindingsFooter,
|
|
246
250
|
renderInvestigationRefusalAction,
|
|
247
251
|
diagnoseConsent,
|
|
248
252
|
initialPath,
|
|
@@ -285,6 +289,7 @@ export function RadarApp({
|
|
|
285
289
|
value={renderDiagnoseAction ?? defaultDiagnoseAction}
|
|
286
290
|
consentCopy={diagnoseConsent}
|
|
287
291
|
renderRunActions={renderInvestigationRunActions}
|
|
292
|
+
renderFindingsFooter={renderInvestigationFindingsFooter}
|
|
288
293
|
renderRefusalAction={renderInvestigationRefusalAction}
|
|
289
294
|
>
|
|
290
295
|
<DiagnoseProvider
|
package/src/api/client.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { createListRefetchInterval, normalizeResourceList, type ResourceListBody
|
|
|
5
5
|
import type { CascadeDetail } from '@skyhook-io/k8s-ui/components/ui/ForceDeleteConfirmDialog'
|
|
6
6
|
import { canonicalResourceGroup } from '@skyhook-io/k8s-ui/utils/api-resources'
|
|
7
7
|
import { pluralize } from '@skyhook-io/k8s-ui/utils/pluralize'
|
|
8
|
-
import type { ReadGap, ReadGapSet } from '@skyhook-io/k8s-ui/types/read-coverage'
|
|
8
|
+
import type { ReadGap, ReadGapSet, ReadNameSet } from '@skyhook-io/k8s-ui/types/read-coverage'
|
|
9
9
|
import type { ClusterScope } from '@skyhook-io/k8s-ui/types/cluster-scope'
|
|
10
10
|
import type { WorkloadHistoryCoverage } from '@skyhook-io/k8s-ui/utils/workload-history-notes'
|
|
11
11
|
import { knownKindForPluralWithGroup, pluralToKind } from '@skyhook-io/k8s-ui/utils/navigation'
|
|
@@ -502,6 +502,9 @@ export interface DashboardMetrics {
|
|
|
502
502
|
// When false, only requests/capacity are meaningful — live usage (from
|
|
503
503
|
// metrics-server) is unavailable and usage fields are zero.
|
|
504
504
|
usageAvailable: boolean;
|
|
505
|
+
// Namespaces whose pods were summed into requestsMillis/requestPercent.
|
|
506
|
+
// Omitted when requests cover the whole cluster or from an older Radar.
|
|
507
|
+
requestsNamespaces?: ReadNameSet;
|
|
505
508
|
}
|
|
506
509
|
|
|
507
510
|
export interface MetricSummary {
|
|
@@ -695,6 +698,8 @@ export interface DashboardNetworkPolicyCoverage {
|
|
|
695
698
|
// Workloads left out of totalWorkloads.
|
|
696
699
|
ignoredNamespaceWorkloads?: number;
|
|
697
700
|
hostNetworkWorkloads?: number;
|
|
701
|
+
// Kubernetes kind and API group of the counted policies. Older Radars omit it.
|
|
702
|
+
policyKinds?: { kind: string; group: string }[];
|
|
698
703
|
}
|
|
699
704
|
|
|
700
705
|
export interface DashboardGitOpsControllers {
|