@skyhook-io/radar-app 1.17.0 → 1.18.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 (347) hide show
  1. package/README.md +1 -1
  2. package/package.json +11 -11
  3. package/src/App.tsx +138 -116
  4. package/src/api/actions.errorCode.test.ts +40 -0
  5. package/src/api/actions.test.ts +48 -0
  6. package/src/api/actions.ts +79 -0
  7. package/src/api/apiResources.navigation.test.tsx +232 -0
  8. package/src/api/apiResources.ts +46 -3
  9. package/src/api/client.gitopsPoll.test.ts +99 -0
  10. package/src/api/client.helmPreview.test.tsx +48 -0
  11. package/src/api/client.helmSource.test.ts +39 -0
  12. package/src/api/client.namespaceSwitch.hook.test.tsx +54 -0
  13. package/src/api/client.namespaceSwitch.test.ts +107 -0
  14. package/src/api/client.resourceAvailability.test.ts +24 -0
  15. package/src/api/client.ts +580 -103
  16. package/src/api/client.workloadRuns.test.ts +53 -0
  17. package/src/api/cnpg-ha.live.test.ts +140 -0
  18. package/src/api/cnpg-ha.test.ts +78 -0
  19. package/src/api/cnpg-ha.ts +19 -0
  20. package/src/api/cnpg-history.ts +123 -0
  21. package/src/api/cnpg-inspect.ts +102 -0
  22. package/src/api/cnpg-protection.ts +112 -0
  23. package/src/api/cnpg-recovery.test.tsx +60 -0
  24. package/src/api/cnpg-recovery.ts +262 -0
  25. package/src/api/cnpg-sessions.ts +175 -0
  26. package/src/api/cnpg-storage.ts +138 -0
  27. package/src/api/cnpg.legacy-reads.test.ts +43 -0
  28. package/src/api/cnpg.pooler-runtime.test.ts +15 -0
  29. package/src/api/cnpg.ts +428 -10
  30. package/src/api/config.test.ts +23 -1
  31. package/src/api/config.ts +7 -3
  32. package/src/api/diagnose.ts +4 -1
  33. package/src/api/drain-plan.test.ts +70 -40
  34. package/src/api/policy.ts +5 -5
  35. package/src/api/radarFeatures.render.test.tsx +47 -3
  36. package/src/api/radarFeatures.ts +5 -1
  37. package/src/api/reviewedActionMutation.test.tsx +164 -0
  38. package/src/api/reviewedActionMutation.ts +66 -0
  39. package/src/api/timelineSource.test.ts +9 -0
  40. package/src/api/timelineSource.ts +8 -0
  41. package/src/api/traffic.scope.render.test.tsx +60 -0
  42. package/src/api/traffic.ts +3 -1
  43. package/src/components/audit/AuditView.tsx +9 -0
  44. package/src/components/capacity/CapacityActivity.tsx +3 -31
  45. package/src/components/capacity/CapacityDemand.tsx +4 -36
  46. package/src/components/capacity/CapacityOverview.tsx +217 -56
  47. package/src/components/capacity/CapacityPoolDetail.tsx +6 -55
  48. package/src/components/capacity/CapacityView.test.tsx +323 -0
  49. package/src/components/capacity/ClusterSchedulingCard.tsx +2 -10
  50. package/src/components/capacity/certaintyGlyph.test.tsx +2 -9
  51. package/src/components/capacity/routes.ts +42 -0
  52. package/src/components/capacity/shared.tsx +11 -129
  53. package/src/components/capacity/workspaceRoute.ts +18 -0
  54. package/src/components/cnpg/CNPGActionHost.compatibility.test.tsx +30 -0
  55. package/src/components/cnpg/CNPGArchivingRepair.tsx +191 -0
  56. package/src/components/cnpg/CNPGBlockingSessions.test.tsx +50 -0
  57. package/src/components/cnpg/CNPGBlockingSessions.tsx +333 -0
  58. package/src/components/cnpg/CNPGClusterActivity.test.tsx +11 -0
  59. package/src/components/cnpg/CNPGClusterActivity.tsx +18 -9
  60. package/src/components/cnpg/CNPGClusterLogs.compatibility.test.tsx +130 -0
  61. package/src/components/cnpg/CNPGClusterLogs.empty.test.tsx +29 -0
  62. package/src/components/cnpg/CNPGClusterLogs.test.ts +9 -0
  63. package/src/components/cnpg/CNPGClusterLogs.tsx +81 -24
  64. package/src/components/cnpg/CNPGClusterTabs.test.tsx +152 -0
  65. package/src/components/cnpg/CNPGClusterTabs.tsx +187 -0
  66. package/src/components/cnpg/CNPGClustersKindView.tsx +46 -0
  67. package/src/components/cnpg/CNPGConfiguration.test.tsx +223 -0
  68. package/src/components/cnpg/CNPGConfiguration.tsx +190 -0
  69. package/src/components/cnpg/CNPGCreateClusterDialog.test.tsx +113 -0
  70. package/src/components/cnpg/CNPGCreateClusterDialog.tsx +74 -0
  71. package/src/components/cnpg/CNPGDeclarations.test.ts +107 -0
  72. package/src/components/cnpg/CNPGDeclarations.tsx +236 -78
  73. package/src/components/cnpg/CNPGDetailPage.test.tsx +62 -0
  74. package/src/components/cnpg/CNPGDetailPage.tsx +159 -98
  75. package/src/components/cnpg/CNPGDrawerTrail.tsx +2 -2
  76. package/src/components/cnpg/CNPGInvestigationAction.test.tsx +30 -0
  77. package/src/components/cnpg/CNPGOperator.test.tsx +34 -0
  78. package/src/components/cnpg/CNPGOperator.tsx +78 -30
  79. package/src/components/cnpg/CNPGOperatorBanner.tsx +39 -0
  80. package/src/components/cnpg/CNPGOperatorConditions.test.tsx +45 -0
  81. package/src/components/cnpg/CNPGOperatorConditions.tsx +16 -0
  82. package/src/components/cnpg/CNPGOperatorConfig.test.tsx +27 -0
  83. package/src/components/cnpg/CNPGOperatorDiagnosis.tsx +247 -0
  84. package/src/components/cnpg/CNPGOverview.test.tsx +171 -0
  85. package/src/components/cnpg/CNPGOverview.tsx +238 -63
  86. package/src/components/cnpg/CNPGParametersInEffect.test.tsx +51 -0
  87. package/src/components/cnpg/CNPGParametersInEffect.tsx +120 -0
  88. package/src/components/cnpg/CNPGPerformance.prerequisite.test.tsx +48 -0
  89. package/src/components/cnpg/CNPGPerformance.test.tsx +73 -0
  90. package/src/components/cnpg/CNPGPerformance.tsx +477 -0
  91. package/src/components/cnpg/CNPGPooling.test.tsx +89 -0
  92. package/src/components/cnpg/CNPGPooling.tsx +97 -40
  93. package/src/components/cnpg/CNPGProtection.test.tsx +145 -0
  94. package/src/components/cnpg/CNPGProtection.tsx +228 -122
  95. package/src/components/cnpg/CNPGReplicationTab.test.tsx +87 -0
  96. package/src/components/cnpg/CNPGReplicationTab.tsx +212 -0
  97. package/src/components/cnpg/CNPGReplicationView.tsx +264 -0
  98. package/src/components/cnpg/CNPGStorage.test.tsx +140 -0
  99. package/src/components/cnpg/CNPGStorage.tsx +619 -0
  100. package/src/components/cnpg/CNPGSummaryHost.overview.test.tsx +44 -0
  101. package/src/components/cnpg/CNPGSummaryHost.test.tsx +23 -0
  102. package/src/components/cnpg/CNPGSummaryHost.tsx +230 -55
  103. package/src/components/cnpg/CNPGTrends.denied.test.tsx +33 -0
  104. package/src/components/cnpg/CNPGTrends.missing.test.tsx +69 -0
  105. package/src/components/cnpg/CNPGTrends.test.ts +38 -0
  106. package/src/components/cnpg/CNPGTrends.tsx +702 -0
  107. package/src/components/cnpg/CNPGView.tsx +34 -21
  108. package/src/components/cnpg/CNPGWorkspace.compatibility.test.tsx +90 -0
  109. package/src/components/cnpg/actions/CNPGClusterActions.dialog.test.tsx +79 -0
  110. package/src/components/cnpg/actions/CNPGClusterActions.test.tsx +142 -0
  111. package/src/components/cnpg/actions/CNPGClusterActions.tsx +853 -0
  112. package/src/components/cnpg/actions/CNPGConnectButton.read.test.tsx +40 -0
  113. package/src/components/cnpg/actions/CNPGConnectButton.test.ts +25 -0
  114. package/src/components/cnpg/actions/CNPGConnectButton.tsx +131 -0
  115. package/src/components/cnpg/actions/CNPGDestroyInstanceDialog.tsx +185 -0
  116. package/src/components/cnpg/actions/CNPGInstanceActions.test.tsx +38 -0
  117. package/src/components/cnpg/actions/CNPGInstanceActions.tsx +74 -0
  118. package/src/components/cnpg/actions/CNPGMaintenanceBanner.tsx +53 -0
  119. package/src/components/cnpg/actions/CNPGPoolerActions.test.tsx +35 -0
  120. package/src/components/cnpg/actions/CNPGPoolerActions.tsx +79 -0
  121. package/src/components/cnpg/actions/CNPGReportDialog.test.tsx +12 -0
  122. package/src/components/cnpg/actions/CNPGReportDialog.tsx +91 -0
  123. package/src/components/cnpg/actions/CNPGScheduleActions.run.test.tsx +58 -0
  124. package/src/components/cnpg/actions/CNPGScheduleActions.test.tsx +54 -0
  125. package/src/components/cnpg/actions/CNPGScheduleActions.tsx +208 -0
  126. package/src/components/cnpg/actions/actionModel.test.ts +111 -0
  127. package/src/components/cnpg/actions/actionModel.ts +127 -0
  128. package/src/components/cnpg/actions/renderCNPGHeaderActions.tsx +60 -0
  129. package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +58 -0
  130. package/src/components/cnpg/actions/useOpenCNPGPsql.ts +22 -0
  131. package/src/components/cnpg/archivingRepair.test.ts +104 -0
  132. package/src/components/cnpg/archivingRepair.ts +145 -0
  133. package/src/components/cnpg/baseBackup.test.ts +36 -0
  134. package/src/components/cnpg/baseBackup.ts +36 -0
  135. package/src/components/cnpg/blocking.test.ts +59 -0
  136. package/src/components/cnpg/blocking.ts +131 -0
  137. package/src/components/cnpg/coverageText.test.ts +27 -0
  138. package/src/components/cnpg/creation/CNPGTargetFields.tsx +110 -0
  139. package/src/components/cnpg/creation/targetModel.test.ts +137 -0
  140. package/src/components/cnpg/creation/targetModel.ts +149 -0
  141. package/src/components/cnpg/fleetStatus.test.ts +46 -0
  142. package/src/components/cnpg/fleetStatus.ts +43 -0
  143. package/src/components/cnpg/formFields.ts +2 -0
  144. package/src/components/cnpg/grantText.test.tsx +11 -0
  145. package/src/components/cnpg/host.test.tsx +24 -0
  146. package/src/components/cnpg/host.tsx +101 -0
  147. package/src/components/cnpg/inspectModel.test.ts +120 -0
  148. package/src/components/cnpg/inspectModel.ts +140 -0
  149. package/src/components/cnpg/logicalSlots.test.ts +30 -0
  150. package/src/components/cnpg/logicalSlots.ts +29 -0
  151. package/src/components/cnpg/lsn.test.ts +40 -0
  152. package/src/components/cnpg/lsn.ts +43 -0
  153. package/src/components/cnpg/operations/CNPGFleetOperation.tsx +30 -0
  154. package/src/components/cnpg/operations/CNPGOperationTracker.test.tsx +247 -0
  155. package/src/components/cnpg/operations/CNPGOperationTracker.tsx +255 -0
  156. package/src/components/cnpg/operations/model.test.ts +510 -0
  157. package/src/components/cnpg/operations/model.ts +499 -0
  158. package/src/components/cnpg/operations/presentation.test.ts +80 -0
  159. package/src/components/cnpg/operations/presentation.ts +84 -0
  160. package/src/components/cnpg/operations/store.ts +98 -0
  161. package/src/components/cnpg/operatorStatus.test.ts +134 -0
  162. package/src/components/cnpg/operatorStatus.ts +194 -0
  163. package/src/components/cnpg/paths.test.ts +54 -0
  164. package/src/components/cnpg/paths.ts +47 -4
  165. package/src/components/cnpg/protection/CNPGAttachArchiveDialog.tsx +185 -0
  166. package/src/components/cnpg/protection/CNPGCreateScheduleDialog.tsx +196 -0
  167. package/src/components/cnpg/protection/CNPGProtectionSetup.test.tsx +121 -0
  168. package/src/components/cnpg/protection/CNPGProtectionSetup.tsx +452 -0
  169. package/src/components/cnpg/protection/CNPGScheduleInput.tsx +115 -0
  170. package/src/components/cnpg/protection/CNPGScheduleRepairButton.tsx +120 -0
  171. package/src/components/cnpg/protection/scheduleModel.test.ts +19 -0
  172. package/src/components/cnpg/protection/scheduleModel.ts +16 -0
  173. package/src/components/cnpg/recovery/CNPGRecoveryPoint.tsx +220 -0
  174. package/src/components/cnpg/recovery/CNPGRestoreButton.test.tsx +29 -0
  175. package/src/components/cnpg/recovery/CNPGRestoreButton.tsx +26 -0
  176. package/src/components/cnpg/recovery/CNPGRestoreChecks.test.tsx +23 -0
  177. package/src/components/cnpg/recovery/CNPGRestoreChecks.tsx +153 -0
  178. package/src/components/cnpg/recovery/CNPGRestoreDialog.back.test.tsx +149 -0
  179. package/src/components/cnpg/recovery/CNPGRestoreDialog.test.tsx +46 -0
  180. package/src/components/cnpg/recovery/CNPGRestoreDialog.tsx +333 -0
  181. package/src/components/cnpg/recovery/CNPGRestoreProgress.tsx +182 -0
  182. package/src/components/cnpg/recovery/CNPGRestoreValidation.tsx +216 -0
  183. package/src/components/cnpg/recovery/restoreModel.test.ts +709 -0
  184. package/src/components/cnpg/recovery/restoreModel.ts +685 -0
  185. package/src/components/cnpg/recovery/restoreOperation.ts +56 -0
  186. package/src/components/cnpg/refresh.test.ts +38 -0
  187. package/src/components/cnpg/refresh.ts +17 -0
  188. package/src/components/cnpg/refreshNotice.test.tsx +29 -0
  189. package/src/components/cnpg/routes.test.ts +34 -3
  190. package/src/components/cnpg/routes.ts +60 -48
  191. package/src/components/cnpg/runtimeAssessment.ts +198 -0
  192. package/src/components/cnpg/runtimeModel.test.ts +175 -0
  193. package/src/components/cnpg/runtimeModel.ts +196 -0
  194. package/src/components/cnpg/runtimeParts.test.tsx +17 -0
  195. package/src/components/cnpg/runtimeParts.tsx +79 -0
  196. package/src/components/cnpg/shared.test.tsx +59 -0
  197. package/src/components/cnpg/shared.tsx +100 -182
  198. package/src/components/cnpg/storageModel.test.ts +107 -0
  199. package/src/components/cnpg/storageModel.ts +101 -0
  200. package/src/components/cnpg/trendSamples.test.ts +148 -0
  201. package/src/components/cnpg/trendSamples.ts +222 -0
  202. package/src/components/cnpg/useCNPGClusterAssessment.ts +30 -0
  203. package/src/components/cnpg/useCNPGKubectlContext.test.tsx +45 -0
  204. package/src/components/cnpg/useCNPGKubectlContext.ts +13 -0
  205. package/src/components/cnpg/useCNPGNavigate.test.tsx +58 -0
  206. package/src/components/cnpg/useCNPGNavigate.ts +21 -0
  207. package/src/components/cnpg/useCNPGPoolerLive.ts +46 -0
  208. package/src/components/cnpg/useCNPGScreenParams.ts +24 -0
  209. package/src/components/cnpg/useCNPGSidebarWorkspace.ts +66 -16
  210. package/src/components/cnpg/workspaceRoute.ts +23 -0
  211. package/src/components/cost/ApplicationCostTab.test.ts +7 -0
  212. package/src/components/cost/ApplicationCostTab.tsx +7 -7
  213. package/src/components/cost/CostView.test.ts +2 -1
  214. package/src/components/cost/CostView.tsx +0 -2
  215. package/src/components/cost/WorkloadCostTab.tsx +2 -4
  216. package/src/components/cost/errors.ts +3 -1
  217. package/src/components/cost/source.test.ts +10 -0
  218. package/src/components/cost/source.ts +5 -1
  219. package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
  220. package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
  221. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
  222. package/src/components/diagnose/InvestigationView.tsx +2 -1
  223. package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
  224. package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
  225. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -43
  226. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
  227. package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
  228. package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
  229. package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
  230. package/src/components/diagnose/investigationEvidence/observations.ts +20 -0
  231. package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
  232. package/src/components/diagnose/investigationEvidence/projection.test.ts +123 -0
  233. package/src/components/diagnose/investigationEvidence/types.ts +11 -0
  234. package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
  235. package/src/components/diagnose/investigationState.test.ts +36 -1
  236. package/src/components/diagnose/investigationState.ts +8 -0
  237. package/src/components/diagnose/launch.ts +2 -2
  238. package/src/components/dock/BottomDock.tsx +8 -3
  239. package/src/components/dock/TerminalTab.test.tsx +17 -0
  240. package/src/components/dock/TerminalTab.tsx +7 -3
  241. package/src/components/dock/WorkloadLogsTab.tsx +3 -0
  242. package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
  243. package/src/components/execution/BatchExecutionView.tsx +23 -8
  244. package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
  245. package/src/components/gitops/ArgoResourceDiffLoader.tsx +4 -2
  246. package/src/components/gitops/GitOpsView.tsx +23 -23
  247. package/src/components/helm/HelmCompareRoute.test.tsx +59 -0
  248. package/src/components/helm/HelmCompareRoute.tsx +57 -26
  249. package/src/components/helm/HelmReleaseDrawer.test.ts +55 -3
  250. package/src/components/helm/HelmReleaseDrawer.tsx +186 -64
  251. package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
  252. package/src/components/helm/HelmReleaseNotes.tsx +26 -0
  253. package/src/components/helm/OwnedResources.tsx +2 -2
  254. package/src/components/helm/TrackChartSourceDialog.render.test.tsx +192 -0
  255. package/src/components/helm/TrackChartSourceDialog.test.ts +51 -0
  256. package/src/components/helm/TrackChartSourceDialog.tsx +179 -176
  257. package/src/components/helm/ValuesDiffPreview.tsx +4 -1
  258. package/src/components/helm/ValuesViewer.test.tsx +301 -0
  259. package/src/components/helm/ValuesViewer.tsx +169 -78
  260. package/src/components/home/ActivitySummary.tsx +2 -1
  261. package/src/components/home/ClusterHealthCard.tsx +4 -4
  262. package/src/components/home/CostCard.test.tsx +100 -0
  263. package/src/components/home/CostCard.tsx +2 -2
  264. package/src/components/home/HelmSummary.tsx +2 -2
  265. package/src/components/home/HomeView.tsx +32 -12
  266. package/src/components/home/MCPSetupDialog.test.tsx +30 -0
  267. package/src/components/home/MCPSetupDialog.tsx +13 -6
  268. package/src/components/home/ProblemsPanel.test.tsx +82 -0
  269. package/src/components/home/TopologyPreview.tsx +2 -2
  270. package/src/components/home/mcpToolCatalog.ts +18 -2
  271. package/src/components/issues/IssuesPane.render.test.tsx +143 -0
  272. package/src/components/issues/IssuesPane.test.ts +65 -1
  273. package/src/components/issues/IssuesPane.tsx +213 -26
  274. package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
  275. package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
  276. package/src/components/issues/uncheckedSources.test.ts +43 -0
  277. package/src/components/issues/uncheckedSources.ts +74 -0
  278. package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
  279. package/src/components/resource/PVCUsageBar.render.test.tsx +32 -0
  280. package/src/components/resource/PVCUsageBar.test.tsx +24 -0
  281. package/src/components/resource/PVCUsageBar.tsx +15 -6
  282. package/src/components/resource/WorkloadMetricsHelpDialog.test.tsx +3 -1
  283. package/src/components/resource/WorkloadMetricsHelpDialog.tsx +1 -1
  284. package/src/components/resources/CompositeRenderer.tsx +4 -4
  285. package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
  286. package/src/components/resources/ImageFilesystemModal.tsx +11 -4
  287. package/src/components/resources/PodFilesystemModal.tsx +2 -2
  288. package/src/components/resources/ResourceDetailDrawer.tsx +2 -2
  289. package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
  290. package/src/components/resources/ResourcesView.tsx +44 -15
  291. package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
  292. package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
  293. package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
  294. package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
  295. package/src/components/settings/LocalIntegrationStatus.test.tsx +52 -0
  296. package/src/components/settings/LocalIntegrationStatus.tsx +3 -4
  297. package/src/components/settings/SettingsDialog.tsx +49 -30
  298. package/src/components/timeline/TimelineList.tsx +22 -24
  299. package/src/components/timeline/TimelineLoadError.test.tsx +62 -0
  300. package/src/components/timeline/TimelineLoadError.tsx +96 -0
  301. package/src/components/timeline/TimelineView.tsx +18 -45
  302. package/src/components/timeline/ViewModeToggle.tsx +20 -0
  303. package/src/components/timeline/useStickyError.test.tsx +47 -0
  304. package/src/components/timeline/useStickyError.ts +15 -0
  305. package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
  306. package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
  307. package/src/components/traffic/TrafficView.tsx +12 -12
  308. package/src/components/traffic/trafficFilters.test.ts +20 -1
  309. package/src/components/traffic/trafficFilters.ts +13 -0
  310. package/src/components/ui/DiagnosticsOverlay.tsx +34 -2
  311. package/src/components/ui/Markdown.test.tsx +65 -0
  312. package/src/components/ui/Markdown.tsx +144 -127
  313. package/src/components/ui/Omnibar.tsx +13 -2
  314. package/src/components/ui/Toast.tsx +1 -1
  315. package/src/components/ui/omnibar-match.test.ts +30 -0
  316. package/src/components/ui/omnibar-match.ts +18 -0
  317. package/src/components/whats-new/releaseNotes.ts +63 -1
  318. package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
  319. package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
  320. package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
  321. package/src/components/workload/NodeDrainStatus.tsx +55 -0
  322. package/src/components/workload/WorkloadView.test.ts +10 -1
  323. package/src/components/workload/WorkloadView.tsx +63 -243
  324. package/src/components/workspace/layout.test.tsx +29 -0
  325. package/src/components/workspace/layout.tsx +259 -0
  326. package/src/components/workspace/table.ts +7 -0
  327. package/src/context/ConnectionContext.test.ts +27 -1
  328. package/src/context/ConnectionContext.tsx +17 -7
  329. package/src/contexts/CapabilitiesContext.tsx +1 -1
  330. package/src/integrations/resourceHost.test.tsx +55 -0
  331. package/src/integrations/resourceHost.ts +99 -0
  332. package/src/integrations/resourceHosts.test.tsx +142 -0
  333. package/src/integrations/resourceHosts.tsx +121 -0
  334. package/src/integrations/workspaceRoute.ts +20 -0
  335. package/src/integrations/workspaceRoutes.test.ts +40 -0
  336. package/src/integrations/workspaceRoutes.ts +22 -0
  337. package/src/integrations/workspaceScreens.tsx +14 -0
  338. package/src/utils/drawer-trail.ts +35 -0
  339. package/src/utils/kindFilterStore.test.ts +147 -0
  340. package/src/utils/kindFilterStore.ts +91 -0
  341. package/src/utils/navigation.test.ts +13 -1
  342. package/src/utils/navigation.ts +53 -2
  343. package/src/utils/page-links.ts +21 -0
  344. package/src/utils/tabStorage.ts +40 -0
  345. package/src/utils/viewMemory.test.ts +78 -0
  346. package/src/utils/viewMemory.ts +54 -0
  347. package/src/utils/wails-clipboard.ts +4 -2
