@skyhook-io/radar-app 1.20.1 → 1.20.3
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 +12 -7
- package/src/api/client.namespaceSwitch.hook.test.tsx +170 -1
- package/src/api/client.pauseDeployment.test.tsx +77 -0
- package/src/api/client.restartError.test.ts +14 -0
- package/src/api/client.revisionRefresh.test.tsx +44 -0
- package/src/api/client.rollbackError.test.ts +14 -0
- package/src/api/client.ts +218 -11
- package/src/api/networkAttachments.test.tsx +120 -0
- package/src/api/networkAttachments.ts +30 -0
- package/src/api/radarFeatures.test.ts +5 -0
- package/src/api/radarFeatures.ts +3 -0
- package/src/api/secretsStore.test.ts +33 -0
- package/src/api/secretsStore.ts +37 -0
- package/src/components/ConnectionErrorView.test.tsx +11 -0
- package/src/components/ConnectionErrorView.tsx +19 -0
- package/src/components/ContextSwitcher.tsx +9 -2
- package/src/components/applications/ApplicationsView.openResource.test.tsx +118 -0
- package/src/components/applications/ApplicationsView.tsx +8 -11
- package/src/components/cost/CostView.tsx +27 -9
- package/src/components/diagnose/InvestigationView.tsx +12 -3
- package/src/components/diagnose/investigationEvidence/adapters/helm.test.tsx +52 -0
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +10 -0
- package/src/components/diagnose/investigationEvidence/bodies/platform.tsx +82 -51
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/dock/TerminalPreferences.query.test.tsx +57 -0
- package/src/components/dock/TerminalPreferences.test.tsx +68 -0
- package/src/components/dock/TerminalPreferences.tsx +73 -0
- package/src/components/gitops/GitOpsView.tsx +1 -9
- package/src/components/helm/HelmReleaseDrawer.tsx +24 -12
- package/src/components/helm/HelmView.tsx +5 -3
- package/src/components/helm/NotCheckedBadge.test.tsx +62 -0
- package/src/components/helm/NotCheckedBadge.tsx +39 -0
- package/src/components/helm/OwnedResources.test.tsx +86 -0
- package/src/components/helm/OwnedResources.tsx +65 -8
- package/src/components/home/ClusterHealthCard.heading.test.tsx +72 -0
- package/src/components/home/ClusterHealthCard.test.ts +44 -1
- package/src/components/home/ClusterHealthCard.tsx +22 -10
- package/src/components/home/HelmSummary.tsx +15 -15
- package/src/components/home/mcpToolCatalog.ts +2 -2
- package/src/components/resource/RightsizingStrip.test.ts +57 -0
- package/src/components/resource/RightsizingStrip.tsx +53 -4
- package/src/components/resources/ImageFilesystemModal.test.tsx +74 -6
- package/src/components/resources/ImageFilesystemModal.tsx +98 -6
- package/src/components/resources/PodFileUploadPanel.tsx +150 -0
- package/src/components/resources/PodFilesystemModal.tsx +246 -3
- package/src/components/resources/pod-file-upload.test.tsx +223 -0
- package/src/components/resources/pod-file-upload.ts +266 -0
- package/src/components/resources/renderers/HTTPRouteRenderer.test.tsx +50 -0
- package/src/components/resources/renderers/HTTPRouteRenderer.tsx +27 -0
- package/src/components/resources/renderers/PodRenderer.tsx +26 -1
- package/src/components/resources/renderers/SecretProviderClassRenderer.tsx +25 -0
- package/src/components/rightsizing/RightsizingScanView.tsx +16 -1
- package/src/components/rightsizing/model.test.ts +11 -0
- package/src/components/rightsizing/model.ts +3 -1
- package/src/components/rightsizing/presentation.test.ts +46 -0
- package/src/components/rightsizing/presentation.ts +17 -2
- package/src/components/traffic/TrafficView.tsx +27 -27
- package/src/components/traffic/trafficFilters.test.ts +18 -1
- package/src/components/traffic/trafficFilters.ts +30 -1
- package/src/components/ui/Omnibar.tsx +4 -1
- package/src/components/ui/RadarOmnibar.test.tsx +55 -2
- package/src/components/ui/RadarOmnibar.tsx +7 -1
- package/src/components/ui/SearchSyntaxHelp.test.tsx +9 -2
- package/src/components/ui/SearchSyntaxHelp.tsx +3 -2
- package/src/components/ui/UpdateNotification.test.tsx +23 -1
- package/src/components/ui/UpdateNotification.tsx +26 -2
- package/src/components/ui/omnibar-match.test.ts +7 -0
- package/src/components/ui/omnibar-match.ts +1 -0
- package/src/components/ui/searchCoverageNote.test.ts +17 -0
- package/src/components/ui/searchCoverageNote.ts +31 -7
- package/src/components/useContextSwitchFlow.tsx +9 -1
- package/src/components/workload/NodeCertificateEvidence.test.tsx +51 -0
- package/src/components/workload/NodeCertificateEvidence.tsx +44 -0
- package/src/components/workload/WorkloadView.tsx +51 -11
- package/src/context/ConnectionContext.test.ts +1 -0
- package/src/context/ConnectionContext.tsx +2 -2
- package/src/integrations/resourceHosts.test.tsx +2 -2
- package/src/integrations/resourceHosts.tsx +4 -0
- package/src/utils/namespacePick.test.ts +87 -0
- package/src/utils/namespacePick.ts +88 -0
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
useRightsizingScan,
|
|
20
20
|
type RightsizingRow,
|
|
21
21
|
} from '../../api/client'
|
|
22
|
-
import { RIGHTSIZING_DOCS_URL } from '../resource/RightsizingStrip'
|
|
22
|
+
import { podLevelOverUseNote, RIGHTSIZING_DOCS_URL } from '../resource/RightsizingStrip'
|
|
23
23
|
import { buildWorkloadPath } from '../../utils/navigation'
|
|
24
24
|
import { CostViewTabs } from '../cost/CostViewTabs'
|
|
25
25
|
import {
|
|
@@ -962,6 +962,13 @@ function EvidenceNote({ row }: { row: RightsizingRow }) {
|
|
|
962
962
|
}
|
|
963
963
|
|
|
964
964
|
function primaryEvidenceNote(row: RightsizingRow) {
|
|
965
|
+
if (row.fit === 'pod_level_request' && !row.queryError)
|
|
966
|
+
return (
|
|
967
|
+
<p className="mt-1 text-xs text-theme-text-tertiary">
|
|
968
|
+
{podLevelOverUseNote(row) ??
|
|
969
|
+
"This pod sets a pod-level request in spec.resources, which the scheduler reserves instead of container requests. Radar shows this container's usage but doesn't size the pod-level request."}
|
|
970
|
+
</p>
|
|
971
|
+
)
|
|
965
972
|
if (row.hpaManaged)
|
|
966
973
|
return (
|
|
967
974
|
<p className="mt-1 text-xs text-theme-text-tertiary">
|
|
@@ -987,6 +994,14 @@ function primaryEvidenceNote(row: RightsizingRow) {
|
|
|
987
994
|
Radar could not verify restart history before suggesting a lower memory request.
|
|
988
995
|
</p>
|
|
989
996
|
)
|
|
997
|
+
if (row.recommendationReason === 'requests_exceed_pod_limit')
|
|
998
|
+
return (
|
|
999
|
+
<p className="mt-1 text-xs text-theme-text-tertiary">
|
|
1000
|
+
Together with the other containers' requests and suggested increases, the calculated
|
|
1001
|
+
request would take the pod above its pod-level limit. Decide how to split the limit, or
|
|
1002
|
+
raise it.
|
|
1003
|
+
</p>
|
|
1004
|
+
)
|
|
990
1005
|
if (row.limitConflict)
|
|
991
1006
|
return (
|
|
992
1007
|
<p className="mt-1 text-xs text-theme-text-tertiary">
|
|
@@ -343,3 +343,14 @@ it('ranks known safety risks and increases above savings, while routine reviews
|
|
|
343
343
|
expect(names.slice(6, 9)).toEqual(['bursty', 'hpa', 'idle'])
|
|
344
344
|
expect(names.slice(9)).toEqual(['failed-risk', 'steady'])
|
|
345
345
|
})
|
|
346
|
+
|
|
347
|
+
describe('pod-level requests', () => {
|
|
348
|
+
it('puts a container under a pod-level request in review, with no impact', () => {
|
|
349
|
+
const rows = [
|
|
350
|
+
metric({ fit: 'pod_level_request', resource: 'cpu', podLevelRequest: '200m' }),
|
|
351
|
+
metric({ fit: 'pod_level_request', resource: 'memory', podLevelRequest: '128Mi' }),
|
|
352
|
+
]
|
|
353
|
+
expect(classifyRows(rows, 2)).toBe('review')
|
|
354
|
+
expect(calculateImpact(rows, 2)).toMatchObject({ cpuChange: 0, memoryChange: 0 })
|
|
355
|
+
})
|
|
356
|
+
})
|
|
@@ -62,7 +62,9 @@ function needsManualReview(row: RightsizingRow): boolean {
|
|
|
62
62
|
needsSafetyReview(row) ||
|
|
63
63
|
(isReduction(row) && row.bursty === true) ||
|
|
64
64
|
row.recommendationReason === 'hpa_evidence_unavailable' ||
|
|
65
|
-
row.recommendationReason === 'oom_evidence_unavailable'
|
|
65
|
+
row.recommendationReason === 'oom_evidence_unavailable' ||
|
|
66
|
+
// Mirrors ManualReviewReasons: Radar does not size a pod-level request.
|
|
67
|
+
row.fit === 'pod_level_request'
|
|
66
68
|
)
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -102,3 +102,49 @@ describe('rightsizing request presentation', () => {
|
|
|
102
102
|
)
|
|
103
103
|
})
|
|
104
104
|
})
|
|
105
|
+
|
|
106
|
+
describe('pod-level request presentation', () => {
|
|
107
|
+
it('shows the pod-level value and asks for review instead of a per-container change', () => {
|
|
108
|
+
const result = getResourceRequestPresentation(
|
|
109
|
+
metric({
|
|
110
|
+
fit: 'pod_level_request',
|
|
111
|
+
podLevelRequest: '200m',
|
|
112
|
+
recommendationReason: 'pod_level_request',
|
|
113
|
+
}),
|
|
114
|
+
)
|
|
115
|
+
expect(result.primary).toContain('200m')
|
|
116
|
+
expect(result.tone).toBe('review')
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
describe('pod-level limit conflict presentation', () => {
|
|
121
|
+
it('points at the pod limit rather than the container limit', () => {
|
|
122
|
+
const podLimit = getResourceRequestPresentation(
|
|
123
|
+
metric({
|
|
124
|
+
fit: 'under_requested',
|
|
125
|
+
limitConflict: true,
|
|
126
|
+
recommendationReason: 'requests_exceed_pod_limit',
|
|
127
|
+
}),
|
|
128
|
+
)
|
|
129
|
+
const containerLimit = getResourceRequestPresentation(
|
|
130
|
+
metric({
|
|
131
|
+
fit: 'under_requested',
|
|
132
|
+
limitConflict: true,
|
|
133
|
+
recommendationReason: 'recommended_request_exceeds_limit',
|
|
134
|
+
}),
|
|
135
|
+
)
|
|
136
|
+
expect(podLimit.tone).toBe('review')
|
|
137
|
+
expect(podLimit.secondary).not.toBe(containerLimit.secondary)
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
describe('pod-level request without usage evidence', () => {
|
|
142
|
+
it('still shows the pod-level request instead of Unset', () => {
|
|
143
|
+
for (const row of [
|
|
144
|
+
metric({ fit: 'insufficient_history', podLevelRequest: '128Mi' }),
|
|
145
|
+
metric({ fit: 'insufficient_history', podLevelRequest: '128Mi', queryError: 'usage query failed' }),
|
|
146
|
+
]) {
|
|
147
|
+
expect(getResourceRequestPresentation(row).primary).toContain('128Mi')
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
})
|
|
@@ -23,12 +23,24 @@ export function getResourceRequestPresentation(
|
|
|
23
23
|
if (!row) return { primary: '—', secondary: 'No result returned', signals: [], tone: 'neutral' }
|
|
24
24
|
|
|
25
25
|
const current = row.currentRequest && row.currentRequestValue !== 0 ? row.currentRequest : 'Unset'
|
|
26
|
-
|
|
26
|
+
// A pod-level request is what the pod reserves, whether or not usage evidence arrived.
|
|
27
|
+
const currentOnly = row.podLevelRequest
|
|
28
|
+
? `${row.podLevelRequest} for the pod`
|
|
29
|
+
: current === 'Unset'
|
|
30
|
+
? current
|
|
31
|
+
: `${current} current`
|
|
27
32
|
const signals = resourceSignals(row)
|
|
28
33
|
const reason = row.recommendationReason
|
|
29
34
|
|
|
30
35
|
if (row.queryError)
|
|
31
36
|
return { primary: currentOnly, secondary: 'Metrics query failed', signals, tone: 'neutral' }
|
|
37
|
+
if (row.fit === 'pod_level_request')
|
|
38
|
+
return {
|
|
39
|
+
primary: currentOnly,
|
|
40
|
+
secondary: 'Review the pod-level request',
|
|
41
|
+
signals,
|
|
42
|
+
tone: 'review',
|
|
43
|
+
}
|
|
32
44
|
if (row.fit === 'insufficient_history')
|
|
33
45
|
return { primary: currentOnly, secondary: 'Not enough history', signals, tone: 'neutral' }
|
|
34
46
|
if (scaledToZero)
|
|
@@ -63,7 +75,10 @@ export function getResourceRequestPresentation(
|
|
|
63
75
|
if (row.limitConflict)
|
|
64
76
|
return {
|
|
65
77
|
primary: comparison,
|
|
66
|
-
secondary:
|
|
78
|
+
secondary:
|
|
79
|
+
reason === 'requests_exceed_pod_limit'
|
|
80
|
+
? 'Review against the pod limit'
|
|
81
|
+
: 'Raise the limit before changing',
|
|
67
82
|
signals,
|
|
68
83
|
tone: 'review',
|
|
69
84
|
}
|
|
@@ -17,7 +17,19 @@ import { AlertBanner, EmptyState, PaneLoader, FreshnessControl } from '@skyhook-
|
|
|
17
17
|
import { useConnection } from '../../context/ConnectionContext'
|
|
18
18
|
import { Tooltip } from '../ui/Tooltip'
|
|
19
19
|
import { SEVERITY_TEXT } from '@skyhook-io/k8s-ui/utils/badge-colors'
|
|
20
|
-
import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, type VolumeUnit, isExternalKind, mergeFlowVolume, coverageLabel, type GraphFlow, endpointPair, graphEndpoint, graphEndpointId, mergeRawPairs, mergedEdgePort, selectedEdgeMatcher, selectionRawPairs, selectionMatch, graphSize, GRAPH_DRAW_BUDGET, GRAPH_DRAW_CEILING, parseFocus, focusParam, focusId, focusNeighborhood, touchesFocus, endpointSummaries, namespaceSummaries, verdictChoices, type TrafficFocus } from './trafficFilters'
|
|
20
|
+
import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, type VolumeUnit, isExternalKind, mergeFlowVolume, coverageLabel, type GraphFlow, endpointPair, graphEndpoint, graphEndpointId, mergeRawPairs, mergedEdgePort, selectedEdgeMatcher, selectionRawPairs, selectionMatch, graphSize, GRAPH_DRAW_BUDGET, GRAPH_DRAW_CEILING, parseFocus, focusParam, focusId, focusNeighborhood, touchesFocus, endpointSummaries, namespaceSummaries, verdictChoices, type TrafficFocus, warningRetries, warningBannerTitle, emptyWarningHeadline } from './trafficFilters'
|
|
21
|
+
|
|
22
|
+
// Where a warning about which cluster the traffic belongs to points: how the map
|
|
23
|
+
// keeps to this cluster in a shared metrics store, and how to set its label.
|
|
24
|
+
const CLUSTER_SCOPE_DOCS_URL = 'https://github.com/skyhook-io/radar/blob/main/docs/configuration.md#traffic-map-in-a-shared-metrics-store'
|
|
25
|
+
|
|
26
|
+
function ClusterScopeDocsLink() {
|
|
27
|
+
return (
|
|
28
|
+
<a className="text-xs text-accent hover:underline" href={CLUSTER_SCOPE_DOCS_URL} target="_blank" rel="noopener noreferrer">
|
|
29
|
+
How to fix this
|
|
30
|
+
</a>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
21
33
|
|
|
22
34
|
// Consecutive 2s retries of an empty result that came with a transient warning.
|
|
23
35
|
const MAX_EMPTY_RETRIES = 5
|
|
@@ -498,27 +510,16 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
498
510
|
enabled: wizardState === 'ready' && !isConnecting && !connectionError,
|
|
499
511
|
})
|
|
500
512
|
|
|
501
|
-
// A
|
|
502
|
-
//
|
|
503
|
-
|
|
504
|
-
const warningIsPermanent = flowsData?.warningKind === 'partial'
|
|
513
|
+
// A partial, incomplete or cluster warning is the source's answer rather than
|
|
514
|
+
// a hiccup, so retrying it is all cost and no progress.
|
|
515
|
+
const warningRetriable = warningRetries(flowsData?.warningKind)
|
|
505
516
|
const coverage = coverageLabel(flowsData?.coveredSince, flowsData?.timestamp)
|
|
506
|
-
// An 'incomplete' one is a fetch that worked but could not see everything
|
|
507
|
-
// (events lost, nodes unreachable). Not a failure, so not retried at once.
|
|
508
|
-
const warningIsIncomplete = flowsData?.warningKind === 'incomplete'
|
|
509
517
|
const flowsWarning = flowsData?.warning ? (
|
|
510
518
|
<AlertBanner
|
|
511
519
|
variant="warning"
|
|
512
|
-
|
|
513
|
-
// on edges that are shown — a port reported as 0, UDP as TCP, a
|
|
514
|
-
// 5xx rate that failed to load — so it says "unreliable", not
|
|
515
|
-
// "incomplete", which would send the reader looking for missing
|
|
516
|
-
// workloads. An incomplete or transient one beside flows is
|
|
517
|
-
// exactly that: a stream cut short, events lost, a node the
|
|
518
|
-
// relay could not reach, a TCP query that failed — edges may
|
|
519
|
-
// be missing from what is drawn.
|
|
520
|
-
title={warningIsPermanent ? 'Some values on this map are unreliable' : 'Some traffic may be missing from this map'}
|
|
520
|
+
title={warningBannerTitle(flowsData.warningKind)}
|
|
521
521
|
message={flowsData.warning}
|
|
522
|
+
action={flowsData.warningClusterScope ? <ClusterScopeDocsLink /> : undefined}
|
|
522
523
|
/>
|
|
523
524
|
) : null
|
|
524
525
|
|
|
@@ -537,14 +538,14 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
537
538
|
emptyRetriesRef.current = 0
|
|
538
539
|
return
|
|
539
540
|
}
|
|
540
|
-
if (
|
|
541
|
+
if (warningRetriable && !flowsFetching && emptyRetriesRef.current < MAX_EMPTY_RETRIES) {
|
|
541
542
|
const timer = setTimeout(() => {
|
|
542
543
|
emptyRetriesRef.current += 1
|
|
543
544
|
refetchFlowsRaw()
|
|
544
545
|
}, 2000)
|
|
545
546
|
return () => clearTimeout(timer)
|
|
546
547
|
}
|
|
547
|
-
}, [flowsData,
|
|
548
|
+
}, [flowsData, warningRetriable, flowsFetching, refetchFlowsRaw])
|
|
548
549
|
|
|
549
550
|
// Filter flows based on user preferences
|
|
550
551
|
// Note: namespace filtering is done server-side via the global namespace selector
|
|
@@ -1612,6 +1613,7 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
1612
1613
|
onShowSystem={() => setHideSystem(false)}
|
|
1613
1614
|
onSwitchNamespace={onSetNamespaces && !namespaceLocked && focus.namespace ? () => onSetNamespaces([focus.namespace!]) : undefined}
|
|
1614
1615
|
warning={flowsData.warning}
|
|
1616
|
+
warningClusterScope={flowsData.warningClusterScope}
|
|
1615
1617
|
onLeave={() => setFocus(null)}
|
|
1616
1618
|
/>
|
|
1617
1619
|
</div>
|
|
@@ -1660,14 +1662,9 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
1660
1662
|
tone="neutral"
|
|
1661
1663
|
variant="card"
|
|
1662
1664
|
icon={AlertTriangle}
|
|
1663
|
-
headline={
|
|
1664
|
-
warningIsPermanent
|
|
1665
|
-
? 'No traffic Radar can place on the map'
|
|
1666
|
-
: warningIsIncomplete
|
|
1667
|
-
? 'No traffic seen, but some may be missing'
|
|
1668
|
-
: 'Unable to fetch traffic data'
|
|
1669
|
-
}
|
|
1665
|
+
headline={emptyWarningHeadline(flowsData.warningKind)}
|
|
1670
1666
|
body={flowsData.warning}
|
|
1667
|
+
action={flowsData.warningClusterScope ? <ClusterScopeDocsLink /> : undefined}
|
|
1671
1668
|
className="max-w-md"
|
|
1672
1669
|
/>
|
|
1673
1670
|
) : (
|
|
@@ -1697,12 +1694,14 @@ export function TrafficView({ namespaces, onSetNamespaces }: TrafficViewProps) {
|
|
|
1697
1694
|
* one of them means the workload is quiet: Radar may have hidden its traffic,
|
|
1698
1695
|
* or never fetched it.
|
|
1699
1696
|
*/
|
|
1700
|
-
function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsideNamespaces, window, onShowAll, onShowSystem, onSwitchNamespace, warning, onLeave }: {
|
|
1697
|
+
function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsideNamespaces, window, onShowAll, onShowSystem, onSwitchNamespace, warning, warningClusterScope, onLeave }: {
|
|
1701
1698
|
focus: TrafficFocus
|
|
1702
1699
|
/** Hide System is on: traffic with system namespaces was never fetched. */
|
|
1703
1700
|
hideSystem: boolean
|
|
1704
1701
|
/** The fetch's own warning: with it, absence is not proof of quiet. */
|
|
1705
1702
|
warning?: string
|
|
1703
|
+
/** The warning is about which cluster the traffic belongs to. */
|
|
1704
|
+
warningClusterScope?: boolean
|
|
1706
1705
|
hiddenByFilters: boolean
|
|
1707
1706
|
systemHidden: boolean
|
|
1708
1707
|
outsideNamespaces: boolean
|
|
@@ -1755,6 +1754,7 @@ function FocusNotFound({ focus, hiddenByFilters, systemHidden, hideSystem, outsi
|
|
|
1755
1754
|
>
|
|
1756
1755
|
Leave focus
|
|
1757
1756
|
</button>
|
|
1757
|
+
{warningClusterScope && <ClusterScopeDocsLink />}
|
|
1758
1758
|
</div>
|
|
1759
1759
|
}
|
|
1760
1760
|
className="max-w-md"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest'
|
|
2
2
|
import type { AggregatedFlow, TrafficFlow } from '../../types'
|
|
3
|
-
import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, isExternalKind, isPolicyDropReason, requestRateOf, errorRateOf, formatRate, displayVolume, mergeFlowVolume, dedupeHTTPPairs, coverageLabel, latencyWeightOf, endpointPair, selectionRawPairs, mergeRawPairs, graphEndpoint, graphSize, parseFocus, focusParam, focusId, touchesFocus, focusNeighborhood, endpointSummaries, searchEndpoints, namespaceSummaries, namespaceOverBudget, hasStatusData, connectionRows, selectionMatch, edgeCarriesPort, edgesOnPort, mergedEdgePort, selectedEdgeMatcher, verdictChoices, type GraphFlow } from './trafficFilters'
|
|
3
|
+
import { matchesStatusRanges, bucketsFromCounts, bucketsFromStatus, isRateBasedSource, keepAvailable, effectiveThreshold, volumeUnit, isExternalKind, isPolicyDropReason, requestRateOf, errorRateOf, formatRate, displayVolume, mergeFlowVolume, dedupeHTTPPairs, coverageLabel, latencyWeightOf, endpointPair, selectionRawPairs, mergeRawPairs, graphEndpoint, graphSize, parseFocus, focusParam, focusId, touchesFocus, focusNeighborhood, endpointSummaries, searchEndpoints, namespaceSummaries, namespaceOverBudget, hasStatusData, connectionRows, selectionMatch, edgeCarriesPort, edgesOnPort, mergedEdgePort, selectedEdgeMatcher, verdictChoices, warningRetries, warningBannerTitle, emptyWarningHeadline, type GraphFlow } from './trafficFilters'
|
|
4
4
|
|
|
5
5
|
describe('matchesStatusRanges', () => {
|
|
6
6
|
it('does not filter when nothing is selected', () => {
|
|
@@ -697,3 +697,20 @@ describe('verdictChoices', () => {
|
|
|
697
697
|
expect(verdictChoices(['forwarded', 'redirected'])).toEqual(['forwarded'])
|
|
698
698
|
})
|
|
699
699
|
})
|
|
700
|
+
|
|
701
|
+
describe('flows warning kinds', () => {
|
|
702
|
+
// A cluster warning is the answer about a shared metrics store, not a failed
|
|
703
|
+
// fetch: retrying it only repeats the store's queries.
|
|
704
|
+
it('retries only warnings that may clear on their own', () => {
|
|
705
|
+
expect(warningRetries(undefined)).toBe(true)
|
|
706
|
+
expect(warningRetries('transient')).toBe(true)
|
|
707
|
+
expect(warningRetries('partial')).toBe(false)
|
|
708
|
+
expect(warningRetries('incomplete')).toBe(false)
|
|
709
|
+
expect(warningRetries('cluster')).toBe(false)
|
|
710
|
+
})
|
|
711
|
+
|
|
712
|
+
it('does not call a cluster warning a fetch failure or missing traffic', () => {
|
|
713
|
+
expect(emptyWarningHeadline('cluster')).not.toBe(emptyWarningHeadline('transient'))
|
|
714
|
+
expect(warningBannerTitle('cluster')).not.toBe(warningBannerTitle('transient'))
|
|
715
|
+
})
|
|
716
|
+
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AggregatedFlow, TrafficFlow } from '../../types'
|
|
1
|
+
import type { AggregatedFlow, TrafficFlow, TrafficWarningKind } from '../../types'
|
|
2
2
|
import type { TrafficEndpointPair, TrafficEndpointRef, TrafficMatch } from '../../api/traffic'
|
|
3
3
|
import type { TrafficGraphSelection } from './TrafficGraph'
|
|
4
4
|
|
|
@@ -708,3 +708,32 @@ export function verdictChoices(seen: Iterable<string>): string[] {
|
|
|
708
708
|
if (present.size === 1 && present.has('forwarded')) return []
|
|
709
709
|
return ['forwarded', 'dropped', 'error'].filter(v => present.has(v))
|
|
710
710
|
}
|
|
711
|
+
|
|
712
|
+
/** Whether an empty map with this warning is worth fetching again at once. Only
|
|
713
|
+
* a transient one (or one from a Radar that sends no kind) may clear on its own;
|
|
714
|
+
* the rest are the answer, and polling them costs the source a burst of queries. */
|
|
715
|
+
export function warningRetries(kind: TrafficWarningKind | undefined): boolean {
|
|
716
|
+
return kind !== 'partial' && kind !== 'incomplete' && kind !== 'cluster'
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/** Title of the banner shown beside flows that carry a warning. */
|
|
720
|
+
export function warningBannerTitle(kind: TrafficWarningKind | undefined): string {
|
|
721
|
+
switch (kind) {
|
|
722
|
+
// About values on edges that are shown - a port reported as 0, UDP as TCP -
|
|
723
|
+
// so "unreliable", not "incomplete", which would send the reader looking
|
|
724
|
+
// for missing workloads.
|
|
725
|
+
case 'partial': return 'Some values on this map are unreliable'
|
|
726
|
+
case 'cluster': return "This map may include other clusters' traffic"
|
|
727
|
+
default: return 'Some traffic may be missing from this map'
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** Headline of the empty map when the source explained why it is empty. */
|
|
732
|
+
export function emptyWarningHeadline(kind: TrafficWarningKind | undefined): string {
|
|
733
|
+
switch (kind) {
|
|
734
|
+
case 'partial': return 'No traffic Radar can place on the map'
|
|
735
|
+
case 'incomplete': return 'No traffic seen, but some may be missing'
|
|
736
|
+
case 'cluster': return 'No traffic labeled as this cluster'
|
|
737
|
+
default: return 'Unable to fetch traffic data'
|
|
738
|
+
}
|
|
739
|
+
}
|
|
@@ -124,6 +124,8 @@ export interface OmnibarProps {
|
|
|
124
124
|
* note says part of the scope wasn't searched, so an empty result is then
|
|
125
125
|
* qualified rather than reported as no match. */
|
|
126
126
|
note?: OmnibarNote
|
|
127
|
+
/** The connected server supports searching Event reasons and messages. */
|
|
128
|
+
eventContentSearch?: boolean
|
|
127
129
|
/** Bounded modifier value sets to autocomplete (e.g. { ns: [...], kind: [...] }). */
|
|
128
130
|
modifierOptions?: Record<string, string[]>
|
|
129
131
|
/** Namespaces to seed as removable `ns:` pills when the launcher opens empty
|
|
@@ -185,6 +187,7 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
|
|
|
185
187
|
isError = false,
|
|
186
188
|
isPlaceholderData = false,
|
|
187
189
|
note,
|
|
190
|
+
eventContentSearch = false,
|
|
188
191
|
modifierOptions,
|
|
189
192
|
seedNamespaces,
|
|
190
193
|
loadRecents,
|
|
@@ -653,7 +656,7 @@ export const Omnibar = forwardRef<OmnibarHandle, OmnibarProps>(function Omnibar(
|
|
|
653
656
|
leftSlot={<Search className={hero ? 'w-5 h-5 shrink-0 text-theme-text-tertiary' : 'w-3.5 h-3.5 shrink-0 text-theme-text-tertiary'} />}
|
|
654
657
|
rightSlot={
|
|
655
658
|
<div className="flex items-center gap-1.5 shrink-0">
|
|
656
|
-
<SearchSyntaxHelp />
|
|
659
|
+
<SearchSyntaxHelp eventContentSearch={eventContentSearch} />
|
|
657
660
|
{!hero && !text && pills.length === 0 && (
|
|
658
661
|
<kbd className="text-[10px] text-theme-text-tertiary bg-theme-surface px-1 py-0.5 rounded border border-theme-border-light">
|
|
659
662
|
{mac ? '⌘' : 'Ctrl+'}K
|
|
@@ -11,12 +11,13 @@ vi.mock('../diagnose/DiagnoseContext', () => ({ useDiagnose: () => ({ available:
|
|
|
11
11
|
vi.mock('../../hooks/useRecentResources', () => ({ loadRecentResources: () => [], recordRecentResource: vi.fn() }))
|
|
12
12
|
vi.mock('../../api/apiResources', async (importOriginal) => ({ ...(await importOriginal<object>()), useAPIResources: () => ({ data: [] }) }))
|
|
13
13
|
vi.mock('./command-items', async (importOriginal) => ({ ...(await importOriginal<object>()), useCommandItems: () => [] }))
|
|
14
|
-
const caps = vi.hoisted(() => ({ data: undefined as undefined | { authEnabled?: boolean } }))
|
|
14
|
+
const caps = vi.hoisted(() => ({ data: undefined as undefined | { authEnabled?: boolean; features?: { searchCoverage?: boolean; searchEventContent?: boolean } } }))
|
|
15
15
|
vi.mock('../../api/client', async (importOriginal) => ({
|
|
16
16
|
...(await importOriginal<object>()),
|
|
17
17
|
useNamespaceScope: () => ({ data: undefined }),
|
|
18
18
|
useContexts: () => ({ data: [] }),
|
|
19
19
|
useCapabilities: () => caps,
|
|
20
|
+
useRadarFeature: () => ({ support: caps.data ? (caps.data.features?.searchEventContent ? 'supported' : 'unsupported') : 'unknown' }),
|
|
20
21
|
}))
|
|
21
22
|
|
|
22
23
|
import { RadarOmnibar } from './RadarOmnibar'
|
|
@@ -33,10 +34,11 @@ const failed: SearchCoverageEntry[] = [{ kind: 'SpStall', group: 'stall.sp-live.
|
|
|
33
34
|
beforeEach(() => {
|
|
34
35
|
vi.useFakeTimers()
|
|
35
36
|
Element.prototype.scrollIntoView = vi.fn()
|
|
36
|
-
caps.data =
|
|
37
|
+
caps.data = { features: { searchEventContent: true } }
|
|
37
38
|
searches = 0
|
|
38
39
|
vi.stubGlobal('fetch', vi.fn(async (input: string) => {
|
|
39
40
|
const url = new URL(input, 'http://localhost')
|
|
41
|
+
if (url.pathname.endsWith('/version-check')) return new Response(JSON.stringify({ currentVersion: 'dev' }), { status: 200 })
|
|
40
42
|
if (!url.pathname.endsWith('/search')) throw new Error(`Unexpected request: ${input}`)
|
|
41
43
|
searches++
|
|
42
44
|
return new Response(JSON.stringify({ hits: [], total: 0, searched: 0, total_matched: 0, coverage: coverageOf(unsearched) }), { status: 200 })
|
|
@@ -165,6 +167,57 @@ describe('RadarOmnibar namespace notes', () => {
|
|
|
165
167
|
})
|
|
166
168
|
})
|
|
167
169
|
|
|
170
|
+
describe('RadarOmnibar Event search', () => {
|
|
171
|
+
it.each(['CertificateExpirationWarning', 'kind:Event CertificateExpirationWarning', 'k:ev CertificateExpirationWarning'])('explains an older server without offering unsupported Event text search: %s', async (query) => {
|
|
172
|
+
caps.data = { features: { searchCoverage: true } }
|
|
173
|
+
unsearched = []
|
|
174
|
+
await typeQuery(query)
|
|
175
|
+
expect(page()).toContain('Update the connected Radar server to search Event reasons and messages.')
|
|
176
|
+
expect([...document.body.querySelectorAll('button')].some((b) => b.textContent === 'Search Events')).toBe(false)
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it('waits for server support instead of guessing while capabilities load', async () => {
|
|
180
|
+
caps.data = undefined
|
|
181
|
+
unsearched = []
|
|
182
|
+
await typeQuery('CertificateExpirationWarning')
|
|
183
|
+
expect(page()).not.toContain('Search Events')
|
|
184
|
+
expect(page()).not.toContain('Update the connected Radar server')
|
|
185
|
+
})
|
|
186
|
+
it('opts an empty broad search into Events and preserves its namespace and reason', async () => {
|
|
187
|
+
unsearched = []
|
|
188
|
+
const requests: string[] = []
|
|
189
|
+
vi.mocked(fetch).mockImplementation(async (input) => {
|
|
190
|
+
const query = new URL(String(input), 'http://localhost').searchParams.get('q') ?? ''
|
|
191
|
+
requests.push(query)
|
|
192
|
+
const hits = query.includes('kind:Event')
|
|
193
|
+
? [{ score: 1, kind: 'Event', namespace: 'prod', name: 'certificate-warning', matched: [{ token: 'CertificateExpirationWarning', site: 'content:reason', score: 12 }], snippets: [{ path: 'reason', text: 'CertificateExpirationWarning' }] }]
|
|
194
|
+
: []
|
|
195
|
+
return new Response(JSON.stringify({ hits, total: hits.length, total_matched: hits.length, coverage: coverageOf([]) }), { status: 200 })
|
|
196
|
+
})
|
|
197
|
+
await typeQuery('ns:prod')
|
|
198
|
+
act(() => host.querySelector('input')!.dispatchEvent(new KeyboardEvent('keydown', { key: ' ', bubbles: true })))
|
|
199
|
+
await typeQuery('CertificateExpirationWarning')
|
|
200
|
+
expect(page()).toContain("Kubernetes Events aren't included in a broad search.")
|
|
201
|
+
const button = [...document.body.querySelectorAll('button')].find((b) => b.textContent === 'Search Events')
|
|
202
|
+
expect(button).toBeDefined()
|
|
203
|
+
act(() => button?.click())
|
|
204
|
+
await advance(300)
|
|
205
|
+
await advance(100)
|
|
206
|
+
expect(requests.at(-1)).toBe('ns:prod kind:Event CertificateExpirationWarning')
|
|
207
|
+
expect(page()).toContain('certificate-warning')
|
|
208
|
+
expect(page()).toContain('in event')
|
|
209
|
+
expect(page()).not.toContain('in spec')
|
|
210
|
+
expect(host.querySelector('input')!.value).toBe('CertificateExpirationWarning')
|
|
211
|
+
expect([...document.body.querySelectorAll('button')].some((b) => b.textContent === 'Search Events')).toBe(false)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
it.each(['kind:Pod CertificateExpirationWarning', 'k:events renewal', 'kind:"Event" renewal'])('does not redirect an explicitly scoped search: %s', async (query) => {
|
|
215
|
+
unsearched = []
|
|
216
|
+
await typeQuery(query)
|
|
217
|
+
expect(page()).not.toContain('Search Events')
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
|
|
168
221
|
describe('RadarOmnibar read recovery', () => {
|
|
169
222
|
it.each([
|
|
170
223
|
['alone', []],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useEffect, useMemo, useState, useRef, useImperativeHandle } from 'react'
|
|
2
2
|
import { Omnibar, type OmnibarHandle } from './Omnibar'
|
|
3
|
-
import { useSearch, useNamespaceScope, useContexts, type SearchHit, type SearchResult } from '../../api/client'
|
|
3
|
+
import { useSearch, useNamespaceScope, useContexts, useRadarFeature, type SearchHit, type SearchResult } from '../../api/client'
|
|
4
4
|
import { useAPIResources } from '../../api/apiResources'
|
|
5
5
|
import { loadRecentResources, recordRecentResource } from '../../hooks/useRecentResources'
|
|
6
6
|
import { useCommandItems, type CommandItemCallbacks } from './command-items'
|
|
@@ -48,6 +48,7 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
|
|
|
48
48
|
const { data: nsScope } = useNamespaceScope()
|
|
49
49
|
const { data: apiResources } = useAPIResources()
|
|
50
50
|
const { data: contexts } = useContexts()
|
|
51
|
+
const { support: eventContentSupport } = useRadarFeature('searchEventContent')
|
|
51
52
|
const contextKey = useMemo(() => contexts?.find((c) => c.isCurrent)?.name ?? '', [contexts])
|
|
52
53
|
|
|
53
54
|
const modifierOptions = useMemo(() => ({
|
|
@@ -70,6 +71,10 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
|
|
|
70
71
|
hits: searchData?.hits,
|
|
71
72
|
query,
|
|
72
73
|
recheckKind: (kind) => omnibarRef.current?.addModifier({ key: 'kind', value: kind }),
|
|
74
|
+
searchEvents: eventContentSupport === 'supported' && !isFetching && !isPlaceholderData && !isError
|
|
75
|
+
? () => omnibarRef.current?.addModifier({ key: 'kind', value: 'Event' })
|
|
76
|
+
: undefined,
|
|
77
|
+
eventSearchNeedsUpgrade: eventContentSupport === 'unsupported' && !isFetching && !isPlaceholderData && !isError,
|
|
73
78
|
pendingExhausted: exhaustedQuery === query,
|
|
74
79
|
openKindList: (kind, group) => {
|
|
75
80
|
const resource = apiResources?.find((r) => r.kind === kind && r.group === group)
|
|
@@ -88,6 +93,7 @@ export const RadarOmnibar = forwardRef<OmnibarHandle, RadarOmnibarProps>(functio
|
|
|
88
93
|
isError={isError}
|
|
89
94
|
isPlaceholderData={isPlaceholderData}
|
|
90
95
|
note={note}
|
|
96
|
+
eventContentSearch={eventContentSupport === 'supported'}
|
|
91
97
|
modifierOptions={modifierOptions}
|
|
92
98
|
seedNamespaces={nsScope?.actives}
|
|
93
99
|
onInvestigateQuery={onInvestigateQuery}
|
|
@@ -11,16 +11,23 @@ afterEach(() => {
|
|
|
11
11
|
host?.remove()
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
function render() {
|
|
14
|
+
function render(eventContentSearch = false) {
|
|
15
15
|
host = document.createElement('div')
|
|
16
16
|
document.body.appendChild(host)
|
|
17
17
|
root = createRoot(host)
|
|
18
|
-
act(() => root!.render(<SearchSyntaxHelp />))
|
|
18
|
+
act(() => root!.render(<SearchSyntaxHelp eventContentSearch={eventContentSearch} />))
|
|
19
19
|
return host.querySelector('button')!
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const cardShown = () => document.body.textContent?.includes('Search syntax') ?? false
|
|
23
23
|
|
|
24
|
+
it.each([false, true])('describes only Event search supported by the server: %s', (supported) => {
|
|
25
|
+
const button = render(supported)
|
|
26
|
+
act(() => button.click())
|
|
27
|
+
expect(document.body.textContent).toContain(supported ? 'search Event reasons and messages' : 'search Events by name')
|
|
28
|
+
expect(document.body.textContent).not.toContain(supported ? 'search Events by name' : 'search Event reasons and messages')
|
|
29
|
+
})
|
|
30
|
+
|
|
24
31
|
it('toggles on a click with no pointer before it (assistive activation)', () => {
|
|
25
32
|
const button = render()
|
|
26
33
|
act(() => button.click())
|
|
@@ -8,6 +8,7 @@ import { isTouchIntent } from '@skyhook-io/k8s-ui'
|
|
|
8
8
|
const OPERATORS: { syntax: string; desc: string }[] = [
|
|
9
9
|
{ syntax: 'ns:prod', desc: 'filter by namespace' },
|
|
10
10
|
{ syntax: 'kind:Deployment', desc: 'filter by resource kind' },
|
|
11
|
+
{ syntax: 'kind:Event', desc: 'search Events by name' },
|
|
11
12
|
{ syntax: 'label:app=api', desc: 'filter by label' },
|
|
12
13
|
{ syntax: 'image:nginx', desc: 'match container image' },
|
|
13
14
|
{ syntax: 'redis cache', desc: 'multiple terms — all must match' },
|
|
@@ -21,7 +22,7 @@ const OPERATORS: { syntax: string; desc: string }[] = [
|
|
|
21
22
|
// that just opened the search box, so hover ignores a tap's side effects. A
|
|
22
23
|
// click (a tap, or assistive-technology activation) toggles the card, except
|
|
23
24
|
// right after a mouse hover opened it; a tap elsewhere closes it.
|
|
24
|
-
export function SearchSyntaxHelp() {
|
|
25
|
+
export function SearchSyntaxHelp({ eventContentSearch = false }: { eventContentSearch?: boolean }) {
|
|
25
26
|
const [open, setOpen] = useState(false)
|
|
26
27
|
const btnRef = useRef<HTMLButtonElement>(null)
|
|
27
28
|
const popRef = useRef<HTMLDivElement>(null)
|
|
@@ -95,7 +96,7 @@ export function SearchSyntaxHelp() {
|
|
|
95
96
|
{OPERATORS.map((op) => (
|
|
96
97
|
<div key={op.syntax} className="flex items-baseline gap-2">
|
|
97
98
|
<code className="shrink-0 rounded bg-theme-elevated border border-theme-border-light px-1.5 py-0.5 text-xs text-theme-text-primary">{op.syntax}</code>
|
|
98
|
-
<span className="text-xs text-theme-text-secondary">{op.desc}</span>
|
|
99
|
+
<span className="text-xs text-theme-text-secondary">{op.syntax === 'kind:Event' && eventContentSearch ? 'search Event reasons and messages' : op.desc}</span>
|
|
99
100
|
</div>
|
|
100
101
|
))}
|
|
101
102
|
</div>
|
|
@@ -3,6 +3,8 @@ import { renderToString } from 'react-dom/server'
|
|
|
3
3
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
4
4
|
|
|
5
5
|
let deploymentMode = 'local'
|
|
6
|
+
let installMethod = 'direct'
|
|
7
|
+
let manualUpdate: 'appimage' | 'package' | 'download' | undefined
|
|
6
8
|
|
|
7
9
|
vi.mock('../../api/client', () => ({
|
|
8
10
|
useCapabilities: () => ({ data: { deployment: { mode: deploymentMode } } }),
|
|
@@ -11,7 +13,8 @@ vi.mock('../../api/client', () => ({
|
|
|
11
13
|
currentVersion: '1.2.3',
|
|
12
14
|
latestVersion: '1.3.0',
|
|
13
15
|
updateAvailable: true,
|
|
14
|
-
installMethod
|
|
16
|
+
installMethod,
|
|
17
|
+
manualUpdate,
|
|
15
18
|
releaseUrl: 'https://github.com/skyhook-io/radar/releases/tag/v1.3.0',
|
|
16
19
|
// Off, so the Product Hunt launch day doesn't take the corner whatever today is.
|
|
17
20
|
productHuntLaunch: { enabled: false, url: '', start: '0001-01-01T00:00:00Z', end: '0001-01-01T00:00:00Z' },
|
|
@@ -37,6 +40,8 @@ function renderNotification() {
|
|
|
37
40
|
describe('UpdateNotification', () => {
|
|
38
41
|
beforeEach(() => {
|
|
39
42
|
deploymentMode = 'local'
|
|
43
|
+
installMethod = 'direct'
|
|
44
|
+
manualUpdate = undefined
|
|
40
45
|
})
|
|
41
46
|
|
|
42
47
|
it('keeps the update popup for local installations', () => {
|
|
@@ -45,6 +50,23 @@ describe('UpdateNotification', () => {
|
|
|
45
50
|
expect(html).toContain('1.3.0')
|
|
46
51
|
})
|
|
47
52
|
|
|
53
|
+
it('offers the in-app update to desktop installs that can replace themselves', () => {
|
|
54
|
+
installMethod = 'desktop'
|
|
55
|
+
const html = renderNotification()
|
|
56
|
+
// The in-app update button plus the dismiss button.
|
|
57
|
+
expect(html.match(/<button/g)).toHaveLength(2)
|
|
58
|
+
expect(html).not.toContain('href="https://github.com/skyhook-io/radar/releases/tag/v1.3.0"')
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it.each(['appimage', 'package', 'download'] as const)('links %s desktop installs to the release instead of updating in place', how => {
|
|
62
|
+
installMethod = 'desktop'
|
|
63
|
+
manualUpdate = how
|
|
64
|
+
const html = renderNotification()
|
|
65
|
+
expect(html).toContain('href="https://github.com/skyhook-io/radar/releases/tag/v1.3.0"')
|
|
66
|
+
// Only the dismiss button: no in-app update.
|
|
67
|
+
expect(html.match(/<button/g)).toHaveLength(1)
|
|
68
|
+
})
|
|
69
|
+
|
|
48
70
|
it('suppresses the update popup for shared in-cluster viewers', () => {
|
|
49
71
|
deploymentMode = 'in-cluster'
|
|
50
72
|
expect(renderNotification()).toBe('')
|
|
@@ -52,7 +52,8 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
|
|
|
52
52
|
const startUpdate = useStartDesktopUpdate()
|
|
53
53
|
const applyUpdate = useApplyDesktopUpdate()
|
|
54
54
|
const isDesktop = versionInfo?.installMethod === 'desktop'
|
|
55
|
-
const
|
|
55
|
+
const desktopSelfUpdate = isDesktop && !versionInfo?.manualUpdate
|
|
56
|
+
const { data: updateStatus } = useDesktopUpdateStatus(desktopUpdating || (inSettings && expanded && desktopSelfUpdate))
|
|
56
57
|
|
|
57
58
|
useEffect(() => {
|
|
58
59
|
if (!expanded) return
|
|
@@ -213,8 +214,25 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
|
|
|
213
214
|
{!inSettings && <>You're on {versionInfo.currentVersion}.</>}
|
|
214
215
|
</p>
|
|
215
216
|
|
|
217
|
+
{/* Desktop that cannot replace itself: how to update, and the download */}
|
|
218
|
+
{isDesktop && versionInfo.manualUpdate && versionInfo.releaseUrl && (
|
|
219
|
+
<>
|
|
220
|
+
<p className="text-xs text-theme-text-secondary mt-1">
|
|
221
|
+
{MANUAL_UPDATE_TEXT[versionInfo.manualUpdate]}
|
|
222
|
+
</p>
|
|
223
|
+
<a
|
|
224
|
+
href={versionInfo.releaseUrl}
|
|
225
|
+
target="_blank"
|
|
226
|
+
rel="noopener noreferrer"
|
|
227
|
+
className="inline-flex items-center gap-1 mt-2 text-xs font-medium text-accent-text hover:underline"
|
|
228
|
+
>
|
|
229
|
+
Download from GitHub →
|
|
230
|
+
</a>
|
|
231
|
+
</>
|
|
232
|
+
)}
|
|
233
|
+
|
|
216
234
|
{/* Desktop: in-app update flow */}
|
|
217
|
-
{
|
|
235
|
+
{desktopSelfUpdate && (
|
|
218
236
|
<DesktopUpdateControls
|
|
219
237
|
state={effectiveState}
|
|
220
238
|
progress={updateStatus?.progress}
|
|
@@ -308,6 +326,12 @@ export function UpdateNotification({ placement = 'floating' }: { placement?: 'fl
|
|
|
308
326
|
)
|
|
309
327
|
}
|
|
310
328
|
|
|
329
|
+
const MANUAL_UPDATE_TEXT: Record<NonNullable<VersionInfo['manualUpdate']>, string> = {
|
|
330
|
+
appimage: "This AppImage can't update itself. Download the new one and use it in place of this file.",
|
|
331
|
+
package: 'Download the new .deb or .rpm and install it with your package manager, such as apt or dnf.',
|
|
332
|
+
download: "Radar can't replace itself in this folder. Download the new version and copy it over this one, as an administrator if the folder needs it.",
|
|
333
|
+
}
|
|
334
|
+
|
|
311
335
|
function CopyIcon({ copied, failed }: { copied: boolean; failed: boolean }) {
|
|
312
336
|
if (copied) return <Check className="w-3.5 h-3.5 text-green-400 shrink-0" />
|
|
313
337
|
if (failed) return <X className="w-3.5 h-3.5 text-red-400 shrink-0" />
|