@skyhook-io/radar-app 1.18.0 → 1.18.2
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 +6 -0
- package/package.json +2 -3
- package/src/App.tsx +43 -12
- package/src/api/client.deleteResource.test.tsx +111 -0
- package/src/api/client.gitops-destination.test.tsx +55 -0
- package/src/api/client.resource-list.test.ts +76 -0
- package/src/api/client.resourceAudit.test.tsx +57 -0
- package/src/api/client.resourcePath.test.ts +107 -0
- package/src/api/client.ts +197 -57
- package/src/api/quotas.ts +9 -20
- package/src/api/radarFeatures.ts +2 -0
- package/src/api/resourceLists.test.ts +84 -0
- package/src/api/resourceLists.ts +71 -0
- package/src/components/capacity/CapacityDemand.tsx +6 -3
- package/src/components/capacity/CapacityOverview.tsx +14 -7
- package/src/components/capacity/CapacityPoolDetail.tsx +7 -5
- package/src/components/capacity/ClusterSchedulingCard.tsx +3 -3
- package/src/components/capacity/shared.tsx +9 -5
- package/src/components/cnpg/CNPGOverview.tsx +4 -1
- package/src/components/cnpg/CNPGView.tsx +1 -0
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +1 -0
- package/src/components/compare/CompareResourcePicker.test.tsx +58 -0
- package/src/components/compare/CompareViewRoute.tsx +5 -1
- package/src/components/compare/useCompareCandidates.ts +1 -1
- package/src/components/compare/useCompareLauncher.tsx +4 -2
- package/src/components/diagnose/ApplyDialog.test.tsx +10 -0
- package/src/components/diagnose/ApplyDialog.tsx +8 -1
- package/src/components/diagnose/AssessmentCard.tsx +60 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +5 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +62 -2
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +6 -5
- package/src/components/diagnose/InvestigationView.tsx +47 -13
- package/src/components/diagnose/StoryExcerpt.tsx +24 -5
- package/src/components/diagnose/assessmentCopy.ts +11 -0
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +36 -1
- package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
- package/src/components/diagnose/investigationEvidence/adapters/listCoverage.test.ts +415 -0
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/resource.ts +107 -8
- package/src/components/diagnose/investigationEvidence/adapters/testdata/crossplane-paused-get-resource.json +28 -0
- package/src/components/diagnose/investigationEvidence/bodies/index.tsx +2 -0
- package/src/components/diagnose/investigationEvidence/bodies/inventory.tsx +66 -16
- package/src/components/diagnose/investigationEvidence/bodies/workload.tsx +5 -1
- package/src/components/diagnose/investigationEvidence/builder.ts +16 -2
- package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
- package/src/components/diagnose/investigationEvidence/excerpt.ts +2 -0
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/observations.ts +8 -3
- package/src/components/diagnose/investigationEvidence/projection.test.ts +81 -4
- package/src/components/diagnose/investigationEvidence/types.ts +15 -0
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
- package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
- package/src/components/diagnose/storyParts.test.tsx +53 -0
- package/src/components/diagnose/toolCallLabel.test.ts +9 -0
- package/src/components/diagnose/toolCallLabel.ts +2 -0
- package/src/components/execution/BatchExecutionView.image-browse.test.tsx +46 -0
- package/src/components/execution/BatchExecutionView.tsx +6 -4
- package/src/components/gitops/GitOpsView.identity.test.tsx +113 -0
- package/src/components/gitops/GitOpsView.tsx +62 -40
- package/src/components/gitops/useDestinationCluster.ts +2 -1
- package/src/components/helm/ArtifactHubSourceSearch.test.tsx +124 -0
- package/src/components/helm/ArtifactHubSourceSearch.tsx +240 -0
- package/src/components/helm/ChartBrowser.tsx +9 -8
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -2
- package/src/components/helm/HelmView.tsx +34 -23
- package/src/components/helm/InstallWizard.tsx +6 -2
- package/src/components/helm/TrackChartSourceDialog.render.test.tsx +269 -96
- package/src/components/helm/TrackChartSourceDialog.tsx +607 -104
- package/src/components/helm/ValuesViewer.test.tsx +1 -0
- package/src/components/helm/ValuesViewer.tsx +4 -2
- package/src/components/home/ClusterHealthCard.tsx +28 -21
- package/src/components/home/MCPSetupDialog.test.tsx +27 -2
- package/src/components/home/MCPSetupDialog.tsx +14 -2
- package/src/components/home/mcpToolCatalog.ts +39 -2
- package/src/components/issues/IssuesPane.render.test.tsx +5 -5
- package/src/components/nav/PrimaryNavRail.tsx +34 -2
- package/src/components/product-hunt/ProductHuntNotice.render.test.tsx +120 -0
- package/src/components/product-hunt/ProductHuntNotice.test.ts +121 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +202 -0
- package/src/components/product-hunt/launchWindow.ts +78 -0
- package/src/components/product-hunt/useProductHuntRailEntry.test.tsx +76 -0
- package/src/components/product-hunt/useProductHuntRailEntry.ts +27 -0
- package/src/components/resource/PrometheusCharts.overlays.test.ts +45 -0
- package/src/components/resource/PrometheusCharts.tsx +2 -2
- package/src/components/resources/CompositeRenderer.tsx +4 -0
- package/src/components/resources/ResourcesView.tsx +30 -68
- package/src/components/resources/renderers/PodRenderer.tsx +4 -1
- package/src/components/settings/LocalConnectionSettings.tsx +1 -0
- package/src/components/settings/MyPermissionsDialog.tsx +12 -9
- package/src/components/traffic/TrafficSourcePill.test.tsx +110 -0
- package/src/components/traffic/TrafficSourcePill.tsx +111 -0
- package/src/components/traffic/TrafficView.tsx +9 -55
- package/src/components/ui/DiagnosticsOverlay.test.ts +25 -0
- package/src/components/ui/DiagnosticsOverlay.tsx +2 -1
- package/src/components/ui/Omnibar.note.test.tsx +141 -0
- package/src/components/ui/Omnibar.tsx +82 -18
- package/src/components/ui/RadarOmnibar.test.tsx +201 -0
- package/src/components/ui/RadarOmnibar.tsx +39 -4
- package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
- package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
- package/src/components/ui/UpdateNotification.manual.test.tsx +177 -0
- package/src/components/ui/UpdateNotification.test.tsx +4 -1
- package/src/components/ui/UpdateNotification.tsx +61 -10
- package/src/components/ui/omnibar-match.test.ts +15 -8
- package/src/components/ui/omnibar-match.ts +11 -6
- package/src/components/ui/searchCoverage.fixtures.ts +16 -0
- package/src/components/ui/searchCoverageNote.test.ts +245 -0
- package/src/components/ui/searchCoverageNote.ts +222 -0
- package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
- package/src/components/whats-new/WhatsNew.test.ts +10 -0
- package/src/components/whats-new/WhatsNew.tsx +5 -4
- package/src/components/whats-new/WhatsNewDialog.test.tsx +20 -0
- package/src/components/whats-new/releaseNotes.ts +57 -5
- package/src/components/workload/WorkloadView.tsx +18 -6
- package/src/components/workspace/layout.tsx +2 -1
- package/src/contexts/CapabilitiesContext.tsx +1 -0
- package/src/hooks/useGitOpsWriteGuard.test.tsx +126 -2
- package/src/hooks/useGitOpsWriteGuard.ts +25 -3
- package/src/hooks/useResolvedGitOpsOwner.ts +14 -9
- package/src/hooks/useResourceCounts.ts +2 -0
- package/src/index.css +87 -4
- package/src/index.ts +7 -0
- package/src/utils/artifacthub.test.ts +18 -0
- package/src/utils/artifacthub.ts +9 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { sanitizePrinterTable, type PrinterTable } from '@skyhook-io/k8s-ui/components/resources/printer-columns'
|
|
2
|
+
import type { ResourceCoverage, ResourceListResponse } from '@skyhook-io/k8s-ui/types/resource-coverage'
|
|
3
|
+
import { isLowerBound } from '@skyhook-io/k8s-ui/utils/resource-coverage'
|
|
4
|
+
|
|
5
|
+
export interface ResourceListResult<T> {
|
|
6
|
+
items: T[]
|
|
7
|
+
coverage: ResourceCoverage
|
|
8
|
+
printerTable: PrinterTable | null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Every list body a supported Radar sends: the coverage envelope, or from a
|
|
13
|
+
* Radar that predates coverage a bare array, or for `?table=1` the printer
|
|
14
|
+
* envelope without `coverage`.
|
|
15
|
+
*/
|
|
16
|
+
export type ResourceListBody<T> =
|
|
17
|
+
| ResourceListResponse<T>
|
|
18
|
+
| (Omit<ResourceListResponse<T>, 'coverage'> & { coverage?: undefined })
|
|
19
|
+
| T[]
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Reads a list body by its shape rather than by the cluster's advertised
|
|
23
|
+
* features: a host can point one query client at several clusters, so a cached
|
|
24
|
+
* capabilities answer may describe a different Radar than the one that
|
|
25
|
+
* answered. A response without coverage can't establish absence, so it reads
|
|
26
|
+
* as `unknown`.
|
|
27
|
+
*/
|
|
28
|
+
export function normalizeResourceList<T>(body: ResourceListBody<T>): ResourceListResult<T> {
|
|
29
|
+
if (Array.isArray(body)) return { items: body, coverage: { status: 'unknown' }, printerTable: null }
|
|
30
|
+
return { items: body.items, coverage: body.coverage ?? { status: 'unknown' }, printerTable: sanitizePrinterTable(body) }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Back off once per loading response, resetting for a new query or settled coverage. */
|
|
34
|
+
export function createListRefetchInterval(normalInterval?: number | false) {
|
|
35
|
+
type ListQuery = { state: { data?: { coverage: ResourceCoverage }; dataUpdateCount: number } }
|
|
36
|
+
let previousQuery: ListQuery | undefined
|
|
37
|
+
let previousUpdate = -1
|
|
38
|
+
let delay = 0
|
|
39
|
+
return (query: ListQuery): number | false | undefined => {
|
|
40
|
+
if (query !== previousQuery || !listSyncPending(query.state.data?.coverage)) {
|
|
41
|
+
delay = 0
|
|
42
|
+
previousUpdate = -1
|
|
43
|
+
previousQuery = query
|
|
44
|
+
}
|
|
45
|
+
if (!listSyncPending(query.state.data?.coverage)) return normalInterval
|
|
46
|
+
if (query.state.dataUpdateCount !== previousUpdate) {
|
|
47
|
+
delay = delay === 0 ? 5000 : Math.min(delay * 2, 30000)
|
|
48
|
+
previousUpdate = query.state.dataUpdateCount
|
|
49
|
+
}
|
|
50
|
+
return delay
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function listSyncPending(coverage: ResourceCoverage | undefined): boolean {
|
|
55
|
+
return coverage?.status === 'partial' && coverage.gaps.some(gap => gap.code === 'kind_sync_pending')
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* One status for a view assembled from several list reads. A failed read makes
|
|
60
|
+
* it partial, and so does one Radar's collection narrowed: the view shows
|
|
61
|
+
* totals for the cluster, which a read of only the collected namespaces can't
|
|
62
|
+
* establish. `nothingToRead` says discovery found no kind to read, which is
|
|
63
|
+
* itself a complete answer.
|
|
64
|
+
*/
|
|
65
|
+
export function combinedListStatus(coverage: ResourceCoverage[], failed: boolean, nothingToRead: boolean): 'complete' | 'partial' | 'unknown' {
|
|
66
|
+
if (failed || coverage.some(isLowerBound)) return 'partial'
|
|
67
|
+
if (coverage.length === 0 ? nothingToRead : coverage.every(c => c.status === 'complete')) return 'complete'
|
|
68
|
+
return 'unknown'
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { isLowerBound as lowerBound } from '@skyhook-io/k8s-ui/utils/resource-coverage'
|
|
@@ -632,6 +632,7 @@ function DemandGroupCard({
|
|
|
632
632
|
key={`${constraint.predicate}-${constraint.sourcePath}`}
|
|
633
633
|
tone="structural"
|
|
634
634
|
size="sm"
|
|
635
|
+
className="phone:[overflow-wrap:anywhere]"
|
|
635
636
|
>
|
|
636
637
|
{constraint.key || constraint.predicate}
|
|
637
638
|
{constraint.operator ? ` ${constraint.operator}` : ""}
|
|
@@ -664,6 +665,7 @@ function DemandGroupCard({
|
|
|
664
665
|
key={`${toleration.key ?? "*"}-${toleration.effect ?? "*"}-${index}`}
|
|
665
666
|
tone="structural"
|
|
666
667
|
size="sm"
|
|
668
|
+
className="phone:[overflow-wrap:anywhere]"
|
|
667
669
|
>
|
|
668
670
|
{toleration.key || "*"}
|
|
669
671
|
{toleration.value ? `=${toleration.value}` : ""}
|
|
@@ -810,14 +812,15 @@ function PoolEvaluationCard({
|
|
|
810
812
|
<button
|
|
811
813
|
type="button"
|
|
812
814
|
aria-expanded={expanded}
|
|
813
|
-
className={`flex w-full items-center gap-2 px-3 py-2.5 text-left ${ROW_HOVER}`}
|
|
815
|
+
className={`flex w-full items-center gap-2 px-3 py-2.5 text-left phone:flex-wrap phone:gap-y-1 ${ROW_HOVER}`}
|
|
814
816
|
onClick={() => setExpanded((current) => !current)}
|
|
815
817
|
>
|
|
816
818
|
<CollapseChevron open={expanded} className="h-4 w-4" />
|
|
817
819
|
<span
|
|
818
820
|
role="link"
|
|
819
821
|
tabIndex={0}
|
|
820
|
-
|
|
822
|
+
// Phones: a name longer than the row breaks inside it (chevron + gap = 1.5rem).
|
|
823
|
+
className="font-mono text-sm font-medium text-accent-text hover:underline phone:max-w-[calc(100%-1.5rem)] phone:break-words"
|
|
821
824
|
onClick={(event) => {
|
|
822
825
|
event.stopPropagation();
|
|
823
826
|
onOpenPool(evaluation.pool.name);
|
|
@@ -833,7 +836,7 @@ function PoolEvaluationCard({
|
|
|
833
836
|
{evaluation.pool.name}
|
|
834
837
|
</span>
|
|
835
838
|
<PoolEvaluationBadge result={evaluation.result} />
|
|
836
|
-
<span className="ml-auto text-[11px] text-theme-text-tertiary">
|
|
839
|
+
<span className="ml-auto text-[11px] text-theme-text-tertiary phone:whitespace-nowrap">
|
|
837
840
|
{predicateCount} {predicateCount === 1 ? "predicate" : "predicates"}
|
|
838
841
|
{evaluation.evidenceMeta.truncated ? " · truncated" : ""}
|
|
839
842
|
</span>
|
|
@@ -346,12 +346,12 @@ export function CapacityOverview({
|
|
|
346
346
|
<button
|
|
347
347
|
type="button"
|
|
348
348
|
onClick={() => setShowExplain(true)}
|
|
349
|
-
className="mt-1 text-xs font-medium text-accent-text hover:underline"
|
|
349
|
+
className="mt-1 text-xs font-medium text-accent-text hover:underline phone:text-left"
|
|
350
350
|
>
|
|
351
351
|
Scheduling capacity ≠ actual usage — how to read these numbers
|
|
352
352
|
</button>
|
|
353
353
|
</div>
|
|
354
|
-
<div className="flex items-center gap-2">
|
|
354
|
+
<div className="flex items-center gap-2 phone:flex-wrap phone:gap-y-1">
|
|
355
355
|
<ScopeBadges coverage={coverage} />
|
|
356
356
|
<CapacityFreshness
|
|
357
357
|
meta={data}
|
|
@@ -373,7 +373,9 @@ export function CapacityOverview({
|
|
|
373
373
|
</Notice>
|
|
374
374
|
)}
|
|
375
375
|
|
|
376
|
-
|
|
376
|
+
{/* Phones: managers take the full row, the counts pair up beside each
|
|
377
|
+
other, and a count left alone on the last row takes it whole. */}
|
|
378
|
+
<div className="grid grid-cols-2 gap-3 phone:[&>:last-child:nth-child(even)]:col-span-2 lg:grid-cols-3 xl:grid-cols-5">
|
|
377
379
|
<ManagersTile
|
|
378
380
|
managers={summary.managers}
|
|
379
381
|
groups={data.groups}
|
|
@@ -419,6 +421,8 @@ export function CapacityOverview({
|
|
|
419
421
|
"Claim inventory",
|
|
420
422
|
)}
|
|
421
423
|
attention={(summary.claimStages?.failed ?? 0) > 0}
|
|
424
|
+
// Keeps the row full when the denied Pending pods tile below takes its own.
|
|
425
|
+
className={podsDeniedFlag ? "phone:col-span-2" : undefined}
|
|
422
426
|
/>
|
|
423
427
|
)}
|
|
424
428
|
{podsDeniedFlag ? (
|
|
@@ -426,6 +430,8 @@ export function CapacityOverview({
|
|
|
426
430
|
label="Pending pods"
|
|
427
431
|
value="Unavailable"
|
|
428
432
|
sub="Pod access denied — not zero"
|
|
433
|
+
// "Unavailable" is wider than a half-width tile on a phone.
|
|
434
|
+
className="phone:col-span-2"
|
|
429
435
|
certainty="unknown"
|
|
430
436
|
certaintyTitle="Unknown — the current identity cannot list Pods. Absence of data is not zero."
|
|
431
437
|
/>
|
|
@@ -496,7 +502,7 @@ export function CapacityOverview({
|
|
|
496
502
|
signals.map((signal) => (
|
|
497
503
|
<div
|
|
498
504
|
key={signal.key}
|
|
499
|
-
className="flex items-start gap-3 px-4 py-2.5 hover:bg-theme-hover/40"
|
|
505
|
+
className="flex items-start gap-3 px-4 py-2.5 hover:bg-theme-hover/40 phone:flex-wrap phone:gap-y-1"
|
|
500
506
|
>
|
|
501
507
|
<Badge
|
|
502
508
|
severity={signal.severity}
|
|
@@ -515,7 +521,7 @@ export function CapacityOverview({
|
|
|
515
521
|
key={subject.label}
|
|
516
522
|
type="button"
|
|
517
523
|
onClick={subject.open}
|
|
518
|
-
className="font-mono text-accent-text hover:underline"
|
|
524
|
+
className="font-mono text-accent-text hover:underline phone:max-w-full phone:break-words phone:text-left"
|
|
519
525
|
>
|
|
520
526
|
{subject.label}
|
|
521
527
|
</button>
|
|
@@ -526,7 +532,8 @@ export function CapacityOverview({
|
|
|
526
532
|
{signal.action && (
|
|
527
533
|
<LinkButton
|
|
528
534
|
onClick={signal.action.run}
|
|
529
|
-
|
|
535
|
+
// Phones: the action drops under the text, lined up with it.
|
|
536
|
+
className="shrink-0 self-center phone:basis-full phone:pl-[3.75rem]"
|
|
530
537
|
>
|
|
531
538
|
{signal.action.label} →
|
|
532
539
|
</LinkButton>
|
|
@@ -606,7 +613,7 @@ function ManagersTile({
|
|
|
606
613
|
? autoscalerStatus?.observedAt
|
|
607
614
|
: undefined;
|
|
608
615
|
return (
|
|
609
|
-
<div className="rounded-xl border border-theme-border bg-theme-surface px-4 py-3 shadow-theme-sm">
|
|
616
|
+
<div className="rounded-xl border border-theme-border bg-theme-surface px-4 py-3 shadow-theme-sm phone:col-span-2">
|
|
610
617
|
<div className="flex items-center gap-1.5">
|
|
611
618
|
<span className="text-[11px] font-medium uppercase tracking-wide text-theme-text-tertiary">
|
|
612
619
|
Capacity managers
|
|
@@ -173,7 +173,8 @@ export function CapacityPoolDetail({
|
|
|
173
173
|
|
|
174
174
|
{query.error && <RefreshError message={errorMessage(query.error)} />}
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
{/* Phones: the tabs stay on one line and scroll sideways. */}
|
|
177
|
+
<div className="flex gap-1 border-b border-theme-border phone:overflow-x-auto">
|
|
177
178
|
{POOL_SECTIONS.map((tab) => (
|
|
178
179
|
<button
|
|
179
180
|
key={tab.id}
|
|
@@ -184,7 +185,7 @@ export function CapacityPoolDetail({
|
|
|
184
185
|
tab.id === "summary" ? poolPath : `${poolPath}/${tab.id}`,
|
|
185
186
|
)
|
|
186
187
|
}
|
|
187
|
-
className={`border-b-2 px-3 py-2 text-sm font-medium transition-colors ${
|
|
188
|
+
className={`border-b-2 px-3 py-2 text-sm font-medium transition-colors phone:shrink-0 phone:whitespace-nowrap ${
|
|
188
189
|
section === tab.id
|
|
189
190
|
? "border-skyhook-500 text-theme-text-primary"
|
|
190
191
|
: "border-transparent text-theme-text-secondary hover:text-theme-text-primary"
|
|
@@ -780,15 +781,16 @@ function WorkloadAttribution({
|
|
|
780
781
|
<button
|
|
781
782
|
key={identityKey({ ref: workload.owner })}
|
|
782
783
|
type="button"
|
|
783
|
-
|
|
784
|
+
// Phones: the workload gets its own full line and the counts wrap under it.
|
|
785
|
+
className="flex w-full items-baseline justify-between gap-2 border-b border-theme-border-subtle py-1.5 text-left last:border-b-0 hover:text-accent-text phone:flex-wrap phone:justify-start phone:gap-x-3 phone:gap-y-0.5"
|
|
784
786
|
onClick={() =>
|
|
785
787
|
onOpenResource(refToSelectedResource(workload.owner))
|
|
786
788
|
}
|
|
787
789
|
>
|
|
788
|
-
<span className="min-w-0 flex-1 truncate font-mono text-xs text-theme-text-primary">
|
|
790
|
+
<span className="min-w-0 flex-1 truncate font-mono text-xs text-theme-text-primary phone:basis-full phone:whitespace-normal phone:[overflow-wrap:anywhere]">
|
|
789
791
|
{workload.owner.kind}/{workload.owner.name}
|
|
790
792
|
</span>
|
|
791
|
-
<span className="shrink-0 text-xs text-theme-text-tertiary">
|
|
793
|
+
<span className="shrink-0 text-xs text-theme-text-tertiary phone:shrink phone:min-w-0 phone:[overflow-wrap:anywhere]">
|
|
792
794
|
{workload.owner.namespace}
|
|
793
795
|
</span>
|
|
794
796
|
<span className="shrink-0 font-mono text-xs">
|
|
@@ -428,8 +428,8 @@ function SchedulingBarRowView({ row }: { row: SchedulingBarRow }) {
|
|
|
428
428
|
|
|
429
429
|
return (
|
|
430
430
|
<div role="group" aria-label={ariaLabel}>
|
|
431
|
-
<div className="flex items-center gap-3">
|
|
432
|
-
<span className="flex w-44 shrink-0 items-center gap-1.5">
|
|
431
|
+
<div className="flex items-center gap-3 phone:flex-wrap phone:gap-y-1">
|
|
432
|
+
<span className="flex w-44 shrink-0 items-center gap-1.5 phone:w-full">
|
|
433
433
|
<span className="truncate font-mono text-xs text-theme-text-primary">
|
|
434
434
|
{row.resource === "cpu" || row.resource === "memory"
|
|
435
435
|
? resourceLabel(row.resource)
|
|
@@ -517,7 +517,7 @@ function SchedulingBarRowView({ row }: { row: SchedulingBarRow }) {
|
|
|
517
517
|
</div>
|
|
518
518
|
)}
|
|
519
519
|
</div>
|
|
520
|
-
<div className="ml-[11.75rem] mt-1 flex flex-wrap items-baseline gap-x-3 gap-y-0.5 text-xs">
|
|
520
|
+
<div className="ml-[11.75rem] mt-1 flex phone:ml-0 flex-wrap items-baseline gap-x-3 gap-y-0.5 text-xs">
|
|
521
521
|
<NumberPart
|
|
522
522
|
value={
|
|
523
523
|
row.requested !== null
|
|
@@ -1048,6 +1048,7 @@ export function KpiTile({
|
|
|
1048
1048
|
attention = false,
|
|
1049
1049
|
linkLabel,
|
|
1050
1050
|
onClick,
|
|
1051
|
+
className,
|
|
1051
1052
|
}: {
|
|
1052
1053
|
label: string;
|
|
1053
1054
|
value: ReactNode;
|
|
@@ -1057,6 +1058,7 @@ export function KpiTile({
|
|
|
1057
1058
|
attention?: boolean;
|
|
1058
1059
|
linkLabel?: string;
|
|
1059
1060
|
onClick?: () => void;
|
|
1061
|
+
className?: string;
|
|
1060
1062
|
}) {
|
|
1061
1063
|
const clickable = Boolean(onClick);
|
|
1062
1064
|
return (
|
|
@@ -1078,9 +1080,9 @@ export function KpiTile({
|
|
|
1078
1080
|
clickable
|
|
1079
1081
|
? "cursor-pointer transition-colors hover:border-theme-border-light hover:bg-theme-hover/40"
|
|
1080
1082
|
: ""
|
|
1081
|
-
}`}
|
|
1083
|
+
} ${className ?? ""}`}
|
|
1082
1084
|
>
|
|
1083
|
-
<div className="flex items-center gap-1.5">
|
|
1085
|
+
<div className="flex items-center gap-1.5 phone:flex-wrap phone:gap-y-1">
|
|
1084
1086
|
<span className="text-[11px] font-medium uppercase tracking-wide text-theme-text-tertiary">
|
|
1085
1087
|
{label}
|
|
1086
1088
|
</span>
|
|
@@ -1128,10 +1130,11 @@ export function KeyValueRows({ rows }: { rows: [string, ReactNode][] }) {
|
|
|
1128
1130
|
{rows.map(([label, value], index) => (
|
|
1129
1131
|
<div
|
|
1130
1132
|
key={`${label}-${index}`}
|
|
1131
|
-
|
|
1133
|
+
// Phones: a value too long for the row moves under its label and breaks inside it.
|
|
1134
|
+
className="flex items-center justify-between gap-4 py-2 first:pt-0 last:pb-0 phone:flex-wrap phone:gap-y-0.5"
|
|
1132
1135
|
>
|
|
1133
1136
|
<span className="text-sm text-theme-text-secondary">{label}</span>
|
|
1134
|
-
<span className="text-right font-mono text-sm text-theme-text-primary">
|
|
1137
|
+
<span className="text-right font-mono text-sm text-theme-text-primary phone:ml-auto phone:min-w-0 phone:[overflow-wrap:anywhere]">
|
|
1135
1138
|
{value}
|
|
1136
1139
|
</span>
|
|
1137
1140
|
</div>
|
|
@@ -1157,7 +1160,8 @@ export function TokenGroup({
|
|
|
1157
1160
|
<div className="flex flex-wrap gap-1">
|
|
1158
1161
|
{values.length > 0 ? (
|
|
1159
1162
|
values.map((value) => (
|
|
1160
|
-
|
|
1163
|
+
// Phones: a value wider than the row breaks inside its chip instead of being clipped.
|
|
1164
|
+
<Badge key={value} tone="structural" size="sm" className="phone:[overflow-wrap:anywhere]">
|
|
1161
1165
|
{value}
|
|
1162
1166
|
</Badge>
|
|
1163
1167
|
))
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
StatusDot,
|
|
11
11
|
Tooltip,
|
|
12
12
|
toneTextClass,
|
|
13
|
+
usePhoneLayout,
|
|
13
14
|
type CNPGFleetRow,
|
|
14
15
|
type CNPGProblemCategory,
|
|
15
16
|
} from '@skyhook-io/k8s-ui'
|
|
@@ -225,7 +226,9 @@ export function CNPGOverview({
|
|
|
225
226
|
const context = connection.context || data.context
|
|
226
227
|
// Some namespaces were not read: the count is a floor, not the cluster's total.
|
|
227
228
|
const totalText = `${clustersCov?.state === 'partial' ? '≥' : ''}${total}`
|
|
228
|
-
|
|
229
|
+
// No cluster authoring on a phone (a YAML editor follows the dialog).
|
|
230
|
+
const isPhone = usePhoneLayout()
|
|
231
|
+
const createAction = onCreate && !isPhone ? (
|
|
229
232
|
<button type="button" onClick={onCreate} className="btn-secondary inline-flex items-center gap-1.5 px-3 py-1.5 text-sm">
|
|
230
233
|
<Plus className="h-3.5 w-3.5" />
|
|
231
234
|
Create
|
|
@@ -112,6 +112,7 @@ export function CNPGView({ namespaces, selectedResource, onOpenResource, onClose
|
|
|
112
112
|
onSelectedKindChange={selectKind}
|
|
113
113
|
apiResources={apiResources}
|
|
114
114
|
resourceCounts={counts?.counts}
|
|
115
|
+
resourceCoverage={counts?.coverage}
|
|
115
116
|
resourceForbidden={counts?.forbidden}
|
|
116
117
|
resourceUnavailable={counts?.unavailable}
|
|
117
118
|
pinned={pinned}
|
|
@@ -51,6 +51,7 @@ export function useCNPGWriteGuard({
|
|
|
51
51
|
acknowledged={acked}
|
|
52
52
|
onAcknowledgedChange={setAcked}
|
|
53
53
|
onOpenOwner={route ? () => navigate(route) : undefined}
|
|
54
|
+
onOpenManager={(owner) => navigate(gitOpsRouteForOwner(owner))}
|
|
54
55
|
/>
|
|
55
56
|
),
|
|
56
57
|
satisfied: canConfirmGitOpsWrite(guard, acked),
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
5
|
+
import { CompareResourcePicker, type CompareResourceRef } from '@skyhook-io/k8s-ui'
|
|
6
|
+
|
|
7
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
8
|
+
|
|
9
|
+
const source: CompareResourceRef = { kind: 'configmaps', namespace: 'read-a', name: 'app' }
|
|
10
|
+
let root: Root
|
|
11
|
+
let element: HTMLDivElement
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
element = document.createElement('div')
|
|
15
|
+
document.body.appendChild(element)
|
|
16
|
+
root = createRoot(element)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
act(() => root.unmount())
|
|
21
|
+
element.remove()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
function render(notes: { coverageNote?: string; scopeNote?: string } = {}) {
|
|
25
|
+
act(() => {
|
|
26
|
+
root.render(<CompareResourcePicker open onClose={() => {}} source={source} candidates={[source]} {...notes} onPick={() => {}} />)
|
|
27
|
+
})
|
|
28
|
+
return document.body.textContent ?? ''
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const note = (text: string) => [...document.querySelectorAll('[role="status"]')].find((el) => el.textContent === text)
|
|
32
|
+
|
|
33
|
+
describe('compare picker empty state', () => {
|
|
34
|
+
it('says nothing else exists only when the list was complete', () => {
|
|
35
|
+
expect(render()).toContain('No other configmaps available to compare against.')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it("doesn't claim nothing else exists after a qualified read", () => {
|
|
39
|
+
const partial = 'Partial results. Radar read read-a; your permissions exclude configmaps in read-b.'
|
|
40
|
+
const text = render({ coverageNote: partial })
|
|
41
|
+
expect(text).toContain('No other configmaps found in what Radar could read.')
|
|
42
|
+
expect(text).not.toContain('available to compare against')
|
|
43
|
+
expect(note(partial)?.className).toContain('text-warning-text')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('shows a collection-narrowed list as scope, not as a warning', () => {
|
|
47
|
+
const scope = 'Radar collects this kind only in 1 namespace: read-a.'
|
|
48
|
+
const text = render({ scopeNote: scope })
|
|
49
|
+
expect(text).toContain('No other configmaps found in the collected namespaces.')
|
|
50
|
+
expect(note(scope)?.className).not.toContain('text-warning-text')
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('lets the warning win when both notes are set', () => {
|
|
54
|
+
const text = render({ coverageNote: 'Partial results.', scopeNote: 'Radar collects this kind only in 1 namespace: read-a.' })
|
|
55
|
+
expect(text).toContain('Partial results.')
|
|
56
|
+
expect(text).not.toContain('Radar collects this kind')
|
|
57
|
+
})
|
|
58
|
+
})
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
ResourceCompareView,
|
|
5
5
|
CompareResourcePicker,
|
|
6
6
|
parseRef,
|
|
7
|
+
resourceCoverageNotice,
|
|
8
|
+
resourceNarrowedNotice,
|
|
7
9
|
refToParam,
|
|
8
10
|
type CompareResourceRef,
|
|
9
11
|
type CompareSide,
|
|
@@ -42,7 +44,7 @@ export function CompareViewRoute() {
|
|
|
42
44
|
const aQuery = useResource<unknown>(a?.kind ?? '', a?.namespace ?? '', a?.name ?? '', a?.group)
|
|
43
45
|
const bQuery = useResource<unknown>(b?.kind ?? '', b?.namespace ?? '', b?.name ?? '', b?.group)
|
|
44
46
|
|
|
45
|
-
const { candidates, isPending: candidatesPending, error: candidatesError } = useCompareCandidates(kind, group, !!pickerOpen)
|
|
47
|
+
const { candidates, coverage: candidatesCoverage, isPending: candidatesPending, error: candidatesError } = useCompareCandidates(kind, group, !!pickerOpen)
|
|
46
48
|
|
|
47
49
|
const updateParam = useCallback(
|
|
48
50
|
(next: Record<string, string>) => {
|
|
@@ -114,6 +116,8 @@ export function CompareViewRoute() {
|
|
|
114
116
|
source={source}
|
|
115
117
|
sourceSide={pickerOpen}
|
|
116
118
|
candidates={candidates}
|
|
119
|
+
coverageNote={resourceCoverageNotice(candidatesCoverage)}
|
|
120
|
+
scopeNote={resourceNarrowedNotice(candidatesCoverage)}
|
|
117
121
|
loading={candidatesPending}
|
|
118
122
|
error={candidatesError}
|
|
119
123
|
onPick={handlePick}
|
|
@@ -23,5 +23,5 @@ export function useCompareCandidates(kind: string, group: string | undefined, en
|
|
|
23
23
|
group,
|
|
24
24
|
}))
|
|
25
25
|
}, [query.data, kind, group])
|
|
26
|
-
return { candidates, isPending: query.isPending, error: query.error }
|
|
26
|
+
return { candidates, coverage: query.coverage, isPending: query.isPending, error: query.error }
|
|
27
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react'
|
|
2
2
|
import { useNavigate } from 'react-router-dom'
|
|
3
|
-
import { CompareResourcePicker, refToParam, type CompareResourceRef } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import { CompareResourcePicker, refToParam, resourceCoverageNotice, resourceNarrowedNotice, type CompareResourceRef } from '@skyhook-io/k8s-ui'
|
|
4
4
|
import { useCompareCandidates } from './useCompareCandidates'
|
|
5
5
|
import { useNavCustomization } from '../../context/NavCustomization'
|
|
6
6
|
|
|
@@ -30,7 +30,7 @@ export function useCompareLauncher({ kind, namespace, name, group }: UseCompareL
|
|
|
30
30
|
const navigate = useNavigate()
|
|
31
31
|
const [open, setOpen] = useState(false)
|
|
32
32
|
const kindLower = kind.toLowerCase()
|
|
33
|
-
const { candidates, isPending, error } = useCompareCandidates(kindLower, group, open)
|
|
33
|
+
const { candidates, coverage, isPending, error } = useCompareCandidates(kindLower, group, open)
|
|
34
34
|
const { crossClusterCompareHref, onHostNavigate } = useNavCustomization()
|
|
35
35
|
|
|
36
36
|
const onCompareTo = useCallback(() => setOpen(true), [])
|
|
@@ -65,6 +65,8 @@ export function useCompareLauncher({ kind, namespace, name, group }: UseCompareL
|
|
|
65
65
|
onClose={() => setOpen(false)}
|
|
66
66
|
source={source}
|
|
67
67
|
candidates={candidates}
|
|
68
|
+
coverageNote={resourceCoverageNotice(coverage)}
|
|
69
|
+
scopeNote={resourceNarrowedNotice(coverage)}
|
|
68
70
|
loading={open && isPending}
|
|
69
71
|
error={open ? error : null}
|
|
70
72
|
onPick={handlePick}
|
|
@@ -123,3 +123,13 @@ it("distinguishes local execution from sending resource data to the model provid
|
|
|
123
123
|
expect(html).toContain("model provider under your account, not to Radar");
|
|
124
124
|
expect(html).not.toContain("never leaves your machine");
|
|
125
125
|
});
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
it("explains pause conditionally even when the proposed fix removes it, without changing the existing gate", () => {
|
|
129
|
+
const resourceData = { metadata: { name: "archive", annotations: { "crossplane.io/paused": "true" } }, spec: { providerConfigRef: { name: "default" } } };
|
|
130
|
+
const result = renderToStaticMarkup(<ApplyDialog open onClose={() => {}} onConfirm={() => {}} agentLabel="Local agent" resourceLabel="Bucket archive" context="fixture" fix="Remove the pause annotation." gitOpsGuard={unmanaged} resourceData={resourceData} />);
|
|
131
|
+
expect(result).toContain("Pause affects reconciliation");
|
|
132
|
+
expect(result).toContain("requests resumption");
|
|
133
|
+
expect(result).not.toContain("will resume");
|
|
134
|
+
expect(applyButton(result)).not.toContain('disabled=""');
|
|
135
|
+
});
|
|
@@ -8,12 +8,13 @@ import {
|
|
|
8
8
|
RefreshCw,
|
|
9
9
|
} from "lucide-react";
|
|
10
10
|
import { DialogPortal } from "@skyhook-io/k8s-ui/components/ui/DialogPortal";
|
|
11
|
-
import { GitOpsWriteWarning } from "@skyhook-io/k8s-ui";
|
|
11
|
+
import { GitOpsWriteWarning, type GitOpsOwnerRef } from "@skyhook-io/k8s-ui";
|
|
12
12
|
import {
|
|
13
13
|
canConfirmGitOpsWrite,
|
|
14
14
|
gitOpsWriteGuardKey,
|
|
15
15
|
type GitOpsWriteGuard,
|
|
16
16
|
} from "@skyhook-io/k8s-ui/utils/gitops-write-guard";
|
|
17
|
+
import { CrossplaneApplyNotice } from "@skyhook-io/k8s-ui/components/ui/CrossplaneOperationNotice";
|
|
17
18
|
import { parseContextName } from "../../utils/context-name";
|
|
18
19
|
import type { Diagnosis, ApplyMutationOutcome } from "../../api/diagnose";
|
|
19
20
|
import { AIMarkdown, CopyButton } from "./AIMarkdown";
|
|
@@ -32,7 +33,9 @@ export function ApplyDialog({
|
|
|
32
33
|
precondition,
|
|
33
34
|
gitOpsGuard,
|
|
34
35
|
onOpenGitOpsOwner,
|
|
36
|
+
onOpenGitOpsManager,
|
|
35
37
|
confidence,
|
|
38
|
+
resourceData,
|
|
36
39
|
}: {
|
|
37
40
|
open: boolean;
|
|
38
41
|
onClose: () => void;
|
|
@@ -48,7 +51,9 @@ export function ApplyDialog({
|
|
|
48
51
|
/** GitOps/Helm write guard for the target; undefined blocks Apply. */
|
|
49
52
|
gitOpsGuard?: GitOpsWriteGuard;
|
|
50
53
|
onOpenGitOpsOwner?: () => void;
|
|
54
|
+
onOpenGitOpsManager?: (owner: GitOpsOwnerRef) => void;
|
|
51
55
|
confidence?: number;
|
|
56
|
+
resourceData?: unknown;
|
|
52
57
|
}) {
|
|
53
58
|
const titleId = useId();
|
|
54
59
|
const fixText = fix?.trim();
|
|
@@ -144,12 +149,14 @@ export function ApplyDialog({
|
|
|
144
149
|
)}
|
|
145
150
|
</div>
|
|
146
151
|
<div className="shrink-0 space-y-2 p-4">
|
|
152
|
+
<CrossplaneApplyNotice resources={[resourceData]} />
|
|
147
153
|
{gitOpsGuard && (
|
|
148
154
|
<GitOpsWriteWarning
|
|
149
155
|
guard={gitOpsGuard}
|
|
150
156
|
acknowledged={acked}
|
|
151
157
|
onAcknowledgedChange={(value) => setAckedKey(value ? guardKey : "")}
|
|
152
158
|
onOpenOwner={onOpenGitOpsOwner}
|
|
159
|
+
onOpenManager={onOpenGitOpsManager}
|
|
153
160
|
/>
|
|
154
161
|
)}
|
|
155
162
|
{lowConfidence && (
|