@skyhook-io/radar-app 1.18.1 → 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/package.json +1 -1
- package/src/App.tsx +23 -8
- package/src/api/client.deleteResource.test.tsx +111 -0
- package/src/api/client.resourceAudit.test.tsx +57 -0
- package/src/api/client.resourcePath.test.ts +107 -0
- package/src/api/client.ts +136 -37
- 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/actions/useCNPGWriteGuard.tsx +1 -0
- 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/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/prometheus.test.ts +2 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +2 -1
- 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/workload.tsx +5 -1
- package/src/components/diagnose/investigationEvidence/builder.ts +3 -1
- package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/observations.ts +7 -3
- package/src/components/diagnose/investigationEvidence/projection.test.ts +57 -3
- 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/helm/ChartBrowser.tsx +4 -4
- 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/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 +29 -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/resources/CompositeRenderer.tsx +4 -0
- package/src/components/resources/ResourcesView.tsx +1 -1
- package/src/components/settings/LocalConnectionSettings.tsx +1 -0
- package/src/components/ui/RadarOmnibar.test.tsx +18 -0
- package/src/components/ui/RadarOmnibar.tsx +1 -0
- package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
- package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
- package/src/components/ui/UpdateNotification.test.tsx +2 -0
- package/src/components/ui/UpdateNotification.tsx +32 -5
- package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
- package/src/components/workload/WorkloadView.tsx +10 -4
- 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/index.css +85 -0
package/src/api/client.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createListRefetchInterval, normalizeResourceList, type ResourceListBody, type ResourceListResult } from './resourceLists'
|
|
2
|
+
import type { CascadeDetail } from '@skyhook-io/k8s-ui/components/ui/ForceDeleteConfirmDialog'
|
|
2
3
|
import { canonicalResourceGroup } from '@skyhook-io/k8s-ui/utils/api-resources'
|
|
3
4
|
import { pluralize } from '@skyhook-io/k8s-ui/utils/pluralize'
|
|
4
5
|
import { knownKindForPluralWithGroup, pluralToKind } from '@skyhook-io/k8s-ui/utils/navigation'
|
|
@@ -810,12 +811,14 @@ export function useResourceAudit(
|
|
|
810
811
|
name: string,
|
|
811
812
|
group?: string,
|
|
812
813
|
) {
|
|
814
|
+
const { segment: emptyNamespaceSegment, pending: capabilitiesPending } = useEmptyNamespaceSegment();
|
|
813
815
|
const params = new URLSearchParams();
|
|
814
816
|
if (group) params.set("group", group);
|
|
815
817
|
const query = params.toString();
|
|
816
818
|
return useQuery<AuditFinding[]>({
|
|
817
|
-
queryKey: ["audit", "resource", kind, group ?? "", namespace, name],
|
|
818
|
-
queryFn: () => fetchJSON(`/audit/resource/${kind
|
|
819
|
+
queryKey: ["audit", "resource", kind, group ?? "", namespace, name, namespace ? "" : emptyNamespaceSegment],
|
|
820
|
+
queryFn: () => fetchJSON(`/audit/resource/${resourcePathSegments(kind, namespace, name, emptyNamespaceSegment)}${query ? `?${query}` : ""}`),
|
|
821
|
+
enabled: namespace !== "" || !capabilitiesPending,
|
|
819
822
|
staleTime: 30000,
|
|
820
823
|
});
|
|
821
824
|
}
|
|
@@ -1798,6 +1801,7 @@ export interface VersionInfo {
|
|
|
1798
1801
|
installMethod: InstallMethod;
|
|
1799
1802
|
updateCommand?: string;
|
|
1800
1803
|
error?: string;
|
|
1804
|
+
productHuntLaunch?: { enabled: boolean; url: string; start: string; end: string };
|
|
1801
1805
|
}
|
|
1802
1806
|
|
|
1803
1807
|
const UPDATE_CHECK_STORAGE_KEY_PREFIX = 'radar-update-check';
|
|
@@ -2021,15 +2025,15 @@ const SEARCH_MIN_QUERY = 2;
|
|
|
2021
2025
|
|
|
2022
2026
|
// useSearch hits the resource-search engine. The caller supplies the (already
|
|
2023
2027
|
// debounced) query; the hook is enabled only past the min length. include=none
|
|
2024
|
-
// keeps the per-hit payload identity-only; context=
|
|
2025
|
-
//
|
|
2028
|
+
// keeps the per-hit payload identity-only; context=status attaches health/issueCount,
|
|
2029
|
+
// while context=summary also requests navigation. React Query's AbortSignal cancels
|
|
2026
2030
|
// overlapping scans on a new query. keepPreviousData avoids flicker while the
|
|
2027
2031
|
// next query resolves.
|
|
2028
2032
|
export function useSearch(
|
|
2029
2033
|
query: string,
|
|
2030
2034
|
opts?: {
|
|
2031
2035
|
limit?: number;
|
|
2032
|
-
context?: "summary" | "none";
|
|
2036
|
+
context?: "summary" | "status" | "none";
|
|
2033
2037
|
enabled?: boolean;
|
|
2034
2038
|
globalNs?: boolean;
|
|
2035
2039
|
/** Re-query on an interval decided from the latest response. */
|
|
@@ -2768,21 +2772,42 @@ export function useArgoRevisionMetadata(
|
|
|
2768
2772
|
});
|
|
2769
2773
|
}
|
|
2770
2774
|
|
|
2775
|
+
// A cluster-scoped resource sends "_" as its namespace segment: proxies in
|
|
2776
|
+
// front of Radar (Radar Cloud's among them) merge "//", which drops the
|
|
2777
|
+
// segment and leaves a path no route matches.
|
|
2778
|
+
function resourcePathSegments(
|
|
2779
|
+
kind: string,
|
|
2780
|
+
namespace: string,
|
|
2781
|
+
name: string,
|
|
2782
|
+
emptyNamespaceSegment = "_",
|
|
2783
|
+
): string {
|
|
2784
|
+
return `${kind}/${namespace || emptyNamespaceSegment}/${name}`;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
// A Radar without the clusterScopedPlaceholder flag reads "_" on the update and
|
|
2788
|
+
// audit routes as a real namespace, so until the flag is confirmed these
|
|
2789
|
+
// routes keep the empty segment every Radar accepts when reached directly.
|
|
2790
|
+
function useEmptyNamespaceSegment() {
|
|
2791
|
+
const { data: capabilities, isPending } = useCapabilities();
|
|
2792
|
+
return {
|
|
2793
|
+
segment: capabilities?.features?.clusterScopedPlaceholder ? "_" : "",
|
|
2794
|
+
pending: isPending,
|
|
2795
|
+
};
|
|
2796
|
+
}
|
|
2797
|
+
|
|
2771
2798
|
// Generic resource fetching - returns resource with relationships
|
|
2772
|
-
// Uses '_' as placeholder for cluster-scoped resources (empty namespace)
|
|
2773
2799
|
export function fetchResourceWithRelationships<T>(
|
|
2774
2800
|
kind: string,
|
|
2775
2801
|
namespace: string,
|
|
2776
2802
|
name: string,
|
|
2777
2803
|
group?: string,
|
|
2778
2804
|
): Promise<ResourceWithRelationships<T>> {
|
|
2779
|
-
const ns = namespace || "_";
|
|
2780
2805
|
const params = new URLSearchParams();
|
|
2781
2806
|
if (group) params.set("group", group);
|
|
2782
2807
|
const queryString = params.toString();
|
|
2783
2808
|
|
|
2784
2809
|
return fetchJSON(
|
|
2785
|
-
`/resources/${kind
|
|
2810
|
+
`/resources/${resourcePathSegments(kind, namespace, name)}${queryString ? `?${queryString}` : ""}`,
|
|
2786
2811
|
);
|
|
2787
2812
|
}
|
|
2788
2813
|
|
|
@@ -4393,6 +4418,7 @@ export function useAvailablePorts(
|
|
|
4393
4418
|
// Update a resource with new YAML
|
|
4394
4419
|
export function useUpdateResource() {
|
|
4395
4420
|
const queryClient = useQueryClient();
|
|
4421
|
+
const { segment: emptyNamespaceSegment } = useEmptyNamespaceSegment();
|
|
4396
4422
|
|
|
4397
4423
|
return useMutation({
|
|
4398
4424
|
mutationFn: async ({
|
|
@@ -4413,7 +4439,7 @@ export function useUpdateResource() {
|
|
|
4413
4439
|
reviewedContext?: string
|
|
4414
4440
|
}) => {
|
|
4415
4441
|
const url = new URL(
|
|
4416
|
-
`${getApiBase()}/resources/${kind
|
|
4442
|
+
`${getApiBase()}/resources/${resourcePathSegments(kind, namespace, name, emptyNamespaceSegment)}`,
|
|
4417
4443
|
window.location.origin,
|
|
4418
4444
|
);
|
|
4419
4445
|
if (!force) {
|
|
@@ -4487,8 +4513,8 @@ export function useUpdateResource() {
|
|
|
4487
4513
|
});
|
|
4488
4514
|
}
|
|
4489
4515
|
|
|
4490
|
-
//
|
|
4491
|
-
export interface CascadeDeletePreview {
|
|
4516
|
+
// Cached owner-reference projection and root controller cleanup.
|
|
4517
|
+
export interface CascadeDeletePreview extends CascadeDetail {
|
|
4492
4518
|
root: { kind: string; namespace: string; name: string; group?: string };
|
|
4493
4519
|
rootResolved: boolean;
|
|
4494
4520
|
dependents: {
|
|
@@ -4510,14 +4536,62 @@ export function useCascadeDeletePreview(
|
|
|
4510
4536
|
queryKey: ["cascade-preview", kind, group, namespace, name],
|
|
4511
4537
|
queryFn: () =>
|
|
4512
4538
|
fetchJSON<CascadeDeletePreview>(
|
|
4513
|
-
`/resources/${kind
|
|
4539
|
+
`/resources/${resourcePathSegments(kind, namespace, name)}/cascade-preview${group ? `?group=${encodeURIComponent(group)}` : ""}`,
|
|
4514
4540
|
),
|
|
4515
4541
|
enabled,
|
|
4516
|
-
staleTime:
|
|
4542
|
+
staleTime: 0,
|
|
4517
4543
|
});
|
|
4518
4544
|
}
|
|
4519
4545
|
|
|
4520
4546
|
// Delete a resource
|
|
4547
|
+
interface DeleteResourceResult {
|
|
4548
|
+
deletionTimestamp?: string;
|
|
4549
|
+
pendingFinalizers?: string[];
|
|
4550
|
+
observationError?: string;
|
|
4551
|
+
outcomeUnknown?: boolean;
|
|
4552
|
+
}
|
|
4553
|
+
|
|
4554
|
+
async function readDeleteResult(request: Promise<Response>): Promise<DeleteResourceResult> {
|
|
4555
|
+
let response: Response;
|
|
4556
|
+
try {
|
|
4557
|
+
response = await request;
|
|
4558
|
+
} catch (error) {
|
|
4559
|
+
return { outcomeUnknown: true, observationError: String(error) };
|
|
4560
|
+
}
|
|
4561
|
+
if (!response.ok) {
|
|
4562
|
+
const error = await readErrorBody(response);
|
|
4563
|
+
if (response.status >= 500 || response.status === 408) {
|
|
4564
|
+
return { outcomeUnknown: true, observationError: error.error || `HTTP ${response.status}` };
|
|
4565
|
+
}
|
|
4566
|
+
throw new Error(error.error || `HTTP ${response.status}`);
|
|
4567
|
+
}
|
|
4568
|
+
const unconfirmed = { observationError: "Deletion accepted; the response did not confirm cleanup." };
|
|
4569
|
+
try {
|
|
4570
|
+
const result = JSON.parse(await response.text()) as DeleteResourceResult;
|
|
4571
|
+
if (result === null || typeof result !== "object" || Array.isArray(result)
|
|
4572
|
+
|| (result.deletionTimestamp !== undefined && typeof result.deletionTimestamp !== "string")
|
|
4573
|
+
|| (result.observationError !== undefined && typeof result.observationError !== "string")
|
|
4574
|
+
|| (result.pendingFinalizers !== undefined && (!Array.isArray(result.pendingFinalizers) || result.pendingFinalizers.some(value => typeof value !== "string")))) {
|
|
4575
|
+
return unconfirmed;
|
|
4576
|
+
}
|
|
4577
|
+
return result;
|
|
4578
|
+
} catch {
|
|
4579
|
+
return unconfirmed;
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
|
|
4583
|
+
function deleteResourceNotification(result: DeleteResourceResult): { message: string; type: "info" | "success"; detail?: string } {
|
|
4584
|
+
if (result.outcomeUnknown) return { message: "Deletion outcome unknown; inspect before retrying", type: "info", detail: result.observationError };
|
|
4585
|
+
if (result.observationError) {
|
|
4586
|
+
return { message: "Deletion accepted; completion unconfirmed", type: "info", detail: result.observationError };
|
|
4587
|
+
}
|
|
4588
|
+
if (result.pendingFinalizers?.length) {
|
|
4589
|
+
return { message: `Deleting — waiting on finalizers: ${result.pendingFinalizers.join(", ")}`, type: "info" };
|
|
4590
|
+
}
|
|
4591
|
+
if (result.deletionTimestamp) return { message: "Deleting…", type: "info" };
|
|
4592
|
+
return { message: "Resource deleted", type: "success" };
|
|
4593
|
+
}
|
|
4594
|
+
|
|
4521
4595
|
export function useDeleteResource() {
|
|
4522
4596
|
const queryClient = useQueryClient();
|
|
4523
4597
|
|
|
@@ -4536,7 +4610,7 @@ export function useDeleteResource() {
|
|
|
4536
4610
|
force?: boolean;
|
|
4537
4611
|
}) => {
|
|
4538
4612
|
const url = new URL(
|
|
4539
|
-
|
|
4613
|
+
apiUrl(`/resources/${resourcePathSegments(kind, namespace, name)}`),
|
|
4540
4614
|
window.location.origin,
|
|
4541
4615
|
);
|
|
4542
4616
|
if (group) {
|
|
@@ -4545,21 +4619,18 @@ export function useDeleteResource() {
|
|
|
4545
4619
|
if (force) {
|
|
4546
4620
|
url.searchParams.set("force", "true");
|
|
4547
4621
|
}
|
|
4548
|
-
|
|
4549
|
-
method: "DELETE",
|
|
4550
|
-
});
|
|
4551
|
-
if (!response.ok) {
|
|
4552
|
-
const error = await readErrorBody(response);
|
|
4553
|
-
throw new Error(error.error || `HTTP ${response.status}`);
|
|
4554
|
-
}
|
|
4555
|
-
// DELETE returns 204 No Content, no body to parse
|
|
4556
|
-
return { success: true };
|
|
4622
|
+
return readDeleteResult(apiFetch(url.toString(), { method: "DELETE" }));
|
|
4557
4623
|
},
|
|
4558
4624
|
meta: {
|
|
4559
4625
|
errorMessage: "Failed to delete resource",
|
|
4560
|
-
successMessage: "Resource deleted",
|
|
4561
4626
|
},
|
|
4562
|
-
onSuccess: (
|
|
4627
|
+
onSuccess: (result, variables) => {
|
|
4628
|
+
const { message, detail, type } = deleteResourceNotification(result);
|
|
4629
|
+
if (type === "success") {
|
|
4630
|
+
showApiSuccess(message, detail);
|
|
4631
|
+
} else {
|
|
4632
|
+
showApiNotice(message, detail, type);
|
|
4633
|
+
}
|
|
4563
4634
|
queryClient.invalidateQueries({
|
|
4564
4635
|
queryKey: ["resources", variables.kind],
|
|
4565
4636
|
});
|
|
@@ -4587,32 +4658,60 @@ export function useBulkDeleteResources() {
|
|
|
4587
4658
|
const results = await Promise.allSettled(
|
|
4588
4659
|
items.map(async ({ kind, group, namespace, name }) => {
|
|
4589
4660
|
const url = new URL(
|
|
4590
|
-
|
|
4661
|
+
apiUrl(`/resources/${resourcePathSegments(kind, namespace, name)}`),
|
|
4591
4662
|
window.location.origin,
|
|
4592
4663
|
);
|
|
4593
4664
|
if (group) url.searchParams.set("group", group);
|
|
4594
4665
|
if (force) url.searchParams.set("force", "true");
|
|
4595
|
-
|
|
4596
|
-
if (!response.ok) {
|
|
4597
|
-
const error = await readErrorBody(response);
|
|
4598
|
-
throw new Error(
|
|
4599
|
-
error.error || `Failed to delete ${namespace}/${name}`,
|
|
4600
|
-
);
|
|
4601
|
-
}
|
|
4602
|
-
return { kind, namespace, name };
|
|
4666
|
+
return { kind, namespace, name, result: await readDeleteResult(apiFetch(url.toString(), { method: "DELETE" })) };
|
|
4603
4667
|
}),
|
|
4604
4668
|
);
|
|
4605
4669
|
const failed = results.filter((r) => r.status === "rejected");
|
|
4606
4670
|
if (failed.length > 0) {
|
|
4671
|
+
const unknown = results.filter(result => result.status === "fulfilled" && result.value.result.outcomeUnknown).length;
|
|
4607
4672
|
throw new Error(
|
|
4608
|
-
`Failed to delete ${failed.length} of ${items.length} resources`,
|
|
4673
|
+
`Failed to delete ${failed.length} of ${items.length} ${items.length === 1 ? "resource" : "resources"}${unknown ? `; deletion outcome unknown for ${unknown}; inspect before retrying` : ""}`,
|
|
4609
4674
|
);
|
|
4610
4675
|
}
|
|
4611
|
-
return
|
|
4676
|
+
return results.flatMap((r) => r.status === "fulfilled" ? [r.value] : []);
|
|
4612
4677
|
},
|
|
4613
4678
|
meta: {
|
|
4614
4679
|
errorMessage: "Failed to delete some resources",
|
|
4615
|
-
|
|
4680
|
+
},
|
|
4681
|
+
onSuccess: (deleted) => {
|
|
4682
|
+
const pending = deleted.filter(({ result }) => result.pendingFinalizers?.length);
|
|
4683
|
+
const unknown = deleted.filter(({ result }) => result.outcomeUnknown);
|
|
4684
|
+
const unobserved = deleted.filter(({ result }) => result.observationError);
|
|
4685
|
+
const deleting = deleted.filter(({ result }) => result.deletionTimestamp);
|
|
4686
|
+
const resources = `${deleted.length} ${deleted.length === 1 ? "resource" : "resources"}`;
|
|
4687
|
+
let message = `${resources} deleted`;
|
|
4688
|
+
let type: "info" | "success" = "success";
|
|
4689
|
+
const unread = `completion unconfirmed for ${unobserved.length}`;
|
|
4690
|
+
if (unknown.length) {
|
|
4691
|
+
message = `Deletion outcome unknown for ${unknown.length} ${unknown.length === 1 ? "resource" : "resources"}; inspect before retrying${pending.length ? `; ${pending.length} waiting on finalizers` : ""}`;
|
|
4692
|
+
type = "info";
|
|
4693
|
+
} else if (pending.length) {
|
|
4694
|
+
message = `Deleting — ${pending.length} ${pending.length === 1 ? "resource" : "resources"} waiting on finalizers${unobserved.length ? `; ${unread}` : ""}`;
|
|
4695
|
+
type = "info";
|
|
4696
|
+
} else if (unobserved.length) {
|
|
4697
|
+
message = `Deletion accepted for ${resources}; ${unread}`;
|
|
4698
|
+
type = "info";
|
|
4699
|
+
} else if (deleting.length) {
|
|
4700
|
+
message = `Deleting ${deleting.length} ${deleting.length === 1 ? "resource" : "resources"}…`;
|
|
4701
|
+
type = "info";
|
|
4702
|
+
}
|
|
4703
|
+
const details = deleted.flatMap(({ namespace, name, result }) => {
|
|
4704
|
+
const notification = deleteResourceNotification(result);
|
|
4705
|
+
return result.observationError || result.pendingFinalizers?.length || result.deletionTimestamp
|
|
4706
|
+
? [`${namespace}/${name}: ${notification.message}${notification.detail ? `: ${notification.detail}` : ""}`]
|
|
4707
|
+
: [];
|
|
4708
|
+
});
|
|
4709
|
+
const detail = details.length ? listWithOverflow(details) : undefined;
|
|
4710
|
+
if (type === "success") {
|
|
4711
|
+
showApiSuccess(message, detail);
|
|
4712
|
+
} else {
|
|
4713
|
+
showApiNotice(message, detail, type);
|
|
4714
|
+
}
|
|
4616
4715
|
},
|
|
4617
4716
|
// onSettled, not onSuccess — a partial failure still deleted some
|
|
4618
4717
|
// resources, and the table must refetch to drop them.
|
|
@@ -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
|
|
@@ -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),
|
|
@@ -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 && (
|