@skyhook-io/radar-app 1.19.0 → 1.20.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/README.md +1 -1
- package/package.json +5 -5
- package/src/App.tsx +31 -5
- package/src/api/application-evidence.ts +63 -0
- package/src/api/argoSync.test.ts +22 -0
- package/src/api/client.audit-gating.test.tsx +48 -0
- package/src/api/client.kueuePosition.test.ts +32 -0
- package/src/api/client.kueueQueueWorkloads.test.tsx +71 -0
- package/src/api/client.resource-identity.test.ts +3 -0
- package/src/api/client.resourceIssues.test.tsx +239 -0
- package/src/api/client.resourcePath.test.ts +3 -0
- package/src/api/client.ts +285 -55
- package/src/api/config.ts +21 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/radarFeatures.render.test.tsx +33 -1
- package/src/api/radarFeatures.test.ts +47 -0
- package/src/api/radarFeatures.ts +40 -1
- package/src/api/rbac.settled.test.tsx +42 -0
- package/src/api/rbac.test.ts +18 -0
- package/src/api/rbac.ts +37 -7
- package/src/api/traffic.ts +9 -4
- package/src/api/usage-data.fixtures.ts +3 -1
- package/src/api/usage-data.test.tsx +134 -0
- package/src/api/usage-data.ts +35 -7
- package/src/api/workloadPodsPolling.test.ts +26 -0
- package/src/components/CloudConnectFlow.test.tsx +86 -0
- package/src/components/CloudConnectFlow.tsx +65 -27
- package/src/components/CloudFunnelButton.test.tsx +140 -5
- package/src/components/CloudFunnelButton.tsx +50 -9
- package/src/components/ConnectionErrorView.test.tsx +34 -0
- package/src/components/ConnectionErrorView.tsx +35 -11
- package/src/components/ContextSwitcher.tsx +5 -2
- package/src/components/SwitchAwareConnectionError.test.tsx +43 -0
- package/src/components/SwitchAwareConnectionError.tsx +85 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.flow.test.tsx +234 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.test.tsx +144 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.tsx +218 -0
- package/src/components/capacity/CapacityDemand.tsx +3 -2
- package/src/components/capacity/demandSummary.test.ts +38 -0
- package/src/components/capacity/shared.tsx +12 -1
- package/src/components/cost/ApplicationCostTab.tsx +4 -0
- package/src/components/cost/CostTrendChart.tsx +2 -0
- package/src/components/cost/WorkloadCostTab.tsx +4 -0
- package/src/components/cost/source.test.ts +5 -0
- package/src/components/cost/source.ts +11 -0
- package/src/components/diagnose/AIMarkdown.tsx +3 -0
- package/src/components/diagnose/AgentSetupNotice.test.tsx +17 -0
- package/src/components/diagnose/AgentSetupNotice.tsx +21 -3
- package/src/components/diagnose/ContinueInAgentButton.mounted.test.tsx +182 -0
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +128 -0
- package/src/components/diagnose/ContinueInAgentButton.tsx +303 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +1 -1
- package/src/components/diagnose/DiagnoseContext.tsx +68 -2
- package/src/components/diagnose/DiagnoseSurface.tsx +58 -113
- package/src/components/diagnose/ExampleInvestigationLink.tsx +20 -0
- package/src/components/diagnose/Home.test.tsx +26 -0
- package/src/components/diagnose/Home.tsx +20 -1
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +45 -22
- package/src/components/diagnose/InvestigationView.tsx +94 -26
- package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +450 -0
- package/src/components/diagnose/LocalDiagnoseAction.tsx +354 -35
- package/src/components/diagnose/NextStepJump.test.tsx +92 -0
- package/src/components/diagnose/NextStepJump.tsx +75 -0
- package/src/components/diagnose/QuestionComposer.tsx +8 -0
- package/src/components/diagnose/exampleInvestigation.events.json +191 -0
- package/src/components/diagnose/exampleInvestigation.loadFailure.test.tsx +94 -0
- package/src/components/diagnose/exampleInvestigation.test.tsx +248 -0
- package/src/components/diagnose/exampleInvestigation.ts +121 -0
- package/src/components/diagnose/investigationCase.test.tsx +9 -1
- package/src/components/diagnose/investigationEvidence/adapters/applicationFindings.test.ts +739 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +50 -2
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +9 -0
- package/src/components/diagnose/investigationEvidence/builder.ts +30 -0
- package/src/components/diagnose/investigationEvidence/observations.ts +121 -2
- package/src/components/diagnose/investigationEvidence/projection.test.ts +85 -3
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/diagnose/investigationState.ts +28 -0
- package/src/components/diagnose/lastInvestigation.test.ts +95 -0
- package/src/components/diagnose/lastInvestigation.ts +58 -0
- package/src/components/diagnose/launch.test.ts +125 -1
- package/src/components/diagnose/launch.ts +57 -10
- package/src/components/diagnose/toolCallLabel.test.ts +10 -4
- package/src/components/execution/BatchExecutionView.tsx +24 -11
- package/src/components/execution/JobSetAdmission.test.tsx +42 -0
- package/src/components/execution/JobSetAdmission.tsx +18 -3
- package/src/components/execution/JobSetMemberComparison.tsx +2 -1
- package/src/components/execution/runState.test.ts +14 -0
- package/src/components/execution/runState.ts +8 -0
- package/src/components/gitops/GitOpsView.rollbackGate.test.tsx +202 -0
- package/src/components/gitops/GitOpsView.syncRequest.test.tsx +369 -0
- package/src/components/gitops/GitOpsView.tsx +86 -17
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +2 -3
- package/src/components/gitops/destination-toast.test.ts +1 -1
- package/src/components/gitops/destination-toast.ts +2 -2
- package/src/components/home/ClusterHealthCard.tsx +1 -1
- package/src/components/home/HomeAgentBlock.test.tsx +31 -3
- package/src/components/home/HomeAgentBlock.tsx +13 -4
- package/src/components/home/HomeDiagramCard.tsx +47 -0
- package/src/components/home/HomeView.tsx +81 -41
- package/src/components/home/MCPSetupDialog.test.tsx +95 -5
- package/src/components/home/MCPSetupDialog.tsx +30 -5
- package/src/components/home/ProblemsPanel.investigate.test.tsx +171 -0
- package/src/components/home/ProblemsPanel.test.tsx +3 -1
- package/src/components/home/TopologyPreview.test.tsx +73 -0
- package/src/components/home/TopologyPreview.tsx +120 -233
- package/src/components/home/TrafficSummary.test.tsx +63 -0
- package/src/components/home/TrafficSummary.tsx +135 -138
- package/src/components/home/mcpToolCatalog.ts +23 -10
- package/src/components/issues/IssuesPane.test.ts +11 -0
- package/src/components/issues/IssuesPane.tsx +15 -5
- package/src/components/issues/uncheckedSources.test.ts +20 -1
- package/src/components/issues/uncheckedSources.ts +18 -0
- package/src/components/kueue/KueuePendingPosition.tsx +35 -0
- package/src/components/kueue/useRelatedObjects.test.tsx +219 -0
- package/src/components/kueue/useRelatedReads.test.ts +56 -0
- package/src/components/kueue/useRelatedReads.ts +205 -0
- package/src/components/logs/MultiPodLogsTab.test.tsx +93 -0
- package/src/components/logs/MultiPodLogsTab.tsx +120 -0
- package/src/components/logs/PodLogsUnavailable.test.tsx +18 -0
- package/src/components/logs/PodLogsUnavailable.tsx +21 -0
- package/src/components/logs/RayClusterLogsTab.reselect.test.tsx +67 -0
- package/src/components/logs/RayClusterLogsTab.test.tsx +167 -0
- package/src/components/logs/RayClusterLogsTab.tsx +109 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +3 -2
- package/src/components/logs/rayClusterPods.ts +32 -0
- package/src/components/outageSince.test.ts +21 -0
- package/src/components/outageSince.ts +10 -0
- package/src/components/resource/PrometheusCharts.overlays.test.ts +12 -0
- package/src/components/resource/PrometheusCharts.tsx +3 -40
- package/src/components/resources/crd/CRDSchemaTab.test.tsx +28 -0
- package/src/components/resources/crd/CRDSchemaTab.tsx +13 -0
- package/src/components/resources/crd/host.tsx +14 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.test.tsx +27 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.tsx +12 -0
- package/src/components/resources/renderers/JobAdmissionRenderers.test.tsx +4 -1
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +4 -3
- package/src/components/resources/renderers/KueueHostRenderers.test.tsx +117 -0
- package/src/components/resources/renderers/KueueQueueRenderers.test.tsx +97 -0
- package/src/components/resources/renderers/KueueQueueRenderers.tsx +139 -0
- package/src/components/resources/renderers/KueueWorkloadRenderer.test.tsx +7 -1
- package/src/components/resources/renderers/KueueWorkloadRenderer.tsx +47 -7
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.test.tsx +67 -0
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.tsx +31 -0
- package/src/components/resources/renderers/RayClusterRenderer.test.tsx +81 -3
- package/src/components/resources/renderers/RayClusterRenderer.tsx +19 -4
- package/src/components/traffic/TrafficView.tsx +3 -3
- package/src/components/ui/command-items-crd.test.tsx +23 -0
- package/src/components/ui/command-items.ts +2 -1
- package/src/components/useContextSwitchFlow.test.tsx +61 -0
- package/src/components/useContextSwitchFlow.tsx +21 -4
- package/src/components/whats-new/WhatsNew.test.ts +10 -3
- package/src/components/whats-new/WhatsNew.tsx +5 -1
- package/src/components/whats-new/WhatsNewDialog.test.tsx +17 -3
- package/src/components/whats-new/releaseNotes.ts +77 -4
- package/src/components/workload/RelatedFindingsSection.test.tsx +126 -0
- package/src/components/workload/RelatedFindingsSection.tsx +80 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +85 -98
- package/src/components/workload/issueResourceOpener.test.ts +20 -0
- package/src/components/workload/issueResourceOpener.ts +17 -0
- package/src/context/ConnectionContext.tsx +133 -60
- package/src/context/ConnectionProvider.retry.test.tsx +176 -0
- package/src/context/ContextSwitchContext.tsx +14 -1
- package/src/context/DiagnoseCustomization.tsx +3 -0
- package/src/context/clusterConnected.ts +10 -0
- package/src/contexts/CapabilitiesContext.tsx +6 -4
- package/src/hooks/useElementSize.ts +30 -0
- package/src/integrations/resourceHost.test.tsx +1 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +21 -4
- package/src/integrations/resourceHosts.tsx +12 -0
- package/src/main.tsx +5 -0
- package/src/utils/related-findings.ts +46 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LucideIcon } from 'lucide-react'
|
|
2
|
-
import { BellOff, Bot, Database, GitCompareArrows, HardDrive, Hourglass, Layers, MessageCircleQuestionMark, Network, RefreshCcw, Scale, ScanSearch, ScrollText, Search, ShieldAlert, SlidersHorizontal, Undo2 } from 'lucide-react'
|
|
2
|
+
import { Activity, BellOff, Bot, Boxes, Braces, Database, GitCompareArrows, HardDrive, Hourglass, Layers, MessageCircleQuestionMark, Network, RefreshCcw, Scale, ScanSearch, ScrollText, Search, ShieldAlert, SlidersHorizontal, Undo2 } from 'lucide-react'
|
|
3
3
|
import { compareVersions } from '../../utils/version'
|
|
4
4
|
|
|
5
5
|
export interface ReleaseHighlight {
|
|
@@ -48,6 +48,76 @@ export const CHANGELOG_URL = 'https://radarhq.io/changelog'
|
|
|
48
48
|
// major release must have its own entry: scripts/check-whats-new.sh refuses to
|
|
49
49
|
// release one without it.
|
|
50
50
|
export const RELEASE_NOTES: ReleaseNotes[] = [
|
|
51
|
+
{
|
|
52
|
+
version: 'v1.20.0',
|
|
53
|
+
highlights: [
|
|
54
|
+
{
|
|
55
|
+
id: 'crd-schema-browser',
|
|
56
|
+
icon: Braces,
|
|
57
|
+
title: 'Explore CRDs and their schemas',
|
|
58
|
+
description: 'CRDs now have a sidebar row and a schema browser. Search fields, paste a path from an API error, and read types, defaults and validation rules.',
|
|
59
|
+
leadDescription: "CustomResourceDefinitions now have a sidebar row, and typing crd finds them in Cmd-K. The drawer and a full Schema tab show each version's fields in a tree like kubectl explain, with types, defaults and validation rules. Paste a path from an API server error to find the field and see the rules on its parents.",
|
|
60
|
+
importance: 8,
|
|
61
|
+
path: '/resources/customresourcedefinitions?apiGroup=apiextensions.k8s.io',
|
|
62
|
+
cta: 'Open CRDs',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'rollbacks-safer-syncs',
|
|
66
|
+
icon: Undo2,
|
|
67
|
+
title: 'Reliable rollbacks and safer Argo CD syncs',
|
|
68
|
+
description: "Argo CD rollback works and reports what it deployed; Deployment rollback matches kubectl. Syncs keep the Application's options and leave pruning off.",
|
|
69
|
+
importance: 7,
|
|
70
|
+
path: '/gitops',
|
|
71
|
+
cta: 'Open GitOps',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'kueue-support',
|
|
75
|
+
icon: Layers,
|
|
76
|
+
title: 'Deep Kueue support',
|
|
77
|
+
description: 'Browse queue Workloads, admission history and Kueue-reported pending positions. Issues flag rejected checks and broken queues, not quota waits.',
|
|
78
|
+
importance: 7,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'issues-more-failures',
|
|
82
|
+
icon: ShieldAlert,
|
|
83
|
+
title: 'Issues explain more failures',
|
|
84
|
+
description: 'Failed cert-manager renewals, evicted Pods with their node, surge deadlocks on ReadWriteOnce volumes, and webhooks that may block Pod creation.',
|
|
85
|
+
importance: 6,
|
|
86
|
+
path: '/issues',
|
|
87
|
+
cta: 'Open Issues',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'deeper-operator-support',
|
|
91
|
+
icon: Boxes,
|
|
92
|
+
title: 'Deeper Strimzi, Ray, JobSet and KServe support',
|
|
93
|
+
description: 'See failed connector tasks even when Ready, JobSet members in Topology and current Ray Pod logs. KServe flags failed components, not planned stops.',
|
|
94
|
+
importance: 6,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'application-evidence',
|
|
98
|
+
icon: Database,
|
|
99
|
+
title: 'Collect RabbitMQ, NATS and Vault evidence locally',
|
|
100
|
+
description: "On local Radar, collect one Pod's RabbitMQ alarms, NATS consumer counters or Vault seal state from a default plaintext endpoint.",
|
|
101
|
+
importance: 6,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'otel-flagger',
|
|
105
|
+
icon: Activity,
|
|
106
|
+
title: 'Deeper OpenTelemetry and Flagger support',
|
|
107
|
+
description: 'Flagger Issues name missing targets, metric templates and provider Secrets. AI diagnosis reads Collectors and Canaries through current workloads.',
|
|
108
|
+
importance: 5,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
improvements: [
|
|
112
|
+
// The grid fills row by row: pair lines of similar length.
|
|
113
|
+
'Switching to an unreachable context keeps your current cluster; Cannot Connect says since when',
|
|
114
|
+
'Issue rows and Investigate buttons show recent local investigations; see an example before your first',
|
|
115
|
+
'Limit what Radar can reach with rbac.namespaces, disableExec and --disable-auto-port-forward',
|
|
116
|
+
'GitOps trees show operator-created workloads; drawers link webhooks, issuers and Secrets',
|
|
117
|
+
'get_changes includes RBAC and Node edits; search finds resources by a pasted IP or ip:port',
|
|
118
|
+
'Issues link a missing Secret to its SealedSecret and report missing parent Gateways',
|
|
119
|
+
],
|
|
120
|
+
},
|
|
51
121
|
{
|
|
52
122
|
version: 'v1.19.0',
|
|
53
123
|
highlights: [
|
|
@@ -374,7 +444,10 @@ export function unreadReleases(
|
|
|
374
444
|
// skipped releases sees the best of them, weighted toward the newest; older
|
|
375
445
|
// releases than this list covers are left to the changelog.
|
|
376
446
|
export const RELEASE_WEIGHTS = [1, 0.75, 0.5]
|
|
377
|
-
export const MAX_CARDS =
|
|
447
|
+
export const MAX_CARDS = 7
|
|
448
|
+
// Auto-open weighs only the strongest cards, so a release can't clear the bar
|
|
449
|
+
// on a long list of minor ones.
|
|
450
|
+
export const SCORED_CARDS = 5
|
|
378
451
|
export const MAX_LINES = 8
|
|
379
452
|
// A fuller set of useful improvements can merit an announcement even without
|
|
380
453
|
// a single release-defining feature.
|
|
@@ -396,7 +469,7 @@ export interface ComposedNotes {
|
|
|
396
469
|
/** The first one leads the dialog at full width. */
|
|
397
470
|
highlights: ComposedHighlight[]
|
|
398
471
|
lines: ComposedLine[]
|
|
399
|
-
/** Sum of the shown highlights' scores. */
|
|
472
|
+
/** Sum of the strongest shown highlights' scores, up to SCORED_CARDS. */
|
|
400
473
|
score: number
|
|
401
474
|
/** False when older unseen releases were left out. */
|
|
402
475
|
complete: boolean
|
|
@@ -419,7 +492,7 @@ export function composeReleaseNotes(releases: ReleaseNotes[]): ComposedNotes {
|
|
|
419
492
|
versions: shown.map(notes => notes.version),
|
|
420
493
|
highlights,
|
|
421
494
|
lines,
|
|
422
|
-
score: highlights.reduce((sum, h) => sum + h.score, 0),
|
|
495
|
+
score: highlights.slice(0, SCORED_CARDS).reduce((sum, h) => sum + h.score, 0),
|
|
423
496
|
complete: shown.length === releases.length,
|
|
424
497
|
}
|
|
425
498
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { act } from "react";
|
|
4
|
+
import { createRoot } from "react-dom/client";
|
|
5
|
+
import { renderToString } from "react-dom/server";
|
|
6
|
+
import type { RelatedFindingsGroup } from "@skyhook-io/k8s-ui";
|
|
7
|
+
import { RelatedFindingsSection } from "./RelatedFindingsSection";
|
|
8
|
+
|
|
9
|
+
const cached: RelatedFindingsGroup = {
|
|
10
|
+
associatedVia: {
|
|
11
|
+
group: "kafka.strimzi.io",
|
|
12
|
+
kind: "KafkaConnect",
|
|
13
|
+
namespace: "app",
|
|
14
|
+
name: "connect",
|
|
15
|
+
},
|
|
16
|
+
kinds: {
|
|
17
|
+
count: 1,
|
|
18
|
+
names: [{ group: "kafka.strimzi.io", kind: "KafkaConnector" }],
|
|
19
|
+
},
|
|
20
|
+
checked: 1,
|
|
21
|
+
unknown: 0,
|
|
22
|
+
gaps: [],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
describe("Related findings coverage", () => {
|
|
26
|
+
it("opens the association anchor using the host's resource navigation", () => {
|
|
27
|
+
const onResourceClick = vi.fn();
|
|
28
|
+
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
|
29
|
+
const host = document.createElement("div");
|
|
30
|
+
const root = createRoot(host);
|
|
31
|
+
try {
|
|
32
|
+
act(() =>
|
|
33
|
+
root.render(
|
|
34
|
+
<RelatedFindingsSection
|
|
35
|
+
data={[{ ...cached, unknown: 1 }]}
|
|
36
|
+
onResourceClick={onResourceClick}
|
|
37
|
+
/>,
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
const button = host.querySelector("button")!;
|
|
41
|
+
expect(button.textContent).toBe(
|
|
42
|
+
"KafkaConnect app/connect (kafka.strimzi.io)",
|
|
43
|
+
);
|
|
44
|
+
act(() => button.click());
|
|
45
|
+
expect(onResourceClick).toHaveBeenCalledWith(cached.associatedVia);
|
|
46
|
+
} finally {
|
|
47
|
+
act(() => root.unmount());
|
|
48
|
+
vi.unstubAllGlobals();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
it("hides absent, empty and assessed groups without findings or limitations", () => {
|
|
52
|
+
for (const data of [undefined, [], [cached]])
|
|
53
|
+
expect(renderToString(<RelatedFindingsSection data={data} />)).toBe("");
|
|
54
|
+
});
|
|
55
|
+
it("explains unassessable snapshots from structured fields alone", () => {
|
|
56
|
+
const html = renderToString(
|
|
57
|
+
<RelatedFindingsSection data={[{ ...cached, unknown: 1 }]} />,
|
|
58
|
+
);
|
|
59
|
+
expect(html).toContain("1 of 1 checked resources");
|
|
60
|
+
expect(html).toContain("could not be assessed");
|
|
61
|
+
expect(html).toContain("KafkaConnector (kafka.strimzi.io)");
|
|
62
|
+
expect(html).toContain("status is reported separately");
|
|
63
|
+
expect(html).not.toContain("Operational issues");
|
|
64
|
+
});
|
|
65
|
+
it.each([
|
|
66
|
+
["radar_kind_not_collected", "Radar doesn't collect it"],
|
|
67
|
+
["kind_sync_pending", "still loading"],
|
|
68
|
+
])("explains %s using the existing read vocabulary", (code, explanation) => {
|
|
69
|
+
const html = renderToString(
|
|
70
|
+
<RelatedFindingsSection data={[{ ...cached, gaps: [{ code }] }]} />,
|
|
71
|
+
);
|
|
72
|
+
expect(html).toContain(explanation);
|
|
73
|
+
});
|
|
74
|
+
it("keeps input gaps and output omissions distinct", () => {
|
|
75
|
+
const gap = { ...cached, checked: 0, gaps: [{ code: "list_too_large" }] };
|
|
76
|
+
const html = renderToString(<RelatedFindingsSection data={[gap]} />);
|
|
77
|
+
expect(html).toContain("incomplete related inventory");
|
|
78
|
+
expect(html).not.toContain("Additional related findings were omitted");
|
|
79
|
+
const both = renderToString(
|
|
80
|
+
<RelatedFindingsSection data={[{ ...gap, truncated: true }]} />,
|
|
81
|
+
);
|
|
82
|
+
expect(both).toContain("incomplete related inventory");
|
|
83
|
+
expect(both).toContain("Additional related findings were omitted");
|
|
84
|
+
});
|
|
85
|
+
it("keeps independent anchors and counts separate without connector wording", () => {
|
|
86
|
+
const groups: RelatedFindingsGroup[] = [
|
|
87
|
+
{
|
|
88
|
+
...cached,
|
|
89
|
+
associatedVia: {
|
|
90
|
+
group: "postgresql.cnpg.io",
|
|
91
|
+
kind: "Cluster",
|
|
92
|
+
namespace: "db",
|
|
93
|
+
name: "orders",
|
|
94
|
+
},
|
|
95
|
+
kinds: {
|
|
96
|
+
count: 1,
|
|
97
|
+
names: [{ group: "postgresql.cnpg.io", kind: "Backup" }],
|
|
98
|
+
},
|
|
99
|
+
checked: 2,
|
|
100
|
+
unknown: 1,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
...cached,
|
|
104
|
+
associatedVia: {
|
|
105
|
+
group: "external-secrets.io",
|
|
106
|
+
kind: "ExternalSecret",
|
|
107
|
+
namespace: "app",
|
|
108
|
+
name: "credentials",
|
|
109
|
+
},
|
|
110
|
+
kinds: {
|
|
111
|
+
count: 1,
|
|
112
|
+
names: [{ group: "external-secrets.io", kind: "ClusterSecretStore" }],
|
|
113
|
+
},
|
|
114
|
+
checked: 3,
|
|
115
|
+
unknown: 2,
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
const html = renderToString(<RelatedFindingsSection data={groups} />);
|
|
119
|
+
expect(html).toContain("db/orders");
|
|
120
|
+
expect(html).toContain("app/credentials");
|
|
121
|
+
expect(html).toContain("1 of 2 checked");
|
|
122
|
+
expect(html).toContain("2 of 3 checked");
|
|
123
|
+
expect(html).not.toContain("3 of 5");
|
|
124
|
+
expect(html).not.toContain("connector");
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Info } from "lucide-react";
|
|
2
|
+
import {
|
|
3
|
+
ResourceIssuesSection,
|
|
4
|
+
type IssueResourceRef,
|
|
5
|
+
type RelatedFindingsGroup,
|
|
6
|
+
} from "@skyhook-io/k8s-ui";
|
|
7
|
+
import { relatedFindingLimitations } from "../../utils/related-findings";
|
|
8
|
+
|
|
9
|
+
export function RelatedFindingsSection({
|
|
10
|
+
data,
|
|
11
|
+
onResourceClick,
|
|
12
|
+
}: {
|
|
13
|
+
data: RelatedFindingsGroup[] | undefined;
|
|
14
|
+
onResourceClick?: (ref: IssueResourceRef) => void;
|
|
15
|
+
}) {
|
|
16
|
+
const groups = data?.filter(
|
|
17
|
+
(group) =>
|
|
18
|
+
group.findings?.length ||
|
|
19
|
+
group.truncated ||
|
|
20
|
+
group.unknown > 0 ||
|
|
21
|
+
group.gaps.length > 0,
|
|
22
|
+
);
|
|
23
|
+
if (!groups?.length) return null;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className="space-y-4">
|
|
27
|
+
{groups.map((group, index) => {
|
|
28
|
+
const anchor = group.associatedVia;
|
|
29
|
+
const limits = relatedFindingLimitations(group);
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
key={`${anchor.group}/${anchor.kind}/${anchor.namespace}/${anchor.name}/${index}`}
|
|
33
|
+
className="space-y-2 border-b border-theme-border pb-4 last:border-0 last:pb-0"
|
|
34
|
+
>
|
|
35
|
+
{group.findings?.length ? (
|
|
36
|
+
<ResourceIssuesSection
|
|
37
|
+
heading="Related findings"
|
|
38
|
+
issues={group.findings}
|
|
39
|
+
onResourceClick={onResourceClick}
|
|
40
|
+
/>
|
|
41
|
+
) : (
|
|
42
|
+
<h3 className="flex items-center gap-2 px-1 text-xs font-semibold uppercase tracking-wide text-theme-text-secondary">
|
|
43
|
+
<Info
|
|
44
|
+
className="h-4 w-4 text-theme-text-tertiary"
|
|
45
|
+
aria-hidden
|
|
46
|
+
/>
|
|
47
|
+
Related findings
|
|
48
|
+
</h3>
|
|
49
|
+
)}
|
|
50
|
+
<p className="text-xs text-theme-text-secondary">
|
|
51
|
+
Via{" "}
|
|
52
|
+
{onResourceClick ? (
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
className="text-accent hover:underline"
|
|
56
|
+
onClick={() => onResourceClick(anchor)}
|
|
57
|
+
>
|
|
58
|
+
{`${anchor.kind} ${anchor.namespace ? `${anchor.namespace}/` : ""}${anchor.name}${anchor.group ? ` (${anchor.group})` : ""}`}
|
|
59
|
+
</button>
|
|
60
|
+
) : (
|
|
61
|
+
`${anchor.kind} ${anchor.namespace ? `${anchor.namespace}/` : ""}${anchor.name}${anchor.group ? ` (${anchor.group})` : ""}`
|
|
62
|
+
)}
|
|
63
|
+
. These findings concern the linked resources; this resource's
|
|
64
|
+
status is reported separately.
|
|
65
|
+
</p>
|
|
66
|
+
{limits.length > 0 && (
|
|
67
|
+
<ul className="text-xs text-theme-text-secondary">
|
|
68
|
+
{limits.map((limit) => (
|
|
69
|
+
<li key={`${limit.kind}/${limit.message}`}>
|
|
70
|
+
{limit.message}
|
|
71
|
+
</li>
|
|
72
|
+
))}
|
|
73
|
+
</ul>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
})}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -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 { collectServingRefs, supportsBatchExecution } from './WorkloadView'
|
|
5
|
+
import { collectServingRefs, memberOverviewParams, supportsBatchExecution } from './WorkloadView'
|
|
6
6
|
import { findInheritedGitOpsLookupRef } from '../../hooks/useResolvedGitOpsOwner'
|
|
7
7
|
|
|
8
8
|
describe('findInheritedGitOpsLookupRef', () => {
|
|
@@ -84,3 +84,12 @@ describe('collectServingRefs', () => {
|
|
|
84
84
|
expect(collectServingRefs({ routedFrom: [broker, broker, other] })).toEqual([broker, other])
|
|
85
85
|
})
|
|
86
86
|
})
|
|
87
|
+
|
|
88
|
+
describe('memberOverviewParams', () => {
|
|
89
|
+
it('selects the member and returns to the Overview in one change, keeping other params', () => {
|
|
90
|
+
const next = memberOverviewParams(new URLSearchParams('apiGroup=jobset.x-k8s.io&tab=topology&run=jobs/ml/old'), 'jobs/ml/train-workers-1')
|
|
91
|
+
expect(next.get('run')).toBe('jobs/ml/train-workers-1')
|
|
92
|
+
expect(next.has('tab')).toBe(false)
|
|
93
|
+
expect(next.get('apiGroup')).toBe('jobset.x-k8s.io')
|
|
94
|
+
})
|
|
95
|
+
})
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { RelatedFindingsSection } from './RelatedFindingsSection'
|
|
1
2
|
import { decorateResourceDiagnose, resourceDetailRedirect, resourceDetailSlots, resourceLogs, resourceRendererOverrides } from '../../integrations/resourceHosts'
|
|
3
|
+
import { ApplicationEvidenceAction } from '../application-evidence/ApplicationEvidenceAction'
|
|
2
4
|
import { useMemo, useEffect, useCallback, useRef, useState, type ReactNode } from 'react'
|
|
3
5
|
import { useQueries, useQueryClient } from '@tanstack/react-query'
|
|
4
6
|
import { Navigate, useNavigate, useLocation, useSearchParams } from 'react-router-dom'
|
|
5
7
|
import { workloadPodAwaitsScheduling } from '../capacity/podDemandGate'
|
|
6
|
-
import {
|
|
7
|
-
import { Terminal, Stethoscope } from 'lucide-react'
|
|
8
|
+
import { Stethoscope } from 'lucide-react'
|
|
8
9
|
import {
|
|
9
10
|
WorkloadView as BaseWorkloadView,
|
|
10
11
|
EditableYamlView,
|
|
@@ -55,7 +56,6 @@ import {
|
|
|
55
56
|
fetchWorkloadHistoryPage,
|
|
56
57
|
useChanges,
|
|
57
58
|
useResourceWithRelationships,
|
|
58
|
-
usePodLogs,
|
|
59
59
|
useTopology,
|
|
60
60
|
useUpdateResource,
|
|
61
61
|
usePreviewResources,
|
|
@@ -101,11 +101,14 @@ import { WorkloadCostTab } from '../cost/WorkloadCostTab'
|
|
|
101
101
|
import { isOpenCostWorkloadKind } from '../cost/kinds'
|
|
102
102
|
import { isRadarFeatureUnsupported } from '../../api/radarFeatures'
|
|
103
103
|
import { useTrafficAvailable } from '../../api/traffic'
|
|
104
|
-
import { useResourceAudit, useResourceIssues, useSubjectIssues, useRadarFeature, useTrace, fetchTraceWithProbes, fetchInClusterCapability, runInClusterMerged } from '../../api/client'
|
|
104
|
+
import { isNotFoundError, useResourceAudit, useResourceIssues, useSubjectIssues, useRadarFeature, useTrace, fetchTraceWithProbes, fetchInClusterCapability, runInClusterMerged } from '../../api/client'
|
|
105
105
|
import { AuditAlerts, getRadarUpgradeRequirement, ResourceIssuesSection, ReachabilityView, TraceSummary, InClusterConsentDialog, traceFingerprint, staticPollUnreliable, summarizeInClusterTests, type Trace as NetworkTrace, type InClusterCapability, inClusterConsentGiven, consentRequestRows } from '@skyhook-io/k8s-ui'
|
|
106
106
|
import { WorkloadLogsViewer } from '../logs/WorkloadLogsViewer'
|
|
107
107
|
import { ScheduledWorkloadLogsViewer } from '../logs/ScheduledWorkloadLogsViewer'
|
|
108
108
|
import { LogsViewer } from '../logs/LogsViewer'
|
|
109
|
+
import { MultiPodLogsTab } from '../logs/MultiPodLogsTab'
|
|
110
|
+
import { RayClusterLogsTab } from '../logs/RayClusterLogsTab'
|
|
111
|
+
import { isKubeRayCluster } from '../logs/rayClusterPods'
|
|
109
112
|
import { BatchExecutionFullscreen } from '../execution/BatchExecutionView'
|
|
110
113
|
import { workloadRunTimelineEvents } from '../execution/batch-timeline'
|
|
111
114
|
import {
|
|
@@ -131,8 +134,20 @@ import { useDesktopDownload } from '../../hooks/useDesktopDownload'
|
|
|
131
134
|
import { useCompareLauncher } from '../compare/useCompareLauncher'
|
|
132
135
|
import { useDiagnoseCustomization } from '../../context/DiagnoseCustomization'
|
|
133
136
|
import { NodeDrainStatus } from './NodeDrainStatus'
|
|
137
|
+
import { recordUsageEvent } from '../../api/usage-data'
|
|
138
|
+
import { issueResourceOpener } from './issueResourceOpener'
|
|
134
139
|
|
|
135
140
|
type TabType = WorkloadTabType
|
|
141
|
+
|
|
142
|
+
// The usage-report view a tab counts under. Timeline holds the resource's
|
|
143
|
+
// events (it replaced the Events tab), so it counts as panel:events.
|
|
144
|
+
const PANEL_USAGE_VIEWS: Partial<Record<TabType, string>> = {
|
|
145
|
+
logs: 'panel:logs',
|
|
146
|
+
yaml: 'panel:yaml',
|
|
147
|
+
metrics: 'panel:metrics',
|
|
148
|
+
timeline: 'panel:events',
|
|
149
|
+
}
|
|
150
|
+
|
|
136
151
|
const BATCH_EXECUTION_KINDS = new Set([
|
|
137
152
|
'Job',
|
|
138
153
|
'CronJob',
|
|
@@ -357,6 +372,8 @@ function useActionsBarProps(
|
|
|
357
372
|
const argoRefreshMutation = useArgoRefresh()
|
|
358
373
|
const argoSuspendMutation = useArgoSuspend()
|
|
359
374
|
const argoResumeMutation = useArgoResume()
|
|
375
|
+
const { upgrade: argoResumeUpgrade, blockedReason: argoResumeBlockedReason } = useRadarFeature('argoAutoSyncEnable')
|
|
376
|
+
const { support: argoInheritanceSupport } = useRadarFeature('argoSyncInheritance')
|
|
360
377
|
|
|
361
378
|
const {
|
|
362
379
|
data: cascadePreview,
|
|
@@ -461,9 +478,10 @@ function useActionsBarProps(
|
|
|
461
478
|
onFluxResume: (params: Parameters<typeof fluxResumeMutation.mutate>[0]) =>
|
|
462
479
|
fluxResumeMutation.mutate(params),
|
|
463
480
|
isFluxResuming: fluxResumeMutation.isPending,
|
|
464
|
-
onArgoSync: (params: Parameters<typeof argoSyncMutation.
|
|
465
|
-
argoSyncMutation.
|
|
481
|
+
onArgoSync: (params: Parameters<typeof argoSyncMutation.mutateAsync>[0]) =>
|
|
482
|
+
argoSyncMutation.mutateAsync(params),
|
|
466
483
|
isArgoSyncing: argoSyncMutation.isPending,
|
|
484
|
+
argoSyncDialog: { pinsComparedRevision: argoInheritanceSupport === 'supported' },
|
|
467
485
|
onArgoRefresh: (params: Parameters<typeof argoRefreshMutation.mutate>[0]) =>
|
|
468
486
|
argoRefreshMutation.mutate(params),
|
|
469
487
|
isArgoRefreshing: argoRefreshMutation.isPending,
|
|
@@ -473,6 +491,8 @@ function useActionsBarProps(
|
|
|
473
491
|
onArgoResume: (params: Parameters<typeof argoResumeMutation.mutate>[0]) =>
|
|
474
492
|
argoResumeMutation.mutate(params),
|
|
475
493
|
isArgoResuming: argoResumeMutation.isPending,
|
|
494
|
+
argoResumeUpgrade,
|
|
495
|
+
argoResumeBlockedReason,
|
|
476
496
|
canNodeWrite,
|
|
477
497
|
onCordonNode: (params: Parameters<typeof cordonMutation.mutate>[0]) =>
|
|
478
498
|
cordonMutation.mutate(params),
|
|
@@ -526,8 +546,14 @@ export function WorkloadView({
|
|
|
526
546
|
? 'reachability' // the network tab was renamed Reachability
|
|
527
547
|
: (rawTab as TabType) || 'overview'
|
|
528
548
|
|
|
549
|
+
|
|
550
|
+
// A panel counts when someone switches to it. Counting renders instead would
|
|
551
|
+
// recount the same open tab: the drawer mounts hidden WorkloadView layers
|
|
552
|
+
// for expand-on-hover and crossfades.
|
|
529
553
|
const handleTabChange = useCallback(
|
|
530
554
|
(tab: TabType, opts?: { replace?: boolean }) => {
|
|
555
|
+
const panel = PANEL_USAGE_VIEWS[tab]
|
|
556
|
+
if (panel && tab !== migratedTab) recordUsageEvent({ type: 'view', name: panel })
|
|
531
557
|
const params = new URLSearchParams(searchParams)
|
|
532
558
|
if (tab === 'overview') {
|
|
533
559
|
params.delete('tab')
|
|
@@ -536,7 +562,7 @@ export function WorkloadView({
|
|
|
536
562
|
}
|
|
537
563
|
setSearchParams(params, { replace: opts?.replace ?? !pushTabHistory, state: location.state })
|
|
538
564
|
},
|
|
539
|
-
[pushTabHistory, searchParams, setSearchParams, location.state],
|
|
565
|
+
[migratedTab, pushTabHistory, searchParams, setSearchParams, location.state],
|
|
540
566
|
)
|
|
541
567
|
|
|
542
568
|
const selectedRunKey = searchParams.get('run') ?? ''
|
|
@@ -549,6 +575,13 @@ export function WorkloadView({
|
|
|
549
575
|
},
|
|
550
576
|
[searchParams, setSearchParams],
|
|
551
577
|
)
|
|
578
|
+
// A pushed entry, so Back returns to the graph.
|
|
579
|
+
const handleSelectTopologyMember = useCallback(
|
|
580
|
+
(memberKey: string) => {
|
|
581
|
+
setSearchParams(memberOverviewParams(searchParams, memberKey), { state: location.state })
|
|
582
|
+
},
|
|
583
|
+
[searchParams, setSearchParams, location.state],
|
|
584
|
+
)
|
|
552
585
|
|
|
553
586
|
// Fetch resource with relationships
|
|
554
587
|
const {
|
|
@@ -814,7 +847,9 @@ export function WorkloadView({
|
|
|
814
847
|
const isCronJob = apiKind === 'cronjobs' && (!effectiveGroup || effectiveGroup === 'batch')
|
|
815
848
|
const { support: coverageSupport } = useRadarFeature('resourceIssueCoverage')
|
|
816
849
|
const useCronJobCoverage = isCronJob && coverageSupport === 'supported'
|
|
817
|
-
const
|
|
850
|
+
const issueObservation = resource ? JSON.stringify([resource.metadata?.uid, resource.metadata?.resourceVersion]) : undefined
|
|
851
|
+
const ordinaryIssues = useResourceIssues(apiKind, rest.group, namespace, name,
|
|
852
|
+
rest.active !== false && !useCronJobCoverage && !isNotFoundError(resourceError), issueObservation)
|
|
818
853
|
const cronJobIssues = useSubjectIssues(useCronJobCoverage ? { kind: 'CronJob', group: 'batch', namespace, name, uid: resource?.metadata?.uid } : null, useCronJobCoverage && Boolean(resource))
|
|
819
854
|
const liveIssues = useCronJobCoverage ? cronJobIssues.data?.issues : ordinaryIssues.data
|
|
820
855
|
const issuesPending = useCronJobCoverage ? cronJobIssues.isPending : ordinaryIssues.isPending
|
|
@@ -826,6 +861,7 @@ export function WorkloadView({
|
|
|
826
861
|
}, [schedulingEvidence, handleTabChange])
|
|
827
862
|
const { data: auditFindings } = useResourceAudit(apiKind, namespace, name, effectiveGroup)
|
|
828
863
|
const hasOperationalIssues = Boolean(liveIssues?.length)
|
|
864
|
+
const openIssueResource = issueResourceOpener(rest.onNavigateToResource)
|
|
829
865
|
const {
|
|
830
866
|
onCompareTo,
|
|
831
867
|
onCompareAcrossClusters,
|
|
@@ -1178,6 +1214,8 @@ export function WorkloadView({
|
|
|
1178
1214
|
olderHistoryError={historyFallback ? null : olderHistoryError}
|
|
1179
1215
|
historyScoped={!historyFallback}
|
|
1180
1216
|
historyIncomplete={!historyFallback && Boolean(historyQuery.data?.incomplete)}
|
|
1217
|
+
historyCoverage={historyFallback ? undefined : historyQuery.data?.historyCoverage}
|
|
1218
|
+
historyGaps={historyFallback ? undefined : historyQuery.data?.gaps}
|
|
1181
1219
|
historyError={(historyFallback ? namespaceChanges.error : historyQuery.error) as Error | null}
|
|
1182
1220
|
onRetryHistory={() => void (historyFallback ? namespaceChanges.refetch() : historyQuery.refetch())}
|
|
1183
1221
|
relatedTimelineEvents={relatedTimelineEvents}
|
|
@@ -1205,6 +1243,8 @@ export function WorkloadView({
|
|
|
1205
1243
|
renderLogsTab={(props) => (
|
|
1206
1244
|
<LogsTabContent
|
|
1207
1245
|
{...props}
|
|
1246
|
+
resourceLoading={resourceLoading}
|
|
1247
|
+
resourceError={resourceError}
|
|
1208
1248
|
group={effectiveGroup}
|
|
1209
1249
|
selectedRunKey={selectedRunKey}
|
|
1210
1250
|
onSelectRun={handleSelectedRunChange}
|
|
@@ -1212,6 +1252,7 @@ export function WorkloadView({
|
|
|
1212
1252
|
/>
|
|
1213
1253
|
)}
|
|
1214
1254
|
{...resourceDetailSlots({ kind: apiKind, group: resource?.apiVersion ? resourceGroup : effectiveGroup, namespace, name }, rest.extraTabs)}
|
|
1255
|
+
onSelectTopologyMember={batchExecution && batchKind === 'JobSet' ? handleSelectTopologyMember : undefined}
|
|
1215
1256
|
renderExpandedOverview={({ kind: k, apiKind, namespace: ns, name: n, resource: res, leadContent }) =>
|
|
1216
1257
|
supportsBatchExecution(k, apiKind, effectiveGroup, res?.apiVersion) &&
|
|
1217
1258
|
res ? (
|
|
@@ -1298,7 +1339,12 @@ export function WorkloadView({
|
|
|
1298
1339
|
return (
|
|
1299
1340
|
<>
|
|
1300
1341
|
{diagnoseInline}
|
|
1342
|
+
<ApplicationEvidenceAction kind={k} namespace={ns} name={n} group={g} uid={resource?.metadata?.uid ?? ''} />
|
|
1301
1343
|
{diagnoseHint}
|
|
1344
|
+
<RelatedFindingsSection
|
|
1345
|
+
data={resourceResponse?.relatedFindings}
|
|
1346
|
+
onResourceClick={openIssueResource}
|
|
1347
|
+
/>
|
|
1302
1348
|
<AuditOverviewSection
|
|
1303
1349
|
findings={auditFindings ?? []}
|
|
1304
1350
|
onViewAll={() => navigateRouter('/checks')}
|
|
@@ -1314,17 +1360,7 @@ export function WorkloadView({
|
|
|
1314
1360
|
renderDetailSection={schedulingEvidence?.state === 'reported' ? ({ issue }) => issue.kind === 'CronJob' && issue.reason === schedulingEvidence.reason ? <CronJobSchedulingDetails evidence={schedulingEvidence} onViewTimeline={viewSchedulingReport} /> : null : undefined}
|
|
1315
1361
|
compact={!expanded}
|
|
1316
1362
|
subjectResource={{ kind: apiKind, namespace, name, group: rest.group }}
|
|
1317
|
-
onResourceClick={
|
|
1318
|
-
rest.onNavigateToResource
|
|
1319
|
-
? (ref) =>
|
|
1320
|
-
rest.onNavigateToResource?.({
|
|
1321
|
-
kind: kindToPluralWithGroup(ref.kind, ref.group ?? ''),
|
|
1322
|
-
namespace: ref.namespace ?? '',
|
|
1323
|
-
name: ref.name,
|
|
1324
|
-
group: ref.group ?? '',
|
|
1325
|
-
})
|
|
1326
|
-
: undefined
|
|
1327
|
-
}
|
|
1363
|
+
onResourceClick={openIssueResource}
|
|
1328
1364
|
/>
|
|
1329
1365
|
</div>
|
|
1330
1366
|
)}
|
|
@@ -1365,6 +1401,16 @@ export function WorkloadView({
|
|
|
1365
1401
|
)
|
|
1366
1402
|
}
|
|
1367
1403
|
|
|
1404
|
+
/** The search params that open `memberKey` in the Overview: the member and
|
|
1405
|
+
* the tab change in one write, since two writes from the same render would
|
|
1406
|
+
* each start from the old params and the second would drop the first. */
|
|
1407
|
+
export function memberOverviewParams(current: URLSearchParams, memberKey: string): URLSearchParams {
|
|
1408
|
+
const params = new URLSearchParams(current)
|
|
1409
|
+
params.set('run', memberKey)
|
|
1410
|
+
params.delete('tab')
|
|
1411
|
+
return params
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1368
1414
|
export function collectServingRefs(relationships: Relationships | undefined): ResourceRef[] {
|
|
1369
1415
|
if (!relationships) return []
|
|
1370
1416
|
return dedupeResourceRefs([
|
|
@@ -1484,6 +1530,8 @@ function LogsTabContent({
|
|
|
1484
1530
|
selectedRunKey,
|
|
1485
1531
|
onSelectRun,
|
|
1486
1532
|
viewNamespaces,
|
|
1533
|
+
resourceLoading,
|
|
1534
|
+
resourceError,
|
|
1487
1535
|
}: {
|
|
1488
1536
|
kind: string
|
|
1489
1537
|
apiKind: string
|
|
@@ -1499,6 +1547,8 @@ function LogsTabContent({
|
|
|
1499
1547
|
selectedRunKey: string
|
|
1500
1548
|
onSelectRun: (runKey: string) => void
|
|
1501
1549
|
viewNamespaces: string[]
|
|
1550
|
+
resourceLoading: boolean
|
|
1551
|
+
resourceError: Error | null
|
|
1502
1552
|
}) {
|
|
1503
1553
|
if (SCHEDULED_LOG_KINDS.has(kind) && supportsBatchExecution(kind, apiKind, group, resource?.apiVersion)) {
|
|
1504
1554
|
return (
|
|
@@ -1518,6 +1568,22 @@ function LogsTabContent({
|
|
|
1518
1568
|
const integrationLogs = resourceLogs({ kind, group, namespace, name }, resource)
|
|
1519
1569
|
if (integrationLogs) return integrationLogs
|
|
1520
1570
|
|
|
1571
|
+
if (isKubeRayCluster(kind, group, resource?.apiVersion)) {
|
|
1572
|
+
return (
|
|
1573
|
+
<RayClusterLogsTab
|
|
1574
|
+
namespace={namespace}
|
|
1575
|
+
name={name}
|
|
1576
|
+
uid={resource?.metadata?.uid}
|
|
1577
|
+
suspendRequested={resource?.spec?.suspend === true}
|
|
1578
|
+
rootLoading={resourceLoading}
|
|
1579
|
+
rootError={resourceError}
|
|
1580
|
+
historyPods={pods}
|
|
1581
|
+
selectedPod={selectedPod}
|
|
1582
|
+
onSelectPod={onSelectPod}
|
|
1583
|
+
/>
|
|
1584
|
+
)
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1521
1587
|
// Workload kinds with stable pod selectors use the aggregated workload logs viewer
|
|
1522
1588
|
if (WORKLOAD_LOG_KINDS.has(kind) && (kind !== 'Job' || isCoreBatchJob(apiKind, group))) {
|
|
1523
1589
|
return (
|
|
@@ -1613,85 +1679,6 @@ function PodLogsTab({
|
|
|
1613
1679
|
)
|
|
1614
1680
|
}
|
|
1615
1681
|
|
|
1616
|
-
function MultiPodLogsTab({
|
|
1617
|
-
pods,
|
|
1618
|
-
namespace,
|
|
1619
|
-
selectedPod,
|
|
1620
|
-
onSelectPod,
|
|
1621
|
-
initialContainer,
|
|
1622
|
-
}: {
|
|
1623
|
-
pods: ResourceRef[]
|
|
1624
|
-
namespace: string
|
|
1625
|
-
selectedPod: string | null
|
|
1626
|
-
onSelectPod: (name: string | null) => void
|
|
1627
|
-
initialContainer?: string | null
|
|
1628
|
-
}) {
|
|
1629
|
-
useEffect(() => {
|
|
1630
|
-
if (pods.length > 0 && !selectedPod) {
|
|
1631
|
-
onSelectPod(pods[0].name)
|
|
1632
|
-
}
|
|
1633
|
-
}, [pods, selectedPod, onSelectPod])
|
|
1634
|
-
|
|
1635
|
-
const podNamespace = pods.find((p) => p.name === selectedPod)?.namespace || namespace
|
|
1636
|
-
|
|
1637
|
-
// Fetch container list for the selected pod
|
|
1638
|
-
const { data: logsData } = usePodLogs(podNamespace, selectedPod || '', {
|
|
1639
|
-
tailLines: 1,
|
|
1640
|
-
})
|
|
1641
|
-
const containers = logsData?.containers || []
|
|
1642
|
-
|
|
1643
|
-
// A terminated pod (common for Job/CronJob children) has nothing to follow —
|
|
1644
|
-
// only stream live ones. Wait for the pod to load before deciding so we don't
|
|
1645
|
-
// briefly auto-stream a completed pod while its phase is still unknown.
|
|
1646
|
-
const { data: selectedPodResource } = useResource<any>('Pod', podNamespace, selectedPod || '')
|
|
1647
|
-
const phase = selectedPodResource?.status?.phase
|
|
1648
|
-
const autoStream = !!phase && phase !== 'Succeeded' && phase !== 'Failed'
|
|
1649
|
-
|
|
1650
|
-
if (pods.length === 0) {
|
|
1651
|
-
return (
|
|
1652
|
-
<div className="flex flex-col items-center justify-center h-full text-theme-text-tertiary">
|
|
1653
|
-
<Terminal className="w-12 h-12 mb-4 opacity-50" />
|
|
1654
|
-
<p>No pods available</p>
|
|
1655
|
-
</div>
|
|
1656
|
-
)
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
return (
|
|
1660
|
-
<div className="h-full flex flex-col">
|
|
1661
|
-
{pods.length > 1 && (
|
|
1662
|
-
<div className="shrink-0 border-b border-theme-border bg-theme-surface/50 px-4 py-2 flex gap-2 overflow-x-auto">
|
|
1663
|
-
{pods.map((pod) => (
|
|
1664
|
-
<button
|
|
1665
|
-
key={pod.name}
|
|
1666
|
-
onClick={() => onSelectPod(pod.name)}
|
|
1667
|
-
className={clsx(
|
|
1668
|
-
'px-3 py-1.5 text-sm rounded-lg whitespace-nowrap transition-colors',
|
|
1669
|
-
selectedPod === pod.name
|
|
1670
|
-
? 'bg-blue-500 text-theme-text-primary'
|
|
1671
|
-
: 'bg-theme-elevated text-theme-text-secondary hover:bg-theme-hover',
|
|
1672
|
-
)}
|
|
1673
|
-
>
|
|
1674
|
-
{pod.name.length > 40 ? '...' + pod.name.slice(-37) : pod.name}
|
|
1675
|
-
</button>
|
|
1676
|
-
))}
|
|
1677
|
-
</div>
|
|
1678
|
-
)}
|
|
1679
|
-
{selectedPod && containers.length > 0 && (
|
|
1680
|
-
<div className="flex-1 min-h-0">
|
|
1681
|
-
<LogsViewer
|
|
1682
|
-
key={selectedPod}
|
|
1683
|
-
namespace={podNamespace}
|
|
1684
|
-
podName={selectedPod}
|
|
1685
|
-
containers={containers}
|
|
1686
|
-
initialContainer={initialContainer || undefined}
|
|
1687
|
-
autoStream={autoStream}
|
|
1688
|
-
/>
|
|
1689
|
-
</div>
|
|
1690
|
-
)}
|
|
1691
|
-
</div>
|
|
1692
|
-
)
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
1682
|
function AuditOverviewSection({
|
|
1696
1683
|
findings,
|
|
1697
1684
|
onViewAll,
|