@skyhook-io/radar-app 1.21.3 → 1.21.5
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 +1 -1
- package/src/App.tsx +3 -0
- package/src/api/client.ts +42 -2
- package/src/api/radarFeatures.ts +2 -0
- package/src/api/vulnerabilities.export.test.ts +44 -0
- package/src/api/vulnerabilities.ts +73 -4
- package/src/components/applications/ApplicationsView.tsx +38 -8
- package/src/components/applications/ArgoSyncDetails.tsx +32 -0
- package/src/components/applications/RenderedChanges.test.tsx +179 -0
- package/src/components/applications/RenderedChanges.tsx +233 -0
- package/src/components/audit/AuditView.tsx +2 -1
- package/src/components/audit/VulnerabilitiesView.test.tsx +177 -0
- package/src/components/audit/VulnerabilitiesView.tsx +197 -48
- package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +30 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +21 -1
- package/src/components/diagnose/investigationEvidence/bodies/platform.tsx +9 -0
- package/src/components/diagnose/investigationEvidence/types.ts +12 -0
- package/src/components/helm/HelmReleaseDrawer.test.ts +27 -0
- package/src/components/helm/HelmReleaseDrawer.tsx +24 -3
- package/src/components/helm/HelmView.tsx +16 -6
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +3 -0
- package/src/components/helm/releaseController.test.tsx +26 -0
- package/src/components/helm/releaseController.tsx +98 -0
- package/src/components/resources/renderers/K3sHelmChartRenderer.tsx +18 -0
- package/src/components/traffic/TrafficGraph.export.test.tsx +57 -0
- package/src/components/traffic/TrafficGraph.tsx +11 -20
- package/src/components/traffic/TrafficView.layoutUnavailable.test.tsx +1 -0
- package/src/components/traffic/TrafficView.tsx +17 -2
- package/src/components/traffic/traffic-export.test.ts +51 -0
- package/src/components/traffic/traffic-export.ts +114 -0
- package/src/components/traffic/trafficFilters.ts +16 -0
- package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.test.tsx +30 -1
- package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.tsx +3 -2
- package/src/components/vulnerabilities/parts.test.ts +59 -3
- package/src/components/vulnerabilities/parts.tsx +199 -5
- package/src/components/workload/WorkloadRevisionsButton.test.tsx +34 -0
- package/src/components/workload/WorkloadRevisionsButton.tsx +31 -0
- package/src/components/workload/WorkloadView.tsx +11 -3
- package/src/hooks/useDesktopDownload.test.tsx +57 -0
- package/src/hooks/useDesktopDownload.ts +31 -9
- package/src/integrations/resourceHosts.test.tsx +1 -1
- package/src/integrations/resourceHosts.tsx +2 -0
|
@@ -9,6 +9,7 @@ import { nonEmptyString, record, stringArray } from "../parse";
|
|
|
9
9
|
import {
|
|
10
10
|
type InvestigationEvidenceRelevance,
|
|
11
11
|
type InvestigationEvidenceSource,
|
|
12
|
+
type InvestigationHelmController,
|
|
12
13
|
type InvestigationHelmOperation,
|
|
13
14
|
type InvestigationHelmOwnedResource,
|
|
14
15
|
type InvestigationHelmRelease,
|
|
@@ -208,7 +209,10 @@ export function adaptHelmRelease(
|
|
|
208
209
|
return;
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
|
-
if (
|
|
212
|
+
if (
|
|
213
|
+
(value.managedByFlux !== undefined && typeof value.managedByFlux !== "boolean") ||
|
|
214
|
+
(value.managedByK3s !== undefined && typeof value.managedByK3s !== "boolean")
|
|
215
|
+
) {
|
|
212
216
|
invalidPayload(builder, source);
|
|
213
217
|
return;
|
|
214
218
|
}
|
|
@@ -259,8 +263,10 @@ export function adaptHelmRelease(
|
|
|
259
263
|
? { statusUnreadCount: value.statusUnreadCount }
|
|
260
264
|
: {}),
|
|
261
265
|
...(value.managedByFlux === true ? { managedByFlux: true } : {}),
|
|
266
|
+
...(value.managedByK3s === true ? { managedByK3s: true } : {}),
|
|
262
267
|
managedByFluxHelmRelease: value.managedByFluxHelmRelease as
|
|
263
268
|
string | undefined,
|
|
269
|
+
...releaseControllerField(value.controller),
|
|
264
270
|
lastOperation,
|
|
265
271
|
resources,
|
|
266
272
|
...(history ? { history } : {}),
|
|
@@ -320,3 +326,17 @@ export function adaptHelmRelease(
|
|
|
320
326
|
}
|
|
321
327
|
}
|
|
322
328
|
}
|
|
329
|
+
|
|
330
|
+
// controller is kept only when it names an object; any tool counts.
|
|
331
|
+
function releaseControllerField(value: unknown): { controller?: InvestigationHelmController } {
|
|
332
|
+
const v = record(value);
|
|
333
|
+
if (!v) return {};
|
|
334
|
+
const { tool, kind, name, namespace } = v;
|
|
335
|
+
if (!nonEmptyString(tool) || !nonEmptyString(kind) || !nonEmptyString(name)) return {};
|
|
336
|
+
const ref = record(v.valuesRef);
|
|
337
|
+
const values =
|
|
338
|
+
ref && ref.exists === true && nonEmptyString(ref.kind) && nonEmptyString(ref.name)
|
|
339
|
+
? `${ref.kind} ${typeof ref.namespace === "string" ? ref.namespace : ""}/${ref.name}`
|
|
340
|
+
: undefined;
|
|
341
|
+
return { controller: { tool, kind, name, namespace: typeof namespace === "string" ? namespace : "", ...(values ? { values } : {}) } };
|
|
342
|
+
}
|
|
@@ -152,6 +152,15 @@ export function HelmBody({ data }: { data: EvidenceDataOf<"helm"> }) {
|
|
|
152
152
|
<p className="text-xs text-theme-text-tertiary">
|
|
153
153
|
Managed by Flux{release.managedByFluxHelmRelease ? ` HelmRelease ${release.managedByFluxHelmRelease}` : ''}
|
|
154
154
|
</p>
|
|
155
|
+
) : release.controller ? (
|
|
156
|
+
<p className="text-xs text-theme-text-tertiary">
|
|
157
|
+
Managed by {release.controller.tool} {release.controller.kind} {release.controller.namespace}/{release.controller.name}
|
|
158
|
+
{release.controller.values ? ` · values in ${release.controller.values}` : ''}
|
|
159
|
+
</p>
|
|
160
|
+
) : release.managedByK3s ? (
|
|
161
|
+
<p className="text-xs text-theme-text-tertiary">
|
|
162
|
+
Managed by the k3s/RKE2 helm-controller
|
|
163
|
+
</p>
|
|
155
164
|
) : null}
|
|
156
165
|
{release.hooks && release.hooks.length > 0 ? (
|
|
157
166
|
<div>
|
|
@@ -286,6 +286,9 @@ export interface InvestigationHelmRelease {
|
|
|
286
286
|
statusUnreadCount?: number;
|
|
287
287
|
managedByFlux?: boolean;
|
|
288
288
|
managedByFluxHelmRelease?: string;
|
|
289
|
+
/** k3s/RKE2 ownership, kept when the HelmChart is withheld. */
|
|
290
|
+
managedByK3s?: boolean;
|
|
291
|
+
controller?: InvestigationHelmController;
|
|
289
292
|
lastOperation?: InvestigationHelmOperation;
|
|
290
293
|
resources: InvestigationHelmOwnedResource[];
|
|
291
294
|
/** Newest first; the tool returns the release's stored revisions. */
|
|
@@ -645,3 +648,12 @@ export interface InvestigationRootCauseEvidenceResolution {
|
|
|
645
648
|
status: "linked" | "missing" | "invalid";
|
|
646
649
|
links: InvestigationRootCauseEvidenceLink[];
|
|
647
650
|
}
|
|
651
|
+
|
|
652
|
+
export interface InvestigationHelmController {
|
|
653
|
+
tool: string;
|
|
654
|
+
kind: string;
|
|
655
|
+
namespace: string;
|
|
656
|
+
name: string;
|
|
657
|
+
/** "Kind namespace/name" of the object values are changed in, when one exists. */
|
|
658
|
+
values?: string;
|
|
659
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { controllerManagedText, otherController, releaseControllerOf } from './releaseController'
|
|
2
3
|
import { DEFAULT_SHOW_EFFECTIVE_VALUES, effectiveHelmStorageNamespace, isUpgradeSourceIssueActionable, upgradePickerVersions } from './HelmReleaseDrawer'
|
|
3
4
|
|
|
4
5
|
describe('Helm values view', () => {
|
|
@@ -67,3 +68,29 @@ describe('upgradePickerVersions', () => {
|
|
|
67
68
|
expect(upgradePickerVersions(undefined, '1.5.0')).toBeNull()
|
|
68
69
|
})
|
|
69
70
|
})
|
|
71
|
+
|
|
72
|
+
describe('release controller', () => {
|
|
73
|
+
const k3s = (exists?: boolean) => ({ tool: 'k3s', kind: 'HelmChart', group: 'helm.cattle.io', namespace: 'kube-system', name: 'traefik', valuesRef: { kind: 'HelmChartConfig', group: 'helm.cattle.io', namespace: 'kube-system', name: 'traefik', exists } })
|
|
74
|
+
|
|
75
|
+
it('reads the generic field, and the Flux field from an older Radar', () => {
|
|
76
|
+
expect(releaseControllerOf({ controller: k3s(true) })).toEqual(k3s(true))
|
|
77
|
+
expect(releaseControllerOf({ managedByFluxHelmRelease: 'flux-system/app' })).toEqual({ tool: 'flux', kind: 'HelmRelease', group: 'helm.toolkit.fluxcd.io', namespace: 'flux-system', name: 'app' })
|
|
78
|
+
expect(releaseControllerOf({})).toBeUndefined()
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('words any controller, naming where values change', () => {
|
|
82
|
+
expect(controllerManagedText(k3s(true))).toBe('Managed by k3s. HelmChart kube-system/traefik installs this release from its own definition, so an upgrade or rollback here is overwritten the next time helm-controller runs the install Job (when the HelmChart or its HelmChartConfig changes). Change values in HelmChartConfig kube-system/traefik.')
|
|
83
|
+
expect(controllerManagedText(k3s(false))).toBe('Managed by k3s. HelmChart kube-system/traefik installs this release from its own definition, so an upgrade or rollback here is overwritten the next time helm-controller runs the install Job (when the HelmChart or its HelmChartConfig changes). Create a HelmChartConfig kube-system/traefik to change its values.')
|
|
84
|
+
expect(controllerManagedText(k3s(undefined))).toContain('(create it if it does not exist)')
|
|
85
|
+
const fleet = { tool: 'fleet', kind: 'Bundle', group: 'fleet.cattle.io', namespace: 'fleet-local', name: 'app' }
|
|
86
|
+
expect(controllerManagedText(fleet)).toBe('Managed by fleet. Bundle fleet-local/app installs this release from its own definition, so an upgrade or rollback here can be overwritten by that Bundle. Change it through that Bundle.')
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
describe('controllers other than Flux', () => {
|
|
91
|
+
it('are the ones that hide upgrade hints and get the generic note; Flux keeps its own routing', () => {
|
|
92
|
+
expect(otherController({ controller: { tool: 'k3s', kind: 'HelmChart', group: 'helm.cattle.io', namespace: 'kube-system', name: 'traefik' } })?.tool).toBe('k3s')
|
|
93
|
+
expect(otherController({ managedByFluxHelmRelease: 'flux-system/x' })).toBeUndefined()
|
|
94
|
+
expect(otherController({})).toBeUndefined()
|
|
95
|
+
})
|
|
96
|
+
})
|
|
@@ -4,7 +4,7 @@ import { flushSync } from 'react-dom'
|
|
|
4
4
|
import { FetchResult, compareVersions, usePhoneLayout } from '@skyhook-io/k8s-ui'
|
|
5
5
|
import { startViewTransitionSafe } from '@skyhook-io/k8s-ui/utils/view-transition'
|
|
6
6
|
import { useRefreshAnimation } from '../../hooks/useRefreshAnimation'
|
|
7
|
-
import { X, Copy, Check, RefreshCw, Package, Code, History, Settings, Link2, Anchor, GitFork, BookOpen, ArrowUpCircle, Trash2, GitBranch, AlertTriangle, RotateCcw, Clock, GitCompare, ExternalLink, SlidersHorizontal, Eye, Loader2 } from 'lucide-react'
|
|
7
|
+
import { X, Copy, Check, RefreshCw, Package, Code, History, Settings, Link2, Anchor, GitFork, BookOpen, ArrowUpCircle, Trash2, GitBranch, AlertTriangle, RotateCcw, Clock, GitCompare, ExternalLink, SlidersHorizontal, Eye, Loader2, Server } from 'lucide-react'
|
|
8
8
|
import yaml from 'yaml'
|
|
9
9
|
import { useNavigate } from 'react-router-dom'
|
|
10
10
|
import { clsx } from 'clsx'
|
|
@@ -27,6 +27,8 @@ import { OwnedResources } from './OwnedResources'
|
|
|
27
27
|
import { TrackChartSourceDialog } from './TrackChartSourceDialog'
|
|
28
28
|
import { HelmDrawerFrame } from './HelmDrawerFrame'
|
|
29
29
|
import { ObservedHelmReleaseDrawer } from './ObservedHelmReleaseDrawer'
|
|
30
|
+
import { HIDDEN_K3S_TEXT, ReleaseControllerNote, controllerManagedText, otherController as otherControllerOf } from './releaseController'
|
|
31
|
+
import type { HelmReleaseController } from '@skyhook-io/k8s-ui'
|
|
30
32
|
import { Collapse, CollapseChevron } from '@skyhook-io/k8s-ui/components/ui/Collapse'
|
|
31
33
|
import { Disclosure } from '@skyhook-io/k8s-ui/components/ui/Disclosure'
|
|
32
34
|
|
|
@@ -201,6 +203,10 @@ function FullHelmRelease({ release, onClose, onNavigateToResource }: Pick<HelmRe
|
|
|
201
203
|
release.name
|
|
202
204
|
)
|
|
203
205
|
const [refetch, isRefreshAnimating] = useRefreshAnimation(refetchRelease)
|
|
206
|
+
// A controller other than Flux (Flux keeps its own GitOps routing below).
|
|
207
|
+
const otherController = releaseDetail ? otherControllerOf(releaseDetail) : undefined
|
|
208
|
+
const hiddenK3s = !otherController && !!releaseDetail?.managedByK3s
|
|
209
|
+
const otherManaged = !!otherController || hiddenK3s
|
|
204
210
|
|
|
205
211
|
// Fetch manifest for selected revision (or latest)
|
|
206
212
|
const { data: manifest, isLoading: manifestLoading } = useHelmManifest(
|
|
@@ -591,6 +597,9 @@ function FullHelmRelease({ release, onClose, onNavigateToResource }: Pick<HelmRe
|
|
|
591
597
|
upgrade check failed
|
|
592
598
|
</span>
|
|
593
599
|
</Tooltip>
|
|
600
|
+
) : upgradeInfo?.updateAvailable && otherManaged ? (
|
|
601
|
+
// Another controller reinstalls the release; there is no Radar view to route an upgrade to.
|
|
602
|
+
null
|
|
594
603
|
) : upgradeInfo?.updateAvailable && (releaseDetail?.managedByFlux || releaseDetail?.managedByFluxHelmRelease) ? (
|
|
595
604
|
// Route-only for GitOps-managed releases: a direct `helm upgrade`
|
|
596
605
|
// may be reconciled back, so surface the available version as info.
|
|
@@ -623,7 +632,7 @@ function FullHelmRelease({ release, onClose, onNavigateToResource }: Pick<HelmRe
|
|
|
623
632
|
</span>
|
|
624
633
|
</Tooltip>
|
|
625
634
|
) : upgradeInfo?.error ? (
|
|
626
|
-
(releaseDetail?.managedByFlux || releaseDetail?.managedByFluxHelmRelease) ? (
|
|
635
|
+
otherManaged ? null : (releaseDetail?.managedByFlux || releaseDetail?.managedByFluxHelmRelease) ? (
|
|
627
636
|
// Keep source changes with Flux even when its controller link is hidden.
|
|
628
637
|
<Tooltip content={releaseDetail?.managedByFluxHelmRelease
|
|
629
638
|
? "Chart source is managed by Flux. Track upgrades from its HelmRelease in the GitOps view."
|
|
@@ -663,7 +672,7 @@ function FullHelmRelease({ release, onClose, onNavigateToResource }: Pick<HelmRe
|
|
|
663
672
|
) : null}
|
|
664
673
|
</div>
|
|
665
674
|
<div className="flex items-center gap-1">
|
|
666
|
-
{sourceFeature.support === 'supported' && !releaseDetail?.managedByFlux && !releaseDetail?.managedByFluxHelmRelease && <Tooltip content="Choose chart source">
|
|
675
|
+
{sourceFeature.support === 'supported' && !releaseDetail?.managedByFlux && !releaseDetail?.managedByFluxHelmRelease && !otherManaged && <Tooltip content="Choose chart source">
|
|
667
676
|
<button type="button" aria-label="Choose chart source" disabled={!canHelmWrite} onClick={() => setShowTrackSource(true)} className="p-1.5 text-theme-text-secondary hover:text-theme-text-primary hover:bg-theme-elevated rounded disabled:opacity-50"><Link2 className="w-4 h-4" /></button>
|
|
668
677
|
</Tooltip>}
|
|
669
678
|
<Tooltip content="Refresh">
|
|
@@ -734,6 +743,14 @@ function FullHelmRelease({ release, onClose, onNavigateToResource }: Pick<HelmRe
|
|
|
734
743
|
</button>
|
|
735
744
|
</Tooltip>
|
|
736
745
|
)}
|
|
746
|
+
{otherController && <ReleaseControllerNote controller={otherController} onNavigateToResource={onNavigateToResource} />}
|
|
747
|
+
{hiddenK3s && (
|
|
748
|
+
<Tooltip content={HIDDEN_K3S_TEXT} wrapperClassName="mt-1">
|
|
749
|
+
<span className="inline-flex items-center gap-1 mt-1 text-xs text-theme-text-secondary">
|
|
750
|
+
<Server className="w-3 h-3" />Managed by k3s
|
|
751
|
+
</span>
|
|
752
|
+
</Tooltip>
|
|
753
|
+
)}
|
|
737
754
|
</div>
|
|
738
755
|
|
|
739
756
|
{/* Tabs */}
|
|
@@ -768,6 +785,7 @@ function FullHelmRelease({ release, onClose, onNavigateToResource }: Pick<HelmRe
|
|
|
768
785
|
releaseNamespace={releaseDetail.namespace}
|
|
769
786
|
managedByFlux={releaseDetail.managedByFlux}
|
|
770
787
|
managedByFluxHelmRelease={releaseDetail.managedByFluxHelmRelease}
|
|
788
|
+
otherController={otherController}
|
|
771
789
|
hookDiagnostics={releaseDetail.hookDiagnostics}
|
|
772
790
|
onCompare={handleCompareRevisions}
|
|
773
791
|
onNavigateToResource={onNavigateToResource}
|
|
@@ -1141,6 +1159,7 @@ function HelmOperationBanner({
|
|
|
1141
1159
|
releaseNamespace,
|
|
1142
1160
|
managedByFlux,
|
|
1143
1161
|
managedByFluxHelmRelease,
|
|
1162
|
+
otherController,
|
|
1144
1163
|
hookDiagnostics,
|
|
1145
1164
|
onCompare,
|
|
1146
1165
|
onNavigateToResource,
|
|
@@ -1150,6 +1169,7 @@ function HelmOperationBanner({
|
|
|
1150
1169
|
releaseNamespace: string
|
|
1151
1170
|
managedByFlux?: boolean
|
|
1152
1171
|
managedByFluxHelmRelease?: string
|
|
1172
|
+
otherController?: HelmReleaseController
|
|
1153
1173
|
hookDiagnostics?: HookDiagnostic[]
|
|
1154
1174
|
onCompare?: (rev1: number, rev2: number) => void
|
|
1155
1175
|
onNavigateToResource?: NavigateToResource
|
|
@@ -1230,6 +1250,7 @@ function HelmOperationBanner({
|
|
|
1230
1250
|
Managed by Flux{managedByFluxHelmRelease ? ` HelmRelease ${managedByFluxHelmRelease}` : ''}. Direct Helm changes may be reconciled back.
|
|
1231
1251
|
</p>
|
|
1232
1252
|
)}
|
|
1253
|
+
{otherController && <p className="mt-1 text-xs text-theme-text-tertiary">{controllerManagedText(otherController)}</p>}
|
|
1233
1254
|
</div>
|
|
1234
1255
|
</div>
|
|
1235
1256
|
</div>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useState, useMemo, useRef, useEffect, useCallback, forwardRef } from 'react'
|
|
2
|
+
import { HiddenK3sBadge, ReleaseControllerBadge, managedByOtherController, releaseControllerOf } from './releaseController'
|
|
3
|
+
import type { HelmReleaseController } from '@skyhook-io/k8s-ui'
|
|
2
4
|
import { useRegisterShortcuts } from '../../hooks/useKeyboardShortcuts'
|
|
3
|
-
import { Package, Search, ArrowUpCircle, LayoutGrid, List, Shield,
|
|
5
|
+
import { GitBranch, Package, Search, ArrowUpCircle, LayoutGrid, List, Shield, ChevronRight, RotateCcw, Clock } from 'lucide-react'
|
|
4
6
|
import { CertaintyGlyph, PaneLoader, PageHeader, SortableTh, FreshnessControl, type SortDir, Input, usePhoneLayout } from '@skyhook-io/k8s-ui'
|
|
5
7
|
import { useConnection } from '../../context/ConnectionContext'
|
|
6
8
|
import { clsx } from 'clsx'
|
|
@@ -617,7 +619,7 @@ const ObservedReleaseRow = forwardRef<HTMLTableRowElement, ObservedReleaseRowPro
|
|
|
617
619
|
<Package className="w-4 h-4 text-theme-text-tertiary shrink-0" />
|
|
618
620
|
<span className="min-w-0 truncate text-sm font-medium text-theme-text-primary phone:max-w-[calc(100%-1.5rem)] phone:shrink-0">{release.name}</span>
|
|
619
621
|
<ReleaseHealthBadge release={release} observed />
|
|
620
|
-
|
|
622
|
+
<ControllerBadge release={release} />
|
|
621
623
|
</div>
|
|
622
624
|
<span className="hidden truncate pl-6 text-xs text-theme-text-tertiary phone:block">{release.namespace}</span>
|
|
623
625
|
</td>
|
|
@@ -670,9 +672,17 @@ const ObservedReleaseRow = forwardRef<HTMLTableRowElement, ObservedReleaseRowPro
|
|
|
670
672
|
)
|
|
671
673
|
})
|
|
672
674
|
|
|
673
|
-
function
|
|
675
|
+
function ControllerBadge({ release }: { release: { controller?: HelmReleaseController; managedByFlux?: boolean; managedByFluxHelmRelease?: string; managedByK3s?: boolean } }) {
|
|
676
|
+
const controller = releaseControllerOf(release)
|
|
677
|
+
if (controller) return <ReleaseControllerBadge controller={controller} />
|
|
678
|
+
if (release.managedByFlux) return <HiddenFluxBadge />
|
|
679
|
+
return release.managedByK3s ? <HiddenK3sBadge /> : null
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
// Flux owns the release but the caller can't read its HelmRelease's namespace.
|
|
683
|
+
function HiddenFluxBadge() {
|
|
674
684
|
return (
|
|
675
|
-
<Tooltip content=
|
|
685
|
+
<Tooltip content="The owning Flux HelmRelease's namespace isn't available in this view, or Radar couldn't check your access. Manage this release through Flux; direct Helm changes may be reconciled back.">
|
|
676
686
|
<span className="badge-sm shrink-0 border border-theme-border bg-theme-elevated text-theme-text-secondary">
|
|
677
687
|
<GitBranch className="w-3 h-3" />
|
|
678
688
|
Flux
|
|
@@ -706,8 +716,8 @@ const ReleaseRow = forwardRef<HTMLTableRowElement, ReleaseRowProps>(
|
|
|
706
716
|
<ReleaseHealthBadge release={release} />
|
|
707
717
|
<NotCheckedBadge count={release.statusUnreadCount} />
|
|
708
718
|
{listOperation && <HelmOperationChip operation={listOperation} />}
|
|
709
|
-
|
|
710
|
-
{upgradeInfo?.updateAvailable && (
|
|
719
|
+
<ControllerBadge release={release} />
|
|
720
|
+
{upgradeInfo?.updateAvailable && !managedByOtherController(release) && (
|
|
711
721
|
<Tooltip content={`Upgrade available: ${release.chartVersion} → ${upgradeInfo.latestVersion}`}>
|
|
712
722
|
<span className={clsx('badge-sm shrink-0', SEVERITY_BADGE.warning)}>
|
|
713
723
|
<ArrowUpCircle className="w-3 h-3" />
|
|
@@ -12,6 +12,7 @@ import { Tooltip } from '../ui/Tooltip'
|
|
|
12
12
|
import { formatDate } from './helm-utils'
|
|
13
13
|
import { ObservedHelmDrawerNote } from './ObservedHelmNotice'
|
|
14
14
|
import { OwnedResources } from './OwnedResources'
|
|
15
|
+
import { ReleaseControllerNote, otherController as otherControllerOf } from './releaseController'
|
|
15
16
|
|
|
16
17
|
type TabId = 'overview' | 'history' | 'resources'
|
|
17
18
|
|
|
@@ -54,6 +55,7 @@ export function ObservedHelmReleaseDrawer({ release, onClose, onNavigateToResour
|
|
|
54
55
|
useEffect(() => setActiveTab('overview'), [release.namespace, release.name])
|
|
55
56
|
|
|
56
57
|
const flux = data?.managedByFluxHelmRelease
|
|
58
|
+
const otherController = data ? otherControllerOf(data) : undefined
|
|
57
59
|
const tabs = TABS.filter((tab) => tab.id !== 'history' || data?.fluxHistory?.length)
|
|
58
60
|
const shownTab = tabs.some((tab) => tab.id === activeTab) ? activeTab : 'overview'
|
|
59
61
|
|
|
@@ -106,6 +108,7 @@ export function ObservedHelmReleaseDrawer({ release, onClose, onNavigateToResour
|
|
|
106
108
|
</button>
|
|
107
109
|
</Tooltip>
|
|
108
110
|
)}
|
|
111
|
+
{otherController && <ReleaseControllerNote controller={otherController} onNavigateToResource={onNavigateToResource} />}
|
|
109
112
|
</div>
|
|
110
113
|
|
|
111
114
|
<div className="flex items-center gap-1 px-4 pb-2 overflow-x-auto">
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { renderToStaticMarkup } from 'react-dom/server'
|
|
3
|
+
import { HiddenK3sBadge, ReleaseControllerBadge, managedByOtherController } from './releaseController'
|
|
4
|
+
|
|
5
|
+
const k3s = { tool: 'k3s', kind: 'HelmChart', group: 'helm.cattle.io', namespace: 'kube-system', name: 'traefik', valuesRef: { kind: 'HelmChartConfig', group: 'helm.cattle.io', namespace: 'kube-system', name: 'traefik', exists: undefined } }
|
|
6
|
+
|
|
7
|
+
describe('ReleaseControllerBadge', () => {
|
|
8
|
+
it('labels the controller by its tool', () => {
|
|
9
|
+
const html = renderToStaticMarkup(<ReleaseControllerBadge controller={k3s} />)
|
|
10
|
+
expect(html).toContain('k3s')
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
describe('managedByOtherController', () => {
|
|
15
|
+
it('hides upgrade hints for a k3s release whose HelmChart is withheld, not for Flux or plain Helm', () => {
|
|
16
|
+
expect(managedByOtherController({ managedByK3s: true })).toBe(true)
|
|
17
|
+
expect(managedByOtherController({ controller: k3s })).toBe(true)
|
|
18
|
+
expect(managedByOtherController({ managedByFluxHelmRelease: 'flux-system/app' })).toBe(false)
|
|
19
|
+
expect(managedByOtherController({})).toBe(false)
|
|
20
|
+
})
|
|
21
|
+
it('the hidden k3s badge names no HelmChart', () => {
|
|
22
|
+
const html = renderToStaticMarkup(<HiddenK3sBadge />)
|
|
23
|
+
expect(html).toContain('k3s')
|
|
24
|
+
expect(html).not.toContain('kube-system')
|
|
25
|
+
})
|
|
26
|
+
})
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { GitBranch, Server } from 'lucide-react'
|
|
2
|
+
import type { HelmReleaseController } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import { Tooltip } from '../ui/Tooltip'
|
|
4
|
+
import { kindToPluralWithGroup, type NavigateToResource } from '../../utils/navigation'
|
|
5
|
+
|
|
6
|
+
// The controller of a release. An older Radar sends only the Flux field.
|
|
7
|
+
export function releaseControllerOf(r: { controller?: HelmReleaseController; managedByFluxHelmRelease?: string }): HelmReleaseController | undefined {
|
|
8
|
+
if (r.controller) return r.controller
|
|
9
|
+
if (!r.managedByFluxHelmRelease) return undefined
|
|
10
|
+
const [namespace = '', name = ''] = r.managedByFluxHelmRelease.split('/')
|
|
11
|
+
return { tool: 'flux', kind: 'HelmRelease', group: 'helm.toolkit.fluxcd.io', namespace, name }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// A controller other than Flux. Flux keeps its own routing (GitOps link,
|
|
15
|
+
// route-only upgrade hint); any other gets the generic note, and its upgrade
|
|
16
|
+
// hints are hidden because Radar has no view to route an upgrade to.
|
|
17
|
+
export function otherController(r: { controller?: HelmReleaseController; managedByFluxHelmRelease?: string }): HelmReleaseController | undefined {
|
|
18
|
+
const c = releaseControllerOf(r)
|
|
19
|
+
return c && c.tool !== 'flux' ? c : undefined
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Upgrade hints are hidden for any controller other than Flux, including a k3s
|
|
23
|
+
// HelmChart the caller can't read.
|
|
24
|
+
export function managedByOtherController(r: { controller?: HelmReleaseController; managedByFluxHelmRelease?: string; managedByK3s?: boolean }): boolean {
|
|
25
|
+
return !!otherController(r) || !!r.managedByK3s
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const HIDDEN_K3S_TEXT = "Managed by the k3s/RKE2 helm-controller. The owning HelmChart's namespace isn't available in this view, or Radar couldn't check your access. An upgrade or rollback here is overwritten when its install Job reruns; change the release through its HelmChart."
|
|
29
|
+
|
|
30
|
+
export function HiddenK3sBadge() {
|
|
31
|
+
return (
|
|
32
|
+
<Tooltip content={HIDDEN_K3S_TEXT}>
|
|
33
|
+
<span className="badge-sm shrink-0 border border-theme-border bg-theme-elevated text-theme-text-secondary">
|
|
34
|
+
<Server className="w-3 h-3" />
|
|
35
|
+
k3s
|
|
36
|
+
</span>
|
|
37
|
+
</Tooltip>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const TOOL_LABELS: Record<string, string> = { flux: 'Flux', k3s: 'k3s' }
|
|
42
|
+
|
|
43
|
+
function controllerLabel(c: HelmReleaseController): string {
|
|
44
|
+
return TOOL_LABELS[c.tool] ?? c.tool
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const refOf = (o: { namespace: string; name: string }) => `${o.namespace}/${o.name}`
|
|
48
|
+
|
|
49
|
+
export function controllerManagedText(c: HelmReleaseController): string {
|
|
50
|
+
// helm-controller re-runs its install Job only when the Job's config hash changes.
|
|
51
|
+
const effect = c.tool === 'k3s'
|
|
52
|
+
? 'an upgrade or rollback here is overwritten the next time helm-controller runs the install Job (when the HelmChart or its HelmChartConfig changes).'
|
|
53
|
+
: `an upgrade or rollback here can be overwritten by that ${c.kind}.`
|
|
54
|
+
const head = `Managed by ${controllerLabel(c)}. ${c.kind} ${refOf(c)} installs this release from its own definition, so ${effect}`
|
|
55
|
+
const v = c.valuesRef
|
|
56
|
+
if (!v) return `${head} Change it through that ${c.kind}.`
|
|
57
|
+
if (v.exists === true) return `${head} Change values in ${v.kind} ${refOf(v)}.`
|
|
58
|
+
if (v.exists === false) return `${head} Create a ${v.kind} ${refOf(v)} to change its values.`
|
|
59
|
+
// Unknown: the read failed, or the caller may not see it.
|
|
60
|
+
return `${head} Change values in ${v.kind} ${refOf(v)} (create it if it does not exist).`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function ReleaseControllerBadge({ controller }: { controller: HelmReleaseController }) {
|
|
64
|
+
const flux = controller.tool === 'flux'
|
|
65
|
+
const tip = flux
|
|
66
|
+
? `Installed by Flux helm-controller via HelmRelease ${refOf(controller)}. Manage its source in GitOps.`
|
|
67
|
+
: controllerManagedText(controller)
|
|
68
|
+
return (
|
|
69
|
+
<Tooltip content={tip}>
|
|
70
|
+
<span className="badge-sm shrink-0 border border-theme-border bg-theme-elevated text-theme-text-secondary">
|
|
71
|
+
{flux ? <GitBranch className="w-3 h-3" /> : <Server className="w-3 h-3" />}
|
|
72
|
+
{controllerLabel(controller)}
|
|
73
|
+
</span>
|
|
74
|
+
</Tooltip>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function target(o: { kind: string; group: string; namespace: string; name: string }) {
|
|
79
|
+
return { kind: kindToPluralWithGroup(o.kind, o.group), group: o.group, namespace: o.namespace, name: o.name }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// The drawer note for a controller other than Flux (Flux keeps its GitOps link).
|
|
83
|
+
export function ReleaseControllerNote({ controller, onNavigateToResource }: { controller: HelmReleaseController; onNavigateToResource?: NavigateToResource }) {
|
|
84
|
+
const v = controller.valuesRef
|
|
85
|
+
return (
|
|
86
|
+
<Tooltip content={controllerManagedText(controller)} wrapperClassName="mt-1">
|
|
87
|
+
<span className="inline-flex flex-wrap items-center gap-1 rounded border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[11px] text-amber-700 dark:text-amber-400">
|
|
88
|
+
<Server className="w-3 h-3" />
|
|
89
|
+
Managed by {controllerLabel(controller)} ·
|
|
90
|
+
<button type="button" className="hover:underline" onClick={() => onNavigateToResource?.(target(controller))}>{controller.kind} {refOf(controller)}</button>
|
|
91
|
+
{v?.exists === true && <>
|
|
92
|
+
·
|
|
93
|
+
<button type="button" className="hover:underline" onClick={() => onNavigateToResource?.(target(v))}>{v.kind} {refOf(v)}</button>
|
|
94
|
+
</>}
|
|
95
|
+
</span>
|
|
96
|
+
</Tooltip>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import { useNavigate, useSearchParams } from 'react-router-dom'
|
|
3
|
+
import { K3sHelmChartRenderer as BaseK3sHelmChartRenderer } from '@skyhook-io/k8s-ui/components/resources/renderers/K3sHelmRenderers'
|
|
4
|
+
import type { ResourceRef } from '@skyhook-io/k8s-ui'
|
|
5
|
+
|
|
6
|
+
/** Host wrapper: the HelmChart drawer's "Open Helm release" goes to the Helm view, keeping the namespace pick. */
|
|
7
|
+
export function K3sHelmChartRenderer({ data, onNavigate }: { data: any; onNavigate?: (ref: ResourceRef) => void }) {
|
|
8
|
+
const navigate = useNavigate()
|
|
9
|
+
const [searchParams] = useSearchParams()
|
|
10
|
+
const openRelease = useCallback((ref: { namespace: string; name: string }) => {
|
|
11
|
+
const params = new URLSearchParams()
|
|
12
|
+
const namespaces = searchParams.get('namespaces')
|
|
13
|
+
if (namespaces) params.set('namespaces', namespaces)
|
|
14
|
+
params.set('release', `${ref.namespace}/${ref.name}`)
|
|
15
|
+
navigate({ pathname: '/helm', search: params.toString() })
|
|
16
|
+
}, [navigate, searchParams])
|
|
17
|
+
return <BaseK3sHelmChartRenderer data={data} onNavigate={onNavigate} onOpenHelmRelease={openRelease} />
|
|
18
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, useState, type ReactNode } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
|
5
|
+
import type { Edge, Node } from '@xyflow/react'
|
|
6
|
+
import { ToastProvider } from '@skyhook-io/k8s-ui'
|
|
7
|
+
import type { AggregatedFlow } from '../../types'
|
|
8
|
+
import { TrafficGraph } from './TrafficGraph'
|
|
9
|
+
|
|
10
|
+
vi.mock('./TrafficView', () => ({ isClusterAddon: () => false }))
|
|
11
|
+
vi.mock('elkjs/lib/elk.bundled.js', () => ({
|
|
12
|
+
default: class {
|
|
13
|
+
async layout(graph: { children: Node[] }) {
|
|
14
|
+
return { ...graph, children: graph.children.map((node, index) => ({ ...node, x: index * 250, y: 0 })) }
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
}))
|
|
18
|
+
vi.mock('@xyflow/react', () => ({
|
|
19
|
+
ReactFlow: ({ children }: { children: ReactNode }) => <div>{children}</div>,
|
|
20
|
+
Background: () => null,
|
|
21
|
+
Controls: ({ children }: { children: ReactNode }) => <div data-testid="controls">{children}</div>,
|
|
22
|
+
Handle: () => null,
|
|
23
|
+
MarkerType: { ArrowClosed: 'arrowclosed' },
|
|
24
|
+
Position: { Left: 'left', Right: 'right' },
|
|
25
|
+
useNodesState: (initial: Node[]) => [...useState(initial), vi.fn()],
|
|
26
|
+
useEdgesState: (initial: Edge[]) => [...useState(initial), vi.fn()],
|
|
27
|
+
useReactFlow: () => ({ fitView: vi.fn(), getNodes: () => [], getNodesBounds: vi.fn() }),
|
|
28
|
+
useStore: (selector: (s: { domNode: null }) => unknown) => selector({ domNode: null }),
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
32
|
+
let container: HTMLDivElement
|
|
33
|
+
let root: Root
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
container = document.createElement('div')
|
|
36
|
+
document.body.appendChild(container)
|
|
37
|
+
root = createRoot(container)
|
|
38
|
+
})
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
act(() => root.unmount())
|
|
41
|
+
container.remove()
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const flow: AggregatedFlow = {
|
|
45
|
+
source: { name: 'web', namespace: 'default', kind: 'Pod' }, destination: { name: 'api', namespace: 'default', kind: 'Service' },
|
|
46
|
+
protocol: 'tcp', port: 80, connections: 3, bytesSent: 10, bytesRecv: 20, bytesByProtocol: { tcp: { bytesSent: 10, bytesRecv: 20 } }, flowCount: 1, lastSeen: '',
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
it('offers image export in the graph controls', async () => {
|
|
50
|
+
await act(async () => root.render(
|
|
51
|
+
<ToastProvider>
|
|
52
|
+
<TrafficGraph flows={[flow]} onLayoutUnavailable={vi.fn()} windowSeconds={300} />
|
|
53
|
+
</ToastProvider>,
|
|
54
|
+
))
|
|
55
|
+
const controls = container.querySelector('[data-testid="controls"]')!
|
|
56
|
+
expect(controls.querySelector('button[aria-label="Export graph"]')).not.toBeNull()
|
|
57
|
+
})
|
|
@@ -19,13 +19,14 @@ import type { ELK } from 'elkjs/lib/elk.bundled.js'
|
|
|
19
19
|
import type { AggregatedFlow } from '../../types'
|
|
20
20
|
import { clsx } from 'clsx'
|
|
21
21
|
import { X, ArrowRight, Globe, Server, Activity, Puzzle, Crosshair } from 'lucide-react'
|
|
22
|
-
import { MiddleEllipsis, PaneLoader } from '@skyhook-io/k8s-ui'
|
|
22
|
+
import { GraphExportButton, MiddleEllipsis, PaneLoader } from '@skyhook-io/k8s-ui'
|
|
23
23
|
import { isClusterAddon, type AddonMode } from './TrafficView'
|
|
24
24
|
import { SEVERITY_BADGE, SEVERITY_DOT, SEVERITY_TEXT } from '@skyhook-io/k8s-ui/utils/badge-colors'
|
|
25
25
|
import { getNamespaceColor } from '../../utils/traffic-colors'
|
|
26
26
|
import { Tooltip } from '../ui/Tooltip'
|
|
27
27
|
import { TrafficData } from './TrafficData'
|
|
28
|
-
import {
|
|
28
|
+
import { describeTrafficNode } from './traffic-export'
|
|
29
|
+
import { dataByProtocol, protocolsOf, throughputLabel, totalDataByProtocol, protocolName, isRateBasedSource, isExternalKind, requestRateOf, errorRateOf, formatRate, formatConnections, formatVolume, MAX_VISIBLE_PORTS, displayVolume, latencyWeightOf, edgesOnPort, protocolLabel, type TrafficFocus } from './trafficFilters'
|
|
29
30
|
|
|
30
31
|
// ELK is 1.5 MB; load it with the first traffic layout, not with the app.
|
|
31
32
|
let elkPromise: Promise<ELK> | null = null
|
|
@@ -87,6 +88,8 @@ interface TrafficGraphProps {
|
|
|
87
88
|
/** Seconds the byte figures cover, so an edge measured only in bytes can be
|
|
88
89
|
* labelled with its throughput. */
|
|
89
90
|
windowSeconds: number
|
|
91
|
+
/** Saves an exported image instead of a browser download (desktop app). */
|
|
92
|
+
onDownloadBlob?: (blob: Blob, filename: string) => void
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
// Phase 2.1: Calculate edge width based on connection count (log scale)
|
|
@@ -95,20 +98,6 @@ function getEdgeWidth(connections: number): number {
|
|
|
95
98
|
return Math.min(6, Math.max(1.5, Math.log10(Math.max(connections, 1000)) - 1.5))
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
// Phase 2.2: Format connection counts for display
|
|
99
|
-
function formatConnections(count: number): string {
|
|
100
|
-
if (count >= 1_000_000_000) return `${(count / 1_000_000_000).toFixed(1)}B`
|
|
101
|
-
if (count >= 1_000_000) return `${(count / 1_000_000).toFixed(1)}M`
|
|
102
|
-
if (count >= 1_000) return `${(count / 1_000).toFixed(0)}K`
|
|
103
|
-
return count.toString()
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// A volume in the source's own unit: a rate to two significant places for a
|
|
107
|
-
// rate-based source, a whole count otherwise.
|
|
108
|
-
function formatVolume(volume: number, isRateBased: boolean): string {
|
|
109
|
-
return isRateBased ? formatRate(volume) : formatConnections(volume)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
101
|
function formatLatency(ms: number): string {
|
|
113
102
|
if (ms >= 1000) return `${(ms / 1000).toFixed(1)}s`
|
|
114
103
|
if (ms >= 1) return `${ms.toFixed(1)}ms`
|
|
@@ -205,7 +194,6 @@ const SERVICE_CATEGORY_COLORS: Record<string, { bg: string; border: string; dot:
|
|
|
205
194
|
const NODE_WIDTH = 180
|
|
206
195
|
const NODE_BASE_HEIGHT = 56 // Base height without ports
|
|
207
196
|
const NODE_PORT_HEIGHT = 18 // Height per port row
|
|
208
|
-
const MAX_VISIBLE_PORTS = 4 // Maximum ports to show before "+N more"
|
|
209
197
|
|
|
210
198
|
// Custom node component
|
|
211
199
|
export function TrafficNode({ data }: { data: TrafficNodeData }) {
|
|
@@ -372,7 +360,8 @@ export function TrafficNode({ data }: { data: TrafficNodeData }) {
|
|
|
372
360
|
// Legend component
|
|
373
361
|
function TrafficLegend() {
|
|
374
362
|
return (
|
|
375
|
-
|
|
363
|
+
// Clears the graph controls, which sit in the same corner.
|
|
364
|
+
<div className="absolute bottom-2 left-14 bg-theme-surface border border-theme-border rounded-lg p-2.5 text-xs z-10 shadow-lg max-w-xs">
|
|
376
365
|
<div className="font-medium text-theme-text-primary mb-2">Legend</div>
|
|
377
366
|
<div className="space-y-1.5">
|
|
378
367
|
<div className="flex items-center gap-2">
|
|
@@ -1165,7 +1154,7 @@ function trafficEdgeId(sourceId: string, destId: string, flow: AggregatedFlow):
|
|
|
1165
1154
|
return `${sourceId}->${destId}:${flow.port}${flow.directionUnknown ? ':unoriented' : ''}`
|
|
1166
1155
|
}
|
|
1167
1156
|
|
|
1168
|
-
export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups = false, serviceCategories, addonMode = 'show', trafficSource = '', selection: viewSelection, onSelectionChange, onFocus, focusedId, onLayoutUnavailable, windowSeconds }: TrafficGraphProps) {
|
|
1157
|
+
export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups = false, serviceCategories, addonMode = 'show', trafficSource = '', selection: viewSelection, onSelectionChange, onFocus, focusedId, onLayoutUnavailable, windowSeconds, onDownloadBlob }: TrafficGraphProps) {
|
|
1169
1158
|
// Beyla is rate-based too: its Connections field carries requests per second,
|
|
1170
1159
|
// not a connection count, so it needs the same label Istio gets.
|
|
1171
1160
|
const isRateBased = isRateBasedSource(trafficSource)
|
|
@@ -1815,7 +1804,9 @@ export function TrafficGraph({ flows, hotPathThreshold = 0, showNamespaceGroups
|
|
|
1815
1804
|
nodesConnectable={false}
|
|
1816
1805
|
>
|
|
1817
1806
|
<Background />
|
|
1818
|
-
<Controls
|
|
1807
|
+
<Controls>
|
|
1808
|
+
<GraphExportButton defaultFilename="traffic" title="Export traffic" onDownloadBlob={onDownloadBlob} describeNode={describeTrafficNode} />
|
|
1809
|
+
</Controls>
|
|
1819
1810
|
<FitViewOnChange shouldFitViewRef={shouldFitViewRef} layoutedNodes={layoutedNodes} />
|
|
1820
1811
|
</ReactFlow>
|
|
1821
1812
|
|
|
@@ -9,6 +9,7 @@ import type { UseTrafficRecordsOptions } from '../../api/traffic'
|
|
|
9
9
|
|
|
10
10
|
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
11
11
|
|
|
12
|
+
vi.mock('../../hooks/useDesktopDownload', () => ({ useDesktopBlobDownload: () => undefined }))
|
|
12
13
|
vi.mock('elkjs/lib/elk.bundled.js', () => {
|
|
13
14
|
throw new Error('Failed to fetch dynamically imported module')
|
|
14
15
|
})
|