@skyhook-io/radar-app 1.21.1 → 1.21.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/README.md +11 -0
- package/package.json +2 -2
- package/src/App.tsx +50 -28
- package/src/api/actions.test.ts +11 -0
- package/src/api/actions.ts +5 -0
- package/src/api/apiResources.navigation.test.tsx +58 -0
- package/src/api/apiResources.ts +22 -16
- package/src/api/client.diagnostics.test.ts +52 -0
- package/src/api/client.triggerCronJob.test.tsx +49 -0
- package/src/api/client.ts +140 -120
- package/src/api/connectionBinding.test.tsx +82 -0
- package/src/api/connectionBinding.ts +52 -0
- package/src/api/contextSwitch.test.ts +11 -0
- package/src/api/contextSwitch.ts +58 -0
- package/src/api/radarFeatures.ts +7 -0
- package/src/api/sealedSecrets.test.ts +22 -0
- package/src/api/sealedSecrets.ts +37 -0
- package/src/api/vulnerabilities.ts +80 -7
- package/src/components/ConnectionErrorView.tsx +13 -0
- package/src/components/ContextSwitchActions.tsx +43 -0
- package/src/components/ContextSwitcher.tsx +13 -6
- package/src/components/SwitchAwareConnectionError.tsx +2 -2
- package/src/components/audit/Java4ShellPanel.test.tsx +104 -7
- package/src/components/audit/Java4ShellPanel.tsx +169 -72
- package/src/components/cost/ApplicationCostTab.test.ts +16 -0
- package/src/components/cost/ApplicationCostTab.tsx +41 -9
- package/src/components/cost/CostTrendChart.tsx +25 -2
- package/src/components/cost/CostTrendWithheld.render.test.tsx +105 -0
- package/src/components/cost/CostView.tsx +10 -2
- package/src/components/cost/CostViewTabs.test.tsx +18 -0
- package/src/components/cost/CostViewTabs.tsx +14 -22
- package/src/components/cost/WorkloadCostTab.test.ts +15 -0
- package/src/components/cost/WorkloadCostTab.tsx +42 -8
- package/src/components/cost/source.test.ts +16 -1
- package/src/components/cost/source.ts +34 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.test.ts +35 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +16 -1
- package/src/components/dock/NodeTerminalTab.test.tsx +4 -2
- package/src/components/dock/NodeTerminalTab.tsx +8 -8
- package/src/components/dock/TerminalTab.test.tsx +12 -1
- package/src/components/dock/TerminalTab.tsx +6 -3
- package/src/components/home/CostCard.test.tsx +49 -0
- package/src/components/home/CostCard.tsx +98 -63
- package/src/components/home/mcpToolCatalog.ts +1 -0
- package/src/components/resource/DatadogRightsizingPanel.test.tsx +118 -0
- package/src/components/resource/DatadogRightsizingPanel.tsx +68 -0
- package/src/components/resource/DatadogWorkloadCharts.tsx +149 -0
- package/src/components/resource/HPACharts.render.test.tsx +42 -0
- package/src/components/resource/HPACharts.tsx +34 -1
- package/src/components/resource/PrometheusChartsGrid.render.test.tsx +126 -3
- package/src/components/resource/PrometheusChartsGrid.tsx +58 -25
- package/src/components/resource/RestartChart.render.test.tsx +72 -0
- package/src/components/resource/RestartChart.tsx +31 -3
- package/src/components/resource/RightsizingPanel.access.test.tsx +24 -0
- package/src/components/resource/RightsizingStrip.render.test.tsx +44 -0
- package/src/components/resource/RightsizingStrip.test.ts +1 -188
- package/src/components/resource/RightsizingStrip.tsx +27 -300
- package/src/components/resource/WorkloadMetricsSection.render.test.tsx +22 -0
- package/src/components/resource/WorkloadMetricsSection.tsx +14 -4
- package/src/components/resource/nameMatchedScope.ts +39 -0
- package/src/components/resources/pod-file-upload.ts +3 -0
- package/src/components/resources/renderers/CAPIClusterRenderer.tsx +5 -2
- package/src/components/resources/renderers/LonghornVolumeRenderer.test.tsx +104 -0
- package/src/components/resources/renderers/LonghornVolumeRenderer.tsx +31 -0
- package/src/components/resources/renderers/SealedSecretRenderer.test.tsx +41 -0
- package/src/components/resources/renderers/SealedSecretRenderer.tsx +14 -0
- package/src/components/rightsizing/RightsizingScanLink.tsx +22 -0
- package/src/components/rightsizing/RightsizingScanView.tsx +65 -528
- package/src/components/rightsizing/model.test.ts +20 -9
- package/src/components/rightsizing/model.ts +17 -176
- package/src/components/rightsizing/notices.test.tsx +30 -29
- package/src/components/traffic/TrafficFlowList.tsx +8 -4
- package/src/components/traffic/TrafficGraph.test.tsx +31 -1
- package/src/components/traffic/TrafficGraph.tsx +11 -6
- package/src/components/traffic/trafficFilters.ts +4 -4
- package/src/components/ui/DiagnosticsOverlay.test.ts +3 -2
- package/src/components/ui/DiagnosticsOverlay.tsx +23 -13
- package/src/components/ui/command-items.ts +3 -4
- package/src/components/useContextSwitchFlow.test.tsx +9 -0
- package/src/components/useContextSwitchFlow.tsx +43 -5
- package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.test.tsx +54 -0
- package/src/components/vulnerabilities/WorkloadVulnerabilitiesSection.tsx +50 -109
- package/src/components/whats-new/releaseNotes.ts +1 -1
- package/src/components/workload/WorkloadRightsizingSource.test.tsx +83 -0
- package/src/components/workload/WorkloadView.test.ts +22 -1
- package/src/components/workload/WorkloadView.tsx +57 -16
- package/src/context/ConnectionContext.test.ts +1 -0
- package/src/context/ConnectionContext.tsx +58 -15
- package/src/context/ConnectionProvider.connectionId.test.tsx +92 -0
- package/src/context/ConnectionProvider.retry.test.tsx +174 -1
- package/src/context/ContextSwitchContext.tsx +15 -1
- package/src/context/NavCustomization.tsx +6 -3
- package/src/hooks/useEventSource.test.tsx +85 -0
- package/src/hooks/useEventSource.ts +43 -16
- package/src/hooks/useResetViewsOnContextChange.test.tsx +34 -0
- package/src/hooks/useResetViewsOnContextChange.ts +27 -0
- package/src/index.ts +3 -0
- package/src/integrations/resourceHosts.test.tsx +2 -2
- package/src/integrations/resourceHosts.tsx +4 -0
- package/src/utils/navigation.ts +1 -15
- package/src/utils/page-links.ts +6 -0
- package/src/components/rightsizing/presentation.test.ts +0 -150
- package/src/components/rightsizing/presentation.ts +0 -109
|
@@ -12,6 +12,7 @@ import { ImageName } from '../vulnerabilities/parts'
|
|
|
12
12
|
import { Tooltip } from '../ui/Tooltip'
|
|
13
13
|
|
|
14
14
|
const advisoryURL = 'https://github.com/advisories/GHSA-6g7j-4xh3-xq2q'
|
|
15
|
+
const registryAccessURL = 'https://github.com/skyhook-io/radar/blob/main/docs/authentication.md#java4shell-registry-access'
|
|
15
16
|
|
|
16
17
|
interface Java4ShellPanelProps {
|
|
17
18
|
namespaces?: string[]
|
|
@@ -23,8 +24,15 @@ interface Java4ShellPanelProps {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export function Java4ShellPanel({ namespaces = [], context, connected, trivySearch, workload, onNavigateToResource }: Java4ShellPanelProps) {
|
|
26
|
-
const { data, dataUpdatedAt, isFetching, error, refetch } = useJava4ShellCheck(namespaces, context, workload)
|
|
27
|
+
const { data, dataUpdatedAt, isFetching, error, refetch, progress, cancel } = useJava4ShellCheck(namespaces, context, workload)
|
|
27
28
|
const checkedAt = new Date(dataUpdatedAt).toISOString()
|
|
29
|
+
const canceled = error?.name === 'AbortError'
|
|
30
|
+
const scope = workload
|
|
31
|
+
? `${workload.namespace}/${workload.name}`
|
|
32
|
+
: namespaces.length > 3 ? pluralize(namespaces.length, 'selected namespace') : namespaces.join(', ') || 'All namespaces'
|
|
33
|
+
const progressText = progress && progress.total > 0
|
|
34
|
+
? `Checking image groups · ${progress.done} of ${progress.total} processed`
|
|
35
|
+
: 'Reading running Pods and image metadata.'
|
|
28
36
|
return (
|
|
29
37
|
<section aria-label="Java4Shell check" className={`rounded-xl border border-theme-border bg-theme-surface ${workload ? 'p-3' : 'p-4'}`}>
|
|
30
38
|
<div className="flex flex-wrap items-start justify-between gap-3">
|
|
@@ -32,10 +40,11 @@ export function Java4ShellPanel({ namespaces = [], context, connected, trivySear
|
|
|
32
40
|
<h2 className="text-sm font-semibold text-theme-text-primary">Java4Shell</h2>
|
|
33
41
|
<p className="text-xs text-theme-text-secondary">
|
|
34
42
|
{workload
|
|
35
|
-
? 'Check
|
|
36
|
-
: 'Check running
|
|
43
|
+
? 'Check images in this workload for affected Java version declarations.'
|
|
44
|
+
: 'Check running container images for affected Java version declarations.'}
|
|
45
|
+
{' '}Radar reads registry metadata with the credentials available to this check.
|
|
37
46
|
</p>
|
|
38
|
-
<p className="text-xs text-theme-text-
|
|
47
|
+
<p className="text-xs text-theme-text-secondary"><span className="font-medium">Check scope</span> · {scope}</p>
|
|
39
48
|
<div className="flex flex-wrap gap-x-4 gap-y-1 text-xs">
|
|
40
49
|
<a className="text-accent-text hover:underline" href={advisoryURL} target="_blank" rel="noreferrer">{JAVA4SHELL_CVE} advisory</a>
|
|
41
50
|
{trivySearch && <Link className="text-accent-text hover:underline" to={{ search: trivySearch }}>Find in Trivy reports</Link>}
|
|
@@ -47,7 +56,7 @@ export function Java4ShellPanel({ namespaces = [], context, connected, trivySear
|
|
|
47
56
|
type="button"
|
|
48
57
|
className="btn-secondary inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium"
|
|
49
58
|
onClick={() => triggerDownload(
|
|
50
|
-
JSON.stringify({ cve: JAVA4SHELL_CVE, checkedAt, ...data }, null, 2),
|
|
59
|
+
JSON.stringify({ cve: JAVA4SHELL_CVE, checkedAt, context, ...data }, null, 2),
|
|
51
60
|
'application/json',
|
|
52
61
|
`java4shell-${checkedAt.replace(/[:.]/g, '-')}.json`,
|
|
53
62
|
)}
|
|
@@ -55,19 +64,40 @@ export function Java4ShellPanel({ namespaces = [], context, connected, trivySear
|
|
|
55
64
|
<Download className="h-3.5 w-3.5" /> Download JSON
|
|
56
65
|
</button>
|
|
57
66
|
)}
|
|
67
|
+
{cancel && (
|
|
68
|
+
<button type="button" className="btn-secondary shrink-0 px-3 py-1.5 text-xs font-medium" onClick={cancel}>
|
|
69
|
+
{isFetching ? 'Cancel check' : 'Cancel check in another scope'}
|
|
70
|
+
</button>
|
|
71
|
+
)}
|
|
58
72
|
<button
|
|
59
73
|
type="button"
|
|
60
74
|
className="btn-brand shrink-0 px-3 py-1.5 text-xs font-medium"
|
|
61
75
|
onClick={() => void refetch()}
|
|
62
|
-
disabled={!connected || isFetching}
|
|
76
|
+
disabled={!connected || isFetching || Boolean(cancel)}
|
|
63
77
|
>
|
|
64
|
-
{isFetching ? (workload ? 'Checking workload…' : 'Checking workloads…') : data ? 'Run check again' : 'Check for Java4Shell'}
|
|
78
|
+
{isFetching ? (workload ? 'Checking workload…' : 'Checking workloads…') : cancel ? 'Checking another scope…' : data ? 'Run check again' : 'Check for Java4Shell'}
|
|
65
79
|
</button>
|
|
66
80
|
</div>
|
|
67
81
|
</div>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
82
|
+
<p role="status" className="sr-only">
|
|
83
|
+
{isFetching
|
|
84
|
+
? data ? 'Checking Java4Shell. Showing the previous result while the check runs.' : 'Checking Java4Shell.'
|
|
85
|
+
: data && !error ? 'Java4Shell check finished.' : ''}
|
|
86
|
+
</p>
|
|
87
|
+
{isFetching && (
|
|
88
|
+
<div className="mt-3 space-y-1 text-xs text-theme-text-secondary">
|
|
89
|
+
<p aria-hidden>{progressText}</p>
|
|
90
|
+
<progress
|
|
91
|
+
aria-label="Java4Shell scan progress"
|
|
92
|
+
className="block w-full accent-accent"
|
|
93
|
+
value={progress && progress.total > 0 ? progress.done : undefined}
|
|
94
|
+
max={progress?.total || undefined}
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
)}
|
|
98
|
+
{canceled && <p role="status" className="mt-3 text-xs text-theme-text-secondary">Check canceled.{data && ' Showing the previous result.'}</p>}
|
|
99
|
+
{error && !canceled && <p role="alert" className="mt-3 text-xs text-warning-text">{error.message}{data && ' Showing the previous result.'}</p>}
|
|
100
|
+
{data && <Java4ShellResults data={data} checkedAt={checkedAt} onOpen={onNavigateToResource} checkingAgain={isFetching} />}
|
|
71
101
|
</section>
|
|
72
102
|
)
|
|
73
103
|
}
|
|
@@ -77,20 +107,35 @@ const reasonLabels: Record<string, string> = {
|
|
|
77
107
|
version_unknown: 'Unrecognized Java version',
|
|
78
108
|
platform_unknown: 'Image platform unknown',
|
|
79
109
|
auth_required: 'Registry authentication required',
|
|
110
|
+
credential_check_timeout: 'Registry credential check timed out',
|
|
80
111
|
not_found: 'Image missing or private',
|
|
81
112
|
blocked: 'Registry address blocked',
|
|
82
113
|
rate_limited: 'Registry rate limit',
|
|
83
114
|
error: 'Registry read failed',
|
|
84
|
-
not_checked: '
|
|
115
|
+
not_checked: 'Scan limit reached',
|
|
116
|
+
docker_hub_limit: "Radar's Docker Hub lookup cap reached",
|
|
85
117
|
java_home_declared: 'Image sets JAVA_HOME. Java version unknown',
|
|
86
118
|
no_java_declaration: 'Image declares no Java version',
|
|
87
119
|
}
|
|
88
120
|
|
|
89
|
-
function
|
|
121
|
+
function registryNames(hosts?: string[]): string {
|
|
122
|
+
if (!hosts?.length) return ''
|
|
123
|
+
return ` · ${hosts.slice(0, 3).join(', ')}${hosts.length > 3 ? ' and others' : ''}`
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function Java4ShellResults({ data, checkedAt, onOpen, checkingAgain }: { data: Java4ShellResult; checkedAt: string; onOpen?: (resource: SelectedResource) => void; checkingAgain: boolean }) {
|
|
90
127
|
const missingDeclaration = data.unassessed.no_java_declaration ?? 0
|
|
91
128
|
const javaHomeDeclared = data.unassessed.java_home_declared ?? 0
|
|
129
|
+
const dockerHubLimit = data.unassessed.docker_hub_limit ?? 0
|
|
130
|
+
const checkLimitReached = data.unassessed.not_checked ?? 0
|
|
131
|
+
const registryAuthRequired = data.unassessed.auth_required ?? 0
|
|
132
|
+
const registryRateLimit = data.unassessed.rate_limited ?? 0
|
|
92
133
|
const unassessed = Object.values(data.unassessed).reduce((count, n) => count + n, 0)
|
|
93
|
-
const
|
|
134
|
+
const gaps = unassessed - missingDeclaration
|
|
135
|
+
const assessedOutside = data.containers - data.matches - unassessed
|
|
136
|
+
const remainingReasons = Object.entries(data.unassessed).filter(([reason]) =>
|
|
137
|
+
!['auth_required', 'not_checked', 'docker_hub_limit', 'java_home_declared', 'no_java_declaration', 'rate_limited'].includes(reason),
|
|
138
|
+
)
|
|
94
139
|
const coverage = resourceCoverageNotice(data.coverage, 'Pods') ?? resourceNarrowedNotice(data.coverage)
|
|
95
140
|
const namespaces = data.coverage.read?.namespaces
|
|
96
141
|
const scope = data.workload?.name ?? (
|
|
@@ -106,39 +151,29 @@ function Java4ShellResults({ data, checkedAt, onOpen }: { data: Java4ShellResult
|
|
|
106
151
|
else groups.set(key, [row])
|
|
107
152
|
}
|
|
108
153
|
const summary = data.matches > 0
|
|
109
|
-
? `${
|
|
154
|
+
? `${data.matches} of ${data.matches + assessedOutside} assessed containers with an affected Java declaration`
|
|
110
155
|
: data.containers === 0
|
|
111
156
|
? data.workload ? 'Radar found no running containers in this workload' : 'Radar found no running containers in the scope it read'
|
|
112
157
|
: missingDeclaration === data.containers
|
|
113
|
-
? '
|
|
158
|
+
? 'None of the running images declared a Java version'
|
|
114
159
|
: unassessed === data.containers
|
|
115
160
|
? 'Radar could not assess the Java version of any running container'
|
|
116
|
-
:
|
|
161
|
+
: `No affected declarations among ${pluralize(assessedOutside, 'assessed container')}`
|
|
117
162
|
return (
|
|
118
163
|
<div className="mt-3 flex flex-col gap-2 border-t border-theme-border pt-3 text-xs">
|
|
119
164
|
<div className="flex flex-wrap justify-between gap-x-3 gap-y-1">
|
|
120
|
-
<p
|
|
121
|
-
<p className="text-theme-text-tertiary">Checked <TimeValue timestamp={checkedAt} /> · {scope}</p>
|
|
165
|
+
<p className="font-medium text-theme-text-primary">{summary}</p>
|
|
166
|
+
<p className="text-theme-text-tertiary">{checkingAgain ? 'Previous result' : 'Checked'} <TimeValue timestamp={checkedAt} /> · {scope}</p>
|
|
122
167
|
</div>
|
|
123
168
|
{coverage && <p className="text-warning-text">{coverage}</p>}
|
|
124
|
-
{
|
|
169
|
+
{data.containers > 0 && (
|
|
125
170
|
<p className="text-theme-text-secondary">
|
|
126
|
-
|
|
171
|
+
{pluralize(data.containers, 'running container')}
|
|
172
|
+
{data.matches > 0 && assessedOutside > 0 && ` · ${assessedOutside} with versions outside affected ranges`}
|
|
173
|
+
{gaps > 0 && ` · ${gaps} with assessment gaps`}
|
|
174
|
+
{missingDeclaration > 0 && ` · ${missingDeclaration} with no Java version declared`}
|
|
127
175
|
</p>
|
|
128
176
|
)}
|
|
129
|
-
{otherUnassessed > 0 && (
|
|
130
|
-
<p className="text-theme-text-secondary">
|
|
131
|
-
Java version unassessed in {pluralize(otherUnassessed, 'container')}.
|
|
132
|
-
</p>
|
|
133
|
-
)}
|
|
134
|
-
{missingDeclaration > 0 && (
|
|
135
|
-
<p className="text-theme-text-secondary">
|
|
136
|
-
Images for {pluralize(missingDeclaration, 'container')} had no Java version declaration.
|
|
137
|
-
</p>
|
|
138
|
-
)}
|
|
139
|
-
{data.findings.length > 0 && (
|
|
140
|
-
<p className="text-theme-text-secondary">Image metadata describes the declared Java version. Confirm the deployed JVM and the fix from its vendor.</p>
|
|
141
|
-
)}
|
|
142
177
|
{data.workload && <WorkloadJava4ShellRows data={data} />}
|
|
143
178
|
{!data.workload && onOpen && data.findings.length > 0 && (
|
|
144
179
|
<>
|
|
@@ -168,7 +203,7 @@ function Java4ShellResults({ data, checkedAt, onOpen }: { data: Java4ShellResult
|
|
|
168
203
|
</td>
|
|
169
204
|
<td className="px-3 py-2">
|
|
170
205
|
<div className="font-mono text-theme-text-primary">{row.version}</div>
|
|
171
|
-
<div className="text-theme-text-secondary">{row.fixedIn ? `
|
|
206
|
+
<div className="text-theme-text-secondary">{row.fixedIn ? `Advisory fix ${row.fixedIn}` : 'Check the vendor for an upgrade'}</div>
|
|
172
207
|
</td>
|
|
173
208
|
<td className="px-3 py-2">
|
|
174
209
|
<JavaPlacement row={row} />
|
|
@@ -184,7 +219,60 @@ function Java4ShellResults({ data, checkedAt, onOpen }: { data: Java4ShellResult
|
|
|
184
219
|
{data.findingGroups > data.findings.length && (
|
|
185
220
|
<p className="text-theme-text-secondary">Showing {data.findings.length} of {data.findingGroups} matching groups.{!data.workload && ' Narrow the namespace scope to see more.'}</p>
|
|
186
221
|
)}
|
|
187
|
-
{
|
|
222
|
+
{data.findings.length > 0 && (
|
|
223
|
+
<p className="text-theme-text-secondary">Confirm the installed Java version and the fix from its vendor.</p>
|
|
224
|
+
)}
|
|
225
|
+
{data.unaffectedByMajor && (
|
|
226
|
+
<ul aria-label="Declared Java versions outside affected ranges" className="text-theme-text-secondary">
|
|
227
|
+
{Object.entries(data.unaffectedByMajor).map(([major, count]) => (
|
|
228
|
+
<li key={major}>Declared Java {major} outside affected versions · {pluralize(count, 'container')}</li>
|
|
229
|
+
))}
|
|
230
|
+
</ul>
|
|
231
|
+
)}
|
|
232
|
+
{missingDeclaration > 0 && (
|
|
233
|
+
<p className="text-theme-text-secondary">For images with no Java version in their metadata, verify the installed version in workloads that use Java.</p>
|
|
234
|
+
)}
|
|
235
|
+
{gaps > 0 && (
|
|
236
|
+
<div className="space-y-2 border-t border-theme-border pt-2">
|
|
237
|
+
<h3 className="font-medium text-theme-text-primary">Could not check · next steps</h3>
|
|
238
|
+
{registryAuthRequired > 0 && (
|
|
239
|
+
<p className="text-warning-text">
|
|
240
|
+
Registry authentication required for {pluralize(registryAuthRequired, 'container')}{registryNames(data.authRequiredRegistries)}. The node pulled the image, but Radar needs its own access to read the image metadata.{' '}
|
|
241
|
+
<a className="text-accent-text hover:underline" href={registryAccessURL} target="_blank" rel="noreferrer">Set up registry access for Radar</a>
|
|
242
|
+
</p>
|
|
243
|
+
)}
|
|
244
|
+
{checkLimitReached > 0 && (
|
|
245
|
+
<p className="text-theme-text-secondary">
|
|
246
|
+
<span className="text-warning-text">{reasonLabels.not_checked} for {pluralize(checkLimitReached, 'container')}.</span>{' '}
|
|
247
|
+
{data.workload ? 'Retry this workload. If the check still stops early, verify Java in the skipped containers.' : 'Select fewer namespaces or verify Java directly in the skipped containers.'}
|
|
248
|
+
</p>
|
|
249
|
+
)}
|
|
250
|
+
{dockerHubLimit > 0 && (
|
|
251
|
+
<p className="text-theme-text-secondary">
|
|
252
|
+
<span className="text-warning-text">{reasonLabels.docker_hub_limit} for {pluralize(dockerHubLimit, 'container')}.</span>{' '}
|
|
253
|
+
{data.workload ? 'Retry to reuse any image metadata Radar cached. If the cap is reached again, verify Java in the skipped containers.' : 'Retry to reuse cached public image metadata. If the cap persists, narrow the scope or verify Java in the skipped containers.'}
|
|
254
|
+
</p>
|
|
255
|
+
)}
|
|
256
|
+
{registryRateLimit > 0 && (
|
|
257
|
+
<p className="text-theme-text-secondary">
|
|
258
|
+
<span className="text-warning-text">Registry throttling affected {pluralize(registryRateLimit, 'container')}{registryNames(data.rateLimitedRegistries)}.</span>{' '}
|
|
259
|
+
Radar pauses calls to throttled registries for five minutes. Retry after the pause and when the registry quota allows requests again.
|
|
260
|
+
</p>
|
|
261
|
+
)}
|
|
262
|
+
{javaHomeDeclared > 0 && (
|
|
263
|
+
<p className="text-theme-text-secondary">
|
|
264
|
+
Images for {pluralize(javaHomeDeclared, 'container')} set <code>JAVA_HOME</code>. Verify the installed Java version.
|
|
265
|
+
</p>
|
|
266
|
+
)}
|
|
267
|
+
{remainingReasons.map(([reason, count]) => (
|
|
268
|
+
<p key={reason} className="text-theme-text-secondary">{reasonLabels[reason] ?? reason} · {pluralize(count, 'container')}{reason === 'credential_check_timeout' && '. Retry with a smaller scope.'}</p>
|
|
269
|
+
))}
|
|
270
|
+
</div>
|
|
271
|
+
)}
|
|
272
|
+
{data.unassessedGroups > 0 && <UnassessedDetails data={data} onOpen={onOpen} />}
|
|
273
|
+
{!data.workload && data.containers > 0 && (
|
|
274
|
+
<p className="text-theme-text-tertiary">Workload rows show affected declarations and unassessed containers.</p>
|
|
275
|
+
)}
|
|
188
276
|
</div>
|
|
189
277
|
)
|
|
190
278
|
}
|
|
@@ -203,33 +291,13 @@ function WorkloadJava4ShellRows({ data }: { data: Java4ShellResult }) {
|
|
|
203
291
|
</div>
|
|
204
292
|
<div className="flex flex-wrap items-baseline gap-x-2">
|
|
205
293
|
<span className="font-mono text-theme-text-primary">{row.version}</span>
|
|
206
|
-
<span className="text-theme-text-secondary">{row.fixedIn ? `
|
|
294
|
+
<span className="text-theme-text-secondary">{row.fixedIn ? `Advisory fix ${row.fixedIn}` : 'Check the vendor for an upgrade'}</span>
|
|
207
295
|
</div>
|
|
208
296
|
<JavaPlacement row={row} />
|
|
209
297
|
</li>
|
|
210
298
|
))}
|
|
211
299
|
</ul>
|
|
212
300
|
)}
|
|
213
|
-
{data.unassessedRows.length > 0 && (
|
|
214
|
-
<>
|
|
215
|
-
<div className="font-medium text-theme-text-secondary">Unassessed containers</div>
|
|
216
|
-
<ul aria-label="Unassessed containers" className="divide-y divide-theme-border rounded-md border border-theme-border">
|
|
217
|
-
{data.unassessedRows.map(row => (
|
|
218
|
-
<li key={JSON.stringify([row.container, row.image, row.digest, row.reason])} className="space-y-1 p-2">
|
|
219
|
-
<div className="flex flex-wrap items-baseline gap-x-2">
|
|
220
|
-
<span className="font-medium text-theme-text-primary">{row.container}</span>
|
|
221
|
-
<ImageName image={row.image} className="text-theme-text-tertiary" />
|
|
222
|
-
<span className="text-theme-text-tertiary">{pluralize(row.pods, 'Pod')}</span>
|
|
223
|
-
</div>
|
|
224
|
-
<div className="text-theme-text-secondary">{reasonLabels[row.reason] ?? row.reason}</div>
|
|
225
|
-
</li>
|
|
226
|
-
))}
|
|
227
|
-
</ul>
|
|
228
|
-
{data.unassessedGroups > data.unassessedRows.length && (
|
|
229
|
-
<p className="text-theme-text-secondary">Showing {data.unassessedRows.length} of {data.unassessedGroups} unassessed groups.</p>
|
|
230
|
-
)}
|
|
231
|
-
</>
|
|
232
|
-
)}
|
|
233
301
|
</>
|
|
234
302
|
)
|
|
235
303
|
}
|
|
@@ -243,26 +311,41 @@ function WorkloadLink({ workload, onOpen }: { workload: Java4ShellFinding['workl
|
|
|
243
311
|
)
|
|
244
312
|
}
|
|
245
313
|
|
|
246
|
-
function UnassessedDetails({ data, onOpen }: { data: Java4ShellResult; onOpen
|
|
314
|
+
function UnassessedDetails({ data, onOpen }: { data: Java4ShellResult; onOpen?: (resource: SelectedResource) => void }) {
|
|
247
315
|
const [open, setOpen] = useState(false)
|
|
316
|
+
const [showAll, setShowAll] = useState(false)
|
|
248
317
|
const { panelId, buttonProps } = useDisclosure(open)
|
|
249
318
|
const { unassessedRows, unassessedGroups } = data
|
|
250
|
-
const
|
|
319
|
+
const gapRows = unassessedRows.filter(row => row.reason !== 'no_java_declaration')
|
|
320
|
+
const canFilter = gapRows.length > 0 && gapRows.length < unassessedRows.length
|
|
321
|
+
const rows = canFilter && !showAll ? gapRows : unassessedRows
|
|
251
322
|
return (
|
|
252
323
|
<div>
|
|
253
324
|
<button {...buttonProps} type="button" onClick={() => setOpen(!open)} className="inline-flex items-center gap-1.5 py-1 font-medium text-accent-text hover:underline">
|
|
254
325
|
<CollapseChevron open={open} className="h-3.5 w-3.5" />
|
|
255
|
-
|
|
326
|
+
{gapRows.length > 0 ? 'Show skipped images' : 'Show images with no Java version declared'}
|
|
256
327
|
</button>
|
|
257
328
|
<Collapse open={open} id={panelId} mountLazily>
|
|
258
|
-
{
|
|
259
|
-
<
|
|
260
|
-
{
|
|
261
|
-
|
|
329
|
+
{canFilter && (
|
|
330
|
+
<label className="mt-1 flex w-fit items-center gap-2 text-theme-text-secondary">
|
|
331
|
+
<input type="checkbox" className="accent-accent" checked={showAll} onChange={event => setShowAll(event.target.checked)} />
|
|
332
|
+
Include images with no Java version declaration
|
|
333
|
+
</label>
|
|
334
|
+
)}
|
|
335
|
+
{data.workload ? (
|
|
336
|
+
<ul aria-label="Unassessed containers" className="mt-1 divide-y divide-theme-border rounded-md border border-theme-border">
|
|
337
|
+
{rows.map(row => (
|
|
338
|
+
<li key={JSON.stringify([row.container, row.image, row.digest, row.reason])} className="space-y-1 p-2">
|
|
339
|
+
<div className="flex flex-wrap items-baseline gap-x-2">
|
|
340
|
+
<span className="font-medium text-theme-text-primary">{row.container}</span>
|
|
341
|
+
<ImageName image={row.image} className="text-theme-text-tertiary" />
|
|
342
|
+
<span className="text-theme-text-tertiary">{pluralize(row.pods, 'Pod')}</span>
|
|
343
|
+
</div>
|
|
344
|
+
<div className="text-theme-text-secondary">{reasonLabels[row.reason] ?? row.reason}</div>
|
|
345
|
+
</li>
|
|
262
346
|
))}
|
|
263
347
|
</ul>
|
|
264
|
-
)}
|
|
265
|
-
<div role="region" aria-label="Unassessed containers by workload" tabIndex={0} className="mt-1 max-h-64 overflow-auto rounded-lg border border-theme-border">
|
|
348
|
+
) : <div role="region" aria-label="Unassessed containers by workload" tabIndex={0} className="mt-1 max-h-64 overflow-auto rounded-lg border border-theme-border">
|
|
266
349
|
<table className="w-full min-w-[32rem] text-left">
|
|
267
350
|
<thead className="sticky top-0 bg-theme-elevated text-theme-text-secondary">
|
|
268
351
|
<tr>
|
|
@@ -273,9 +356,16 @@ function UnassessedDetails({ data, onOpen }: { data: Java4ShellResult; onOpen: (
|
|
|
273
356
|
</tr>
|
|
274
357
|
</thead>
|
|
275
358
|
<tbody className="divide-y divide-theme-border border-t border-theme-border">
|
|
276
|
-
{
|
|
359
|
+
{rows.map(row => (
|
|
277
360
|
<tr key={JSON.stringify([resourceRefKey(row.workload), row.container, row.image, row.digest, row.reason])} className="align-top">
|
|
278
|
-
<th scope="row" className="px-3 py-2 font-medium"
|
|
361
|
+
<th scope="row" className="px-3 py-2 font-medium">
|
|
362
|
+
{onOpen ? <WorkloadLink workload={row.workload} onOpen={onOpen} /> : (
|
|
363
|
+
<>
|
|
364
|
+
<div>{row.workload.name}</div>
|
|
365
|
+
<div className="text-theme-text-tertiary">{row.workload.kind} · {row.workload.namespace}</div>
|
|
366
|
+
</>
|
|
367
|
+
)}
|
|
368
|
+
</th>
|
|
279
369
|
<td className="px-3 py-2">
|
|
280
370
|
<div className="text-theme-text-primary">{row.container}</div>
|
|
281
371
|
<div className="max-w-48 truncate text-theme-text-tertiary"><ImageName image={row.image} /></div>
|
|
@@ -291,9 +381,9 @@ function UnassessedDetails({ data, onOpen }: { data: Java4ShellResult; onOpen: (
|
|
|
291
381
|
))}
|
|
292
382
|
</tbody>
|
|
293
383
|
</table>
|
|
294
|
-
</div>
|
|
295
|
-
{unassessedGroups > unassessedRows.length && (
|
|
296
|
-
<p className="mt-2 text-theme-text-secondary">Showing {unassessedRows.length} of {unassessedGroups} workload
|
|
384
|
+
</div>}
|
|
385
|
+
{rows.length === unassessedRows.length && unassessedGroups > unassessedRows.length && (
|
|
386
|
+
<p className="mt-2 text-theme-text-secondary">Showing {unassessedRows.length} of {unassessedGroups} groups.{!data.workload && ' Narrow the scope to see more.'}</p>
|
|
297
387
|
)}
|
|
298
388
|
</Collapse>
|
|
299
389
|
</div>
|
|
@@ -301,12 +391,19 @@ function UnassessedDetails({ data, onOpen }: { data: Java4ShellResult; onOpen: (
|
|
|
301
391
|
}
|
|
302
392
|
|
|
303
393
|
function JavaPlacement({ row }: { row: Java4ShellFinding }) {
|
|
304
|
-
const
|
|
394
|
+
const instanceTypes = Object.entries(row.noVBMIByInstanceType ?? {}).sort(([a], [b]) => a.localeCompare(b))
|
|
395
|
+
const inferredNoVBMI = instanceTypes.reduce((total, [, count]) => total + count, 0)
|
|
396
|
+
const nonX86 = row.pods - row.vbmiPods - row.unknownCPUPods - inferredNoVBMI
|
|
305
397
|
return (
|
|
306
398
|
<>
|
|
307
399
|
{row.vbmiPods > 0 && <div className="font-medium text-warning-text">Prioritize patching · {pluralize(row.vbmiPods, 'Pod')} on nodes reporting AVX-512 VBMI</div>}
|
|
308
400
|
{row.unknownCPUPods > 0 && <div className="text-theme-text-secondary">CPU capability unknown for {pluralize(row.unknownCPUPods, 'Pod')}</div>}
|
|
309
|
-
{
|
|
401
|
+
{instanceTypes.map(([instanceType, count]) => (
|
|
402
|
+
<div key={instanceType} className="text-theme-text-secondary">
|
|
403
|
+
{pluralize(count, 'Pod')} on {instanceType} · VBMI absent (inferred from instance type)
|
|
404
|
+
</div>
|
|
405
|
+
))}
|
|
406
|
+
{nonX86 > 0 && <div className="text-theme-text-secondary">{pluralize(nonX86, 'Pod')} on non-x86 nodes at check time</div>}
|
|
310
407
|
{row.mitigationDeclaredPods > 0 && <div className="text-theme-text-tertiary">Mitigation flag declared in {pluralize(row.mitigationDeclaredPods, 'Pod spec')}</div>}
|
|
311
408
|
</>
|
|
312
409
|
)
|
|
@@ -260,3 +260,19 @@ describe('getApplicationCostState', () => {
|
|
|
260
260
|
expect(getApplicationCostState(current, undefined, {})).toBe('configuration_mismatch')
|
|
261
261
|
})
|
|
262
262
|
})
|
|
263
|
+
|
|
264
|
+
describe('getApplicationCostState cluster scope', () => {
|
|
265
|
+
it.each(['cluster_scope', 'partial_data'] as const)('reports %s instead of no data', (reason) => {
|
|
266
|
+
const current: OpenCostApplicationCostResponse = {
|
|
267
|
+
available: false,
|
|
268
|
+
reason,
|
|
269
|
+
totals: {
|
|
270
|
+
hourlyCost: 0, cpuCost: 0, memoryCost: 0, replicas: 0,
|
|
271
|
+
cpuUsageAvailable: false, memoryUsageAvailable: false, cpuAllocationUse: 0, memoryAllocationUse: 0,
|
|
272
|
+
},
|
|
273
|
+
coverage: { total: 1, included: 0 },
|
|
274
|
+
clusterScope: { state: 'several_clusters', note: 'several' },
|
|
275
|
+
}
|
|
276
|
+
expect(getApplicationCostState(current, undefined, {})).toBe(reason)
|
|
277
|
+
})
|
|
278
|
+
})
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type OpenCostTrendSeries,
|
|
15
15
|
} from '../../api/client'
|
|
16
16
|
import { Tooltip } from '../ui/Tooltip'
|
|
17
|
-
import { ChartLegend, CostTimeRangeSelector, StackedAreaChart } from './CostTrendChart'
|
|
17
|
+
import { ChartLegend, CostTimeRangeSelector, CostTrendWithheldNote, StackedAreaChart } from './CostTrendChart'
|
|
18
18
|
import {
|
|
19
19
|
DEFAULT_COST_CURRENCY,
|
|
20
20
|
formatCostPerHour,
|
|
@@ -31,10 +31,14 @@ import {
|
|
|
31
31
|
costIntegrationUnavailableMessage,
|
|
32
32
|
costRateLabels,
|
|
33
33
|
costSourceLabel,
|
|
34
|
+
costTrendWithholding,
|
|
35
|
+
costWithheldScope,
|
|
34
36
|
isCostDiscoveryPending,
|
|
35
37
|
} from './source'
|
|
36
38
|
import { useNavCustomization } from '../../context/NavCustomization'
|
|
37
39
|
import { CostConnectionAction } from './CostConnectionAction'
|
|
40
|
+
import { ClusterScopeNote } from '@skyhook-io/k8s-ui/components/ui/ClusterScopeNote'
|
|
41
|
+
import type { ClusterScope } from '@skyhook-io/k8s-ui/types/cluster-scope'
|
|
38
42
|
|
|
39
43
|
type ApplicationCostState =
|
|
40
44
|
| 'loading'
|
|
@@ -136,6 +140,8 @@ export function ApplicationCostTab({
|
|
|
136
140
|
state === 'deployment_configuration_error' ||
|
|
137
141
|
state === 'metrics_settings_error' ||
|
|
138
142
|
state === 'cost_settings_error' ||
|
|
143
|
+
state === 'cluster_scope' ||
|
|
144
|
+
state === 'partial_data' ||
|
|
139
145
|
state === 'history_unsupported' ||
|
|
140
146
|
state === 'load_error'
|
|
141
147
|
) {
|
|
@@ -153,7 +159,14 @@ export function ApplicationCostTab({
|
|
|
153
159
|
)
|
|
154
160
|
}
|
|
155
161
|
const refusal = crossOriginRefusalMessage(currentQuery.error) ?? crossOriginRefusalMessage(trendQuery.error)
|
|
156
|
-
return
|
|
162
|
+
return (
|
|
163
|
+
<ApplicationCostUnavailable
|
|
164
|
+
state={state}
|
|
165
|
+
message={refusal}
|
|
166
|
+
settingsAvailable={settingsAvailable}
|
|
167
|
+
withheld={costWithheldScope(currentQuery.data) ?? costWithheldScope(trendQuery.data)}
|
|
168
|
+
/>
|
|
169
|
+
)
|
|
157
170
|
}
|
|
158
171
|
|
|
159
172
|
const current = currentQuery.data
|
|
@@ -176,6 +189,9 @@ export function ApplicationCostTab({
|
|
|
176
189
|
const trendCurrency = trend?.currency ?? current?.currency ?? DEFAULT_COST_CURRENCY
|
|
177
190
|
const source = current?.source ?? trend?.source
|
|
178
191
|
const historyUnsupported = trend?.reason === 'history_unsupported'
|
|
192
|
+
// Current costs stand while the trend was withheld: say why, rather than
|
|
193
|
+
// that the range has no history.
|
|
194
|
+
const trendWithholding = state === 'partial_missing_history' ? costTrendWithholding(trend) : undefined
|
|
179
195
|
const currentWindow = current?.window
|
|
180
196
|
const rateLabels = costRateLabels(currentWindow)
|
|
181
197
|
|
|
@@ -183,7 +199,7 @@ export function ApplicationCostTab({
|
|
|
183
199
|
<div className="mx-auto w-full max-w-[1600px] space-y-4">
|
|
184
200
|
{(current?.partial ||
|
|
185
201
|
trend?.partial ||
|
|
186
|
-
(state === 'partial_missing_history' && !historyUnsupported) ||
|
|
202
|
+
(state === 'partial_missing_history' && !historyUnsupported && !trendWithholding) ||
|
|
187
203
|
state === 'partial_missing_current' ||
|
|
188
204
|
unsupportedCount > 0) && (
|
|
189
205
|
<div className="flex items-start gap-2 rounded-lg border border-theme-border bg-theme-base px-3 py-2 text-sm text-theme-text-secondary">
|
|
@@ -248,8 +264,10 @@ export function ApplicationCostTab({
|
|
|
248
264
|
trendCurrency,
|
|
249
265
|
)}
|
|
250
266
|
subvalue={
|
|
251
|
-
|
|
252
|
-
? 'Historical data
|
|
267
|
+
trendWithholding
|
|
268
|
+
? 'Historical data withheld'
|
|
269
|
+
: state === 'partial_missing_history'
|
|
270
|
+
? 'Historical data incomplete'
|
|
253
271
|
: `${included} of ${total} workloads included`
|
|
254
272
|
}
|
|
255
273
|
/>
|
|
@@ -275,8 +293,12 @@ export function ApplicationCostTab({
|
|
|
275
293
|
<ChartLegend series={chartSeries} />
|
|
276
294
|
</div>
|
|
277
295
|
) : (
|
|
278
|
-
<div className="flex h-[240px] items-center justify-center rounded-md border border-dashed border-theme-border bg-theme-base/60 text-sm text-theme-text-tertiary">
|
|
279
|
-
|
|
296
|
+
<div className="flex h-[240px] items-center justify-center rounded-md border border-dashed border-theme-border bg-theme-base/60 px-4 text-sm text-theme-text-tertiary">
|
|
297
|
+
{trendWithholding ? (
|
|
298
|
+
<CostTrendWithheldNote withholding={trendWithholding} />
|
|
299
|
+
) : (
|
|
300
|
+
'No historical workload owner cost points for this range.'
|
|
301
|
+
)}
|
|
280
302
|
</div>
|
|
281
303
|
)}
|
|
282
304
|
</div>
|
|
@@ -409,7 +431,9 @@ export function getApplicationCostState(
|
|
|
409
431
|
reason === 'configuration_mismatch' ||
|
|
410
432
|
reason === 'deployment_configuration_error' ||
|
|
411
433
|
reason === 'metrics_settings_error' ||
|
|
412
|
-
reason === 'cost_settings_error'
|
|
434
|
+
reason === 'cost_settings_error' ||
|
|
435
|
+
reason === 'cluster_scope' ||
|
|
436
|
+
reason === 'partial_data'
|
|
413
437
|
)
|
|
414
438
|
return reason
|
|
415
439
|
if (queryError) return 'load_error'
|
|
@@ -525,6 +549,8 @@ function reasonLabel(reason?: CostUnavailableReason) {
|
|
|
525
549
|
if (reason === 'deployment_configuration_error') return 'Radar configuration is invalid'
|
|
526
550
|
if (reason === 'metrics_settings_error') return 'Saved metrics settings need review'
|
|
527
551
|
if (reason === 'cost_settings_error') return 'Saved cost settings need review'
|
|
552
|
+
if (reason === 'cluster_scope') return 'Withheld: shared metrics store'
|
|
553
|
+
if (reason === 'partial_data') return 'Partial answer from the metrics store'
|
|
528
554
|
return 'No workload cost metrics'
|
|
529
555
|
}
|
|
530
556
|
|
|
@@ -564,10 +590,12 @@ function ApplicationCostUnavailable({
|
|
|
564
590
|
state,
|
|
565
591
|
message,
|
|
566
592
|
settingsAvailable,
|
|
593
|
+
withheld,
|
|
567
594
|
}: {
|
|
568
595
|
state: CostUnavailableReason | 'load_error'
|
|
569
596
|
message?: string
|
|
570
597
|
settingsAvailable: boolean
|
|
598
|
+
withheld?: ClusterScope
|
|
571
599
|
}) {
|
|
572
600
|
const text =
|
|
573
601
|
message ??
|
|
@@ -587,7 +615,11 @@ function ApplicationCostUnavailable({
|
|
|
587
615
|
<div className="flex h-full min-h-[320px] items-center justify-center">
|
|
588
616
|
<div className="flex max-w-md flex-col items-center gap-3 text-center text-theme-text-secondary">
|
|
589
617
|
<Coins className="h-8 w-8 text-theme-text-tertiary/50" />
|
|
590
|
-
|
|
618
|
+
{state === 'cluster_scope' && withheld ? (
|
|
619
|
+
<ClusterScopeNote scope={withheld} title="Costs withheld for this cluster" className="text-left" />
|
|
620
|
+
) : (
|
|
621
|
+
<div className="text-sm">{text}</div>
|
|
622
|
+
)}
|
|
591
623
|
<CostConnectionAction reason={state} />
|
|
592
624
|
</div>
|
|
593
625
|
</div>
|
|
@@ -9,7 +9,14 @@ import {
|
|
|
9
9
|
type OpenCostTrendSeries,
|
|
10
10
|
} from '../../api/client'
|
|
11
11
|
import { DEFAULT_COST_CURRENCY, formatCostAxis, formatCostPerHour } from './format'
|
|
12
|
-
import {
|
|
12
|
+
import { ClusterScopeNote } from '@skyhook-io/k8s-ui/components/ui/ClusterScopeNote'
|
|
13
|
+
import {
|
|
14
|
+
COST_TREND_PARTIAL_NOTE,
|
|
15
|
+
COST_TREND_WITHHELD_TITLE,
|
|
16
|
+
costDataThroughLabel,
|
|
17
|
+
costTrendWithholding,
|
|
18
|
+
type CostTrendWithholding,
|
|
19
|
+
} from './source'
|
|
13
20
|
|
|
14
21
|
const SERIES_COLORS = [
|
|
15
22
|
'#3b82f6', // blue-500
|
|
@@ -45,7 +52,11 @@ export function CostTrendChart({ namespaceScoped = false }: { namespaceScoped?:
|
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
const showKubecostUnavailable = data?.source === 'kubecost' && data.available === false
|
|
48
|
-
|
|
55
|
+
// Hiding a withheld trend (cluster scope, or a partial answer) would read as
|
|
56
|
+
// "no history"; other unavailable Prometheus trends stay hidden.
|
|
57
|
+
const withholding = costTrendWithholding(data)
|
|
58
|
+
const withheld = !showKubecostUnavailable && withholding && (withholding.reason === 'partial_data' || withholding.scope) ? withholding : undefined
|
|
59
|
+
if (!data || ((!data.available || !data.series?.length) && !showKubecostUnavailable && !withheld)) {
|
|
49
60
|
return null
|
|
50
61
|
}
|
|
51
62
|
|
|
@@ -76,6 +87,10 @@ export function CostTrendChart({ namespaceScoped = false }: { namespaceScoped?:
|
|
|
76
87
|
<div className="min-h-[268px] flex items-center justify-center px-6 text-center text-xs text-theme-text-tertiary">
|
|
77
88
|
{kubecostTrendUnavailableMessage(data.reason, namespaceScoped)}
|
|
78
89
|
</div>
|
|
90
|
+
) : withheld ? (
|
|
91
|
+
<div className="min-h-[268px] flex items-center justify-center px-6">
|
|
92
|
+
<CostTrendWithheldNote withholding={withheld} />
|
|
93
|
+
</div>
|
|
79
94
|
) : (
|
|
80
95
|
<>
|
|
81
96
|
<StackedAreaChart
|
|
@@ -93,6 +108,14 @@ export function CostTrendChart({ namespaceScoped = false }: { namespaceScoped?:
|
|
|
93
108
|
)
|
|
94
109
|
}
|
|
95
110
|
|
|
111
|
+
/** Says why a cost trend was withheld, in place of an empty chart. */
|
|
112
|
+
export function CostTrendWithheldNote({ withholding }: { withholding: CostTrendWithholding }) {
|
|
113
|
+
if (withholding.reason === 'cluster_scope') {
|
|
114
|
+
return <ClusterScopeNote scope={withholding.scope} title={COST_TREND_WITHHELD_TITLE} className="max-w-md text-left" />
|
|
115
|
+
}
|
|
116
|
+
return <p className="max-w-md text-center text-sm text-theme-text-tertiary">{COST_TREND_PARTIAL_NOTE}</p>
|
|
117
|
+
}
|
|
118
|
+
|
|
96
119
|
export function StackedAreaChart({
|
|
97
120
|
series,
|
|
98
121
|
currency,
|