@skyhook-io/radar-app 1.22.2 → 1.23.0

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.
Files changed (196) hide show
  1. package/package.json +8 -8
  2. package/src/App.tsx +35 -10
  3. package/src/RadarApp.basename.test.tsx +177 -0
  4. package/src/RadarApp.settings.test.tsx +33 -0
  5. package/src/api/agentSandbox.ts +259 -0
  6. package/src/api/client.autoPromConnect.test.tsx +43 -0
  7. package/src/api/client.metricsRelayCheck.test.tsx +134 -0
  8. package/src/api/client.ts +122 -24
  9. package/src/api/cloudInstallDiscover.test.tsx +76 -0
  10. package/src/api/diagnose.ts +4 -0
  11. package/src/api/kagent.test.ts +82 -0
  12. package/src/api/kagent.ts +230 -0
  13. package/src/api/prometheusCharts.ts +5 -0
  14. package/src/api/radarFeatures.test.ts +9 -0
  15. package/src/api/radarFeatures.ts +13 -0
  16. package/src/api/substrateWorkspace.test.ts +72 -0
  17. package/src/api/substrateWorkspace.ts +1394 -0
  18. package/src/api/vulnerabilities.ts +207 -9
  19. package/src/api/workloadSource.test.tsx +315 -0
  20. package/src/api/workloadSource.ts +128 -12
  21. package/src/components/CloudConnectFlow.tsx +46 -7
  22. package/src/components/CloudFunnelButton.test.tsx +193 -7
  23. package/src/components/CloudFunnelButton.tsx +127 -32
  24. package/src/components/SelfManagedStart.tsx +12 -2
  25. package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
  26. package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
  27. package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
  28. package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
  29. package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
  30. package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
  31. package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
  32. package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
  33. package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
  34. package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
  35. package/src/components/agentsandbox/data.ts +135 -0
  36. package/src/components/agentsandbox/host.test.ts +27 -0
  37. package/src/components/agentsandbox/host.tsx +85 -0
  38. package/src/components/agentsandbox/labels.test.ts +42 -0
  39. package/src/components/agentsandbox/labels.ts +146 -0
  40. package/src/components/agentsandbox/listFilters.ts +85 -0
  41. package/src/components/agentsandbox/lists.ts +52 -0
  42. package/src/components/agentsandbox/routes.ts +23 -0
  43. package/src/components/agentsandbox/shared.tsx +321 -0
  44. package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
  45. package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
  46. package/src/components/agentsandbox/workspace.tsx +258 -0
  47. package/src/components/agentsandbox/workspaceRoute.ts +18 -0
  48. package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
  49. package/src/components/applications/ApplicationsView.tsx +156 -3
  50. package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
  51. package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
  52. package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
  53. package/src/components/audit/VulnerabilitiesView.tsx +639 -199
  54. package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
  55. package/src/components/cloudHints/CloudHintLink.tsx +29 -0
  56. package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
  57. package/src/components/cloudHints/cloudHints.test.ts +126 -0
  58. package/src/components/cloudHints/cloudHints.ts +131 -0
  59. package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
  60. package/src/components/cloudHints/cloudLinks.test.ts +52 -0
  61. package/src/components/cloudHints/cloudLinks.ts +31 -0
  62. package/src/components/cloudHints/hintStorage.ts +28 -0
  63. package/src/components/cnpg/CNPGView.tsx +4 -7
  64. package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
  65. package/src/components/diagnose/DiagnoseContext.tsx +7 -0
  66. package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
  67. package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
  68. package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
  69. package/src/components/home/HomeAgentBlock.tsx +2 -0
  70. package/src/components/home/HomeView.tsx +3 -3
  71. package/src/components/home/MCPSetupDialog.test.tsx +9 -0
  72. package/src/components/home/MCPSetupDialog.tsx +6 -2
  73. package/src/components/home/McpCloudLine.test.tsx +162 -0
  74. package/src/components/home/McpCloudLine.tsx +95 -0
  75. package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
  76. package/src/components/home/mcpToolCatalog.test.ts +10 -0
  77. package/src/components/home/mcpToolCatalog.ts +4 -4
  78. package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
  79. package/src/components/issues/IssuesPane.render.test.tsx +36 -1
  80. package/src/components/issues/IssuesPane.tsx +181 -23
  81. package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
  82. package/src/components/issues/SinceLastVisitRow.tsx +71 -0
  83. package/src/components/issues/sinceLastVisit.test.ts +266 -0
  84. package/src/components/issues/sinceLastVisit.ts +439 -0
  85. package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
  86. package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
  87. package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
  88. package/src/components/kagent/KagentAgentSessions.tsx +124 -0
  89. package/src/components/kagent/KagentDetailPage.tsx +106 -0
  90. package/src/components/kagent/KagentLists.tsx +412 -0
  91. package/src/components/kagent/KagentOverview.tsx +234 -0
  92. package/src/components/kagent/KagentPages.tsx +690 -0
  93. package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
  94. package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
  95. package/src/components/kagent/KagentSidebar.test.tsx +112 -0
  96. package/src/components/kagent/KagentView.tsx +109 -0
  97. package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
  98. package/src/components/kagent/host.tsx +144 -0
  99. package/src/components/kagent/routes.ts +31 -0
  100. package/src/components/kagent/shared.tsx +336 -0
  101. package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
  102. package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
  103. package/src/components/kagent/workspace.fixtures.ts +108 -0
  104. package/src/components/kagent/workspaceRoute.ts +18 -0
  105. package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
  106. package/src/components/resource/MetricsNotConnected.tsx +10 -7
  107. package/src/components/resource/PrometheusCharts.tsx +10 -1
  108. package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
  109. package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
  110. package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
  111. package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
  112. package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
  113. package/src/components/resources/ResourcesView.tsx +2 -6
  114. package/src/components/resources/renderers/PodRenderer.tsx +8 -2
  115. package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
  116. package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
  117. package/src/components/settings/SettingsDialog.tsx +84 -16
  118. package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
  119. package/src/components/settings/SubstrateSettings.test.tsx +131 -0
  120. package/src/components/settings/SubstrateSettings.tsx +544 -0
  121. package/src/components/settings/settings-state.test.ts +21 -3
  122. package/src/components/settings/settings-state.ts +13 -3
  123. package/src/components/share/ShareLinkButton.test.tsx +360 -0
  124. package/src/components/share/ShareLinkButton.tsx +391 -0
  125. package/src/components/share/openShareInCloud.test.ts +29 -0
  126. package/src/components/share/openShareInCloud.ts +10 -0
  127. package/src/components/share/shareLink.test.ts +129 -0
  128. package/src/components/share/shareLink.ts +175 -0
  129. package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
  130. package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
  131. package/src/components/substrate/SubstrateActorPage.tsx +384 -0
  132. package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
  133. package/src/components/substrate/SubstrateActors.tsx +612 -0
  134. package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
  135. package/src/components/substrate/SubstrateConnect.tsx +88 -0
  136. package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
  137. package/src/components/substrate/SubstrateOverview.tsx +575 -0
  138. package/src/components/substrate/SubstratePages.test.tsx +478 -0
  139. package/src/components/substrate/SubstratePool.test.tsx +462 -0
  140. package/src/components/substrate/SubstratePoolPage.tsx +95 -0
  141. package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
  142. package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
  143. package/src/components/substrate/SubstrateStateBar.tsx +63 -0
  144. package/src/components/substrate/SubstrateTemplates.tsx +376 -0
  145. package/src/components/substrate/SubstrateView.tsx +173 -0
  146. package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
  147. package/src/components/substrate/SubstrateWorkers.tsx +389 -0
  148. package/src/components/substrate/attention.ts +81 -0
  149. package/src/components/substrate/contextPin.tsx +69 -0
  150. package/src/components/substrate/host.tsx +83 -0
  151. package/src/components/substrate/kubectlTarget.test.tsx +77 -0
  152. package/src/components/substrate/readings.test.ts +484 -0
  153. package/src/components/substrate/readings.ts +997 -0
  154. package/src/components/substrate/routes.ts +103 -0
  155. package/src/components/substrate/shared.tsx +426 -0
  156. package/src/components/substrate/substrate.fixtures.ts +325 -0
  157. package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
  158. package/src/components/substrate/workspaceRoute.ts +23 -0
  159. package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
  160. package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
  161. package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
  162. package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
  163. package/src/components/traffic/TrafficFlowList.tsx +9 -5
  164. package/src/components/traffic/TrafficGraph.test.tsx +26 -0
  165. package/src/components/traffic/TrafficGraph.tsx +17 -14
  166. package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
  167. package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
  168. package/src/components/traffic/TrafficView.tsx +26 -56
  169. package/src/components/traffic/trafficFilters.test.ts +61 -1
  170. package/src/components/traffic/trafficFilters.ts +68 -8
  171. package/src/components/velero/VeleroOverview.tsx +2 -2
  172. package/src/components/velero/VeleroView.tsx +3 -6
  173. package/src/components/vulnerabilities/columns.tsx +132 -0
  174. package/src/components/vulnerabilities/filters.tsx +317 -0
  175. package/src/components/vulnerabilities/owner.test.ts +54 -0
  176. package/src/components/vulnerabilities/owner.tsx +163 -0
  177. package/src/components/vulnerabilities/parts.test.ts +126 -12
  178. package/src/components/vulnerabilities/parts.tsx +612 -52
  179. package/src/components/vulnerabilities/traffic.test.tsx +65 -0
  180. package/src/components/vulnerabilities/traffic.tsx +40 -0
  181. package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
  182. package/src/components/workload/WorkloadView.tsx +52 -13
  183. package/src/components/workspace/layout.tsx +13 -7
  184. package/src/components/workspace/sidebar.test.ts +48 -0
  185. package/src/components/workspace/sidebar.ts +73 -3
  186. package/src/components/workspace/table.ts +2 -1
  187. package/src/contexts/RegistryAccessMode.test.tsx +51 -0
  188. package/src/contexts/RegistryAccessMode.tsx +25 -0
  189. package/src/integrations/resourceHost.ts +12 -6
  190. package/src/integrations/resourceHosts.test.tsx +27 -1
  191. package/src/integrations/resourceHosts.tsx +15 -7
  192. package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
  193. package/src/integrations/sidebarWorkspaces.ts +41 -0
  194. package/src/integrations/workspaceRoute.ts +1 -1
  195. package/src/integrations/workspaceRoutes.ts +7 -1
  196. package/src/integrations/workspaceScreens.tsx +6 -0
