@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
package/src/api/client.ts
CHANGED
|
@@ -35,6 +35,7 @@ import type {
|
|
|
35
35
|
import { focusManager, useInfiniteQuery, useQuery, useMutation, useQueryClient, skipToken, type QueryClient } from '@tanstack/react-query'
|
|
36
36
|
import { showApiError, showApiSuccess, showApiNotice } from '../components/ui/Toast'
|
|
37
37
|
import { useIsAuthEnabled, useNamespacedCapabilities } from '../contexts/CapabilitiesContext'
|
|
38
|
+
import { applyTabPick, cleanPick, ownsTabPick, pruneTabPick, withActives, writeTabPick } from '../utils/namespacePick'
|
|
38
39
|
import type {
|
|
39
40
|
Topology,
|
|
40
41
|
ClusterInfo,
|
|
@@ -427,7 +428,12 @@ export async function fetchJSON<T>(
|
|
|
427
428
|
// ============================================================================
|
|
428
429
|
|
|
429
430
|
export interface DashboardCluster {
|
|
431
|
+
// Kubeconfig context, or "in-cluster". The kubeconfig cluster entry is in
|
|
432
|
+
// kubeconfigCluster.
|
|
430
433
|
name: string;
|
|
434
|
+
// Kubeconfig cluster entry the context points at; several contexts can
|
|
435
|
+
// share one. Absent in in-cluster mode and from older Radar.
|
|
436
|
+
kubeconfigCluster?: string;
|
|
431
437
|
platform: string;
|
|
432
438
|
version: string;
|
|
433
439
|
connected: boolean;
|
|
@@ -526,6 +532,8 @@ export interface DashboardHelmRelease {
|
|
|
526
532
|
chartVersion: string;
|
|
527
533
|
status: string;
|
|
528
534
|
resourceHealth?: string;
|
|
535
|
+
// Workloads and Pods whose live status wasn't read.
|
|
536
|
+
statusUnreadCount?: number;
|
|
529
537
|
}
|
|
530
538
|
|
|
531
539
|
export interface DashboardHelmSummary {
|
|
@@ -937,6 +945,7 @@ export interface CronJobSchedulingEvidence {
|
|
|
937
945
|
}
|
|
938
946
|
|
|
939
947
|
export interface SubjectIssuesResponse {
|
|
948
|
+
node_certificate_report?: NodeCertificateReport;
|
|
940
949
|
scheduling_report?: CronJobSchedulingEvidence;
|
|
941
950
|
issues: Issue[];
|
|
942
951
|
coverage: "ok" | "syncing" | "notWatched" | "unknownKind";
|
|
@@ -946,6 +955,19 @@ export interface SubjectIssuesResponse {
|
|
|
946
955
|
unchecked_sources?: UncheckedSource[];
|
|
947
956
|
}
|
|
948
957
|
|
|
958
|
+
export interface NodeCertificateReport {
|
|
959
|
+
uid: string;
|
|
960
|
+
event_id?: string;
|
|
961
|
+
state: 'reported' | 'unverified' | 'ok';
|
|
962
|
+
reason: string;
|
|
963
|
+
message: string;
|
|
964
|
+
last_reported_at: string;
|
|
965
|
+
expires_at?: string;
|
|
966
|
+
not_before?: string;
|
|
967
|
+
history_incomplete?: boolean;
|
|
968
|
+
validity_unknown?: boolean;
|
|
969
|
+
}
|
|
970
|
+
|
|
949
971
|
export function useSubjectIssues(
|
|
950
972
|
subject: { kind: string; group: string; namespace: string; name: string; uid?: string } | null,
|
|
951
973
|
enabled: boolean,
|
|
@@ -1140,7 +1162,8 @@ export interface OpenCostNamespaceCost {
|
|
|
1140
1162
|
hourlyCost: number;
|
|
1141
1163
|
cpuCost: number;
|
|
1142
1164
|
memoryCost: number;
|
|
1143
|
-
|
|
1165
|
+
// null: the namespace has volumes whose cost could not be calculated.
|
|
1166
|
+
storageCost?: number | null;
|
|
1144
1167
|
cpuUsageCost?: number;
|
|
1145
1168
|
memoryUsageCost?: number;
|
|
1146
1169
|
efficiency?: number;
|
|
@@ -1175,7 +1198,8 @@ export interface OpenCostSummary {
|
|
|
1175
1198
|
currency?: string;
|
|
1176
1199
|
window?: string;
|
|
1177
1200
|
totalHourlyCost?: number;
|
|
1178
|
-
|
|
1201
|
+
// null: at least one namespace's storage cost is unknown.
|
|
1202
|
+
totalStorageCost?: number | null;
|
|
1179
1203
|
totalIdleCost?: number;
|
|
1180
1204
|
clusterEfficiency?: number;
|
|
1181
1205
|
namespaceScope?: string[];
|
|
@@ -1872,6 +1896,12 @@ export interface VersionInfo {
|
|
|
1872
1896
|
releaseNotes?: string;
|
|
1873
1897
|
installMethod: InstallMethod;
|
|
1874
1898
|
updateCommand?: string;
|
|
1899
|
+
/**
|
|
1900
|
+
* Desktop install that cannot update itself, and how the user updates instead:
|
|
1901
|
+
* a new AppImage, a new .deb/.rpm through the package manager, or a download
|
|
1902
|
+
* because Radar can't write to its folder. Absent: Update Now works.
|
|
1903
|
+
*/
|
|
1904
|
+
manualUpdate?: 'appimage' | 'package' | 'download';
|
|
1875
1905
|
error?: string;
|
|
1876
1906
|
productHuntLaunch?: { enabled: boolean; url: string; start: string; end: string };
|
|
1877
1907
|
}
|
|
@@ -3911,7 +3941,8 @@ export type RightsizingFit =
|
|
|
3911
3941
|
| "oversized"
|
|
3912
3942
|
| "under_requested"
|
|
3913
3943
|
| "missing_request"
|
|
3914
|
-
| "insufficient_history"
|
|
3944
|
+
| "insufficient_history"
|
|
3945
|
+
| "pod_level_request";
|
|
3915
3946
|
export type RightsizingConfidence = "low" | "medium" | "high";
|
|
3916
3947
|
export type RightsizingOwnerCoverage = "ksm_history" | "current_pods";
|
|
3917
3948
|
|
|
@@ -3924,6 +3955,9 @@ export interface RightsizingRow {
|
|
|
3924
3955
|
currentRequestValue?: number;
|
|
3925
3956
|
currentLimit?: string;
|
|
3926
3957
|
currentLimitValue?: number;
|
|
3958
|
+
/** The pod's fixed pod-level request (spec.resources), set when fit is pod_level_request. */
|
|
3959
|
+
podLevelRequest?: string;
|
|
3960
|
+
podLevelRequestValue?: number;
|
|
3927
3961
|
observed?: {
|
|
3928
3962
|
name: "P95" | "P99" | "Max";
|
|
3929
3963
|
value: number;
|
|
@@ -5373,8 +5407,7 @@ export function useRestartWorkload() {
|
|
|
5373
5407
|
},
|
|
5374
5408
|
);
|
|
5375
5409
|
if (!response.ok) {
|
|
5376
|
-
|
|
5377
|
-
throw new Error(error.error || `HTTP ${response.status}`);
|
|
5410
|
+
throw new Error(restartErrorMessage(await readErrorBody(response), response.status));
|
|
5378
5411
|
}
|
|
5379
5412
|
return response.json();
|
|
5380
5413
|
},
|
|
@@ -5391,6 +5424,63 @@ export function useRestartWorkload() {
|
|
|
5391
5424
|
});
|
|
5392
5425
|
}
|
|
5393
5426
|
|
|
5427
|
+
function useSetDeploymentPaused(
|
|
5428
|
+
action: "pause" | "resume",
|
|
5429
|
+
meta: { errorMessage: string; successMessage: string },
|
|
5430
|
+
) {
|
|
5431
|
+
const queryClient = useQueryClient();
|
|
5432
|
+
const { guard } = useRadarFeature("deploymentPause");
|
|
5433
|
+
|
|
5434
|
+
return useMutation({
|
|
5435
|
+
mutationFn: ({
|
|
5436
|
+
kind,
|
|
5437
|
+
namespace,
|
|
5438
|
+
name,
|
|
5439
|
+
}: {
|
|
5440
|
+
kind: string;
|
|
5441
|
+
namespace: string;
|
|
5442
|
+
name: string;
|
|
5443
|
+
}) =>
|
|
5444
|
+
guard(async () => {
|
|
5445
|
+
const response = await apiFetch(
|
|
5446
|
+
`${getApiBase()}/workloads/${kind}/${namespace}/${name}/${action}`,
|
|
5447
|
+
{
|
|
5448
|
+
method: "POST",
|
|
5449
|
+
},
|
|
5450
|
+
);
|
|
5451
|
+
if (!response.ok) {
|
|
5452
|
+
const error = await readErrorBody(response);
|
|
5453
|
+
throw new Error(error.error || `HTTP ${response.status}`);
|
|
5454
|
+
}
|
|
5455
|
+
return response.json();
|
|
5456
|
+
}),
|
|
5457
|
+
meta,
|
|
5458
|
+
onSuccess: (_, variables) => {
|
|
5459
|
+
queryClient.invalidateQueries({
|
|
5460
|
+
queryKey: ["resources", variables.kind],
|
|
5461
|
+
});
|
|
5462
|
+
queryClient.invalidateQueries({
|
|
5463
|
+
queryKey: ["resource", variables.kind, variables.namespace, variables.name],
|
|
5464
|
+
});
|
|
5465
|
+
queryClient.invalidateQueries({ queryKey: ["topology"] });
|
|
5466
|
+
},
|
|
5467
|
+
});
|
|
5468
|
+
}
|
|
5469
|
+
|
|
5470
|
+
export function usePauseDeployment() {
|
|
5471
|
+
return useSetDeploymentPaused("pause", {
|
|
5472
|
+
errorMessage: "Failed to pause rollout",
|
|
5473
|
+
successMessage: "Rollout paused",
|
|
5474
|
+
});
|
|
5475
|
+
}
|
|
5476
|
+
|
|
5477
|
+
export function useResumeDeployment() {
|
|
5478
|
+
return useSetDeploymentPaused("resume", {
|
|
5479
|
+
errorMessage: "Failed to resume rollout",
|
|
5480
|
+
successMessage: "Rollout resumed",
|
|
5481
|
+
});
|
|
5482
|
+
}
|
|
5483
|
+
|
|
5394
5484
|
export function fetchWorkloadImages(
|
|
5395
5485
|
kind: string,
|
|
5396
5486
|
namespace: string,
|
|
@@ -5558,6 +5648,46 @@ export function useWorkloadRevisions(
|
|
|
5558
5648
|
});
|
|
5559
5649
|
}
|
|
5560
5650
|
|
|
5651
|
+
// A rollout can start long after its request returned, as when a resume releases
|
|
5652
|
+
// a held template, so nothing in the request says when its revision exists. The
|
|
5653
|
+
// controller records the Deployment's revision only after creating that ReplicaSet.
|
|
5654
|
+
// deploymentRevision is undefined until the resource loads, and empty on a loaded
|
|
5655
|
+
// Deployment with no revision yet, which is how one created paused starts out.
|
|
5656
|
+
export function useRefreshRevisionsOnNewRollout(
|
|
5657
|
+
kind: string,
|
|
5658
|
+
namespace: string,
|
|
5659
|
+
name: string,
|
|
5660
|
+
deploymentRevision: string | undefined,
|
|
5661
|
+
) {
|
|
5662
|
+
const queryClient = useQueryClient();
|
|
5663
|
+
const seen = useRef(deploymentRevision);
|
|
5664
|
+
|
|
5665
|
+
useEffect(() => {
|
|
5666
|
+
const previous = seen.current;
|
|
5667
|
+
seen.current = deploymentRevision;
|
|
5668
|
+
if (previous === undefined || deploymentRevision === undefined || previous === deploymentRevision) return;
|
|
5669
|
+
queryClient.invalidateQueries({
|
|
5670
|
+
queryKey: ["workload-revisions", kind, namespace, name],
|
|
5671
|
+
});
|
|
5672
|
+
}, [queryClient, kind, namespace, name, deploymentRevision]);
|
|
5673
|
+
}
|
|
5674
|
+
|
|
5675
|
+
// The server's paused-refusal text is written for API and agent callers; in the
|
|
5676
|
+
// UI the way out is the Resume rollout button on the same page.
|
|
5677
|
+
export function rollbackErrorMessage(body: { error?: string; error_code?: string }, status: number): string {
|
|
5678
|
+
if (body.error_code === "workload_paused") {
|
|
5679
|
+
return "This Deployment is paused. Click Resume rollout, then roll back.";
|
|
5680
|
+
}
|
|
5681
|
+
return body.error || `HTTP ${status}`;
|
|
5682
|
+
}
|
|
5683
|
+
|
|
5684
|
+
export function restartErrorMessage(body: { error?: string; error_code?: string }, status: number): string {
|
|
5685
|
+
if (body.error_code === "workload_paused") {
|
|
5686
|
+
return "This Deployment is paused. Click Resume rollout, then restart.";
|
|
5687
|
+
}
|
|
5688
|
+
return body.error || `HTTP ${status}`;
|
|
5689
|
+
}
|
|
5690
|
+
|
|
5561
5691
|
export function useRollbackWorkload() {
|
|
5562
5692
|
const queryClient = useQueryClient();
|
|
5563
5693
|
return useMutation({
|
|
@@ -5581,8 +5711,7 @@ export function useRollbackWorkload() {
|
|
|
5581
5711
|
},
|
|
5582
5712
|
);
|
|
5583
5713
|
if (!response.ok) {
|
|
5584
|
-
|
|
5585
|
-
throw new Error(error.error || `HTTP ${response.status}`);
|
|
5714
|
+
throw new Error(rollbackErrorMessage(await readErrorBody(response), response.status));
|
|
5586
5715
|
}
|
|
5587
5716
|
return response.json();
|
|
5588
5717
|
},
|
|
@@ -7531,8 +7660,20 @@ export function useSwitchContext() {
|
|
|
7531
7660
|
// ============================================================================
|
|
7532
7661
|
|
|
7533
7662
|
export interface NamespaceScope {
|
|
7663
|
+
/**
|
|
7664
|
+
* This tab's pick. Outside --namespace-scope it is the tab's own (see
|
|
7665
|
+
* utils/namespacePick); the server's remembered pick only seeds it.
|
|
7666
|
+
*/
|
|
7534
7667
|
actives: string[];
|
|
7535
7668
|
kubeconfigNamespace: string;
|
|
7669
|
+
/** Context the scope was read under. Absent from servers older than per-tab picks. */
|
|
7670
|
+
context?: string;
|
|
7671
|
+
/**
|
|
7672
|
+
* True when the server drops its own pick to `accessibleNamespaces` on this
|
|
7673
|
+
* read; a tab drops its pick under the same rule. Absent from servers older
|
|
7674
|
+
* than per-tab picks.
|
|
7675
|
+
*/
|
|
7676
|
+
accessChecked?: boolean;
|
|
7536
7677
|
/**
|
|
7537
7678
|
* 'cluster-wide' — no per-user pick; user can list across namespaces.
|
|
7538
7679
|
* 'namespace' — per-user view filter pinned to one or more namespaces.
|
|
@@ -7556,7 +7697,11 @@ export interface NamespaceScope {
|
|
|
7556
7697
|
export function useNamespaceScope() {
|
|
7557
7698
|
return useQuery<NamespaceScope>({
|
|
7558
7699
|
queryKey: ["namespace-scope"],
|
|
7559
|
-
queryFn: () =>
|
|
7700
|
+
queryFn: async ({ signal }) => {
|
|
7701
|
+
const apiBase = getApiBase();
|
|
7702
|
+
const scope = await fetchJSON<NamespaceScope>("/cluster/namespace-scope", signal);
|
|
7703
|
+
return applyTabPick(scope, apiBase);
|
|
7704
|
+
},
|
|
7560
7705
|
staleTime: 30000,
|
|
7561
7706
|
});
|
|
7562
7707
|
}
|
|
@@ -7619,9 +7764,34 @@ export async function refreshAfterNamespaceSwitch(
|
|
|
7619
7764
|
await queryClient.invalidateQueries({ predicate: notScope }, { cancelRefetch: false });
|
|
7620
7765
|
}
|
|
7621
7766
|
|
|
7767
|
+
// Per apiBase, the last namespace switch this tab started, and the newest one
|
|
7768
|
+
// whose answer it applied. Answers can arrive out of order: an older switch
|
|
7769
|
+
// must not overwrite a newer one that already landed, but it still applies
|
|
7770
|
+
// while the newer one is in flight, in case that one is refused.
|
|
7771
|
+
const startedNamespaceSwitch = new Map<string, number>();
|
|
7772
|
+
const appliedNamespaceSwitch = new Map<string, number>();
|
|
7773
|
+
|
|
7774
|
+
export interface NamespaceSwitchStart {
|
|
7775
|
+
seq: number;
|
|
7776
|
+
apiBase: string;
|
|
7777
|
+
context: string | undefined;
|
|
7778
|
+
}
|
|
7779
|
+
|
|
7780
|
+
/** True while `start` is the newest namespace switch this tab has applied. */
|
|
7781
|
+
export function isAppliedNamespaceSwitch(start: NamespaceSwitchStart | undefined): boolean {
|
|
7782
|
+
return !start || appliedNamespaceSwitch.get(start.apiBase) === start.seq;
|
|
7783
|
+
}
|
|
7784
|
+
|
|
7785
|
+
/** Records `start` as applied unless a newer switch already landed. */
|
|
7786
|
+
function claimNamespaceSwitch(start: NamespaceSwitchStart): boolean {
|
|
7787
|
+
if (start.seq < (appliedNamespaceSwitch.get(start.apiBase) ?? 0)) return false;
|
|
7788
|
+
appliedNamespaceSwitch.set(start.apiBase, start.seq);
|
|
7789
|
+
return true;
|
|
7790
|
+
}
|
|
7791
|
+
|
|
7622
7792
|
export function useSetActiveNamespace() {
|
|
7623
7793
|
const queryClient = useQueryClient();
|
|
7624
|
-
return useMutation<NamespaceScope, Error, { namespaces: string[] }>({
|
|
7794
|
+
return useMutation<NamespaceScope, Error, { namespaces: string[] }, NamespaceSwitchStart>({
|
|
7625
7795
|
meta: {
|
|
7626
7796
|
// Surface 403s (RBAC drift, denied bookmark) and network errors via the
|
|
7627
7797
|
// global toast. Without this, App.tsx call sites that mutate without
|
|
@@ -7665,7 +7835,9 @@ export function useSetActiveNamespace() {
|
|
|
7665
7835
|
const error = await readErrorBody(response);
|
|
7666
7836
|
throw new Error(error.error || `HTTP ${response.status}`);
|
|
7667
7837
|
}
|
|
7668
|
-
|
|
7838
|
+
// Awaited so a body lost in transfer reaches the catch below.
|
|
7839
|
+
const scope: NamespaceScope = await response.json();
|
|
7840
|
+
return scope;
|
|
7669
7841
|
} catch (error) {
|
|
7670
7842
|
clearTimeout(timeoutId);
|
|
7671
7843
|
debugNamespaceLog("mutation:error", {
|
|
@@ -7688,10 +7860,45 @@ export function useSetActiveNamespace() {
|
|
|
7688
7860
|
{ cause: error },
|
|
7689
7861
|
);
|
|
7690
7862
|
}
|
|
7863
|
+
// A network failure can hide a write the server already made; its
|
|
7864
|
+
// scope says whether the pick landed. A refused pick (HTTP error) did
|
|
7865
|
+
// not land.
|
|
7866
|
+
if (!isRescope && error instanceof TypeError) {
|
|
7867
|
+
const applied = await reconcileNamespaceSwitch(namespaces);
|
|
7868
|
+
if (applied) {
|
|
7869
|
+
debugNamespaceLog("mutation:network-error-but-applied", { namespaces });
|
|
7870
|
+
return applied;
|
|
7871
|
+
}
|
|
7872
|
+
}
|
|
7691
7873
|
throw error;
|
|
7692
7874
|
}
|
|
7693
7875
|
},
|
|
7694
|
-
|
|
7876
|
+
onMutate: () => {
|
|
7877
|
+
const apiBase = getApiBase();
|
|
7878
|
+
const seq = (startedNamespaceSwitch.get(apiBase) ?? 0) + 1;
|
|
7879
|
+
startedNamespaceSwitch.set(apiBase, seq);
|
|
7880
|
+
const context = queryClient.getQueryData<NamespaceScope>(["namespace-scope"])?.context;
|
|
7881
|
+
return { seq, apiBase, context };
|
|
7882
|
+
},
|
|
7883
|
+
onSuccess: (response, { namespaces }, start) => {
|
|
7884
|
+
let scope = response;
|
|
7885
|
+
if (ownsTabPick(response)) {
|
|
7886
|
+
// The response renders the server's stored pick after the write, which
|
|
7887
|
+
// another tab can change in between, and its context is read after the
|
|
7888
|
+
// write too. Record what this tab asked for, under the context it
|
|
7889
|
+
// asked in.
|
|
7890
|
+
const context = start.context ?? response.context;
|
|
7891
|
+
const cached = queryClient.getQueryData<NamespaceScope>(["namespace-scope"]);
|
|
7892
|
+
// A context switch landed meanwhile: the tab starts again from the
|
|
7893
|
+
// server's pick for the new context.
|
|
7894
|
+
if (getApiBase() !== start.apiBase || (cached && cached.context !== context) || response.context !== context) return;
|
|
7895
|
+
if (!claimNamespaceSwitch(start)) return;
|
|
7896
|
+
const picked = pruneTabPick(response, cleanPick(namespaces));
|
|
7897
|
+
writeTabPick(start.apiBase, context, picked);
|
|
7898
|
+
scope = withActives(response, picked);
|
|
7899
|
+
} else {
|
|
7900
|
+
claimNamespaceSwitch(start);
|
|
7901
|
+
}
|
|
7695
7902
|
debugNamespaceLog("mutation:success-before-scope-cache-write", {
|
|
7696
7903
|
actives: scope.actives,
|
|
7697
7904
|
mode: scope.mode,
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, useEffect } from 'react'
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client'
|
|
4
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
5
|
+
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
|
6
|
+
import { unreadReason } from '@skyhook-io/k8s-ui/components/kueue/related-read'
|
|
7
|
+
import { SecondaryNetworksSection } from '@skyhook-io/k8s-ui/components/resources/renderers/SecondaryNetworksSection'
|
|
8
|
+
import { getPodNetworks, uniqueNetworkAttachmentRefs, type NetworkAttachmentLookups, type NetworkAttachmentRef } from '@skyhook-io/k8s-ui/utils/multus'
|
|
9
|
+
import { useNetworkAttachmentLookups } from './networkAttachments'
|
|
10
|
+
|
|
11
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
12
|
+
let root: Root
|
|
13
|
+
let container: HTMLDivElement
|
|
14
|
+
let client: QueryClient
|
|
15
|
+
let lookups: NetworkAttachmentLookups
|
|
16
|
+
const requests: string[] = []
|
|
17
|
+
// Responses per definition name, served in order; the last one repeats.
|
|
18
|
+
let responses: Record<string, { status: number; body: unknown }[]>
|
|
19
|
+
|
|
20
|
+
const found = { status: 200, body: { resource: { metadata: { name: 'x' } } } }
|
|
21
|
+
const fail = (status: number, error_code?: string) => ({ status, body: { error: 'nope', ...(error_code ? { error_code } : {}) } })
|
|
22
|
+
|
|
23
|
+
function Lookups({ refs }: { refs: NetworkAttachmentRef[] }) {
|
|
24
|
+
const result = useNetworkAttachmentLookups(refs)
|
|
25
|
+
useEffect(() => { lookups = result }, [result])
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function Section({ names }: { names: string }) {
|
|
30
|
+
const pod = { metadata: { name: 'worker', namespace: 'apps', annotations: { 'k8s.v1.cni.cncf.io/networks': names } } }
|
|
31
|
+
const attachmentLookups = useNetworkAttachmentLookups(uniqueNetworkAttachmentRefs(getPodNetworks(pod).rows))
|
|
32
|
+
return <SecondaryNetworksSection pod={pod} attachmentLookups={attachmentLookups} onNavigate={() => undefined} />
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const ref = (name: string, namespace = 'apps'): NetworkAttachmentRef => ({ namespace, name })
|
|
36
|
+
const linked = (name: string) => [...container.querySelectorAll('button')].some(button => button.textContent === name)
|
|
37
|
+
const requestsFor = (name: string) => requests.filter(url => url.includes(`/${name}?`)).length
|
|
38
|
+
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
requests.length = 0
|
|
41
|
+
lookups = {}
|
|
42
|
+
responses = {}
|
|
43
|
+
vi.stubGlobal('fetch', async (input: string | URL | Request) => {
|
|
44
|
+
const url = String(input)
|
|
45
|
+
requests.push(url)
|
|
46
|
+
const name = new URL(url, 'http://localhost').pathname.split('/').pop() ?? ''
|
|
47
|
+
const queue = responses[name] ?? [found]
|
|
48
|
+
const next = queue.length > 1 ? queue.shift()! : queue[0]
|
|
49
|
+
return new Response(JSON.stringify(next.body), { status: next.status })
|
|
50
|
+
})
|
|
51
|
+
client = new QueryClient()
|
|
52
|
+
container = document.createElement('div')
|
|
53
|
+
root = createRoot(container)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
afterEach(async () => {
|
|
57
|
+
await act(async () => root.unmount())
|
|
58
|
+
client.clear()
|
|
59
|
+
vi.unstubAllGlobals()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
async function renderLookups(refs: NetworkAttachmentRef[]) {
|
|
63
|
+
await act(async () => root.render(<QueryClientProvider client={client}><Lookups refs={refs} /></QueryClientProvider>))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function renderSection(names: string) {
|
|
67
|
+
await act(async () => root.render(<QueryClientProvider client={client}><Section names={names} /></QueryClientProvider>))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
it('says whose access refused the read, and does not re-read a viewer denial', async () => {
|
|
71
|
+
const viewer = { state: 'unavailable', code: 'user_forbidden' } as const
|
|
72
|
+
const radar = { state: 'unavailable', code: 'radar_forbidden' } as const
|
|
73
|
+
responses = { hidden: [fail(403, 'user_forbidden')], blocked: [fail(503, 'radar_forbidden')] }
|
|
74
|
+
await renderSection('hidden,blocked')
|
|
75
|
+
await vi.waitFor(() => {
|
|
76
|
+
expect(container.textContent).toContain(unreadReason(viewer))
|
|
77
|
+
expect(container.textContent).toContain(unreadReason(radar))
|
|
78
|
+
}, { timeout: 6000 })
|
|
79
|
+
expect(linked('hidden') || linked('blocked')).toBe(false)
|
|
80
|
+
expect(requestsFor('hidden')).toBe(1)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it('keeps reading while Radar is still connecting and links the definition once it answers', async () => {
|
|
84
|
+
responses = { later: [fail(503, 'cluster_connecting'), found] }
|
|
85
|
+
await renderSection('later')
|
|
86
|
+
await vi.waitFor(() => expect(linked('later')).toBe(true), { timeout: 6000 })
|
|
87
|
+
expect(requestsFor('later')).toBe(2)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it('reads a definition as missing only when the server proved it absent', async () => {
|
|
91
|
+
responses = { gone: [fail(404, 'object_not_found')], vague: [fail(404)] }
|
|
92
|
+
await renderSection('gone,vague')
|
|
93
|
+
const unconfirmed = unreadReason({ state: 'unconfirmed' })
|
|
94
|
+
await vi.waitFor(() => expect(container.textContent).toContain(unconfirmed), { timeout: 6000 })
|
|
95
|
+
const cards = [...container.querySelectorAll('.card-inner')].map(card => card.textContent ?? '')
|
|
96
|
+
const missing = 'No NetworkAttachmentDefinition with this name'
|
|
97
|
+
expect(cards.find(card => card.startsWith('gone'))).toContain(missing)
|
|
98
|
+
expect(cards.find(card => card.startsWith('vague'))).not.toContain(missing)
|
|
99
|
+
expect(requestsFor('gone')).toBe(1)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('reads the definition by its exact group and hyphenated plural', async () => {
|
|
103
|
+
await renderLookups([ref('present', 'shared')])
|
|
104
|
+
await vi.waitFor(() => expect(lookups['shared/present']?.state).toBe('found'))
|
|
105
|
+
expect(requests[0]).toBe('/api/resources/network-attachment-definitions/shared/present?group=k8s.cni.cncf.io')
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it('makes no request for a Pod that names no definitions', async () => {
|
|
109
|
+
await renderLookups([])
|
|
110
|
+
expect(requests).toEqual([])
|
|
111
|
+
expect(lookups).toEqual({})
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('bounds how many definitions one Pod can make Radar read and marks the rest unchecked', async () => {
|
|
115
|
+
await renderLookups(Array.from({ length: 30 }, (_, index) => ref(`net-${index}`)))
|
|
116
|
+
await vi.waitFor(() => expect(Object.values(lookups).filter(lookup => lookup.state === 'found')).toHaveLength(20))
|
|
117
|
+
expect(new Set(requests).size).toBe(20)
|
|
118
|
+
const unchecked = Object.entries(lookups).filter(([, lookup]) => lookup.state === 'unchecked').map(([key]) => key)
|
|
119
|
+
expect(unchecked).toEqual(Array.from({ length: 10 }, (_, index) => `apps/net-${index + 20}`))
|
|
120
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NETWORK_ATTACHMENT_DEFINITION_GROUP,
|
|
3
|
+
NETWORK_ATTACHMENT_DEFINITION_PLURAL,
|
|
4
|
+
networkAttachmentKey,
|
|
5
|
+
type NetworkAttachmentLookups,
|
|
6
|
+
type NetworkAttachmentRef,
|
|
7
|
+
} from '@skyhook-io/k8s-ui/utils/multus'
|
|
8
|
+
import { useRelatedReads } from '../components/kueue/useRelatedReads'
|
|
9
|
+
|
|
10
|
+
// The names come from a Pod annotation anyone who can create Pods controls.
|
|
11
|
+
const MAX_LOOKUPS = 20
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Whether each NetworkAttachmentDefinition a Pod names can be read, as the
|
|
15
|
+
* viewer. One read per definition rather than a list: a denied list comes back
|
|
16
|
+
* empty, which would look the same as a definition that does not exist.
|
|
17
|
+
*/
|
|
18
|
+
export function useNetworkAttachmentLookups(refs: NetworkAttachmentRef[]): NetworkAttachmentLookups {
|
|
19
|
+
const bounded = refs.slice(0, MAX_LOOKUPS)
|
|
20
|
+
const reads = useRelatedReads(bounded.map(ref => ({
|
|
21
|
+
kind: NETWORK_ATTACHMENT_DEFINITION_PLURAL,
|
|
22
|
+
group: NETWORK_ATTACHMENT_DEFINITION_GROUP,
|
|
23
|
+
namespace: ref.namespace,
|
|
24
|
+
name: ref.name,
|
|
25
|
+
})))
|
|
26
|
+
const lookups: NetworkAttachmentLookups = {}
|
|
27
|
+
bounded.forEach((ref, index) => { lookups[networkAttachmentKey(ref)] = reads[index] })
|
|
28
|
+
for (const ref of refs.slice(MAX_LOOKUPS)) lookups[networkAttachmentKey(ref)] = { state: 'unchecked' }
|
|
29
|
+
return lookups
|
|
30
|
+
}
|
|
@@ -15,6 +15,11 @@ import {
|
|
|
15
15
|
} from './radarFeatures'
|
|
16
16
|
|
|
17
17
|
describe('radarFeatureSupport', () => {
|
|
18
|
+
it('requires explicit Event content support even when the older search endpoint is available', () => {
|
|
19
|
+
expect(radarFeatureSupport('searchEventContent', { features: { searchCoverage: true } }, 'v99.0.0')).toBe('unsupported')
|
|
20
|
+
expect(radarFeatureSupport('searchEventContent', { features: { searchEventContent: true } }, 'v1.0.0')).toBe('supported')
|
|
21
|
+
expect(radarFeatureSupport('searchEventContent', undefined, 'dev')).toBe('unknown')
|
|
22
|
+
})
|
|
18
23
|
it('trusts the advertised flag over the version', () => {
|
|
19
24
|
expect(radarFeatureSupport('policyResource', { features: { policyResource: true } }, 'v1.7.2')).toBe('supported')
|
|
20
25
|
expect(radarFeatureSupport('policyResource', { features: { policyResource: true } }, undefined)).toBe('supported')
|
package/src/api/radarFeatures.ts
CHANGED
|
@@ -33,6 +33,7 @@ export const RADAR_FEATURES = {
|
|
|
33
33
|
resourceReadCoverage: { label: 'Resource read coverage', flag: 'resourceReadCoverage', flagShippedWithEndpoint: true },
|
|
34
34
|
searchCoverage: { label: 'Search coverage and object filters', flag: 'searchCoverage', flagShippedWithEndpoint: true },
|
|
35
35
|
applicationEvidence: { label: 'Application evidence collection', flag: 'applicationEvidence', flagShippedWithEndpoint: true },
|
|
36
|
+
searchEventContent: { label: 'Event reason and message searches', flag: 'searchEventContent', flagShippedWithEndpoint: true },
|
|
36
37
|
resourceIssues: { label: 'Operational issues', minimumVersion: 'v1.8.0', flag: 'resourceIssues' },
|
|
37
38
|
resourceIssueCoverage: { label: 'Resource-specific issue views', flag: 'resourceIssueCoverage', flagShippedWithEndpoint: true },
|
|
38
39
|
podEnvironment: { label: 'Values from ConfigMaps and Secrets', minimumVersion: 'v1.9.0', flag: 'podEnvironment' },
|
|
@@ -44,6 +45,7 @@ export const RADAR_FEATURES = {
|
|
|
44
45
|
drainPlan: { label: 'Drain plans', minimumVersion: 'v1.14.0' },
|
|
45
46
|
applications: { label: 'Applications', minimumVersion: 'v1.7.7' },
|
|
46
47
|
workloadHistory: { label: 'Workload history', flag: 'workloadHistory', flagShippedWithEndpoint: true },
|
|
48
|
+
deploymentPause: { label: 'Deployment rollout pause and resume', flag: 'deploymentPause', flagShippedWithEndpoint: true },
|
|
47
49
|
cnpgWorkspace: { label: 'CloudNativePG views', flag: 'cnpgWorkspace', flagShippedWithEndpoint: true },
|
|
48
50
|
cnpgProtectionSetup: { label: 'CloudNativePG backup setup', flag: 'cnpgProtectionSetup', flagShippedWithEndpoint: true },
|
|
49
51
|
gitopsWriteEvidence: { label: 'GitOps revert warnings', flag: 'gitopsWriteEvidence', flagShippedWithEndpoint: true },
|
|
@@ -69,6 +71,7 @@ export const RADAR_FEATURES = {
|
|
|
69
71
|
// Never blocks a control: on an older Radar the Helm view reads /helm/releases.
|
|
70
72
|
helmInventory: { label: 'Helm releases without Secret access', flag: 'helmInventory', flagShippedWithEndpoint: true },
|
|
71
73
|
agentSigninCheck: { label: 'Agent sign-in checks', flag: 'agentSigninCheck', flagShippedWithEndpoint: true },
|
|
74
|
+
podFileUpload: { label: 'Pod file uploads', flag: 'podFileUpload', flagShippedWithEndpoint: true },
|
|
72
75
|
} as const satisfies Record<string, RadarFeatureSpec>
|
|
73
76
|
|
|
74
77
|
export type RadarFeature = keyof typeof RADAR_FEATURES
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { ApiError } from './client'
|
|
3
|
+
import { toSecretsStoreRead } from './secretsStore'
|
|
4
|
+
|
|
5
|
+
const complete = { status: 'complete' as const, scope: { type: 'namespaces' as const }, gaps: [] }
|
|
6
|
+
const partial = (code: string) => ({ status: 'partial' as const, scope: { type: 'namespaces' as const }, gaps: [{ code, action: 'retry' }] })
|
|
7
|
+
|
|
8
|
+
describe('toSecretsStoreRead', () => {
|
|
9
|
+
it('trusts absence only from a complete answer', () => {
|
|
10
|
+
expect(toSecretsStoreRead({ data: [], coverage: complete, error: null, isLoading: false })).toEqual({ state: 'ok', items: [], complete: true })
|
|
11
|
+
expect(toSecretsStoreRead({ data: [{}], coverage: partial('radar_forbidden') as any, error: null, isLoading: false })).toEqual({ state: 'ok', items: [{}], complete: false })
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('does not trust absence from a list without coverage', () => {
|
|
15
|
+
expect(toSecretsStoreRead({ data: [], coverage: { status: 'unknown' }, error: null, isLoading: false })).toEqual({ state: 'ok', items: [], complete: false })
|
|
16
|
+
expect(toSecretsStoreRead({ data: [], error: null, isLoading: false })).toEqual({ state: 'ok', items: [], complete: false })
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('keeps a denial apart from an empty list', () => {
|
|
20
|
+
expect(toSecretsStoreRead({ error: new ApiError('forbidden', 403), isLoading: false })).toEqual({ state: 'forbidden' })
|
|
21
|
+
expect(toSecretsStoreRead({ data: [], coverage: partial('user_forbidden') as any, error: null, isLoading: false })).toEqual({ state: 'forbidden' })
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('reports an unserved API as unavailable, not missing', () => {
|
|
25
|
+
const notServed = new ApiError('unknown resource kind: secretproviderclasses', 400, { error_code: 'kind_unknown' } as any)
|
|
26
|
+
expect(toSecretsStoreRead({ error: notServed, isLoading: false }).state).toBe('unavailable')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('stays loading while the kind syncs', () => {
|
|
30
|
+
expect(toSecretsStoreRead({ isLoading: true, error: null })).toEqual({ state: 'loading' })
|
|
31
|
+
expect(toSecretsStoreRead({ data: [], coverage: partial('kind_sync_pending') as any, error: null, isLoading: false })).toEqual({ state: 'loading' })
|
|
32
|
+
})
|
|
33
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ResourceCoverage } from '@skyhook-io/k8s-ui/types/resource-coverage'
|
|
2
|
+
import type { SecretsStoreRead } from '@skyhook-io/k8s-ui/components/resources/resource-utils-secrets-store'
|
|
3
|
+
import { ApiError, isForbiddenError, isStillLoadingError } from './client'
|
|
4
|
+
|
|
5
|
+
interface ListQuery<T> {
|
|
6
|
+
data?: T[]
|
|
7
|
+
coverage?: ResourceCoverage
|
|
8
|
+
error: unknown
|
|
9
|
+
isLoading: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* One namespace list read, as the Secrets Store renderers need it: what came
|
|
14
|
+
* back, and whether its absence of an object can be trusted. A denial, a kind
|
|
15
|
+
* that is not served and a read still warming up stay distinct from an empty
|
|
16
|
+
* answer.
|
|
17
|
+
*/
|
|
18
|
+
export function toSecretsStoreRead<T>(query: ListQuery<T>): SecretsStoreRead<T> {
|
|
19
|
+
if (query.error) {
|
|
20
|
+
if (isForbiddenError(query.error)) return { state: 'forbidden' }
|
|
21
|
+
if (isStillLoadingError(query.error)) return { state: 'loading' }
|
|
22
|
+
if (query.error instanceof ApiError && query.error.data?.error_code === 'kind_unknown') {
|
|
23
|
+
return { state: 'unavailable', message: 'The Secrets Store CSI driver’s API is not served in this cluster.' }
|
|
24
|
+
}
|
|
25
|
+
return { state: 'unavailable', message: query.error instanceof Error ? query.error.message : String(query.error) }
|
|
26
|
+
}
|
|
27
|
+
if (query.isLoading || !query.data) return { state: 'loading' }
|
|
28
|
+
const coverage = query.coverage
|
|
29
|
+
if (coverage?.status === 'partial') {
|
|
30
|
+
// The caller asked for one namespace, so a user denial leaves nothing read.
|
|
31
|
+
if (query.data.length === 0 && coverage.gaps.some(gap => gap.code === 'user_forbidden')) return { state: 'forbidden' }
|
|
32
|
+
if (query.data.length === 0 && coverage.gaps.some(gap => gap.code === 'kind_sync_pending')) return { state: 'loading' }
|
|
33
|
+
return { state: 'ok', items: query.data, complete: false }
|
|
34
|
+
}
|
|
35
|
+
// Without coverage (an older Radar) a list cannot establish absence.
|
|
36
|
+
return { state: 'ok', items: query.data, complete: coverage?.status === 'complete' }
|
|
37
|
+
}
|
|
@@ -192,6 +192,17 @@ describe('ConnectionErrorView kubeconfig guidance', () => {
|
|
|
192
192
|
})
|
|
193
193
|
})
|
|
194
194
|
|
|
195
|
+
describe('ConnectionErrorView settings error', () => {
|
|
196
|
+
it('shows the message itself and no action a restart is needed to clear', () => {
|
|
197
|
+
const markup = renderError('settings', 'prod')
|
|
198
|
+
|
|
199
|
+
expect(markup).toContain('safe error')
|
|
200
|
+
expect(markup).not.toContain('id="connection-raw-error"')
|
|
201
|
+
expect(markup).not.toContain('Retry Connection')
|
|
202
|
+
expect(markup).not.toContain('Switch context')
|
|
203
|
+
})
|
|
204
|
+
})
|
|
205
|
+
|
|
195
206
|
describe('ConnectionErrorView after a refused switch', () => {
|
|
196
207
|
const connection = { state: 'disconnected' as const, context: 'staging-eu', errorType: 'auth', error: 'safe error' }
|
|
197
208
|
|
|
@@ -403,6 +403,25 @@ export function ConnectionErrorView({ connection, onRetry, isRetrying, back, var
|
|
|
403
403
|
openLocalTerminal({ initialCommand: command, title: 'Auth' })
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
// A startup setting kept Radar from connecting, and the error names the
|
|
407
|
+
// setting to change. Settings are read at startup, so retrying or switching
|
|
408
|
+
// context can't clear it: only the message, no recovery actions.
|
|
409
|
+
if (connection.errorType === 'settings') {
|
|
410
|
+
return (
|
|
411
|
+
<div className="flex-1 flex items-start justify-center pt-12 px-8">
|
|
412
|
+
<div className="max-w-xl w-full flex flex-col items-center text-center">
|
|
413
|
+
<div className="w-14 h-14 rounded-full bg-red-500/10 flex items-center justify-center mb-5">
|
|
414
|
+
<ServerOff className="w-8 h-8 text-red-400" />
|
|
415
|
+
</div>
|
|
416
|
+
<h2 className="text-xl font-semibold text-theme-text-primary mb-6">Settings Need a Change</h2>
|
|
417
|
+
<div className="w-full bg-theme-surface border border-theme-border rounded-lg p-4 text-left">
|
|
418
|
+
<p className="text-sm text-theme-text-secondary break-words">{connection.error}</p>
|
|
419
|
+
</div>
|
|
420
|
+
</div>
|
|
421
|
+
</div>
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
|
|
406
425
|
return (
|
|
407
426
|
<div className="flex-1 flex items-start justify-center pt-12 px-8">
|
|
408
427
|
<div className="max-w-xl w-full">
|