@skyhook-io/radar-app 1.17.1 → 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.
- package/package.json +9 -9
- package/src/App.tsx +14 -30
- package/src/api/client.gitopsPoll.test.ts +99 -0
- package/src/api/client.helmPreview.test.tsx +48 -0
- package/src/api/client.resourceAvailability.test.ts +24 -0
- package/src/api/client.ts +337 -87
- package/src/api/client.workloadRuns.test.ts +53 -0
- package/src/api/config.test.ts +23 -1
- package/src/api/config.ts +7 -3
- package/src/api/diagnose.ts +4 -1
- package/src/api/drain-plan.test.ts +70 -40
- package/src/api/policy.ts +5 -5
- package/src/api/radarFeatures.ts +1 -0
- package/src/api/traffic.scope.render.test.tsx +60 -0
- package/src/api/traffic.ts +3 -1
- package/src/components/cnpg/CNPGSummaryHost.tsx +4 -3
- package/src/components/diagnose/DiagnoseSurface.tsx +3 -3
- package/src/components/diagnose/InvestigationChangesEvidence.test.tsx +352 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +101 -0
- package/src/components/diagnose/InvestigationView.tsx +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/changes.test.ts +123 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +192 -3
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +73 -51
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +64 -2
- package/src/components/diagnose/investigationEvidence/adapters/resource.test.ts +37 -0
- package/src/components/diagnose/investigationEvidence/adapters/testdata/get-changes-created.json +323 -0
- package/src/components/diagnose/investigationEvidence/bodies/streams.tsx +144 -15
- package/src/components/diagnose/investigationEvidence/observations.ts +20 -0
- package/src/components/diagnose/investigationEvidence/parse.ts +57 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +107 -0
- package/src/components/diagnose/investigationEvidence/types.ts +11 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +18 -0
- package/src/components/diagnose/investigationState.test.ts +36 -1
- package/src/components/diagnose/investigationState.ts +8 -0
- package/src/components/diagnose/launch.ts +2 -2
- package/src/components/dock/BottomDock.tsx +6 -3
- package/src/components/dock/WorkloadLogsTab.tsx +3 -0
- package/src/components/execution/BatchExecutionView.render.test.tsx +29 -1
- package/src/components/execution/BatchExecutionView.tsx +23 -8
- package/src/components/execution/cluster-template-runs.render.test.tsx +42 -0
- package/src/components/gitops/GitOpsView.tsx +7 -0
- package/src/components/helm/HelmReleaseDrawer.tsx +139 -55
- package/src/components/helm/HelmReleaseNotes.test.tsx +42 -0
- package/src/components/helm/HelmReleaseNotes.tsx +26 -0
- package/src/components/helm/OwnedResources.tsx +2 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +76 -4
- package/src/components/helm/TrackChartSourceDialog.test.ts +3 -2
- package/src/components/helm/TrackChartSourceDialog.tsx +41 -15
- package/src/components/helm/ValuesDiffPreview.tsx +4 -1
- package/src/components/home/ClusterHealthCard.tsx +4 -4
- package/src/components/home/CostCard.test.tsx +100 -0
- package/src/components/home/CostCard.tsx +2 -2
- package/src/components/home/HelmSummary.tsx +2 -2
- package/src/components/home/HomeView.tsx +15 -6
- package/src/components/home/MCPSetupDialog.test.tsx +30 -0
- package/src/components/home/MCPSetupDialog.tsx +13 -6
- package/src/components/home/ProblemsPanel.test.tsx +1 -0
- package/src/components/home/mcpToolCatalog.ts +18 -2
- package/src/components/issues/IssuesPane.render.test.tsx +21 -0
- package/src/components/issues/IssuesPane.tsx +31 -7
- package/src/components/issues/UncheckedSourceHelp.test.tsx +42 -0
- package/src/components/issues/UncheckedSourceHelp.tsx +24 -0
- package/src/components/issues/uncheckedSources.test.ts +43 -0
- package/src/components/issues/uncheckedSources.ts +58 -5
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +4 -2
- package/src/components/resources/ImageFilesystemModal.test.tsx +68 -0
- package/src/components/resources/ImageFilesystemModal.tsx +11 -4
- package/src/components/resources/PodFilesystemModal.tsx +2 -2
- package/src/components/resources/ResourcesView.scope.render.test.tsx +58 -0
- package/src/components/resources/ResourcesView.tsx +18 -3
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.test.tsx +111 -0
- package/src/components/resources/renderers/FluxHelmReleaseRenderer.tsx +67 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.scope.render.test.tsx +64 -0
- package/src/components/resources/renderers/KyvernoPolicyCoverage.tsx +6 -7
- package/src/components/settings/SettingsDialog.tsx +21 -15
- package/src/components/traffic/TrafficFilterSidebar.test.tsx +77 -0
- package/src/components/traffic/TrafficFilterSidebar.tsx +42 -31
- package/src/components/traffic/TrafficView.tsx +12 -12
- package/src/components/traffic/trafficFilters.test.ts +20 -1
- package/src/components/traffic/trafficFilters.ts +13 -0
- package/src/components/ui/Omnibar.tsx +13 -2
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/omnibar-match.test.ts +30 -0
- package/src/components/ui/omnibar-match.ts +18 -0
- package/src/components/workload/CronJobSchedulingEvidence.test.tsx +35 -0
- package/src/components/workload/CronJobSchedulingEvidence.tsx +37 -0
- package/src/components/workload/NodeDrainStatus.test.tsx +253 -0
- package/src/components/workload/NodeDrainStatus.tsx +55 -0
- package/src/components/workload/WorkloadView.tsx +37 -5
- package/src/context/ConnectionContext.test.ts +27 -1
- package/src/context/ConnectionContext.tsx +17 -7
- package/src/integrations/resourceHosts.test.tsx +1 -0
- package/src/integrations/resourceHosts.tsx +2 -0
- package/src/utils/navigation.ts +14 -0
- package/src/utils/wails-clipboard.ts +4 -2
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
import type { ServicePortRenderProps } from '@skyhook-io/k8s-ui/components/resources/renderers/ServiceRenderer'
|
|
37
37
|
import { isJobSetV1Alpha2 } from '@skyhook-io/k8s-ui/components/resources/resource-utils-jobset-lws'
|
|
38
38
|
import type { SelectedResource, ResourceRef, Relationships, ResourceWithRelationships } from '../../types'
|
|
39
|
+
import { CronJobSchedulingContext, CronJobSchedulingDetails } from './CronJobSchedulingEvidence'
|
|
39
40
|
import { useHistoryPaging } from './historyPaging'
|
|
40
41
|
import { findInheritedGitOpsLookupRef, useResolvedGitOpsOwner } from '../../hooks/useResolvedGitOpsOwner'
|
|
41
42
|
import { useGitOpsWriteGuard } from '../../hooks/useGitOpsWriteGuard'
|
|
@@ -46,6 +47,7 @@ import {
|
|
|
46
47
|
pluralToKind,
|
|
47
48
|
relatedResourcePath,
|
|
48
49
|
buildWorkloadPath,
|
|
50
|
+
namespacesFromSearch,
|
|
49
51
|
type NavigateToResource,
|
|
50
52
|
} from '../../utils/navigation'
|
|
51
53
|
import {
|
|
@@ -81,6 +83,7 @@ import {
|
|
|
81
83
|
useCordonNode,
|
|
82
84
|
useUncordonNode,
|
|
83
85
|
useDrainNode,
|
|
86
|
+
useNodeDrainActivity,
|
|
84
87
|
useDrainPlan,
|
|
85
88
|
useCascadeDeletePreview,
|
|
86
89
|
useResourceEvents,
|
|
@@ -98,7 +101,7 @@ import { WorkloadCostTab } from '../cost/WorkloadCostTab'
|
|
|
98
101
|
import { isOpenCostWorkloadKind } from '../cost/kinds'
|
|
99
102
|
import { isRadarFeatureUnsupported } from '../../api/radarFeatures'
|
|
100
103
|
import { useTrafficAvailable } from '../../api/traffic'
|
|
101
|
-
import { useResourceAudit, useResourceIssues, useTrace, fetchTraceWithProbes, fetchInClusterCapability, runInClusterMerged } from '../../api/client'
|
|
104
|
+
import { useResourceAudit, useResourceIssues, useSubjectIssues, useRadarFeature, useTrace, fetchTraceWithProbes, fetchInClusterCapability, runInClusterMerged } from '../../api/client'
|
|
102
105
|
import { AuditAlerts, getRadarUpgradeRequirement, ResourceIssuesSection, ReachabilityView, TraceSummary, InClusterConsentDialog, traceFingerprint, staticPollUnreliable, summarizeInClusterTests, type Trace as NetworkTrace, type InClusterCapability, inClusterConsentGiven, consentRequestRows } from '@skyhook-io/k8s-ui'
|
|
103
106
|
import { WorkloadLogsViewer } from '../logs/WorkloadLogsViewer'
|
|
104
107
|
import { ScheduledWorkloadLogsViewer } from '../logs/ScheduledWorkloadLogsViewer'
|
|
@@ -127,6 +130,7 @@ import { cleanYamlForDuplicate } from '../../utils/skeleton-yaml'
|
|
|
127
130
|
import { useDesktopDownload } from '../../hooks/useDesktopDownload'
|
|
128
131
|
import { useCompareLauncher } from '../compare/useCompareLauncher'
|
|
129
132
|
import { useDiagnoseCustomization } from '../../context/DiagnoseCustomization'
|
|
133
|
+
import { NodeDrainStatus } from './NodeDrainStatus'
|
|
130
134
|
|
|
131
135
|
type TabType = WorkloadTabType
|
|
132
136
|
const BATCH_EXECUTION_KINDS = new Set([
|
|
@@ -289,6 +293,7 @@ function useActionsBarProps(
|
|
|
289
293
|
name: string,
|
|
290
294
|
group: string | undefined,
|
|
291
295
|
cascadeEnabled: boolean,
|
|
296
|
+
nodeUID: string,
|
|
292
297
|
) {
|
|
293
298
|
const { showCopied } = useToast()
|
|
294
299
|
const { features } = useCapabilitiesContext()
|
|
@@ -367,7 +372,8 @@ function useActionsBarProps(
|
|
|
367
372
|
const canNodeWrite = useCanNodeWrite()
|
|
368
373
|
const cordonMutation = useCordonNode()
|
|
369
374
|
const uncordonMutation = useUncordonNode()
|
|
370
|
-
const drainMutation = useDrainNode()
|
|
375
|
+
const drainMutation = useDrainNode(nodeUID)
|
|
376
|
+
const { activity: drainActivity } = useNodeDrainActivity(name, nodeUID)
|
|
371
377
|
const drainPlanMutation = useDrainPlan()
|
|
372
378
|
|
|
373
379
|
const { renderAction: renderDiagnose } = useDiagnoseCustomization()
|
|
@@ -473,7 +479,7 @@ function useActionsBarProps(
|
|
|
473
479
|
isUncordoningNode: uncordonMutation.isPending,
|
|
474
480
|
onDrainNode: (params: Parameters<typeof drainMutation.mutate>[0]) =>
|
|
475
481
|
drainMutation.mutate(params),
|
|
476
|
-
isDrainingNode: drainMutation.isPending,
|
|
482
|
+
isDrainingNode: nodeUID ? drainActivity?.status === 'pending' : drainMutation.isPending,
|
|
477
483
|
onPlanDrain: (params: Parameters<typeof drainPlanMutation.mutate>[0]) =>
|
|
478
484
|
drainPlanMutation.mutate(params),
|
|
479
485
|
onPlanDrainReset: () => drainPlanMutation.reset(),
|
|
@@ -496,6 +502,8 @@ export function WorkloadView({
|
|
|
496
502
|
}: WorkloadViewProps) {
|
|
497
503
|
const [searchParams, setSearchParams] = useSearchParams()
|
|
498
504
|
const location = useLocation()
|
|
505
|
+
const viewNamespacesKey = namespacesFromSearch(searchParams).join(',')
|
|
506
|
+
const viewNamespaces = useMemo(() => (viewNamespacesKey ? viewNamespacesKey.split(',') : []), [viewNamespacesKey])
|
|
499
507
|
const apiKind = kindToPluralWithGroup(kindProp, rest.group ?? '')
|
|
500
508
|
const queryClient = useQueryClient()
|
|
501
509
|
const [imageTargetOwnership, setImageTargetOwnership] =
|
|
@@ -563,6 +571,8 @@ export function WorkloadView({
|
|
|
563
571
|
const batchRunsQuery = useWorkloadRuns(apiKind, namespace, name, expanded && batchExecution, {
|
|
564
572
|
refetchActive: true,
|
|
565
573
|
clusterScoped: batchKind === 'ClusterWorkflowTemplate',
|
|
574
|
+
namespaces: viewNamespaces,
|
|
575
|
+
ownerUID: batchKind === 'CronJob' ? resource?.metadata?.uid : undefined,
|
|
566
576
|
})
|
|
567
577
|
const relatedTimelineEvents = useMemo(
|
|
568
578
|
() => batchKind === 'JobSet' ? [] : workloadRunTimelineEvents(batchRunsQuery.data?.runs ?? []),
|
|
@@ -786,6 +796,7 @@ export function WorkloadView({
|
|
|
786
796
|
name,
|
|
787
797
|
effectiveGroup,
|
|
788
798
|
!resourceLoading && Boolean(resource),
|
|
799
|
+
apiKind === 'nodes' && !effectiveGroup ? resource?.metadata?.uid ?? '' : '',
|
|
789
800
|
)
|
|
790
801
|
const desktopDownload = useDesktopDownload()
|
|
791
802
|
|
|
@@ -797,7 +808,14 @@ export function WorkloadView({
|
|
|
797
808
|
// would flip the query key when the manifest arrives, drop liveIssues, and flash
|
|
798
809
|
// the renderer banners. The backend canonicalizes a plural kind via discovery,
|
|
799
810
|
// so using the normalized API kind resolves direct links and app navigation alike.
|
|
800
|
-
const
|
|
811
|
+
const isCronJob = apiKind === 'cronjobs' && (!effectiveGroup || effectiveGroup === 'batch')
|
|
812
|
+
const { support: coverageSupport } = useRadarFeature('resourceIssueCoverage')
|
|
813
|
+
const useCronJobCoverage = isCronJob && coverageSupport === 'supported'
|
|
814
|
+
const ordinaryIssues = useResourceIssues(apiKind, rest.group, namespace, name, !useCronJobCoverage)
|
|
815
|
+
const cronJobIssues = useSubjectIssues(useCronJobCoverage ? { kind: 'CronJob', group: 'batch', namespace, name, uid: resource?.metadata?.uid } : null, useCronJobCoverage && Boolean(resource))
|
|
816
|
+
const liveIssues = useCronJobCoverage ? cronJobIssues.data?.issues : ordinaryIssues.data
|
|
817
|
+
const issuesPending = useCronJobCoverage ? cronJobIssues.isPending : ordinaryIssues.isPending
|
|
818
|
+
const schedulingEvidence = cronJobIssues.data?.scheduling_report?.uid === resource?.metadata?.uid ? cronJobIssues.data?.scheduling_report : undefined
|
|
801
819
|
const { data: auditFindings } = useResourceAudit(apiKind, namespace, name, effectiveGroup)
|
|
802
820
|
const hasOperationalIssues = Boolean(liveIssues?.length)
|
|
803
821
|
const {
|
|
@@ -1180,10 +1198,11 @@ export function WorkloadView({
|
|
|
1180
1198
|
group={effectiveGroup}
|
|
1181
1199
|
selectedRunKey={selectedRunKey}
|
|
1182
1200
|
onSelectRun={handleSelectedRunChange}
|
|
1201
|
+
viewNamespaces={viewNamespaces}
|
|
1183
1202
|
/>
|
|
1184
1203
|
)}
|
|
1185
1204
|
{...resourceDetailSlots({ kind: apiKind, group: resource?.apiVersion ? resourceGroup : effectiveGroup, namespace, name }, rest.extraTabs)}
|
|
1186
|
-
renderExpandedOverview={({ kind: k, apiKind, namespace: ns, name: n, resource: res }) =>
|
|
1205
|
+
renderExpandedOverview={({ kind: k, apiKind, namespace: ns, name: n, resource: res, leadContent }) =>
|
|
1187
1206
|
supportsBatchExecution(k, apiKind, effectiveGroup, res?.apiVersion) &&
|
|
1188
1207
|
res ? (
|
|
1189
1208
|
<BatchExecutionFullscreen
|
|
@@ -1193,11 +1212,13 @@ export function WorkloadView({
|
|
|
1193
1212
|
name={n}
|
|
1194
1213
|
resource={res}
|
|
1195
1214
|
selectedRunKey={selectedRunKey}
|
|
1215
|
+
leadContent={leadContent}
|
|
1196
1216
|
canViewLogs={baseActionsBarProps.canViewLogs}
|
|
1197
1217
|
onSelectRun={handleSelectedRunChange}
|
|
1198
1218
|
onSwitchToLogs={() => handleTabChange('logs')}
|
|
1199
1219
|
onSwitchToTimeline={() => handleTabChange('timeline')}
|
|
1200
1220
|
onNavigateToResource={rest.onNavigateToResource}
|
|
1221
|
+
viewNamespaces={viewNamespaces}
|
|
1201
1222
|
/>
|
|
1202
1223
|
) : null
|
|
1203
1224
|
}
|
|
@@ -1248,6 +1269,9 @@ export function WorkloadView({
|
|
|
1248
1269
|
onDownload={desktopDownload}
|
|
1249
1270
|
actionsBarProps={actionsBarProps}
|
|
1250
1271
|
rendererOverrides={resourceRendererOverrides}
|
|
1272
|
+
renderOverviewIntro={apiKind === 'nodes' && !effectiveGroup && resource?.metadata?.uid
|
|
1273
|
+
? () => <NodeDrainStatus name={name} nodeUID={resource.metadata.uid} />
|
|
1274
|
+
: undefined}
|
|
1251
1275
|
renderOverviewExtra={({ kind: k, namespace: ns, name: n, group: g, context }) => {
|
|
1252
1276
|
// Network entry kinds (Service/Ingress/Route/Gateway) ARE the diagnosis
|
|
1253
1277
|
// target: DiagnoseInlineSection renders in the drawer, no hint. Workload
|
|
@@ -1273,8 +1297,11 @@ export function WorkloadView({
|
|
|
1273
1297
|
)
|
|
1274
1298
|
}}
|
|
1275
1299
|
renderOverviewLead={() => (
|
|
1300
|
+
<div className="flex flex-col gap-4">
|
|
1301
|
+
<CronJobSchedulingContext evidence={schedulingEvidence} onViewTimeline={() => handleTabChange('timeline')} />
|
|
1276
1302
|
<ResourceIssuesSection
|
|
1277
1303
|
issues={liveIssues}
|
|
1304
|
+
renderDetailSection={schedulingEvidence?.state === 'reported' ? ({ issue }) => issue.kind === 'CronJob' && issue.reason === schedulingEvidence.reason ? <CronJobSchedulingDetails evidence={schedulingEvidence} onViewTimeline={() => handleTabChange('timeline')} /> : null : undefined}
|
|
1278
1305
|
compact={!expanded}
|
|
1279
1306
|
subjectResource={{ kind: apiKind, namespace, name, group: rest.group }}
|
|
1280
1307
|
onResourceClick={
|
|
@@ -1289,7 +1316,9 @@ export function WorkloadView({
|
|
|
1289
1316
|
: undefined
|
|
1290
1317
|
}
|
|
1291
1318
|
/>
|
|
1319
|
+
</div>
|
|
1292
1320
|
)}
|
|
1321
|
+
hasOverviewLead={hasOperationalIssues || Boolean(schedulingEvidence && schedulingEvidence.state !== 'reported')}
|
|
1293
1322
|
hasOperationalIssues={hasOperationalIssues}
|
|
1294
1323
|
operationalIssuesPending={issuesPending}
|
|
1295
1324
|
onOpenGitOpsResource={gitopsOwnerObject ? handleOpenGitOpsResource : undefined}
|
|
@@ -1442,6 +1471,7 @@ function LogsTabContent({
|
|
|
1442
1471
|
onConsumeInitialContainer,
|
|
1443
1472
|
selectedRunKey,
|
|
1444
1473
|
onSelectRun,
|
|
1474
|
+
viewNamespaces,
|
|
1445
1475
|
}: {
|
|
1446
1476
|
kind: string
|
|
1447
1477
|
apiKind: string
|
|
@@ -1456,6 +1486,7 @@ function LogsTabContent({
|
|
|
1456
1486
|
onConsumeInitialContainer: () => void
|
|
1457
1487
|
selectedRunKey: string
|
|
1458
1488
|
onSelectRun: (runKey: string) => void
|
|
1489
|
+
viewNamespaces: string[]
|
|
1459
1490
|
}) {
|
|
1460
1491
|
if (SCHEDULED_LOG_KINDS.has(kind) && supportsBatchExecution(kind, apiKind, group, resource?.apiVersion)) {
|
|
1461
1492
|
return (
|
|
@@ -1466,6 +1497,7 @@ function LogsTabContent({
|
|
|
1466
1497
|
name={name}
|
|
1467
1498
|
selectedRunKey={selectedRunKey}
|
|
1468
1499
|
onSelectRun={onSelectRun}
|
|
1500
|
+
viewNamespaces={viewNamespaces}
|
|
1469
1501
|
/>
|
|
1470
1502
|
</div>
|
|
1471
1503
|
)
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query'
|
|
2
3
|
|
|
3
|
-
import { shouldApplyPolledConnection, shouldAutoRetryConnection } from './ConnectionContext'
|
|
4
|
+
import { shouldApplyPolledConnection, shouldAutoRetryConnection, refreshQueriesAfterReconnect } from './ConnectionContext'
|
|
5
|
+
|
|
6
|
+
it('retains local drain activity during same-context reconnects, but clears it for another context', () => {
|
|
7
|
+
const client = new QueryClient()
|
|
8
|
+
const drainKey = ['node-drain-activity', '/api', 'worker', 'node-uid']
|
|
9
|
+
client.setQueryData(drainKey, { status: 'pending' })
|
|
10
|
+
client.setQueryData(['resources', 'nodes'], ['stale-node'])
|
|
11
|
+
refreshQueriesAfterReconnect(client, 'original', 'original')
|
|
12
|
+
expect(client.getQueryData(drainKey)).toEqual({ status: 'pending' })
|
|
13
|
+
expect(client.getQueryData(['resources', 'nodes'])).toBeUndefined()
|
|
14
|
+
refreshQueriesAfterReconnect(client, 'original', 'other')
|
|
15
|
+
expect(client.getQueryData(drainKey)).toBeUndefined()
|
|
16
|
+
client.clear()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('uses the recorded context when SSE has already updated the connection state', () => {
|
|
20
|
+
const client = new QueryClient()
|
|
21
|
+
const drainKey = ['node-drain-activity', '/api', 'worker', 'node-uid']
|
|
22
|
+
client.setQueryData(drainKey, { status: 'pending', contextName: 'original' })
|
|
23
|
+
refreshQueriesAfterReconnect(client, 'other', 'other')
|
|
24
|
+
expect(client.getQueryData(drainKey)).toBeUndefined()
|
|
25
|
+
client.setQueryData(drainKey, { status: 'pending', contextName: 'same' })
|
|
26
|
+
refreshQueriesAfterReconnect(client, '', 'same')
|
|
27
|
+
expect(client.getQueryData(drainKey)).toMatchObject({ status: 'pending' })
|
|
28
|
+
client.clear()
|
|
29
|
+
})
|
|
4
30
|
|
|
5
31
|
describe('shouldAutoRetryConnection', () => {
|
|
6
32
|
it('retries transient failures', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createContext, useContext, useState, useCallback, useEffect, useRef, ReactNode } from 'react'
|
|
2
|
-
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
|
2
|
+
import { useQuery, useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query'
|
|
3
3
|
import { getApiBase } from '../api/config'
|
|
4
4
|
import { readErrorBody } from '../api/httpErrors'
|
|
5
|
-
import { apiFetch, type SyncStatusSnapshot } from '../api/client'
|
|
5
|
+
import { apiFetch, type SyncStatusSnapshot, type NodeDrainActivity } from '../api/client'
|
|
6
6
|
|
|
7
7
|
export type ConnectionStateType = 'connected' | 'disconnected' | 'connecting'
|
|
8
8
|
|
|
@@ -51,6 +51,17 @@ const AUTO_RETRY_INITIAL_DELAY_MS = 10000
|
|
|
51
51
|
const AUTO_RETRY_MAX_DELAY_MS = 60000
|
|
52
52
|
const CONNECTION_STATUS_FALLBACK_POLL_MS = 30000
|
|
53
53
|
|
|
54
|
+
export function refreshQueriesAfterReconnect(queryClient: QueryClient, previousContext: string, nextContext: string) {
|
|
55
|
+
queryClient.removeQueries({
|
|
56
|
+
predicate: query => {
|
|
57
|
+
if (query.queryKey[0] !== 'node-drain-activity') return true
|
|
58
|
+
const activity = queryClient.getQueryData<NodeDrainActivity | null>(query.queryKey)
|
|
59
|
+
return activity?.contextName ? activity.contextName !== nextContext : previousContext !== nextContext
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
queryClient.invalidateQueries()
|
|
63
|
+
}
|
|
64
|
+
|
|
54
65
|
export function shouldAutoRetryConnection(errorType?: string): boolean {
|
|
55
66
|
// Auth-shaped failures are excluded: the server runs its own backoff
|
|
56
67
|
// reconnect loop for those, and each browser retry would invoke the exec
|
|
@@ -274,6 +285,7 @@ export function ConnectionProvider({ children }: { children: ReactNode }) {
|
|
|
274
285
|
}))
|
|
275
286
|
},
|
|
276
287
|
onSuccess: (result) => {
|
|
288
|
+
const previousContext = connectionRef.current.context
|
|
277
289
|
setConnection(result)
|
|
278
290
|
if (result.state === 'connected') {
|
|
279
291
|
// Keep the first-connect bookkeeping and the double-refresh window
|
|
@@ -281,9 +293,7 @@ export function ConnectionProvider({ children }: { children: ReactNode }) {
|
|
|
281
293
|
hasConnectedRef.current = true
|
|
282
294
|
lastCacheRefreshAtRef.current = Date.now()
|
|
283
295
|
}
|
|
284
|
-
|
|
285
|
-
queryClient.removeQueries()
|
|
286
|
-
queryClient.invalidateQueries()
|
|
296
|
+
refreshQueriesAfterReconnect(queryClient, previousContext, result.context)
|
|
287
297
|
},
|
|
288
298
|
onError: (error: Error) => {
|
|
289
299
|
const retryError = error as ConnectionRetryError
|
|
@@ -342,13 +352,13 @@ export function ConnectionProvider({ children }: { children: ReactNode }) {
|
|
|
342
352
|
recovered = true
|
|
343
353
|
autoRetryDelayRef.current = AUTO_RETRY_INITIAL_DELAY_MS
|
|
344
354
|
sseActiveRef.current = false
|
|
355
|
+
const previousContext = connectionRef.current.context
|
|
345
356
|
setConnection(result)
|
|
346
357
|
if (result.state === 'connected') {
|
|
347
358
|
hasConnectedRef.current = true
|
|
348
359
|
lastCacheRefreshAtRef.current = Date.now()
|
|
349
360
|
}
|
|
350
|
-
queryClient.
|
|
351
|
-
queryClient.invalidateQueries()
|
|
361
|
+
refreshQueriesAfterReconnect(queryClient, previousContext, result.context)
|
|
352
362
|
})
|
|
353
363
|
.catch((error: Error) => {
|
|
354
364
|
if (stopped) return
|
|
@@ -55,6 +55,7 @@ describe('application resource hosts', () => {
|
|
|
55
55
|
'RolloutRenderer', 'KyvernoPolicyCoverage', 'KyvernoPolicyQueued', 'CNPGObjectStoreRenderer',
|
|
56
56
|
'VeleroBSLRenderer', 'VeleroBackupRenderer', 'VeleroRestoreRenderer', 'CNPGClusterRenderer',
|
|
57
57
|
'CNPGDatabaseRenderer', 'CNPGPublicationRenderer', 'CNPGSubscriptionRenderer', 'CNPGImageCatalogRenderer',
|
|
58
|
+
'FluxHelmReleaseRenderer',
|
|
58
59
|
].sort())
|
|
59
60
|
const inherited = [{ id: 'local', label: 'Local', render: () => null }]
|
|
60
61
|
expect(resourceDetailSlots({ kind: 'Pod', group: '', namespace: 'db', name: 'pg-1' }, inherited).extraTabs).toEqual(inherited)
|
|
@@ -35,6 +35,7 @@ import { KyvernoPolicyQueued } from '../components/resources/renderers/KyvernoPo
|
|
|
35
35
|
import { VeleroBSLRenderer } from '../components/resources/renderers/VeleroBSLRenderer'
|
|
36
36
|
import { VeleroBackupRenderer } from '../components/resources/renderers/VeleroBackupRenderer'
|
|
37
37
|
import { VeleroRestoreRenderer } from '../components/resources/renderers/VeleroRestoreRenderer'
|
|
38
|
+
import { FluxHelmReleaseRenderer } from '../components/resources/renderers/FluxHelmReleaseRenderer'
|
|
38
39
|
|
|
39
40
|
export const resourceHosts: readonly ResourceHost[] = [
|
|
40
41
|
{ id: 'kubernetes', renderers: { PodRenderer, NodeRenderer, ServiceRenderer, WorkloadRenderer, HPARenderer, PVCRenderer } },
|
|
@@ -47,6 +48,7 @@ export const resourceHosts: readonly ResourceHost[] = [
|
|
|
47
48
|
{ id: 'rollouts', renderers: { RolloutRenderer } },
|
|
48
49
|
{ id: 'kyverno', renderers: { KyvernoPolicyCoverage, KyvernoPolicyQueued } },
|
|
49
50
|
{ id: 'velero', renderers: { VeleroBSLRenderer, VeleroBackupRenderer, VeleroRestoreRenderer } },
|
|
51
|
+
{ id: 'flux', renderers: { FluxHelmReleaseRenderer } },
|
|
50
52
|
cnpgResourceHost,
|
|
51
53
|
]
|
|
52
54
|
|
package/src/utils/navigation.ts
CHANGED
|
@@ -134,6 +134,20 @@ export function openExternal(url: string): void {
|
|
|
134
134
|
})
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/** The header picker's namespace selection as the URL carries it: App keeps
|
|
138
|
+
* ?namespaces= in sync with its state (legacy ?namespace= still read). */
|
|
139
|
+
export function namespacesFromSearch(params: URLSearchParams): string[] {
|
|
140
|
+
const nsParam = params.get('namespaces')
|
|
141
|
+
if (nsParam) {
|
|
142
|
+
return nsParam.split(',').map(s => s.trim()).filter(Boolean)
|
|
143
|
+
}
|
|
144
|
+
const ns = params.get('namespace')
|
|
145
|
+
if (ns) {
|
|
146
|
+
return [ns]
|
|
147
|
+
}
|
|
148
|
+
return []
|
|
149
|
+
}
|
|
150
|
+
|
|
137
151
|
// setMainView's cross-view params. A navigation whose search omits
|
|
138
152
|
// ?namespaces= reads as an empty pick to App's URL sync, which clears the
|
|
139
153
|
// user's namespace scope.
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
// these accelerators with nil callbacks (native responder chain), but WKWebView
|
|
11
11
|
// does NOT dispatch a DOM copy/cut event from the native copy: selector.
|
|
12
12
|
// The keydown event DOES reach JS, so we intercept it here.
|
|
13
|
-
// Cmd+V: Handled by menu.go's explicit WindowExecJS callback which reads
|
|
14
|
-
//
|
|
13
|
+
// Cmd+V: Handled by menu.go's explicit WindowExecJS callback, which reads
|
|
14
|
+
// through Wails on macOS. Focused Monaco editors receive a text paste command
|
|
15
|
+
// to avoid their rich paste handler reading the clipboard again. Other
|
|
16
|
+
// inputs receive a synthetic paste event.
|
|
15
17
|
// Right-click Copy/Cut (Monaco): Monaco calls document.execCommand('copy'/'cut'),
|
|
16
18
|
// intercepted by the monkey-patch below.
|
|
17
19
|
// Right-click Paste (Monaco): Not supported — Monaco calls navigator.clipboard
|