@@ -0,0 +1,175 @@
1
+ import { kindToPluralWithGroup } from '@skyhook-io/k8s-ui/utils/navigation'
2
+ import { resourcePath } from '../../utils/navigation'
3
+
4
+ // Paths here are router-relative (no basename), the shape Radar's own links use.
5
+ export interface RouterLocation {
6
+ pathname: string
7
+ search: string
8
+ }
9
+
10
+ export interface ShareSubject {
11
+ kind: string
12
+ group?: string
13
+ namespace?: string
14
+ name: string
15
+ }
16
+
17
+ function withSearch(pathname: string, params: URLSearchParams): string {
18
+ const query = params.toString()
19
+ return query ? `${pathname}?${query}` : pathname
20
+ }
21
+
22
+ /**
23
+ * The link for a resource shown in the side drawer. On /resources the drawer is
24
+ * in the URL, so the address already names it and keeps the list's namespace and
25
+ * filters. Elsewhere (a drawer opened over Topology, a GitOps page) the drawer
26
+ * is not in the URL and the address names the page under it, so the link opens
27
+ * the resource itself.
28
+ */
29
+ export function drawerSharePath(subject: ShareSubject, location: RouterLocation): string {
30
+ const params = new URLSearchParams(location.search)
31
+ const plural = kindToPluralWithGroup(subject.kind, subject.group ?? '')
32
+ const named = subject.namespace ? `${subject.namespace}/${subject.name}` : subject.name
33
+ if (
34
+ location.pathname === `/resources/${plural}` &&
35
+ params.get('resource') === named &&
36
+ (params.get('apiGroup') ?? '') === (subject.group ?? '')
37
+ ) {
38
+ return withSearch(location.pathname, params)
39
+ }
40
+ return resourcePath({ kind: subject.kind, group: subject.group, namespace: subject.namespace ?? '', name: subject.name })
41
+ }
42
+
43
+ export function issueSubjectParams(subject: ShareSubject) {
44
+ return {
45
+ kind: subject.kind,
46
+ apiGroup: subject.group ?? '',
47
+ resource: subject.namespace ? `${subject.namespace}/${subject.name}` : subject.name,
48
+ }
49
+ }
50
+
51
+ /** Share a workload issue with its resource identity and the current namespace selection. */
52
+ export function issueSharePath(issueId: string, location: RouterLocation, subject?: ShareSubject): string {
53
+ const current = new URLSearchParams(location.search)
54
+ const params = location.pathname === '/issues' ? current : new URLSearchParams()
55
+ const namespaces = current.get('namespaces')
56
+ if (namespaces) params.set('namespaces', namespaces)
57
+ if (subject) {
58
+ for (const [key, value] of Object.entries(issueSubjectParams(subject))) params.set(key, value)
59
+ }
60
+ params.set('issue', issueId)
61
+ return withSearch('/issues', params)
62
+ }
63
+
64
+ /**
65
+ * True when the browser reached Radar on a loopback name, so a copied link opens
66
+ * only on this computer. This is the browser's view, not the listener's: a
67
+ * Radar bound to 0.0.0.0 but opened as localhost still hands out localhost links.
68
+ */
69
+ export function isLoopbackHostname(hostname: string): boolean {
70
+ const host = hostname.toLowerCase().replace(/^\[|\]$/g, '')
71
+ if (host === 'localhost' || host.endsWith('.localhost')) return true
72
+ if (host === '::1' || host === '0:0:0:0:0:0:0:1') return true
73
+ return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host)
74
+ }
75
+
76
+ /**
77
+ * The same view in Radar Cloud. Radar Cloud mounts this app under the cluster's
78
+ * page (/c/<id>), so a Radar path maps onto it unchanged. Query parameters the
79
+ * cluster URL already carries are kept. Anything that isn't a cluster page gets
80
+ * no link.
81
+ */
82
+ export function cloudViewUrl(clusterUrl: string, path: string): string | null {
83
+ let base: URL
84
+ try {
85
+ base = new URL(clusterUrl)
86
+ } catch {
87
+ return null
88
+ }
89
+ const cluster = base.pathname.match(/^\/c\/[A-Za-z0-9_-]{1,64}/)?.[0]
90
+ if (!cluster) return null
91
+ const target = new URL(path, 'http://radar.invalid')
92
+ const url = new URL(base.origin)
93
+ url.pathname = `${cluster}${target.pathname === '/' ? '' : target.pathname}`
94
+ const params = new URLSearchParams(base.search)
95
+ // ctx pins a view to the local kubeconfig context; the cluster in Radar
96
+ // Cloud reports its own context, and a page would refuse the local one.
97
+ target.searchParams.forEach((value, key) => {
98
+ if (key !== 'ctx') params.set(key, value)
99
+ })
100
+ url.search = params.toString()
101
+ return url.toString()
102
+ }
103
+
104
+ // Hiding the Radar Cloud option is for good. When storage is blocked it still
105
+ // holds for as long as this page is open.
106
+ const HIDE_KEY = 'radar.share.cloudOption.hidden'
107
+ let hiddenInMemory = false
108
+
109
+ type StorageLike = Pick<Storage, 'getItem' | 'setItem'>
110
+
111
+ function defaultStorage(): StorageLike | undefined {
112
+ try {
113
+ return window.localStorage
114
+ } catch {
115
+ return undefined
116
+ }
117
+ }
118
+
119
+ export function isCloudShareHidden(storage: StorageLike | undefined = defaultStorage()): boolean {
120
+ if (hiddenInMemory) return true
121
+ try {
122
+ return storage?.getItem(HIDE_KEY) === 'true'
123
+ } catch {
124
+ return false
125
+ }
126
+ }
127
+
128
+ // Every open share control drops the option at once, not on its next mount.
129
+ const listeners = new Set<() => void>()
130
+
131
+ export function subscribeCloudShareHidden(listener: () => void): () => void {
132
+ listeners.add(listener)
133
+ return () => listeners.delete(listener)
134
+ }
135
+
136
+ export function hideCloudShare(storage: StorageLike | undefined = defaultStorage()): void {
137
+ hiddenInMemory = true
138
+ try {
139
+ storage?.setItem(HIDE_KEY, 'true')
140
+ } catch {
141
+ // Blocked storage: the in-memory flag above carries the choice.
142
+ }
143
+ listeners.forEach((listener) => listener())
144
+ }
145
+
146
+ // The Radar Cloud option rides along with a copy only a few times, then the
147
+ // icon just copies. Counted per browser; held in memory when storage is blocked.
148
+ const SHOWN_KEY = 'radar.share.cloudOption.shown'
149
+ export const CLOUD_SHARE_SHOWS = 3
150
+ let shownInMemory: number | null = null
151
+
152
+ export function cloudShareShows(storage: StorageLike | undefined = defaultStorage()): number {
153
+ if (shownInMemory !== null) return shownInMemory
154
+ try {
155
+ const n = Number(storage?.getItem(SHOWN_KEY))
156
+ return Number.isFinite(n) && n > 0 ? n : 0
157
+ } catch {
158
+ return 0
159
+ }
160
+ }
161
+
162
+ export function noteCloudShareShown(storage: StorageLike | undefined = defaultStorage()): void {
163
+ const n = cloudShareShows(storage) + 1
164
+ shownInMemory = n
165
+ try {
166
+ storage?.setItem(SHOWN_KEY, String(n))
167
+ } catch {
168
+ // Blocked storage: the in-memory count above carries it.
169
+ }
170
+ }
171
+
172
+ export function resetCloudShareHiddenForTests(): void {
173
+ hiddenInMemory = false
174
+ shownInMemory = null
175
+ }
@@ -0,0 +1,87 @@
1
+ import { useEffect } from 'react'
2
+ import { X } from 'lucide-react'
3
+ import { PaneLoader, ResourceDetailDrawer, Tooltip } from '@skyhook-io/k8s-ui'
4
+ import { substrateErrorCode, useSubstrateActor, type SubstrateRef } from '../../api/substrateWorkspace'
5
+ import { RefreshFailedNotice } from '../workspace/layout'
6
+ import { definitiveFailure } from './readings'
7
+ import { useAnimatedUnmount } from '../../hooks/useAnimatedUnmount'
8
+ import { overlayExitMs } from '../../utils/animation'
9
+ import { actorRowResource } from './SubstrateActors'
10
+ import type { OpenSubject } from './SubstrateAttentionList'
11
+ import { ActorReadFailure } from './SubstrateActorPage'
12
+ import { SubstrateActorOverview } from './SubstrateActorOverview'
13
+ import { ActorStateBadge, Term } from './shared'
14
+
15
+ /**
16
+ * An actor's drawer: the Overview of its page, with Open full view. Actors
17
+ * are not Kubernetes objects, so they have this drawer rather than the
18
+ * resource drawer, which Kubernetes objects opened from here still use.
19
+ */
20
+ export function SubstrateActorDrawer({
21
+ actor,
22
+ onClose,
23
+ onOpenFull,
24
+ onOpenSubject,
25
+ }: {
26
+ actor: SubstrateRef | null
27
+ onClose: () => void
28
+ onOpenFull: (actor: SubstrateRef, tab?: string) => void
29
+ onOpenSubject: OpenSubject
30
+ }) {
31
+ const presence = useAnimatedUnmount(!!actor, overlayExitMs('drawer'))
32
+ useEffect(() => {
33
+ if (!actor) return
34
+ const onKey = (e: KeyboardEvent) => {
35
+ if (e.key === 'Escape' && !e.defaultPrevented) onClose()
36
+ }
37
+ document.addEventListener('keydown', onKey)
38
+ return () => document.removeEventListener('keydown', onKey)
39
+ }, [actor, onClose])
40
+ if (!presence.shouldRender || !actor) return null
41
+ // The resource drawer's frame (position, width, resizing), with an actor's content.
42
+ return (
43
+ <ResourceDetailDrawer resource={actorRowResource(actor)} isOpen={presence.isOpen} onClose={onClose}>
44
+ {() => <ActorDrawerBody key={`${actor.atespace}/${actor.name}`} actor={actor} onClose={onClose} onOpenFull={onOpenFull} onOpenSubject={onOpenSubject} />}
45
+ </ResourceDetailDrawer>
46
+ )
47
+ }
48
+
49
+ function ActorDrawerBody({ actor, onClose, onOpenFull, onOpenSubject }: { actor: SubstrateRef; onClose: () => void; onOpenFull: (actor: SubstrateRef, tab?: string) => void; onOpenSubject: OpenSubject }) {
50
+ const query = useSubstrateActor(actor)
51
+ const detail = definitiveFailure(substrateErrorCode(query.error)) ? undefined : query.data
52
+ return (
53
+ <div role="dialog" aria-label={`Actor ${actor.name}`} className="flex min-h-0 flex-1 flex-col">
54
+ <div className="flex shrink-0 items-start gap-3 border-b border-theme-border px-4 py-3">
55
+ <div className="min-w-0 flex-1">
56
+ <div className="flex flex-wrap items-center gap-2">
57
+ {detail && <ActorStateBadge state={detail.actor.state} impact={detail.row.workerImpact} updateTime={detail.actor.updateTime} />}
58
+ </div>
59
+ <h2 className="mt-1 truncate font-mono text-base font-semibold text-theme-text-primary">{actor.name}</h2>
60
+ <div className="text-xs text-theme-text-tertiary"><Term term="atespace">Atespace</Term>: <span className="font-mono">{actor.atespace}</span></div>
61
+ </div>
62
+ <Tooltip content="Close (Esc)" delay={150} position="bottom">
63
+ <button type="button" aria-label="Close" onClick={onClose} className="rounded-lg p-1.5 text-theme-text-secondary hover:bg-theme-elevated hover:text-theme-text-primary">
64
+ <X className="h-4 w-4" />
65
+ </button>
66
+ </Tooltip>
67
+ </div>
68
+ <div className="min-h-0 flex-1 overflow-y-auto px-4 py-4">
69
+ <RefreshFailedNotice queries={[query]} className="mb-3" />
70
+ {!detail && query.isLoading ? (
71
+ <PaneLoader label={`Loading ${actor.name}…`} />
72
+ ) : !detail ? (
73
+ <ActorReadFailure actor={actor} error={query.error} onBack={onClose} backLabel="Close" />
74
+ ) : (
75
+ <SubstrateActorOverview detail={detail} framed={false} onOpenSubject={onOpenSubject}
76
+ onShowLogs={() => onOpenFull(actor, 'logs')} onShowSnapshots={() => onOpenFull(actor, 'snapshots')} onShowEgress={() => onOpenFull(actor, 'egress')}
77
+ actions={<div className="flex flex-wrap gap-2">
78
+ <button type="button" className="btn-brand px-3 py-1 text-sm" onClick={() => onOpenFull(actor)}>Open actor</button>
79
+ <button type="button" className="btn-secondary px-3 py-1 text-sm" onClick={() => onOpenFull(actor, 'snapshots')}>Snapshots</button>
80
+ <button type="button" className="btn-secondary px-3 py-1 text-sm" onClick={() => onOpenFull(actor, 'logs')}>Logs</button>
81
+ </div>}
82
+ />
83
+ )}
84
+ </div>
85
+ </div>
86
+ )
87
+ }