@@ -0,0 +1,37 @@
1
+ import { Clock, Info } from 'lucide-react'
2
+ import { AlertBanner, CardSection, Disclosure, TimeValue } from '@skyhook-io/k8s-ui'
3
+ import type { CronJobSchedulingEvidence } from '../../api/client'
4
+
5
+ type EvidenceProps = { evidence: CronJobSchedulingEvidence; onViewTimeline: () => void }
6
+
7
+ export function CronJobSchedulingDetails({ evidence, onViewTimeline }: EvidenceProps) {
8
+ return (
9
+ <CardSection icon={Clock} label="Scheduling evidence">
10
+ <p className="text-sm text-theme-text-secondary">Last reported: <TimeValue timestamp={evidence.last_reported_at} />.</p>
11
+ {evidence.configuration_changed_at && <p className="text-sm text-theme-text-secondary">Scheduling settings changed: <TimeValue timestamp={evidence.configuration_changed_at} />.</p>}
12
+ {evidence.history_incomplete && <p className="text-sm text-theme-text-secondary">Some history is unavailable. The report's current relevance cannot be fully verified.</p>}
13
+ <button type="button" onClick={onViewTimeline} className="self-start text-left text-sm font-medium text-accent-text hover:underline">View timeline</button>
14
+ </CardSection>
15
+ )
16
+ }
17
+
18
+ export function CronJobSchedulingContext({ evidence, onViewTimeline }: { evidence?: CronJobSchedulingEvidence; onViewTimeline: () => void }) {
19
+ if (!evidence || evidence.state === 'reported') return null
20
+ const changed = evidence.state === 'configuration_changed'
21
+ return (
22
+ <AlertBanner
23
+ variant="info"
24
+ icon={Info}
25
+ title={changed ? 'Schedule changed after this error' : 'Scheduling history is incomplete'}
26
+ message={changed ? 'Kubernetes has not recorded a scheduled run since the change.' : 'A scheduling error was reported, but retained history cannot establish whether it still applies.'}
27
+ className="mb-0"
28
+ >
29
+ <Disclosure summary="Earlier report" className="mt-2" summaryClassName="text-xs text-theme-text-secondary">
30
+ <div className="mt-3 space-y-3">
31
+ <pre className="whitespace-pre-wrap break-words rounded bg-theme-elevated p-3 text-xs text-theme-text-secondary">{evidence.message}</pre>
32
+ <CronJobSchedulingDetails evidence={evidence} onViewTimeline={onViewTimeline} />
33
+ </div>
34
+ </Disclosure>
35
+ </AlertBanner>
36
+ )
37
+ }
@@ -0,0 +1,253 @@
1
+ // @vitest-environment jsdom
2
+ import { act, useEffect } from 'react'
3
+ import { createRoot, type Root } from 'react-dom/client'
4
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
+ import { afterEach, beforeEach, expect, it, vi } from 'vitest'
6
+ import { NodeDrainStatus } from './NodeDrainStatus'
7
+ import { useDrainNode, useSetActiveNamespace, nodeDrainActivityKey, type NodeDrainActivity, type NamespaceScope } from '../../api/client'
8
+ import { setApiBase } from '../../api/config'
9
+ import { refreshQueriesAfterReconnect } from '../../context/ConnectionContext'
10
+
11
+ let host: HTMLDivElement
12
+ let root: Root
13
+ let client: QueryClient
14
+ let start: () => Promise<unknown>
15
+ let respond: (response: Response) => void
16
+ let reject: (error: Error) => void
17
+
18
+ function Harness({ uid = 'node-uid', visible = true }: { uid?: string; visible?: boolean }) {
19
+ const { mutateAsync } = useDrainNode(uid)
20
+ useEffect(() => {
21
+ start = () => mutateAsync({ name: 'worker' }).catch(() => undefined)
22
+ }, [mutateAsync])
23
+ return visible ? <NodeDrainStatus name="worker" nodeUID={uid} /> : null
24
+ }
25
+
26
+ async function render(uid = 'node-uid', visible = true) {
27
+ await act(async () => {
28
+ root.render(<QueryClientProvider client={client}><Harness uid={uid} visible={visible} /></QueryClientProvider>)
29
+ })
30
+ }
31
+
32
+ async function flush() {
33
+ await act(async () => { await new Promise(resolve => setTimeout(resolve, 0)) })
34
+ }
35
+
36
+ beforeEach(() => {
37
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
38
+ setApiBase('/api')
39
+ host = document.createElement('div')
40
+ document.body.append(host)
41
+ root = createRoot(host)
42
+ client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } })
43
+ vi.stubGlobal('fetch', vi.fn(() => new Promise<Response>((resolve, fail) => { respond = resolve; reject = fail })))
44
+ })
45
+
46
+ afterEach(() => {
47
+ act(() => root.unmount())
48
+ client.clear()
49
+ host.remove()
50
+ vi.useRealTimers()
51
+ vi.unstubAllGlobals()
52
+ setApiBase('/api')
53
+ })
54
+
55
+ it('retains completion when the view changes before the request finishes', async () => {
56
+ await render()
57
+ expect(host.textContent).toBe('')
58
+ let pending: Promise<unknown> | undefined
59
+ await act(async () => { pending = start() })
60
+ await flush()
61
+ expect(host.textContent).toContain('Drain in progress')
62
+ expect(host.textContent).toContain('2m 0s')
63
+ await render('', false)
64
+ await act(async () => {
65
+ respond(Response.json({ outcome: 'complete', evictedPods: ['shop/web'], waitedForDeletion: true }))
66
+ await pending
67
+ })
68
+ await flush()
69
+ await render()
70
+ expect(host.textContent).toContain('Drain complete: 1 pod removed')
71
+ expect(host.textContent).toContain('Last drain in this tab:')
72
+ expect(host.textContent).toContain('The node was left cordoned.')
73
+ expect(host.textContent).not.toContain('The node remains cordoned.')
74
+ expect(host.querySelector('time')?.dateTime).toBeTruthy()
75
+ expect(fetch).toHaveBeenCalledTimes(1)
76
+ await act(async () => { pending = start() })
77
+ await flush()
78
+ expect(host.textContent).toContain('Drain in progress')
79
+ await act(async () => { respond(Response.json({ outcome: 'complete' })); await pending })
80
+ await flush()
81
+ expect(host.textContent).toContain('Nothing to evict')
82
+ })
83
+
84
+ it('retains pending state on return and isolates node UID and API base', async () => {
85
+ await render()
86
+ let pending: Promise<unknown> | undefined
87
+ await act(async () => { pending = start() })
88
+ await flush()
89
+ await render('replacement-uid')
90
+ expect(host.textContent).toBe('')
91
+ setApiBase('/c/other/api')
92
+ await render()
93
+ expect(host.textContent).toBe('')
94
+ setApiBase('/api')
95
+ await render()
96
+ expect(host.textContent).toContain('Drain in progress')
97
+ await act(async () => {
98
+ respond(Response.json({ outcome: 'incomplete', skippedPods: [{ namespace: 'shop', name: 'bare', expectedSkip: false, reason: 'protected' }] }))
99
+ await pending
100
+ })
101
+ await flush()
102
+ expect(host.textContent).toContain('Drain incomplete: 1 pod left on the node')
103
+ })
104
+
105
+ it('preserves request failure as uncertainty without inheriting automatic mutation retries', async () => {
106
+ vi.stubGlobal('crypto', undefined)
107
+ client.setDefaultOptions({ mutations: { retry: 1 } })
108
+ await render()
109
+ let pending: Promise<unknown> | undefined
110
+ await act(async () => { pending = start() })
111
+ await act(async () => { reject(new Error('Connection lost')); await pending })
112
+ await flush()
113
+ expect(host.textContent).toContain('Could not confirm drain completion')
114
+ expect(host.textContent).toContain('Connection lost')
115
+ expect(host.textContent).toContain('does not confirm whether evictions ran')
116
+ expect(fetch).toHaveBeenCalledTimes(1)
117
+ })
118
+
119
+ it('dismisses the recorded result and retains it past the normal cache lifetime until then', async () => {
120
+ await render()
121
+ let pending: Promise<unknown> | undefined
122
+ await act(async () => { pending = start() })
123
+ await act(async () => { respond(Response.json({ outcome: 'complete' })); await pending })
124
+ await flush()
125
+ await render('', false)
126
+ vi.useFakeTimers()
127
+ await act(async () => { await vi.advanceTimersByTimeAsync(10 * 60 * 1000) })
128
+ await render()
129
+ expect(host.textContent).toContain('Nothing to evict')
130
+ await act(async () => { host.querySelector<HTMLButtonElement>('button')?.click(); await vi.advanceTimersByTimeAsync(0) })
131
+ expect(host.textContent).toBe('')
132
+ await render('', false)
133
+ await render()
134
+ expect(host.textContent).toBe('')
135
+ })
136
+
137
+ it('retains a running drain and its final result across a same-context reconnect', async () => {
138
+ client.setQueryData(['cluster-info'], { context: 'same' })
139
+ const invalidate = vi.spyOn(client, 'invalidateQueries')
140
+ await render()
141
+ let pending: Promise<unknown> | undefined
142
+ await act(async () => { pending = start() })
143
+ await act(async () => { refreshQueriesAfterReconnect(client, 'same', 'same') })
144
+ await flush()
145
+ expect(host.textContent).toContain('Drain in progress')
146
+ await act(async () => { respond(Response.json({ outcome: 'complete' })); await pending })
147
+ await flush()
148
+ expect(host.textContent).toContain('Nothing to evict')
149
+ expect(invalidate).toHaveBeenCalledWith({ queryKey: ['topology'] })
150
+ })
151
+
152
+ it('refreshes the node when cluster-info first arrives during a drain', async () => {
153
+ const invalidate = vi.spyOn(client, 'invalidateQueries')
154
+ await render()
155
+ let pending: Promise<unknown> | undefined
156
+ await act(async () => { pending = start() })
157
+ await act(async () => {
158
+ client.setQueryData(['cluster-info'], { context: 'first-load' })
159
+ respond(Response.json({ outcome: 'complete' }))
160
+ await pending
161
+ })
162
+ await flush()
163
+ expect(host.textContent).toContain('Nothing to evict')
164
+ expect(invalidate).toHaveBeenCalledWith({ queryKey: ['resource', 'nodes', '', 'worker'] })
165
+ })
166
+
167
+ it('records completion for the original API base without showing it on another host', async () => {
168
+ await render()
169
+ let pending: Promise<unknown> | undefined
170
+ await act(async () => { pending = start() })
171
+ setApiBase('/c/other/api')
172
+ await render()
173
+ await act(async () => { respond(Response.json({ outcome: 'complete' })); await pending })
174
+ await flush()
175
+ expect(host.textContent).toBe('')
176
+ setApiBase('/api')
177
+ await render()
178
+ expect(host.textContent).toContain('Nothing to evict')
179
+ })
180
+
181
+ it('keeps cluster-scoped drain activity when changing the namespace inventory', async () => {
182
+ let change: (() => Promise<unknown>) | undefined
183
+ function Switch() {
184
+ const { mutateAsync } = useSetActiveNamespace()
185
+ useEffect(() => { change = () => mutateAsync({ namespaces: ['team-a'] }) }, [mutateAsync])
186
+ return <NodeDrainStatus name="worker" nodeUID="node-uid" />
187
+ }
188
+ client.setQueryData(nodeDrainActivityKey('/api', 'worker', 'node-uid'), {
189
+ status: 'pending', startedAt: Date.now(), timeoutSeconds: 120, requestId: 1,
190
+ })
191
+ client.setQueryData(['resources', 'pods'], ['old-pod'])
192
+ await act(async () => {
193
+ root.render(<QueryClientProvider client={client}><Switch /></QueryClientProvider>)
194
+ })
195
+ let pending: Promise<unknown> | undefined
196
+ await act(async () => { pending = change?.() })
197
+ const scope: NamespaceScope = {
198
+ actives: ['team-a'], kubeconfigNamespace: '', mode: 'namespace',
199
+ accessibleNamespaces: ['team-a'], deniedNamespaces: [], authoritative: true,
200
+ canClearNamespace: false, cacheScoped: true, namespaceRescope: true,
201
+ }
202
+ await act(async () => {
203
+ respond(Response.json(scope))
204
+ await pending
205
+ })
206
+ await flush()
207
+ expect(host.textContent).toContain('Drain in progress')
208
+ expect(client.getQueryData(['resources', 'pods'])).toBeUndefined()
209
+ })
210
+
211
+ it('does not recreate a result after the context cache was cleared', async () => {
212
+ await render()
213
+ let pending: Promise<unknown> | undefined
214
+ await act(async () => { pending = start() })
215
+ await render('', false)
216
+ client.removeQueries()
217
+ await act(async () => { respond(Response.json({ outcome: 'complete' })); await pending })
218
+ await render()
219
+ expect(host.textContent).toBe('')
220
+ })
221
+
222
+ it('does not let an older response replace the latest drain result', async () => {
223
+ await render()
224
+ let first: Promise<unknown> | undefined
225
+ let second: Promise<unknown> | undefined
226
+ await act(async () => { first = start() })
227
+ const respondFirst = respond
228
+ await act(async () => { second = start() })
229
+ await act(async () => {
230
+ respond(Response.json({ outcome: 'incomplete', pendingPods: ['shop/web'] }))
231
+ await second
232
+ })
233
+ await flush()
234
+ await act(async () => {
235
+ respondFirst(Response.json({ outcome: 'complete' }))
236
+ await first
237
+ })
238
+ await flush()
239
+ expect(host.textContent).toContain('Drain incomplete: 1 pod left on the node')
240
+ expect(host.textContent).not.toContain('Nothing to evict')
241
+ })
242
+
243
+ it('shows elapsed time and overdue response guidance without inventing a completed outcome', async () => {
244
+ vi.useFakeTimers()
245
+ const activity: NodeDrainActivity = { status: 'pending', startedAt: Date.now(), timeoutSeconds: 120, requestId: 1 }
246
+ client.setQueryData(nodeDrainActivityKey('/api', 'worker', 'node-uid'), activity)
247
+ await render()
248
+ await act(async () => { await vi.advanceTimersByTimeAsync(126_000) })
249
+ expect(host.textContent).toContain('Elapsed 2m 6s')
250
+ expect(host.textContent).toContain("Still waiting for Radar's response")
251
+ expect(host.textContent).toContain('Drain in progress')
252
+ expect(host.querySelector('button')).toBeNull()
253
+ })
@@ -0,0 +1,55 @@
1
+ import { useEffect, useState } from 'react'
2
+ import { Clock, X } from 'lucide-react'
3
+ import { AlertBanner } from '@skyhook-io/k8s-ui'
4
+ import { useNodeDrainActivity } from '../../api/client'
5
+
6
+ function duration(milliseconds: number): string {
7
+ const seconds = Math.max(0, Math.floor(milliseconds / 1000))
8
+ return `${Math.floor(seconds / 60)}m ${seconds % 60}s`
9
+ }
10
+
11
+ export function NodeDrainStatus({ name, nodeUID }: { name: string; nodeUID: string }) {
12
+ const { activity, dismiss } = useNodeDrainActivity(name, nodeUID)
13
+ const [now, setNow] = useState(Date.now)
14
+ const pending = activity?.status === 'pending'
15
+ useEffect(() => {
16
+ if (!pending) return
17
+ const timer = window.setInterval(() => setNow(Date.now()), 1000)
18
+ return () => window.clearInterval(timer)
19
+ }, [pending, activity?.startedAt])
20
+
21
+ if (!activity) return null
22
+ if (activity.status === 'pending') {
23
+ const elapsed = now - activity.startedAt
24
+ return (
25
+ <section aria-label="Drain progress">
26
+ <AlertBanner variant="info" icon={Clock} title="Drain in progress">
27
+ <p>Requesting evictions and waiting for pod deletion.</p>
28
+ <p className="mt-1">Elapsed {duration(elapsed)}. Shared eviction and deletion deadline: {duration(activity.timeoutSeconds * 1000)}. A final verification check can take up to 5 seconds more.</p>
29
+ {elapsed > (activity.timeoutSeconds + 5) * 1000 && (
30
+ <p className="mt-1">Still waiting for Radar's response. Check the connection and the node's pods before retrying or taking it down.</p>
31
+ )}
32
+ <p className="mt-1">You can leave this page and return while this tab stays open.</p>
33
+ </AlertBanner>
34
+ </section>
35
+ )
36
+ }
37
+
38
+ return (
39
+ <section aria-label="Last drain in this tab">
40
+ <AlertBanner
41
+ variant={activity.summary.type}
42
+ title={activity.summary.title}
43
+ action={(
44
+ <button type="button" aria-label="Dismiss drain result" onClick={dismiss} className="text-theme-text-secondary hover:text-theme-text-primary p-1 rounded focus-visible:outline focus-visible:outline-2">
45
+ <X className="w-4 h-4" />
46
+ </button>
47
+ )}
48
+ >
49
+ <p className="text-xs mt-1">Last drain in this tab: <time dateTime={new Date(activity.finishedAt).toISOString()}>{new Date(activity.finishedAt).toLocaleString()}</time>. Duration {duration(activity.finishedAt - activity.startedAt)}.</p>
50
+ <p className="text-xs mt-2 whitespace-pre-line break-words">{activity.summary.detail}</p>
51
+ <p className="text-xs mt-2">Recorded result. Later node or workload changes are not reflected here. Reloading or switching contexts clears this tab's record.</p>
52
+ </AlertBanner>
53
+ </section>
54
+ )
55
+ }
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
2
2
 
3
3
  import { gitOpsOwnerFromRelationships } from '@skyhook-io/k8s-ui'
4
4
  import type { Relationships } from '../../types'
5
- import { supportsBatchExecution } from './WorkloadView'
5
+ import { collectServingRefs, supportsBatchExecution } from './WorkloadView'
6
6
  import { findInheritedGitOpsLookupRef } from '../../hooks/useResolvedGitOpsOwner'
7
7
 
8
8
  describe('findInheritedGitOpsLookupRef', () => {
@@ -75,3 +75,12 @@ describe('supportsBatchExecution', () => {
75
75
  expect(supportsBatchExecution('CronJob', 'cronjobs', 'batch')).toBe(true)
76
76
  })
77
77
  })
78
+
79
+
80
+ describe('collectServingRefs', () => {
81
+ it('loads moved upstream resources while retaining exact API groups', () => {
82
+ const broker = { kind: 'Broker', group: 'eventing.knative.dev', namespace: 'demo', name: 'messages' }
83
+ const other = { ...broker, group: 'other.example' }
84
+ expect(collectServingRefs({ routedFrom: [broker, broker, other] })).toEqual([broker, other])
85
+ })
86
+ })