@skyhook-io/k8s-ui 1.8.10 → 1.8.12
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 +7 -6
- package/src/assets/gitops/argocd.png +0 -0
- package/src/assets/gitops/flux.svg +7 -0
- package/src/components/applications/AppChips.tsx +10 -0
- package/src/components/applications/ApplicationDetail.test.tsx +697 -0
- package/src/components/applications/ApplicationDetail.tsx +3269 -474
- package/src/components/applications/ApplicationsView.tsx +62 -10
- package/src/components/applications/applications-view.test.tsx +47 -0
- package/src/components/applications/index.ts +1 -1
- package/src/components/audit/AuditAlerts.tsx +14 -10
- package/src/components/checks/ChecksView.tsx +2 -3
- package/src/components/checks/severity.ts +14 -10
- package/src/components/cluster-switcher/ClusterSwitcher.tsx +2 -2
- package/src/components/compare/CompareResourcePicker.tsx +2 -2
- package/src/components/gitops/GitOpsDetailLayout.tsx +13 -3
- package/src/components/gitops/GitOpsGraphFilterRail.tsx +2 -1
- package/src/components/gitops/GitOpsTableView.tsx +13 -6
- package/src/components/gitops/ManagedResourcesList.tsx +8 -11
- package/src/components/gitops/SyncCountdown.tsx +26 -17
- package/src/components/gitops/SyncOptionsDialog.test.ts +48 -0
- package/src/components/gitops/SyncOptionsDialog.tsx +190 -46
- package/src/components/gitops/insights/ArgoResourceDiff.tsx +172 -0
- package/src/components/gitops/insights/GitOpsInsightViews.tsx +474 -121
- package/src/components/gitops/insights/index.ts +1 -0
- package/src/components/gitops/insights/insights-helpers.test.ts +102 -1
- package/src/components/gitops/insights/insights-helpers.ts +74 -1
- package/src/components/gitops/tree/GitOpsTreeGraph.tsx +10 -2
- package/src/components/issues/IssuesView.tsx +91 -52
- package/src/components/issues/ResourceIssuesSection.test.tsx +39 -6
- package/src/components/issues/ResourceIssuesSection.tsx +46 -144
- package/src/components/issues/index.ts +3 -0
- package/src/components/issues/issue-timing.ts +53 -0
- package/src/components/issues/issues.test.ts +102 -1
- package/src/components/issues/severity.ts +3 -0
- package/src/components/logs/LogCore.tsx +14 -4
- package/src/components/logs/WorkloadLogsViewer.tsx +31 -6
- package/src/components/logs/useLogStream.ts +8 -1
- package/src/components/namespace-switcher/NamespacePicker.tsx +86 -107
- package/src/components/resources/ResourcesSidebar.test.tsx +71 -0
- package/src/components/resources/ResourcesSidebar.tsx +46 -46
- package/src/components/resources/ResourcesView.selected-kind.test.ts +143 -0
- package/src/components/resources/ResourcesView.tsx +233 -51
- package/src/components/resources/renderers/AWSMachineRenderer.tsx +3 -2
- package/src/components/resources/renderers/AWSManagedClusterRenderer.tsx +3 -2
- package/src/components/resources/renderers/AWSManagedControlPlaneRenderer.tsx +3 -2
- package/src/components/resources/renderers/AWSManagedMachinePoolRenderer.tsx +3 -2
- package/src/components/resources/renderers/AzureMachineRenderer.tsx +3 -2
- package/src/components/resources/renderers/AzureManagedControlPlaneRenderer.tsx +3 -2
- package/src/components/resources/renderers/AzureManagedMachinePoolRenderer.tsx +3 -2
- package/src/components/resources/renderers/CAPIClusterRenderer.tsx +3 -2
- package/src/components/resources/renderers/CAPIKubeadmControlPlaneRenderer.tsx +3 -2
- package/src/components/resources/renderers/CAPIMachineDeploymentRenderer.tsx +3 -2
- package/src/components/resources/renderers/CAPIMachineHealthCheckRenderer.tsx +3 -2
- package/src/components/resources/renderers/CAPIMachinePoolRenderer.tsx +3 -2
- package/src/components/resources/renderers/CAPIMachineRenderer.tsx +3 -2
- package/src/components/resources/renderers/CAPIMachineSetRenderer.tsx +3 -2
- package/src/components/resources/renderers/CertificateRenderer.tsx +3 -2
- package/src/components/resources/renderers/CertificateRequestRenderer.tsx +3 -2
- package/src/components/resources/renderers/ClusterComplianceReportRenderer.tsx +2 -2
- package/src/components/resources/renderers/CompositeRenderer.tsx +3 -2
- package/src/components/resources/renderers/CronWorkflowRenderer.tsx +99 -0
- package/src/components/resources/renderers/ExternalSecretRenderer.tsx +3 -2
- package/src/components/resources/renderers/GCPMachineRenderer.tsx +3 -2
- package/src/components/resources/renderers/GCPManagedControlPlaneRenderer.tsx +3 -2
- package/src/components/resources/renderers/GCPManagedMachinePoolRenderer.tsx +3 -2
- package/src/components/resources/renderers/GRPCRouteRenderer.tsx +7 -3
- package/src/components/resources/renderers/GatewayClassRenderer.tsx +3 -2
- package/src/components/resources/renderers/HTTPRouteRenderer.tsx +7 -3
- package/src/components/resources/renderers/JobRenderer.tsx +3 -1
- package/src/components/resources/renderers/KarpenterEC2NodeClassRenderer.tsx +3 -2
- package/src/components/resources/renderers/KarpenterNodeClaimRenderer.tsx +3 -2
- package/src/components/resources/renderers/KarpenterNodePoolRenderer.tsx +3 -2
- package/src/components/resources/renderers/KedaScaledJobRenderer.tsx +3 -2
- package/src/components/resources/renderers/KedaScaledObjectRenderer.tsx +3 -2
- package/src/components/resources/renderers/ManagedResourceRenderer.tsx +3 -2
- package/src/components/resources/renderers/PVCRenderer.tsx +3 -2
- package/src/components/resources/renderers/PrometheusRuleRenderer.tsx +2 -2
- package/src/components/resources/renderers/SbomReportRenderer.tsx +2 -2
- package/src/components/resources/renderers/SealedSecretRenderer.tsx +3 -2
- package/src/components/resources/renderers/SecretRenderer.tsx +2 -0
- package/src/components/resources/renderers/SecretStoreRenderer.tsx +3 -2
- package/src/components/resources/renderers/ServiceRenderer.tsx +58 -40
- package/src/components/resources/renderers/SimpleRouteRenderer.tsx +7 -3
- package/src/components/resources/renderers/VulnerabilityReportRenderer.tsx +2 -2
- package/src/components/resources/renderers/WorkflowRenderer.test.tsx +43 -0
- package/src/components/resources/renderers/WorkflowRenderer.tsx +60 -78
- package/src/components/resources/renderers/index.ts +1 -0
- package/src/components/resources/resource-utils-argo.test.ts +18 -1
- package/src/components/resources/resource-utils-argo.ts +8 -0
- package/src/components/resources/resource-utils-capi.ts +1 -1
- package/src/components/resources/resource-utils.ts +31 -0
- package/src/components/shared/DetailShell.tsx +2 -2
- package/src/components/shared/ResourceActionsBar.tsx +142 -111
- package/src/components/shared/ResourceRendererDispatch.tsx +33 -4
- package/src/components/shared/UnifiedDiff.tsx +51 -0
- package/src/components/shared/index.ts +1 -0
- package/src/components/timeline/TimelineList.tsx +375 -354
- package/src/components/timeline/TimelineStrip.test.tsx +194 -0
- package/src/components/timeline/TimelineStrip.tsx +836 -0
- package/src/components/timeline/TimelineSwimlanes.test.tsx +1028 -0
- package/src/components/timeline/TimelineSwimlanes.tsx +2498 -593
- package/src/components/timeline/TimelineToolbar.test.tsx +320 -0
- package/src/components/timeline/TimelineToolbar.tsx +759 -0
- package/src/components/timeline/TimelineToolbarState.test.tsx +88 -0
- package/src/components/timeline/index.ts +23 -0
- package/src/components/timeline/scrubber-math.test.ts +235 -0
- package/src/components/timeline/scrubber-math.ts +249 -0
- package/src/components/timeline/shared.test.tsx +219 -0
- package/src/components/timeline/shared.tsx +232 -447
- package/src/components/timeline/timeline-filters.test.ts +196 -0
- package/src/components/timeline/timeline-filters.ts +180 -0
- package/src/components/timeline/timeline-lane-sort.test.ts +97 -0
- package/src/components/timeline/timeline-lane-sort.ts +77 -0
- package/src/components/timeline/timeline-live.test.ts +131 -0
- package/src/components/timeline/timeline-live.ts +77 -0
- package/src/components/topology/GroupNode.tsx +9 -2
- package/src/components/topology/K8sResourceNode.test.ts +11 -0
- package/src/components/topology/K8sResourceNode.tsx +387 -243
- package/src/components/topology/TopologyBreadcrumb.tsx +30 -0
- package/src/components/topology/TopologyControls.tsx +3 -1
- package/src/components/topology/TopologyFilterSidebar.tsx +9 -0
- package/src/components/topology/TopologyGraph.tsx +149 -90
- package/src/components/topology/TopologyOverlayBar.tsx +30 -0
- package/src/components/topology/TopologySearch.tsx +25 -17
- package/src/components/topology/index.ts +2 -0
- package/src/components/topology/layout.ts +10 -2
- package/src/components/topology/topology.css +0 -92
- package/src/components/ui/Badge.tsx +6 -1
- package/src/components/ui/CodeViewer.tsx +2 -2
- package/src/components/ui/Collapse.tsx +59 -0
- package/src/components/ui/ConfirmDialog.tsx +7 -3
- package/src/components/ui/DialogPortal.tsx +31 -9
- package/src/components/ui/Input.tsx +24 -0
- package/src/components/ui/MultiSelectPicker.test.tsx +101 -0
- package/src/components/ui/MultiSelectPicker.tsx +167 -0
- package/src/components/ui/PaneLoader.tsx +10 -2
- package/src/components/ui/ResourceBar.tsx +68 -25
- package/src/components/ui/SearchBox.tsx +18 -4
- package/src/components/ui/SearchPillInput.tsx +2 -2
- package/src/components/ui/SelectMenu.tsx +81 -0
- package/src/components/ui/drawer-components.tsx +48 -32
- package/src/components/ui/index.ts +6 -0
- package/src/components/ui/severity-tone.ts +11 -4
- package/src/components/workload/ResourceDetailDrawer.tsx +6 -2
- package/src/components/workload/WorkloadView.tsx +2706 -475
- package/src/components/workload/index.ts +1 -1
- package/src/theme/tailwind-theme.css +1 -0
- package/src/theme/variables.css +2 -1
- package/src/types/core.ts +57 -4
- package/src/types/gitops-insights.ts +69 -1
- package/src/types/gitops.ts +3 -3
- package/src/utils/application-history.test.ts +538 -0
- package/src/utils/application-history.ts +257 -0
- package/src/utils/application-topology.test.ts +198 -0
- package/src/utils/application-topology.ts +261 -0
- package/src/utils/applications.test.ts +201 -1
- package/src/utils/applications.ts +1182 -393
- package/src/utils/index.ts +3 -0
- package/src/utils/navigation.test.ts +32 -1
- package/src/utils/navigation.ts +70 -0
- package/src/utils/resource-hierarchy.test.ts +1024 -1
- package/src/utils/resource-hierarchy.ts +925 -267
- package/src/utils/resource-icons.ts +2 -0
- package/src/utils/topology-neighborhood.test.ts +202 -1
- package/src/utils/topology-neighborhood.ts +194 -13
- package/src/utils/workflow-execution.test.ts +556 -0
- package/src/utils/workflow-execution.ts +814 -0
- package/src/utils/workload-colors.ts +2 -3
|
@@ -1,163 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { diagnosticFactLabel, confidenceTitle, incidentParentLabel } from './diagnostic'
|
|
1
|
+
import { useMemo, useState } from 'react'
|
|
2
|
+
import { AlertTriangle } from 'lucide-react'
|
|
3
|
+
import { kindToPlural } from '../../utils/navigation'
|
|
4
|
+
import { IssueRow } from './IssuesView'
|
|
5
|
+
import { compareIssues, subjectRef, type Issue, type IssueResourceRef } from './types'
|
|
7
6
|
|
|
8
|
-
/**
|
|
9
|
-
* ResourceIssuesSection — the compact "Operational Issues" block for the resource
|
|
10
|
-
* detail. Renders the live, diagnosed Issues that touch one resource (its own +,
|
|
11
|
-
* for a workload, its owned pods' issues, server-rolled-up via RelatedIssues).
|
|
12
|
-
* The diagnosis sibling of IssuesView's queue row — same Cause/Action vocabulary,
|
|
13
|
-
* stripped of the queue chrome (accordion, scope copy, fan-out expansion).
|
|
14
|
-
*
|
|
15
|
-
* Header mirrors the queue: the plain `categoryLabel` is the operator-facing
|
|
16
|
-
* headline and the raw `reason` rides alongside as a muted signal (so the K8s
|
|
17
|
-
* jargon is available but not the lead). Body is primarily the plain
|
|
18
|
-
* `cause` (which names the offending object) + the `Next step` — the diagnosis
|
|
19
|
-
* and the fix. The raw `message`/evidence stays in the queue + MCP where the
|
|
20
|
-
* locator detail is wanted; inline it mostly restated the cause or the category,
|
|
21
|
-
* so it's omitted to keep the card scannable. (`message` is the body fallback
|
|
22
|
-
* only for categories that don't yet emit a `cause`.)
|
|
23
|
-
*/
|
|
24
7
|
export function ResourceIssuesSection({
|
|
25
8
|
issues,
|
|
26
9
|
onResourceClick,
|
|
10
|
+
subjectResource,
|
|
27
11
|
}: {
|
|
28
12
|
issues: Issue[] | undefined
|
|
29
13
|
/** When provided, related resources in a causal link become clickable. */
|
|
30
14
|
onResourceClick?: (ref: IssueResourceRef) => void
|
|
15
|
+
/** The resource this section is embedded under. When an issue's subject IS
|
|
16
|
+
* this resource, its redundant "Subject" deep-link is suppressed — the drawer
|
|
17
|
+
* header already names it. Omit (e.g. the standalone fleet queue) to always
|
|
18
|
+
* show the subject. */
|
|
19
|
+
subjectResource?: IssueResourceRef
|
|
31
20
|
}) {
|
|
32
|
-
|
|
21
|
+
const sorted = useMemo(() => [...(issues ?? [])].sort(compareIssues), [issues])
|
|
22
|
+
const [openId, setOpenId] = useState<string | null>(null)
|
|
23
|
+
|
|
24
|
+
if (sorted.length === 0) return null
|
|
25
|
+
|
|
33
26
|
return (
|
|
34
|
-
<
|
|
35
|
-
<div className="
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
<section className="space-y-2">
|
|
28
|
+
<div className="flex items-center gap-2 px-1 text-xs font-semibold uppercase tracking-wide text-theme-text-secondary">
|
|
29
|
+
<AlertTriangle className="h-4 w-4 text-theme-text-tertiary" aria-hidden />
|
|
30
|
+
<span>Operational issues ({sorted.length})</span>
|
|
31
|
+
</div>
|
|
32
|
+
<ol className="flex flex-col gap-1.5">
|
|
33
|
+
{sorted.map((issue) => {
|
|
34
|
+
const key = issueKey(issue)
|
|
38
35
|
return (
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
) : null}
|
|
48
|
-
{issue.count ? (
|
|
49
|
-
<span className="shrink-0 text-xs text-theme-text-tertiary tabular-nums">· {issue.count} affected</span>
|
|
50
|
-
) : null}
|
|
51
|
-
</div>
|
|
52
|
-
{issue.cause ? (
|
|
53
|
-
<p className="text-sm leading-relaxed text-theme-text-secondary">{issue.cause}</p>
|
|
54
|
-
) : issue.message ? (
|
|
55
|
-
<p className="text-sm leading-relaxed text-theme-text-secondary">{issue.message}</p>
|
|
56
|
-
) : null}
|
|
57
|
-
{issue.action ? (
|
|
58
|
-
<p className="mt-1 text-sm leading-relaxed text-theme-text-secondary">
|
|
59
|
-
<span className="font-medium text-theme-text-primary">Next step: </span>
|
|
60
|
-
{issue.action}
|
|
61
|
-
</p>
|
|
62
|
-
) : null}
|
|
63
|
-
{issue.remediation_kind === 'create-namespace' && issue.remediation_target ? (
|
|
64
|
-
<p className="mt-1 text-xs text-theme-text-tertiary">
|
|
65
|
-
Suggested fix: create namespace{' '}
|
|
66
|
-
<code className="rounded bg-theme-elevated px-1 font-mono">{issue.remediation_target}</code> — apply it from the GitOps detail page.
|
|
67
|
-
</p>
|
|
68
|
-
) : null}
|
|
69
|
-
{parent ? (
|
|
70
|
-
<p className="mt-1 text-xs text-theme-text-tertiary">
|
|
71
|
-
{incidentParentLabel(parent.fact_type, parent.confidence)}:{' '}
|
|
72
|
-
{onResourceClick ? (
|
|
73
|
-
<button
|
|
74
|
-
type="button"
|
|
75
|
-
onClick={() => onResourceClick(parent.ref)}
|
|
76
|
-
className="group inline-flex items-center gap-1 text-left font-mono hover:text-theme-text-secondary"
|
|
77
|
-
title={confidenceTitle(parent.confidence ?? '')}
|
|
78
|
-
>
|
|
79
|
-
{parent.ref.kind} / {parent.ref.name}
|
|
80
|
-
<ExternalLink className="h-3 w-3 opacity-0 group-hover:opacity-100" />
|
|
81
|
-
</button>
|
|
82
|
-
) : (
|
|
83
|
-
<span className="font-mono">{parent.ref.kind} / {parent.ref.name}</span>
|
|
84
|
-
)}
|
|
85
|
-
</p>
|
|
86
|
-
) : null}
|
|
87
|
-
<CausalContext issue={issue} onResourceClick={onResourceClick} />
|
|
88
|
-
</div>
|
|
36
|
+
<IssueRow
|
|
37
|
+
key={key}
|
|
38
|
+
issue={issue}
|
|
39
|
+
open={openId === key}
|
|
40
|
+
onToggle={() => setOpenId((cur) => (cur === key ? null : key))}
|
|
41
|
+
onResourceClick={onResourceClick}
|
|
42
|
+
hideSubject={subjectResource ? sameResource(subjectRef(issue), subjectResource) : false}
|
|
43
|
+
/>
|
|
89
44
|
)
|
|
90
45
|
})}
|
|
91
|
-
</
|
|
92
|
-
</
|
|
46
|
+
</ol>
|
|
47
|
+
</section>
|
|
93
48
|
)
|
|
94
49
|
}
|
|
95
50
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
* resources are shown as plain identifiers to keep the resource panel scannable.
|
|
102
|
-
*/
|
|
103
|
-
function CausalContext({ issue, onResourceClick }: { issue: Issue; onResourceClick?: (ref: IssueResourceRef) => void }) {
|
|
104
|
-
const ctx = issue.diagnostic_context
|
|
105
|
-
const links = ctx?.facts?.filter((f) => f.confidence || (f.related_issues && f.related_issues.length > 0)) ?? []
|
|
106
|
-
if (!ctx || links.length === 0) return null
|
|
51
|
+
// Identity match tolerant of singular/plural + casing on kind (the subject ref
|
|
52
|
+
// carries the wire kind, the host typically passes the plural API name) — group
|
|
53
|
+
// is deliberately ignored: a per-resource issue feed is already scoped to one
|
|
54
|
+
// resource, and kind+namespace+name uniquely identifies it there.
|
|
55
|
+
export function sameResource(a: IssueResourceRef, b: IssueResourceRef): boolean {
|
|
107
56
|
return (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</div>
|
|
112
|
-
<ul className="space-y-1.5">
|
|
113
|
-
{links.map((fact, idx) => (
|
|
114
|
-
<li key={`${fact.type}-${idx}`} className="text-xs">
|
|
115
|
-
<div className="flex flex-wrap items-baseline gap-x-2 gap-y-0.5">
|
|
116
|
-
<span className="font-medium text-theme-text-secondary">{diagnosticFactLabel(fact.type)}</span>
|
|
117
|
-
{fact.confidence ? (
|
|
118
|
-
<span className="badge-sm text-[10px] text-theme-text-tertiary" title={confidenceTitle(fact.confidence)}>
|
|
119
|
-
{fact.confidence} confidence
|
|
120
|
-
</span>
|
|
121
|
-
) : null}
|
|
122
|
-
{fact.message ? <span className="text-theme-text-tertiary">{fact.message}</span> : null}
|
|
123
|
-
</div>
|
|
124
|
-
{fact.related_issues && fact.related_issues.length > 0 ? (
|
|
125
|
-
<ul className="mt-0.5 space-y-0.5 pl-3">
|
|
126
|
-
{fact.related_issues.map((rel, ri) => {
|
|
127
|
-
const label = (
|
|
128
|
-
<>
|
|
129
|
-
<span className="text-[10px] uppercase tracking-wide text-theme-text-tertiary">{rel.ref.kind}</span>{' '}
|
|
130
|
-
<span className="font-mono">
|
|
131
|
-
{rel.ref.namespace ? `${rel.ref.namespace} / ` : ''}
|
|
132
|
-
{rel.ref.name}
|
|
133
|
-
</span>
|
|
134
|
-
{rel.count && rel.count > 1 ? (
|
|
135
|
-
<span className="ml-1 tabular-nums" title={`${rel.count} affected resources grouped under this issue`}>· {rel.count} affected</span>
|
|
136
|
-
) : null}
|
|
137
|
-
</>
|
|
138
|
-
)
|
|
139
|
-
return (
|
|
140
|
-
<li key={ri} className="text-theme-text-tertiary">
|
|
141
|
-
{onResourceClick ? (
|
|
142
|
-
<button
|
|
143
|
-
type="button"
|
|
144
|
-
onClick={() => onResourceClick(rel.ref)}
|
|
145
|
-
className="group inline-flex items-center gap-1 text-left hover:text-theme-text-secondary"
|
|
146
|
-
>
|
|
147
|
-
{label}
|
|
148
|
-
<ExternalLink className="h-3 w-3 opacity-0 group-hover:opacity-100" />
|
|
149
|
-
</button>
|
|
150
|
-
) : (
|
|
151
|
-
label
|
|
152
|
-
)}
|
|
153
|
-
</li>
|
|
154
|
-
)
|
|
155
|
-
})}
|
|
156
|
-
</ul>
|
|
157
|
-
) : null}
|
|
158
|
-
</li>
|
|
159
|
-
))}
|
|
160
|
-
</ul>
|
|
161
|
-
</div>
|
|
57
|
+
a.name === b.name &&
|
|
58
|
+
(a.namespace ?? '') === (b.namespace ?? '') &&
|
|
59
|
+
kindToPlural(a.kind).toLowerCase() === kindToPlural(b.kind).toLowerCase()
|
|
162
60
|
)
|
|
163
61
|
}
|
|
62
|
+
|
|
63
|
+
function issueKey(issue: Issue): string {
|
|
64
|
+
return `${issue.cluster_id ?? ''}:${issue.id}`
|
|
65
|
+
}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
export { IssueRow, IssuesView } from './IssuesView';
|
|
6
6
|
export type { IssueRowProps, IssueRowSlotContext, IssuesViewProps } from './IssuesView';
|
|
7
7
|
export { ResourceIssuesSection } from './ResourceIssuesSection';
|
|
8
|
+
export { issueTiming } from './issue-timing';
|
|
9
|
+
export type { IssueTimingDisplay, IssueTimingDisplayKind } from './issue-timing';
|
|
8
10
|
export {
|
|
9
11
|
ISSUE_SEVERITIES,
|
|
10
12
|
ISSUE_SEVERITY_RANK,
|
|
@@ -17,6 +19,7 @@ export {
|
|
|
17
19
|
ISSUE_SEVERITY_LABEL,
|
|
18
20
|
ISSUE_SEVERITY_BADGE_CLASS,
|
|
19
21
|
ISSUE_SEVERITY_TEXT_CLASS,
|
|
22
|
+
ISSUE_SEVERITY_FILL_CLASS,
|
|
20
23
|
ISSUE_SEVERITY_RAIL_CLASS,
|
|
21
24
|
categoryLabel,
|
|
22
25
|
groupLabel,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { formatRelativeAgeTime } from '../../utils/format';
|
|
2
|
+
import { isDeploymentLikeWorkloadKind } from '../../types';
|
|
3
|
+
import type { Issue } from './types';
|
|
4
|
+
|
|
5
|
+
export type IssueTimingDisplayKind = 'creation' | 'regression';
|
|
6
|
+
|
|
7
|
+
export interface IssueTimingDisplay {
|
|
8
|
+
kind: IssueTimingDisplayKind;
|
|
9
|
+
chip: string;
|
|
10
|
+
meta: string;
|
|
11
|
+
tooltip: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function isDeploymentLikeCreation(issue: Issue): boolean {
|
|
15
|
+
const group = issue.group ?? '';
|
|
16
|
+
if (issue.kind === 'Pod') {
|
|
17
|
+
return issue.issue_timing_basis === 'pod_creation'
|
|
18
|
+
|| issue.issue_timing_basis === 'owner_condition';
|
|
19
|
+
}
|
|
20
|
+
return isDeploymentLikeWorkloadKind(issue.kind, group);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function issueTiming(issue: Issue): IssueTimingDisplay | null {
|
|
24
|
+
switch (issue.issue_timing) {
|
|
25
|
+
case 'started_after_resource_was_healthy': {
|
|
26
|
+
const started = issue.first_seen ? `started ${formatRelativeAgeTime(issue.first_seen)} after being healthy` : 'started after being healthy';
|
|
27
|
+
return {
|
|
28
|
+
kind: 'regression',
|
|
29
|
+
chip: 'after healthy',
|
|
30
|
+
meta: started,
|
|
31
|
+
tooltip: 'Previously healthy before this failing signal.',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
case 'started_at_resource_creation': {
|
|
35
|
+
if (isDeploymentLikeCreation(issue)) {
|
|
36
|
+
return {
|
|
37
|
+
kind: 'creation',
|
|
38
|
+
chip: 'since deploy',
|
|
39
|
+
meta: 'present since deployment or first reconciliation',
|
|
40
|
+
tooltip: 'Failing signal began during deployment or first reconciliation.',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
kind: 'creation',
|
|
45
|
+
chip: 'since creation',
|
|
46
|
+
meta: 'present since creation or first reconciliation',
|
|
47
|
+
tooltip: 'Failing signal began during resource creation or first reconciliation.',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
default:
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -4,6 +4,7 @@ import { renderToString } from 'react-dom/server'
|
|
|
4
4
|
import { compareIssues, subjectRef, memberRef, normalizeImagePullMessage, issueMessageParts, type Issue } from './types'
|
|
5
5
|
import { categoryLabel, groupBadgeClass, groupLabel } from './severity'
|
|
6
6
|
import { IssueRow } from './IssuesView'
|
|
7
|
+
import { issueTiming } from './issue-timing'
|
|
7
8
|
|
|
8
9
|
const base: Issue = {
|
|
9
10
|
id: 'id-0',
|
|
@@ -78,7 +79,7 @@ describe('category/group label fallbacks', () => {
|
|
|
78
79
|
})
|
|
79
80
|
|
|
80
81
|
describe('IssueRow', () => {
|
|
81
|
-
it('keeps relative age visible and adds
|
|
82
|
+
it('keeps relative age visible and adds deployment timing as a secondary tag', () => {
|
|
82
83
|
vi.useFakeTimers()
|
|
83
84
|
vi.setSystemTime(new Date('2026-06-30T12:00:00Z'))
|
|
84
85
|
|
|
@@ -96,6 +97,25 @@ describe('IssueRow', () => {
|
|
|
96
97
|
expect(html).toContain('since deploy')
|
|
97
98
|
})
|
|
98
99
|
|
|
100
|
+
it('promotes after-healthy timing in the collapsed row', () => {
|
|
101
|
+
vi.useFakeTimers()
|
|
102
|
+
vi.setSystemTime(new Date('2026-06-30T12:00:00Z'))
|
|
103
|
+
|
|
104
|
+
const html = renderToString(createElement(IssueRow, {
|
|
105
|
+
issue: mk({
|
|
106
|
+
id: 'regression',
|
|
107
|
+
first_seen: '2026-06-30T10:00:00Z',
|
|
108
|
+
issue_timing: 'started_after_resource_was_healthy',
|
|
109
|
+
issue_timing_basis: 'condition',
|
|
110
|
+
}),
|
|
111
|
+
open: false,
|
|
112
|
+
onToggle: () => undefined,
|
|
113
|
+
}))
|
|
114
|
+
|
|
115
|
+
expect(html).toContain('2h')
|
|
116
|
+
expect(html).toContain('after healthy')
|
|
117
|
+
})
|
|
118
|
+
|
|
99
119
|
it('uses the category-group chip class in the queue row', () => {
|
|
100
120
|
const html = renderToString(createElement(IssueRow, {
|
|
101
121
|
issue: mk({ category_group: 'control_plane' }),
|
|
@@ -108,6 +128,87 @@ describe('IssueRow', () => {
|
|
|
108
128
|
})
|
|
109
129
|
})
|
|
110
130
|
|
|
131
|
+
describe('issueTiming', () => {
|
|
132
|
+
it('keeps deployment wording for deployment-like creation failures', () => {
|
|
133
|
+
expect(issueTiming(mk({
|
|
134
|
+
kind: 'Deployment',
|
|
135
|
+
group: 'apps',
|
|
136
|
+
issue_timing: 'started_at_resource_creation',
|
|
137
|
+
issue_timing_basis: 'condition',
|
|
138
|
+
}))).toMatchObject({
|
|
139
|
+
kind: 'creation',
|
|
140
|
+
chip: 'since deploy',
|
|
141
|
+
meta: 'present since deployment or first reconciliation',
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
expect(issueTiming(mk({
|
|
145
|
+
kind: 'Rollout',
|
|
146
|
+
group: 'argoproj.io',
|
|
147
|
+
issue_timing: 'started_at_resource_creation',
|
|
148
|
+
issue_timing_basis: 'condition',
|
|
149
|
+
}))).toMatchObject({
|
|
150
|
+
kind: 'creation',
|
|
151
|
+
chip: 'since deploy',
|
|
152
|
+
meta: 'present since deployment or first reconciliation',
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('uses deployment wording for pod issues only when workload timing evidence is present', () => {
|
|
157
|
+
expect(issueTiming(mk({
|
|
158
|
+
kind: 'Pod',
|
|
159
|
+
issue_timing: 'started_at_resource_creation',
|
|
160
|
+
issue_timing_basis: 'pod_creation',
|
|
161
|
+
}))).toMatchObject({
|
|
162
|
+
kind: 'creation',
|
|
163
|
+
chip: 'since deploy',
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
expect(issueTiming(mk({
|
|
167
|
+
kind: 'Pod',
|
|
168
|
+
issue_timing: 'started_at_resource_creation',
|
|
169
|
+
issue_timing_basis: 'phase',
|
|
170
|
+
}))).toMatchObject({
|
|
171
|
+
kind: 'creation',
|
|
172
|
+
chip: 'since creation',
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
it('uses resource creation wording for non-deployment creation failures', () => {
|
|
177
|
+
expect(issueTiming(mk({
|
|
178
|
+
kind: 'PersistentVolumeClaim',
|
|
179
|
+
issue_timing: 'started_at_resource_creation',
|
|
180
|
+
issue_timing_basis: 'phase',
|
|
181
|
+
}))).toMatchObject({
|
|
182
|
+
kind: 'creation',
|
|
183
|
+
chip: 'since creation',
|
|
184
|
+
meta: 'present since creation or first reconciliation',
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
it('describes after-healthy timing without implying root cause or safety', () => {
|
|
189
|
+
vi.useFakeTimers()
|
|
190
|
+
vi.setSystemTime(new Date('2026-06-30T12:00:00Z'))
|
|
191
|
+
|
|
192
|
+
const display = issueTiming(mk({
|
|
193
|
+
first_seen: '2026-06-30T10:00:00Z',
|
|
194
|
+
issue_timing: 'started_after_resource_was_healthy',
|
|
195
|
+
issue_timing_basis: 'condition',
|
|
196
|
+
}))
|
|
197
|
+
|
|
198
|
+
expect(display).toMatchObject({
|
|
199
|
+
kind: 'regression',
|
|
200
|
+
chip: 'after healthy',
|
|
201
|
+
meta: 'started 2h ago after being healthy',
|
|
202
|
+
tooltip: 'Previously healthy before this failing signal.',
|
|
203
|
+
})
|
|
204
|
+
expect(`${display?.chip} ${display?.meta} ${display?.tooltip}`).not.toMatch(/baseline|safe|ignore/i)
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
it('returns null when there is no confident timing signal', () => {
|
|
208
|
+
expect(issueTiming(mk({ issue_timing: undefined, issue_timing_basis: undefined }))).toBeNull()
|
|
209
|
+
})
|
|
210
|
+
})
|
|
211
|
+
|
|
111
212
|
describe('subjectRef / memberRef', () => {
|
|
112
213
|
it('subjectRef defaults empty group/namespace and threads cluster_id', () => {
|
|
113
214
|
const issue = mk({ cluster_id: 'cl_1', kind: 'Deployment', name: 'web' }) // no group/namespace
|
|
@@ -2,6 +2,7 @@ import type { IssueSeverity } from './types';
|
|
|
2
2
|
import { BADGE_SEVERITY_COLORS as sev } from '../ui/Badge';
|
|
3
3
|
import { NEUTRAL_CHIP_CLASS } from '../ui/CardSection';
|
|
4
4
|
import {
|
|
5
|
+
TONE_FILL_CLASS,
|
|
5
6
|
TONE_HEADER_BAND_CLASS,
|
|
6
7
|
TONE_RAIL_CLASS,
|
|
7
8
|
TONE_SOLID_CLASS,
|
|
@@ -36,6 +37,7 @@ export const ISSUE_SEVERITY_BADGE_CLASS: Record<IssueSeverity, string> = {
|
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export const ISSUE_SEVERITY_TEXT_CLASS = byTone(TONE_TEXT_CLASS);
|
|
40
|
+
export const ISSUE_SEVERITY_FILL_CLASS = byTone(TONE_FILL_CLASS);
|
|
39
41
|
export const ISSUE_SEVERITY_RAIL_CLASS = byTone(TONE_RAIL_CLASS);
|
|
40
42
|
export const ISSUE_SEVERITY_SOLID_CLASS = byTone(TONE_SOLID_CLASS);
|
|
41
43
|
export const ISSUE_SEVERITY_HEADER_BAND_CLASS = byTone(TONE_HEADER_BAND_CLASS);
|
|
@@ -99,6 +101,7 @@ const CATEGORY_LABEL: Record<string, string> = {
|
|
|
99
101
|
gitops_operation_failed: 'GitOps operation failed',
|
|
100
102
|
gitops_out_of_sync: 'GitOps out of sync',
|
|
101
103
|
gitops_health_degraded: 'GitOps health degraded',
|
|
104
|
+
gitops_stale: 'GitOps comparisons stale',
|
|
102
105
|
helm_release_failed: 'Helm release failed',
|
|
103
106
|
webhook_backend_down: 'Webhook backend down',
|
|
104
107
|
control_plane_not_ready: 'Control plane not ready',
|
|
@@ -5,6 +5,7 @@ import type { LogEntry, LogLevel } from './useLogBuffer'
|
|
|
5
5
|
import { useLogSearch } from './useLogSearch'
|
|
6
6
|
import { StructuredLogLine } from './StructuredLogLine'
|
|
7
7
|
import { Tooltip } from '../ui/Tooltip'
|
|
8
|
+
import { Input } from '../ui/Input'
|
|
8
9
|
import {
|
|
9
10
|
formatLogTimestamp,
|
|
10
11
|
highlightSearchMatches,
|
|
@@ -37,6 +38,7 @@ interface LogCoreProps {
|
|
|
37
38
|
toolbarExtra?: ToolbarExtraRenderer
|
|
38
39
|
showPodName?: boolean
|
|
39
40
|
emptyMessage?: string
|
|
41
|
+
emptyCommand?: string | null
|
|
40
42
|
errorMessage?: string | null
|
|
41
43
|
/**
|
|
42
44
|
* Hard override for the viewer palette. When set, the viewer stays pinned to
|
|
@@ -88,6 +90,8 @@ const STRUCTURED_MODE_DESCRIPTIONS: Record<StructuredMode, string> = {
|
|
|
88
90
|
raw: 'Original log line, unparsed',
|
|
89
91
|
}
|
|
90
92
|
|
|
93
|
+
const EMPTY_STATE_CLASS = 'flex-1 flex flex-col items-center justify-center gap-2 px-4 text-center'
|
|
94
|
+
|
|
91
95
|
const TIMESTAMP_FORMAT_SHORT_LABELS: Record<TimestampFormat, string> = {
|
|
92
96
|
'time-local': 'Local time',
|
|
93
97
|
'time-utc': 'UTC time',
|
|
@@ -124,6 +128,7 @@ export function LogCore({
|
|
|
124
128
|
toolbarExtra,
|
|
125
129
|
showPodName = false,
|
|
126
130
|
emptyMessage = 'No logs available',
|
|
131
|
+
emptyCommand,
|
|
127
132
|
errorMessage,
|
|
128
133
|
forceDark,
|
|
129
134
|
}: LogCoreProps) {
|
|
@@ -694,8 +699,7 @@ export function LogCore({
|
|
|
694
699
|
{search.isOpen && (
|
|
695
700
|
<div className={`flex items-center gap-2 px-3 py-2 border-b ${palette.border} ${palette.toolbarBgMuted}`}>
|
|
696
701
|
<Search className={`w-4 h-4 ${palette.textSecondary} shrink-0`} />
|
|
697
|
-
<
|
|
698
|
-
type="text"
|
|
702
|
+
<Input
|
|
699
703
|
value={search.query}
|
|
700
704
|
onChange={(e) => search.setQuery(e.target.value)}
|
|
701
705
|
onKeyDown={(e) => {
|
|
@@ -800,14 +804,20 @@ export function LogCore({
|
|
|
800
804
|
</div>
|
|
801
805
|
</div>
|
|
802
806
|
) : errorMessage ? (
|
|
803
|
-
<div className={
|
|
807
|
+
<div className={`${EMPTY_STATE_CLASS} ${palette.textError}`}>
|
|
804
808
|
<Terminal className="w-8 h-8" />
|
|
805
809
|
<span>{errorMessage}</span>
|
|
806
810
|
</div>
|
|
807
811
|
) : groupedEntries.length === 0 ? (
|
|
808
|
-
<div className={
|
|
812
|
+
<div className={`${EMPTY_STATE_CLASS} ${palette.textTertiary}`}>
|
|
809
813
|
<Terminal className="w-8 h-8" />
|
|
810
814
|
<span>{emptyMessage}</span>
|
|
815
|
+
{emptyCommand && (
|
|
816
|
+
<button type="button" onClick={() => navigator.clipboard.writeText(emptyCommand).catch(() => {})} className={`mt-2 inline-flex max-w-[80%] items-center gap-2 rounded border px-3 py-2 font-mono text-xs ${palette.border} ${palette.toolbarBg}`} title="Copy recovery command">
|
|
817
|
+
<code className="truncate">{emptyCommand}</code>
|
|
818
|
+
<Copy className="h-3.5 w-3.5 shrink-0" />
|
|
819
|
+
</button>
|
|
820
|
+
)}
|
|
811
821
|
</div>
|
|
812
822
|
) : (
|
|
813
823
|
<div className="flex-1 relative">
|
|
@@ -27,6 +27,9 @@ export interface WorkloadLogsFetchParams {
|
|
|
27
27
|
export interface WorkloadLogsResult {
|
|
28
28
|
pods: WorkloadPodInfo[]
|
|
29
29
|
logs: WorkloadRawLog[]
|
|
30
|
+
emptyReason?: string
|
|
31
|
+
emptyMessage?: string
|
|
32
|
+
command?: string
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
export interface WorkloadLogsViewerProps {
|
|
@@ -61,6 +64,8 @@ export function WorkloadLogsViewer({ name, fetchAll, createStream, overrideDownl
|
|
|
61
64
|
const [selectedPods, setSelectedPods] = useState<Set<string>>(new Set())
|
|
62
65
|
const [isLoading, setIsLoading] = useState(false)
|
|
63
66
|
const [fetchError, setFetchError] = useState<string | null>(null)
|
|
67
|
+
const [emptyMessage, setEmptyMessage] = useState<string | null>(null)
|
|
68
|
+
const [emptyCommand, setEmptyCommand] = useState<string | null>(null)
|
|
64
69
|
const [showPodFilter, setShowPodFilter] = useState(false)
|
|
65
70
|
const [logRange, setLogRange] = useState('100')
|
|
66
71
|
const { showError, showSuccess } = useToast()
|
|
@@ -95,9 +100,10 @@ export function WorkloadLogsViewer({ name, fetchAll, createStream, overrideDownl
|
|
|
95
100
|
setFetchError(null)
|
|
96
101
|
try {
|
|
97
102
|
const result = await fetchAll({ container: selectedContainer || undefined, tailLines, sinceSeconds })
|
|
98
|
-
// Older backends marshal empty results as null rather than [].
|
|
99
103
|
const resultPods = result.pods ?? []
|
|
100
104
|
const resultLogs = result.logs ?? []
|
|
105
|
+
setEmptyMessage(result.emptyMessage || null)
|
|
106
|
+
setEmptyCommand(result.command || null)
|
|
101
107
|
|
|
102
108
|
podColorIndexRef.current = new Map(resultPods.map((pod, i) => [pod.name, i]))
|
|
103
109
|
setPods(resultPods)
|
|
@@ -157,6 +163,8 @@ export function WorkloadLogsViewer({ name, fetchAll, createStream, overrideDownl
|
|
|
157
163
|
const nextPods = data.pods as WorkloadPodInfo[]
|
|
158
164
|
podColorIndexRef.current = new Map(nextPods.map((pod, i) => [pod.name, i]))
|
|
159
165
|
setPods(nextPods)
|
|
166
|
+
setEmptyMessage(data.emptyMessage || null)
|
|
167
|
+
setEmptyCommand(data.command || null)
|
|
160
168
|
setSelectedPods(prev => (
|
|
161
169
|
prev.size === 0 ? new Set(nextPods.map((p: WorkloadPodInfo) => p.name)) : prev
|
|
162
170
|
))
|
|
@@ -180,8 +188,12 @@ export function WorkloadLogsViewer({ name, fetchAll, createStream, overrideDownl
|
|
|
180
188
|
const existing = new Set(prev.map(p => p.name))
|
|
181
189
|
const toAdd = newPods.filter(p => !existing.has(p.name))
|
|
182
190
|
if (toAdd.length === 0) return prev
|
|
183
|
-
|
|
191
|
+
const next = [...prev, ...toAdd]
|
|
192
|
+
podColorIndexRef.current = new Map(next.map((pod, i) => [pod.name, i]))
|
|
193
|
+
return next
|
|
184
194
|
})
|
|
195
|
+
setEmptyMessage(null)
|
|
196
|
+
setEmptyCommand(null)
|
|
185
197
|
setSelectedPods(prev => {
|
|
186
198
|
const next = new Set(prev)
|
|
187
199
|
newPods.forEach(p => next.add(p.name))
|
|
@@ -197,6 +209,10 @@ export function WorkloadLogsViewer({ name, fetchAll, createStream, overrideDownl
|
|
|
197
209
|
// while new pod logs start flowing in
|
|
198
210
|
}
|
|
199
211
|
},
|
|
212
|
+
onEnd: (data: any) => {
|
|
213
|
+
if (data?.emptyMessage) setEmptyMessage(data.emptyMessage)
|
|
214
|
+
if (data?.command) setEmptyCommand(data.command)
|
|
215
|
+
},
|
|
200
216
|
},
|
|
201
217
|
'Workload log stream connection failed',
|
|
202
218
|
)
|
|
@@ -299,8 +315,13 @@ export function WorkloadLogsViewer({ name, fetchAll, createStream, overrideDownl
|
|
|
299
315
|
</div>
|
|
300
316
|
{pods.map(pod => {
|
|
301
317
|
const dotBg = palette.podColors[(podColorIndex.get(pod.name) ?? 0) % palette.podColors.length].bg
|
|
318
|
+
const primaryLabel = pod.stepName || pod.name
|
|
319
|
+
const secondaryLabel = pod.stepName ? pod.name : ''
|
|
320
|
+
const stateLabel = pod.stepPhase || pod.phase || (pod.ready ? 'Ready' : 'Not Ready')
|
|
302
321
|
let readyColor: string
|
|
303
|
-
if (
|
|
322
|
+
if (stateLabel === 'Failed' || stateLabel === 'Error') {
|
|
323
|
+
readyColor = isDark ? 'text-red-400' : 'text-red-700'
|
|
324
|
+
} else if (pod.ready || stateLabel === 'Succeeded') {
|
|
304
325
|
readyColor = isDark ? 'text-emerald-400' : 'text-emerald-700'
|
|
305
326
|
} else {
|
|
306
327
|
readyColor = isDark ? 'text-amber-400' : 'text-amber-700'
|
|
@@ -314,9 +335,12 @@ export function WorkloadLogsViewer({ name, fetchAll, createStream, overrideDownl
|
|
|
314
335
|
className={`w-3 h-3 rounded ${palette.borderLight} ${palette.elevatedBg} text-blue-500 focus:ring-blue-500 focus:ring-offset-0`}
|
|
315
336
|
/>
|
|
316
337
|
<span className={`w-2 h-2 rounded-full ${dotBg}`} />
|
|
317
|
-
<span className=
|
|
338
|
+
<span className="min-w-0 flex-1">
|
|
339
|
+
<span className={`block truncate text-xs ${palette.textPrimary}`}>{primaryLabel}</span>
|
|
340
|
+
{secondaryLabel && <span className={`block truncate text-[10px] ${palette.textTertiary}`}>{secondaryLabel}</span>}
|
|
341
|
+
</span>
|
|
318
342
|
<span className={`text-xs ${readyColor}`}>
|
|
319
|
-
{
|
|
343
|
+
{stateLabel}
|
|
320
344
|
</span>
|
|
321
345
|
</label>
|
|
322
346
|
)
|
|
@@ -360,7 +384,8 @@ export function WorkloadLogsViewer({ name, fetchAll, createStream, overrideDownl
|
|
|
360
384
|
onClear={clear}
|
|
361
385
|
toolbarExtra={renderToolbarExtra}
|
|
362
386
|
showPodName
|
|
363
|
-
emptyMessage={pods.length === 0 ? 'No pods found' : 'No logs available'}
|
|
387
|
+
emptyMessage={emptyMessage || (pods.length === 0 ? 'No pods found' : 'No logs available')}
|
|
388
|
+
emptyCommand={emptyCommand}
|
|
364
389
|
errorMessage={fetchError || (entries.length === 0 ? streamError : null)}
|
|
365
390
|
forceDark={forceDark}
|
|
366
391
|
/>
|
|
@@ -10,6 +10,8 @@ export interface LogStreamHandlers {
|
|
|
10
10
|
onPodAdded?: (data: unknown) => void
|
|
11
11
|
/** Called when pods are terminated during streaming (workload logs only) */
|
|
12
12
|
onPodRemoved?: (data: unknown) => void
|
|
13
|
+
/** Called when the server ends the stream cleanly */
|
|
14
|
+
onEnd?: (data: unknown) => void
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -90,11 +92,16 @@ export function useLogStream() {
|
|
|
90
92
|
}
|
|
91
93
|
})
|
|
92
94
|
|
|
93
|
-
es.addEventListener('end', () => {
|
|
95
|
+
es.addEventListener('end', (event) => {
|
|
94
96
|
if (!isCurrent()) return
|
|
95
97
|
endedRef.current = true
|
|
96
98
|
setIsStreaming(false)
|
|
97
99
|
setConnecting(false)
|
|
100
|
+
if (handlers.onEnd) {
|
|
101
|
+
try { handlers.onEnd(JSON.parse((event as MessageEvent).data)) } catch (e) {
|
|
102
|
+
console.error('Failed to parse end event:', e)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
98
105
|
})
|
|
99
106
|
|
|
100
107
|
es.addEventListener('error', (event) => {
|