@skyhook-io/radar-app 1.22.1 → 1.23.0
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 +8 -8
- package/src/App.tsx +131 -38
- package/src/RadarApp.basename.test.tsx +177 -0
- package/src/RadarApp.settings.test.tsx +33 -0
- package/src/RadarApp.tsx +5 -0
- package/src/api/agentSandbox.ts +259 -0
- package/src/api/client.autoPromConnect.test.tsx +43 -0
- package/src/api/client.metricsRelayCheck.test.tsx +134 -0
- package/src/api/client.ts +128 -25
- package/src/api/cloudInstallDiscover.test.tsx +76 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/kagent.test.ts +82 -0
- package/src/api/kagent.ts +230 -0
- package/src/api/prometheusCharts.ts +5 -0
- package/src/api/radarFeatures.test.ts +9 -0
- package/src/api/radarFeatures.ts +13 -0
- package/src/api/substrateWorkspace.test.ts +72 -0
- package/src/api/substrateWorkspace.ts +1394 -0
- package/src/api/vulnerabilities.ts +207 -9
- package/src/api/workloadSource.test.tsx +1172 -0
- package/src/api/workloadSource.ts +408 -0
- package/src/components/APIUnreachableBanner.test.tsx +19 -0
- package/src/components/APIUnreachableBanner.tsx +20 -0
- package/src/components/CloudConnectFlow.tsx +46 -7
- package/src/components/CloudFunnelButton.test.tsx +193 -7
- package/src/components/CloudFunnelButton.tsx +127 -32
- package/src/components/ConnectionErrorView.test.tsx +63 -2
- package/src/components/ConnectionErrorView.tsx +88 -68
- package/src/components/SelfManagedStart.tsx +12 -2
- package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
- package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
- package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
- package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
- package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
- package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
- package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
- package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
- package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
- package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
- package/src/components/agentsandbox/data.ts +135 -0
- package/src/components/agentsandbox/host.test.ts +27 -0
- package/src/components/agentsandbox/host.tsx +85 -0
- package/src/components/agentsandbox/labels.test.ts +42 -0
- package/src/components/agentsandbox/labels.ts +146 -0
- package/src/components/agentsandbox/listFilters.ts +85 -0
- package/src/components/agentsandbox/lists.ts +52 -0
- package/src/components/agentsandbox/routes.ts +23 -0
- package/src/components/agentsandbox/shared.tsx +321 -0
- package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
- package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
- package/src/components/agentsandbox/workspace.tsx +258 -0
- package/src/components/agentsandbox/workspaceRoute.ts +18 -0
- package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
- package/src/components/applications/ApplicationsView.tsx +156 -3
- package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
- package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
- package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
- package/src/components/audit/VulnerabilitiesView.tsx +639 -199
- package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
- package/src/components/cloudHints/CloudHintLink.tsx +29 -0
- package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
- package/src/components/cloudHints/cloudHints.test.ts +126 -0
- package/src/components/cloudHints/cloudHints.ts +131 -0
- package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
- package/src/components/cloudHints/cloudLinks.test.ts +52 -0
- package/src/components/cloudHints/cloudLinks.ts +31 -0
- package/src/components/cloudHints/hintStorage.ts +28 -0
- package/src/components/cnpg/CNPGView.tsx +4 -7
- package/src/components/diagnose/ActivityTurn.tsx +6 -4
- package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
- package/src/components/diagnose/AssessmentCard.tsx +1 -2
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +7 -0
- package/src/components/diagnose/DiagnoseContext.tsx +7 -0
- package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
- package/src/components/diagnose/Home.test.tsx +6 -0
- package/src/components/diagnose/Home.tsx +10 -3
- package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +1 -1
- package/src/components/diagnose/InvestigationEvidencePane.tsx +19 -2
- package/src/components/diagnose/InvestigationFindingsFooter.test.tsx +413 -0
- package/src/components/diagnose/InvestigationView.tsx +120 -23
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/projection.test.ts +1 -1
- package/src/components/diagnose/investigationState.ts +9 -0
- package/src/components/diagnose/parts.test.tsx +11 -3
- package/src/components/diagnose/toolCallLabel.ts +3 -0
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
- package/src/components/home/ActivitySummary.tsx +3 -8
- package/src/components/home/ClusterHealthCard.tsx +91 -17
- package/src/components/home/ClusterHealthCard.utilization.test.tsx +187 -0
- package/src/components/home/HomeAgentBlock.tsx +2 -0
- package/src/components/home/HomeView.tsx +9 -29
- package/src/components/home/MCPSetupDialog.test.tsx +9 -0
- package/src/components/home/MCPSetupDialog.tsx +6 -2
- package/src/components/home/McpCloudLine.test.tsx +162 -0
- package/src/components/home/McpCloudLine.tsx +95 -0
- package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
- package/src/components/home/TopologyPreview.test.tsx +31 -30
- package/src/components/home/TopologyPreview.tsx +19 -28
- package/src/components/home/mcpToolCatalog.test.ts +10 -0
- package/src/components/home/mcpToolCatalog.ts +7 -7
- package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
- package/src/components/issues/IssuesPane.render.test.tsx +36 -1
- package/src/components/issues/IssuesPane.tsx +181 -23
- package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
- package/src/components/issues/SinceLastVisitRow.tsx +71 -0
- package/src/components/issues/sinceLastVisit.test.ts +266 -0
- package/src/components/issues/sinceLastVisit.ts +439 -0
- package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
- package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
- package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
- package/src/components/kagent/KagentAgentSessions.tsx +124 -0
- package/src/components/kagent/KagentDetailPage.tsx +106 -0
- package/src/components/kagent/KagentLists.tsx +412 -0
- package/src/components/kagent/KagentOverview.tsx +234 -0
- package/src/components/kagent/KagentPages.tsx +690 -0
- package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
- package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
- package/src/components/kagent/KagentSidebar.test.tsx +112 -0
- package/src/components/kagent/KagentView.tsx +109 -0
- package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
- package/src/components/kagent/host.tsx +144 -0
- package/src/components/kagent/routes.ts +31 -0
- package/src/components/kagent/shared.tsx +336 -0
- package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
- package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
- package/src/components/kagent/workspace.fixtures.ts +108 -0
- package/src/components/kagent/workspaceRoute.ts +18 -0
- package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
- package/src/components/resource/MetricsNotConnected.tsx +10 -7
- package/src/components/resource/PrometheusCharts.tsx +10 -1
- package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
- package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
- package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
- package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
- package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
- package/src/components/resources/ResourcesView.tsx +2 -6
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +5 -4
- package/src/components/resources/renderers/PodRenderer.tsx +8 -2
- package/src/components/resources/renderers/RolloutRenderer.tsx +4 -1
- package/src/components/resources/renderers/WorkloadRenderer.tsx +4 -1
- package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
- package/src/components/settings/SettingsDialog.tsx +84 -16
- package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
- package/src/components/settings/SubstrateSettings.test.tsx +131 -0
- package/src/components/settings/SubstrateSettings.tsx +544 -0
- package/src/components/settings/settings-state.test.ts +21 -3
- package/src/components/settings/settings-state.ts +13 -3
- package/src/components/share/ShareLinkButton.test.tsx +360 -0
- package/src/components/share/ShareLinkButton.tsx +391 -0
- package/src/components/share/openShareInCloud.test.ts +29 -0
- package/src/components/share/openShareInCloud.ts +10 -0
- package/src/components/share/shareLink.test.ts +129 -0
- package/src/components/share/shareLink.ts +175 -0
- package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
- package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
- package/src/components/substrate/SubstrateActorPage.tsx +384 -0
- package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
- package/src/components/substrate/SubstrateActors.tsx +612 -0
- package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
- package/src/components/substrate/SubstrateConnect.tsx +88 -0
- package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
- package/src/components/substrate/SubstrateOverview.tsx +575 -0
- package/src/components/substrate/SubstratePages.test.tsx +478 -0
- package/src/components/substrate/SubstratePool.test.tsx +462 -0
- package/src/components/substrate/SubstratePoolPage.tsx +95 -0
- package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
- package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
- package/src/components/substrate/SubstrateStateBar.tsx +63 -0
- package/src/components/substrate/SubstrateTemplates.tsx +376 -0
- package/src/components/substrate/SubstrateView.tsx +173 -0
- package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
- package/src/components/substrate/SubstrateWorkers.tsx +389 -0
- package/src/components/substrate/attention.ts +81 -0
- package/src/components/substrate/contextPin.tsx +69 -0
- package/src/components/substrate/host.tsx +83 -0
- package/src/components/substrate/kubectlTarget.test.tsx +77 -0
- package/src/components/substrate/readings.test.ts +484 -0
- package/src/components/substrate/readings.ts +997 -0
- package/src/components/substrate/routes.ts +103 -0
- package/src/components/substrate/shared.tsx +426 -0
- package/src/components/substrate/substrate.fixtures.ts +325 -0
- package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
- package/src/components/substrate/workspaceRoute.ts +23 -0
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
- package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
- package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -5
- package/src/components/traffic/TrafficGraph.test.tsx +26 -0
- package/src/components/traffic/TrafficGraph.tsx +17 -14
- package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
- package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
- package/src/components/traffic/TrafficView.tsx +26 -56
- package/src/components/traffic/trafficFilters.test.ts +61 -1
- package/src/components/traffic/trafficFilters.ts +68 -8
- package/src/components/velero/VeleroOverview.tsx +2 -2
- package/src/components/velero/VeleroView.tsx +3 -6
- package/src/components/vulnerabilities/columns.tsx +132 -0
- package/src/components/vulnerabilities/filters.tsx +317 -0
- package/src/components/vulnerabilities/owner.test.ts +54 -0
- package/src/components/vulnerabilities/owner.tsx +163 -0
- package/src/components/vulnerabilities/parts.test.ts +126 -12
- package/src/components/vulnerabilities/parts.tsx +612 -52
- package/src/components/vulnerabilities/traffic.test.tsx +65 -0
- package/src/components/vulnerabilities/traffic.tsx +40 -0
- package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
- package/src/components/workload/WorkloadView.tsx +119 -14
- package/src/components/workload/WorkloadView.workloadSource.test.tsx +121 -0
- package/src/components/workspace/layout.tsx +13 -7
- package/src/components/workspace/sidebar.test.ts +48 -0
- package/src/components/workspace/sidebar.ts +73 -3
- package/src/components/workspace/table.ts +2 -1
- package/src/context/ConnectionContext.tsx +24 -5
- package/src/context/ConnectionProvider.connectionId.test.tsx +14 -0
- package/src/context/ConnectionProvider.handover.test.tsx +94 -0
- package/src/context/DiagnoseCustomization.tsx +20 -2
- package/src/contexts/RegistryAccessMode.test.tsx +51 -0
- package/src/contexts/RegistryAccessMode.tsx +25 -0
- package/src/hooks/useEventSource.test.tsx +275 -4
- package/src/hooks/useEventSource.ts +278 -51
- package/src/index.ts +1 -0
- package/src/integrations/resourceHost.ts +12 -6
- package/src/integrations/resourceHosts.test.tsx +27 -1
- package/src/integrations/resourceHosts.tsx +15 -7
- package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
- package/src/integrations/sidebarWorkspaces.ts +41 -0
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.ts +7 -1
- package/src/integrations/workspaceScreens.tsx +6 -0
- package/src/utils/navigation.test.ts +1 -6
- package/src/utils/navigation.ts +9 -44
- package/src/utils/network-policy-navigation.test.ts +21 -36
|
@@ -780,6 +780,12 @@ export function investigationPaneCenteredScrollTop({
|
|
|
780
780
|
return Math.max(0, Math.min(centered, contentHeight - viewportHeight));
|
|
781
781
|
}
|
|
782
782
|
|
|
783
|
+
/** A hosted private run opened through a proposal assignment. The reviewer
|
|
784
|
+
* may decide that proposal, but cannot operate the investigator's session. */
|
|
785
|
+
export function isPrivateRunReviewer(run: RunSummary): boolean {
|
|
786
|
+
return run.visibility === "private" && run.ownedByMe === false;
|
|
787
|
+
}
|
|
788
|
+
|
|
783
789
|
export function canStopInvestigation(
|
|
784
790
|
run: RunSummary,
|
|
785
791
|
busy: boolean,
|
|
@@ -791,6 +797,7 @@ export function canStopInvestigation(
|
|
|
791
797
|
const transcriptTerminal =
|
|
792
798
|
latestTurnStatus === "done" || latestTurnStatus === "error";
|
|
793
799
|
return (
|
|
800
|
+
!isPrivateRunReviewer(run) &&
|
|
794
801
|
run.trigger !== "background" &&
|
|
795
802
|
run.status !== "stale" &&
|
|
796
803
|
run.status !== "stopping" &&
|
|
@@ -817,6 +824,7 @@ export function canContinueInOwnAgent(input: {
|
|
|
817
824
|
const transcriptTerminal =
|
|
818
825
|
latestTurnStatus === "done" || latestTurnStatus === "error";
|
|
819
826
|
return (
|
|
827
|
+
!isPrivateRunReviewer(run) &&
|
|
820
828
|
input.streamReady &&
|
|
821
829
|
!input.busy &&
|
|
822
830
|
!input.requestPending &&
|
|
@@ -841,6 +849,7 @@ export function canContinueInvestigation(
|
|
|
841
849
|
transcriptTerminal;
|
|
842
850
|
return (
|
|
843
851
|
!gone &&
|
|
852
|
+
!isPrivateRunReviewer(run) &&
|
|
844
853
|
run.status !== "stale" &&
|
|
845
854
|
run.status !== "stopping" &&
|
|
846
855
|
(run.canContinue !== false || summaryIsLaggingTerminalTranscript)
|
|
@@ -1516,15 +1516,23 @@ describe("TurnView tool outcome truth", () => {
|
|
|
1516
1516
|
expect(html).not.toContain("animate-result-in");
|
|
1517
1517
|
});
|
|
1518
1518
|
|
|
1519
|
-
it("
|
|
1519
|
+
it("describes a workload verification without assuming who started it", () => {
|
|
1520
1520
|
const verification = turn(false);
|
|
1521
1521
|
verification.question = "internal verification prompt";
|
|
1522
1522
|
verification.verify = true;
|
|
1523
1523
|
|
|
1524
1524
|
const html = renderToStaticMarkup(<TurnView turn={verification} />);
|
|
1525
|
-
expect(html).toContain("
|
|
1526
|
-
expect(html).toContain("
|
|
1525
|
+
expect(html).toContain("Workload verification");
|
|
1526
|
+
expect(html).toContain("Checking the current workload");
|
|
1527
1527
|
expect(html).not.toContain("internal verification prompt");
|
|
1528
|
+
|
|
1529
|
+
for (const status of ["done", "error"] as const) {
|
|
1530
|
+
const settled = renderToStaticMarkup(
|
|
1531
|
+
<TurnView turn={{ ...verification, status }} />,
|
|
1532
|
+
);
|
|
1533
|
+
expect(settled).toContain("Workload verification");
|
|
1534
|
+
expect(settled).not.toContain("Checking the current workload");
|
|
1535
|
+
}
|
|
1528
1536
|
});
|
|
1529
1537
|
|
|
1530
1538
|
it("renders an unknown apply prominently and offers current-state verification", () => {
|
|
@@ -62,6 +62,9 @@ export function describeToolCall(tool: string, args?: string): string {
|
|
|
62
62
|
: "Looking up packages";
|
|
63
63
|
case "top_resources":
|
|
64
64
|
return "Ranking resources";
|
|
65
|
+
case "get_cluster_overview":
|
|
66
|
+
return "Reading the cluster overview";
|
|
67
|
+
// Saved runs, and Radars older than get_cluster_overview, still name it.
|
|
65
68
|
case "get_dashboard":
|
|
66
69
|
return "Reading the cluster dashboard";
|
|
67
70
|
case "get_cluster_audit":
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { openCloudFunnel } from '../CloudFunnelButton'
|
|
1
|
+
import { CloudHintLink } from '../cloudHints/CloudHintLink'
|
|
2
|
+
import { useCloudHintsEnabled } from '../cloudHints/cloudHints'
|
|
4
3
|
|
|
5
4
|
// The one sentence a standalone Radar adds for a remote destination: what Radar Cloud
|
|
6
5
|
// does. "Radar Cloud" opens the same dialog as the top-right button, so
|
|
7
6
|
// there is one pitch and one connect flow. That dialog connects THIS
|
|
8
7
|
// cluster; the destination is a second connect from Cloud, which is why the
|
|
9
|
-
// copy says "both clusters" and promises the view in Cloud, not here.
|
|
10
|
-
// is: the server decides whether there is anything to pitch (cloudConnect
|
|
11
|
-
// capability), and embedded hosts (Radar Cloud itself) mount neither.
|
|
8
|
+
// copy says "both clusters" and promises the view in Cloud, not here.
|
|
12
9
|
export function RemoteDestinationCloudHint() {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
if (embedded || !capabilities.data?.cloudConnect) return null
|
|
10
|
+
const enabled = useCloudHintsEnabled()
|
|
11
|
+
if (!enabled) return null
|
|
16
12
|
return (
|
|
17
13
|
<>
|
|
18
|
-
For resources on another cluster, connect both clusters to
|
|
19
|
-
<button type="button" onClick={openCloudFunnel} className="underline decoration-theme-border underline-offset-2 hover:text-theme-text-primary">
|
|
20
|
-
Radar Cloud
|
|
21
|
-
</button>{' '}
|
|
22
|
-
to see this app's resources together.
|
|
14
|
+
For resources on another cluster, connect both clusters to <CloudHintLink entry="gitops-remote" /> to see this app's resources together.
|
|
23
15
|
</>
|
|
24
16
|
)
|
|
25
17
|
}
|
|
@@ -4,14 +4,12 @@ import { Clock, ArrowRight, Shield } from 'lucide-react'
|
|
|
4
4
|
import { useChanges } from '../../api/client'
|
|
5
5
|
import { isChangeEvent } from '../../types'
|
|
6
6
|
import type { TimelineEvent } from '../../types'
|
|
7
|
-
import type { Topology } from '../../types'
|
|
8
7
|
import { useHasLimitedAccess } from '../../contexts/CapabilitiesContext'
|
|
9
8
|
import { buildResourceHierarchy, isProblematicEvent, type ResourceLane } from '../../utils/resource-hierarchy'
|
|
10
9
|
import { buildHealthSpans, timeToX } from '../timeline/shared'
|
|
11
10
|
|
|
12
11
|
interface ActivitySummaryProps {
|
|
13
12
|
namespaces: string[]
|
|
14
|
-
topology?: Topology | null
|
|
15
13
|
onNavigate: () => void
|
|
16
14
|
}
|
|
17
15
|
|
|
@@ -73,7 +71,7 @@ const KIND_SHORT: Record<string, string> = {
|
|
|
73
71
|
TLSRoute: 'TLS',
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
export function ActivitySummary({ namespaces,
|
|
74
|
+
export function ActivitySummary({ namespaces, onNavigate }: ActivitySummaryProps) {
|
|
77
75
|
const hasLimitedAccess = useHasLimitedAccess()
|
|
78
76
|
const { data: events, isLoading, error } = useChanges({
|
|
79
77
|
namespaces,
|
|
@@ -100,14 +98,11 @@ export function ActivitySummary({ namespaces, topology, onNavigate }: ActivitySu
|
|
|
100
98
|
})
|
|
101
99
|
if (windowEvents.length === 0) return []
|
|
102
100
|
|
|
103
|
-
const hierarchy = buildResourceHierarchy({
|
|
104
|
-
events: windowEvents,
|
|
105
|
-
topology: topology || undefined,
|
|
106
|
-
})
|
|
101
|
+
const hierarchy = buildResourceHierarchy({ events: windowEvents })
|
|
107
102
|
return hierarchy
|
|
108
103
|
.sort((a, b) => scoreLane(b) - scoreLane(a))
|
|
109
104
|
.slice(0, MAX_LANES)
|
|
110
|
-
}, [events, startTime, now
|
|
105
|
+
}, [events, startTime, now])
|
|
111
106
|
|
|
112
107
|
const hasActivity = lanes.length > 0
|
|
113
108
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react'
|
|
2
2
|
import type { DashboardResponse, DashboardMetrics, DashboardCRDCount } from '../../api/client'
|
|
3
|
+
import type { ReadNameSet } from '@skyhook-io/k8s-ui/types/read-coverage'
|
|
3
4
|
import { HealthRing } from './HealthRing'
|
|
4
5
|
import {
|
|
5
6
|
AlertTriangle, CheckCircle, XCircle,
|
|
@@ -10,7 +11,7 @@ import { clsx } from 'clsx'
|
|
|
10
11
|
import { formatCPUMillicores, formatMemoryMiB } from '../../utils/format'
|
|
11
12
|
import { useCapabilitiesContext } from '../../contexts/CapabilitiesContext'
|
|
12
13
|
import { HomeAgentBlock } from './HomeAgentBlock'
|
|
13
|
-
import { assetUrl, pluralize, parseContextName, CertaintyGlyph, MiddleEllipsis } from '@skyhook-io/k8s-ui'
|
|
14
|
+
import { assetUrl, pluralize, parseContextName, CertaintyGlyph, MiddleEllipsis, TruncatedText } from '@skyhook-io/k8s-ui'
|
|
14
15
|
import { Tooltip } from '../ui/Tooltip'
|
|
15
16
|
import { mcpEndpointUrl } from '../../api/config'
|
|
16
17
|
import { parseMajorMinor } from '../../utils/version'
|
|
@@ -28,6 +29,7 @@ interface ClusterHealthCardProps {
|
|
|
28
29
|
cluster: DashboardResponse['cluster']
|
|
29
30
|
metrics: DashboardMetrics | null
|
|
30
31
|
metricsServerAvailable: boolean
|
|
32
|
+
selectedNamespaces?: string[]
|
|
31
33
|
topCRDs?: DashboardCRDCount[] // Loaded lazily, may be undefined
|
|
32
34
|
issueCount: number
|
|
33
35
|
hasCriticalIssues: boolean
|
|
@@ -135,6 +137,7 @@ export function ClusterHealthCard({
|
|
|
135
137
|
cluster,
|
|
136
138
|
metrics,
|
|
137
139
|
metricsServerAvailable,
|
|
140
|
+
selectedNamespaces,
|
|
138
141
|
topCRDs: _topCRDs,
|
|
139
142
|
issueCount,
|
|
140
143
|
hasCriticalIssues,
|
|
@@ -228,6 +231,10 @@ export function ClusterHealthCard({
|
|
|
228
231
|
const { raw: rawName, location, headline: rawHeadline } = clusterIdentity(cluster)
|
|
229
232
|
const headlineName = isInCluster ? platformInfo.name : rawHeadline
|
|
230
233
|
|
|
234
|
+
const requestsScope = resolveRequestsScope(metrics?.requestsNamespaces, selectedNamespaces)
|
|
235
|
+
const requestsScopeLabel = requestsScope && requestsScope.count > 0 ? formatRequestsScopeLabel(requestsScope) : undefined
|
|
236
|
+
const requestsScopeTooltip = requestsScope ? formatRequestsScopeTooltip(requestsScope) : undefined
|
|
237
|
+
|
|
231
238
|
return (
|
|
232
239
|
<div className="rounded-xl bg-theme-surface shadow-theme-sm overflow-hidden">
|
|
233
240
|
{/* Main health section - three columns; stacked on phones */}
|
|
@@ -408,17 +415,26 @@ export function ClusterHealthCard({
|
|
|
408
415
|
{metricsServerAvailable && (
|
|
409
416
|
<ResourceBar
|
|
410
417
|
label="Used"
|
|
418
|
+
scope={requestsScope ? 'whole cluster' : undefined}
|
|
411
419
|
used={formatCPUMillicores(metrics.cpu.usageMillis)}
|
|
412
420
|
total={formatCPUMillicores(metrics.cpu.capacityMillis)}
|
|
413
421
|
percent={metrics.cpu.usagePercent}
|
|
414
422
|
/>
|
|
415
423
|
)}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
424
|
+
{requestsScope && requestsScope.count === 0 ? (
|
|
425
|
+
<div className="text-[10px] text-theme-text-tertiary">
|
|
426
|
+
Requested: unavailable (no pods read in this scope)
|
|
427
|
+
</div>
|
|
428
|
+
) : (
|
|
429
|
+
<ResourceBar
|
|
430
|
+
label="Requested"
|
|
431
|
+
scope={requestsScopeLabel}
|
|
432
|
+
scopeTooltip={requestsScopeTooltip}
|
|
433
|
+
used={formatCPUMillicores(metrics.cpu.requestsMillis)}
|
|
434
|
+
total={formatCPUMillicores(metrics.cpu.capacityMillis)}
|
|
435
|
+
percent={metrics.cpu.requestPercent}
|
|
436
|
+
/>
|
|
437
|
+
)}
|
|
422
438
|
</div>
|
|
423
439
|
)}
|
|
424
440
|
{metrics?.memory && (
|
|
@@ -430,17 +446,26 @@ export function ClusterHealthCard({
|
|
|
430
446
|
{metricsServerAvailable && (
|
|
431
447
|
<ResourceBar
|
|
432
448
|
label="Used"
|
|
449
|
+
scope={requestsScope ? 'whole cluster' : undefined}
|
|
433
450
|
used={formatMemoryMiB(metrics.memory.usageMillis)}
|
|
434
451
|
total={formatMemoryMiB(metrics.memory.capacityMillis)}
|
|
435
452
|
percent={metrics.memory.usagePercent}
|
|
436
453
|
/>
|
|
437
454
|
)}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
455
|
+
{requestsScope && requestsScope.count === 0 ? (
|
|
456
|
+
<div className="text-[10px] text-theme-text-tertiary">
|
|
457
|
+
Requested: unavailable (no pods read in this scope)
|
|
458
|
+
</div>
|
|
459
|
+
) : (
|
|
460
|
+
<ResourceBar
|
|
461
|
+
label="Requested"
|
|
462
|
+
scope={requestsScopeLabel}
|
|
463
|
+
scopeTooltip={requestsScopeTooltip}
|
|
464
|
+
used={formatMemoryMiB(metrics.memory.requestsMillis)}
|
|
465
|
+
total={formatMemoryMiB(metrics.memory.capacityMillis)}
|
|
466
|
+
percent={metrics.memory.requestPercent}
|
|
467
|
+
/>
|
|
468
|
+
)}
|
|
444
469
|
</div>
|
|
445
470
|
)}
|
|
446
471
|
{!metricsServerAvailable && (isRestricted('nodes') ? (
|
|
@@ -633,13 +658,45 @@ function RestrictedRing({ label }: { label: string }) {
|
|
|
633
658
|
)
|
|
634
659
|
}
|
|
635
660
|
|
|
661
|
+
function resolveRequestsScope(
|
|
662
|
+
serverScope: ReadNameSet | undefined,
|
|
663
|
+
selectedNamespaces?: string[],
|
|
664
|
+
): ReadNameSet | null {
|
|
665
|
+
if (serverScope) return serverScope
|
|
666
|
+
// An older Radar omits requestsNamespaces; fall back to the picker selection
|
|
667
|
+
// the UI sent so picked namespaces still show their scope.
|
|
668
|
+
if (selectedNamespaces && selectedNamespaces.length > 0) {
|
|
669
|
+
const unique = [...new Set(selectedNamespaces)].sort()
|
|
670
|
+
return { count: unique.length, names: unique }
|
|
671
|
+
}
|
|
672
|
+
return null
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function formatRequestsScopeLabel(scope: ReadNameSet): string {
|
|
676
|
+
if (scope.count === 1 && scope.names?.length === 1) {
|
|
677
|
+
return `in ${scope.names[0]}`
|
|
678
|
+
}
|
|
679
|
+
return `in ${pluralize(scope.count, 'namespace')}`
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function formatRequestsScopeTooltip(scope: ReadNameSet): string | undefined {
|
|
683
|
+
if (!scope.names || scope.names.length <= 1) return undefined
|
|
684
|
+
const maxShown = 8
|
|
685
|
+
if (scope.names.length <= maxShown) return scope.names.join(', ')
|
|
686
|
+
return `${scope.names.slice(0, maxShown).join(', ')} and ${scope.count - maxShown} more`
|
|
687
|
+
}
|
|
688
|
+
|
|
636
689
|
function ResourceBar({
|
|
637
690
|
label,
|
|
691
|
+
scope,
|
|
692
|
+
scopeTooltip,
|
|
638
693
|
used,
|
|
639
694
|
total,
|
|
640
695
|
percent,
|
|
641
696
|
}: {
|
|
642
697
|
label: string
|
|
698
|
+
scope?: string
|
|
699
|
+
scopeTooltip?: string
|
|
643
700
|
used: string
|
|
644
701
|
total: string
|
|
645
702
|
percent: number
|
|
@@ -648,10 +705,27 @@ function ResourceBar({
|
|
|
648
705
|
|
|
649
706
|
return (
|
|
650
707
|
<div>
|
|
651
|
-
|
|
652
|
-
<
|
|
653
|
-
|
|
654
|
-
|
|
708
|
+
{scope ? (
|
|
709
|
+
<div className="mb-0.5 space-y-0.5">
|
|
710
|
+
<TruncatedText
|
|
711
|
+
text={`${label} (${scope})`}
|
|
712
|
+
tooltip={scopeTooltip}
|
|
713
|
+
className="text-[10px] text-theme-text-secondary"
|
|
714
|
+
>
|
|
715
|
+
<span>{label}</span>{' '}
|
|
716
|
+
<span className="text-theme-text-tertiary">({scope})</span>
|
|
717
|
+
</TruncatedText>
|
|
718
|
+
<div className="flex justify-between items-baseline">
|
|
719
|
+
<span className="text-[10px] text-theme-text-tertiary font-mono">{used} / {total}</span>
|
|
720
|
+
<span className="text-[10px] font-medium text-theme-text-secondary font-mono">{percent}%</span>
|
|
721
|
+
</div>
|
|
722
|
+
</div>
|
|
723
|
+
) : (
|
|
724
|
+
<div className="flex justify-between items-baseline mb-0.5">
|
|
725
|
+
<span className="text-[10px] text-theme-text-tertiary font-mono">{label}: {used} / {total}</span>
|
|
726
|
+
<span className="text-[10px] font-medium text-theme-text-secondary font-mono">{percent}%</span>
|
|
727
|
+
</div>
|
|
728
|
+
)}
|
|
655
729
|
<div className="h-2 bg-theme-border rounded overflow-hidden">
|
|
656
730
|
<div
|
|
657
731
|
className={clsx('h-full transition-all', barColor)}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { renderToString } from "react-dom/server";
|
|
4
|
+
import type { DashboardMetrics, DashboardResourceCounts } from "../../api/client";
|
|
5
|
+
import { ClusterHealthCard } from "./ClusterHealthCard";
|
|
6
|
+
|
|
7
|
+
vi.mock("./HomeAgentBlock", () => ({ HomeAgentBlock: () => null }));
|
|
8
|
+
|
|
9
|
+
const baseCounts: DashboardResourceCounts = {
|
|
10
|
+
pods: { total: 10, running: 10, pending: 0, failed: 0, succeeded: 0 },
|
|
11
|
+
deployments: { total: 2, available: 2, unavailable: 0 },
|
|
12
|
+
statefulSets: { total: 0, ready: 0, unready: 0 },
|
|
13
|
+
daemonSets: { total: 0, ready: 0, unready: 0 },
|
|
14
|
+
services: 2,
|
|
15
|
+
ingresses: 0,
|
|
16
|
+
nodes: { total: 2, ready: 2, notReady: 0, cordoned: 0 },
|
|
17
|
+
namespaces: 5,
|
|
18
|
+
jobs: { total: 0, active: 0, succeeded: 0, failed: 0 },
|
|
19
|
+
cronJobs: { total: 0, active: 0, suspended: 0 },
|
|
20
|
+
configMaps: 0,
|
|
21
|
+
secrets: 0,
|
|
22
|
+
pvcs: { total: 0, bound: 0, pending: 0, unbound: 0 },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function baseMetrics(overrides: Partial<DashboardMetrics> = {}): DashboardMetrics {
|
|
26
|
+
return {
|
|
27
|
+
usageAvailable: true,
|
|
28
|
+
cpu: {
|
|
29
|
+
usageMillis: 2500,
|
|
30
|
+
requestsMillis: 500,
|
|
31
|
+
capacityMillis: 8000,
|
|
32
|
+
usagePercent: 31,
|
|
33
|
+
requestPercent: 6,
|
|
34
|
+
},
|
|
35
|
+
memory: {
|
|
36
|
+
usageMillis: 32 * 1024,
|
|
37
|
+
requestsMillis: 2 * 1024,
|
|
38
|
+
capacityMillis: 64 * 1024,
|
|
39
|
+
usagePercent: 50,
|
|
40
|
+
requestPercent: 3,
|
|
41
|
+
},
|
|
42
|
+
...overrides,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function renderCard({
|
|
47
|
+
metrics = baseMetrics(),
|
|
48
|
+
metricsServerAvailable = true,
|
|
49
|
+
selectedNamespaces,
|
|
50
|
+
}: {
|
|
51
|
+
metrics?: DashboardMetrics | null;
|
|
52
|
+
metricsServerAvailable?: boolean;
|
|
53
|
+
selectedNamespaces?: string[];
|
|
54
|
+
}): string {
|
|
55
|
+
return renderToString(
|
|
56
|
+
<ClusterHealthCard
|
|
57
|
+
health={{ healthy: 10, warning: 0, error: 0, warningEvents: 0 }}
|
|
58
|
+
counts={baseCounts}
|
|
59
|
+
cluster={{ name: "test", platform: "eks", version: "1.32", connected: true }}
|
|
60
|
+
metrics={metrics}
|
|
61
|
+
metricsServerAvailable={metricsServerAvailable}
|
|
62
|
+
selectedNamespaces={selectedNamespaces}
|
|
63
|
+
issueCount={0}
|
|
64
|
+
hasCriticalIssues={false}
|
|
65
|
+
nodeVersionSkew={null}
|
|
66
|
+
onNavigateToKind={() => {}}
|
|
67
|
+
onNavigateToView={() => {}}
|
|
68
|
+
/>,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function textContent(html: string): string {
|
|
73
|
+
const div = document.createElement("div");
|
|
74
|
+
div.innerHTML = html;
|
|
75
|
+
return div.textContent ?? "";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
describe("ClusterHealthCard resource utilization scope labels", () => {
|
|
79
|
+
it("keeps plain Used and Requested labels when metrics are cluster-wide", () => {
|
|
80
|
+
const text = textContent(renderCard({ selectedNamespaces: [] }));
|
|
81
|
+
expect(text).toContain("Used: 2.5 cores / 8 cores");
|
|
82
|
+
expect(text).toContain("Requested: 0.50 cores / 8 cores");
|
|
83
|
+
expect(text).toContain("Used: 32 GiB / 64 GiB");
|
|
84
|
+
expect(text).toContain("Requested: 2.0 GiB / 64 GiB");
|
|
85
|
+
expect(text).not.toContain("whole cluster");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("labels cluster usage and single-namespace requests when one namespace is picked", () => {
|
|
89
|
+
const text = textContent(
|
|
90
|
+
renderCard({
|
|
91
|
+
metrics: baseMetrics({ requestsNamespaces: { count: 1, names: ["istio-system"] } }),
|
|
92
|
+
selectedNamespaces: ["istio-system"],
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
expect(text).toContain("Used (whole cluster)");
|
|
96
|
+
expect(text).toContain("Requested (in istio-system)");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("labels multi-namespace requests by count", () => {
|
|
100
|
+
const text = textContent(
|
|
101
|
+
renderCard({
|
|
102
|
+
metrics: baseMetrics({ requestsNamespaces: { count: 3, names: ["app", "istio-system", "payments"] } }),
|
|
103
|
+
selectedNamespaces: ["app", "istio-system", "payments"],
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
expect(text).toContain("Used (whole cluster)");
|
|
107
|
+
expect(text).toContain("Requested (in 3 namespaces)");
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("uses server requestsNamespaces for a restricted user with no picker selection", () => {
|
|
111
|
+
const text = textContent(
|
|
112
|
+
renderCard({
|
|
113
|
+
metrics: baseMetrics({ requestsNamespaces: { count: 2, names: ["team-a", "team-b"] } }),
|
|
114
|
+
selectedNamespaces: [],
|
|
115
|
+
}),
|
|
116
|
+
);
|
|
117
|
+
expect(text).toContain("Used (whole cluster)");
|
|
118
|
+
expect(text).toContain("Requested (in 2 namespaces)");
|
|
119
|
+
|
|
120
|
+
const largeText = textContent(
|
|
121
|
+
renderCard({
|
|
122
|
+
metrics: baseMetrics({ requestsNamespaces: { count: 70 } }),
|
|
123
|
+
selectedNamespaces: [],
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
expect(largeText).toContain("Requested (in 70 namespaces)");
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("keeps the requests scope when metrics-server usage is unavailable", () => {
|
|
130
|
+
const text = textContent(
|
|
131
|
+
renderCard({
|
|
132
|
+
metrics: baseMetrics({
|
|
133
|
+
usageAvailable: false,
|
|
134
|
+
requestsNamespaces: { count: 1, names: ["istio-system"] },
|
|
135
|
+
}),
|
|
136
|
+
metricsServerAvailable: false,
|
|
137
|
+
selectedNamespaces: ["istio-system"],
|
|
138
|
+
}),
|
|
139
|
+
);
|
|
140
|
+
expect(text).not.toContain("Used (whole cluster)");
|
|
141
|
+
expect(text).toContain("Requested (in istio-system)");
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("handles older Radar without requestsNamespaces by falling back to picked namespaces", () => {
|
|
145
|
+
const single = textContent(
|
|
146
|
+
renderCard({
|
|
147
|
+
metrics: baseMetrics({ requestsNamespaces: undefined }),
|
|
148
|
+
selectedNamespaces: ["istio-system"],
|
|
149
|
+
}),
|
|
150
|
+
);
|
|
151
|
+
expect(single).toContain("Used (whole cluster)");
|
|
152
|
+
expect(single).toContain("Requested (in istio-system)");
|
|
153
|
+
|
|
154
|
+
const multi = textContent(
|
|
155
|
+
renderCard({
|
|
156
|
+
metrics: baseMetrics({ requestsNamespaces: undefined }),
|
|
157
|
+
selectedNamespaces: ["app-b", "app-a"],
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
expect(multi).toContain("Requested (in 2 namespaces)");
|
|
161
|
+
|
|
162
|
+
const unscoped = textContent(
|
|
163
|
+
renderCard({
|
|
164
|
+
metrics: baseMetrics({ requestsNamespaces: undefined }),
|
|
165
|
+
selectedNamespaces: [],
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
expect(unscoped).not.toContain("whole cluster");
|
|
169
|
+
expect(unscoped).toContain("Used: 32 GiB / 64 GiB");
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it("shows requests as unavailable instead of 0% when no pod namespaces were read", () => {
|
|
173
|
+
const text = textContent(
|
|
174
|
+
renderCard({
|
|
175
|
+
metrics: baseMetrics({
|
|
176
|
+
cpu: { usageMillis: 2500, requestsMillis: 0, capacityMillis: 8000, usagePercent: 31, requestPercent: 0 },
|
|
177
|
+
memory: { usageMillis: 32 * 1024, requestsMillis: 0, capacityMillis: 64 * 1024, usagePercent: 50, requestPercent: 0 },
|
|
178
|
+
requestsNamespaces: { count: 0, names: [] },
|
|
179
|
+
}),
|
|
180
|
+
selectedNamespaces: ["uncollected-ns"],
|
|
181
|
+
}),
|
|
182
|
+
);
|
|
183
|
+
expect(text).toContain("Used (whole cluster)");
|
|
184
|
+
expect(text).toContain("Requested: unavailable (no pods read in this scope)");
|
|
185
|
+
expect(text).not.toMatch(/(?<!\d)0%/);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
@@ -5,6 +5,7 @@ import { notReadyTooltip } from '../diagnose/LocalDiagnoseAction'
|
|
|
5
5
|
import { useNavCustomization } from '../../context/NavCustomization'
|
|
6
6
|
import { Tooltip } from '../ui/Tooltip'
|
|
7
7
|
import { MCPSetupDialog } from './MCPSetupDialog'
|
|
8
|
+
import { McpCloudLine } from './McpCloudLine'
|
|
8
9
|
|
|
9
10
|
// The Home card's AI entry: start an investigation with the user's own agent,
|
|
10
11
|
// and connect an agent to this Radar's MCP server. The investigation line
|
|
@@ -66,6 +67,7 @@ export function HomeAgentBlock({
|
|
|
66
67
|
vulnerabilityTools={vulnerabilityTools}
|
|
67
68
|
onInvestigate={showInvestigate && d.available ? () => openComposer(d) : undefined}
|
|
68
69
|
applicationEvidenceAvailable={applicationEvidenceAvailable}
|
|
70
|
+
cloudLine={<McpCloudLine onBeforeOpen={() => setMcpDialogOpen(false)} />}
|
|
69
71
|
/>
|
|
70
72
|
</div>
|
|
71
73
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
2
|
import { useCloudConnectSelf, useDashboard, useDashboardCRDs, useDashboardHelm, useIssues, useVersionCheck, type IssuesResponse } from '../../api/client'
|
|
3
3
|
import { useConnection } from '../../context/ConnectionContext'
|
|
4
4
|
import type { ClusterLoadState } from '../../types/clusterLoadState'
|
|
5
|
-
import type { ExtendedMainView,
|
|
5
|
+
import type { ExtendedMainView, SelectedResource } from '../../types'
|
|
6
6
|
import { TopologyPreview } from './TopologyPreview'
|
|
7
7
|
import { HelmSummary } from './HelmSummary'
|
|
8
8
|
import { ActivitySummary } from './ActivitySummary'
|
|
@@ -44,9 +44,8 @@ import { HOVER_REVEAL_ACTION, HOVER_REVEAL_HIT, HOVER_REVEAL_REST } from '../../
|
|
|
44
44
|
|
|
45
45
|
interface HomeViewProps {
|
|
46
46
|
namespaces: string[]
|
|
47
|
-
topology: Topology | null
|
|
48
47
|
onNavigateToView: (view: ExtendedMainView, params?: Record<string, string>) => void
|
|
49
|
-
onNavigateToIssue?: (
|
|
48
|
+
onNavigateToIssue?: (issue: Issue) => void
|
|
50
49
|
onNavigateToResourceKind: (kind: string, group?: string, filters?: Record<string, string[]>) => void
|
|
51
50
|
onNavigateToResource: (resource: SelectedResource) => void
|
|
52
51
|
fallbackClusterLoadState?: ClusterLoadState
|
|
@@ -63,7 +62,7 @@ interface HomeViewProps {
|
|
|
63
62
|
onNavigateToManagerPath?: (path: string) => void
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
export function HomeView({ namespaces,
|
|
65
|
+
export function HomeView({ namespaces, fallbackClusterLoadState, onNavigateToView, onNavigateToIssue, onNavigateToResourceKind, onNavigateToResource, onNavigateToCerts, onNavigateToUpgradeImpact, onNavigateToHelmRelease, onNavigateToManagerPath }: HomeViewProps) {
|
|
67
66
|
// The card itself decides whether the cluster has a capacity story
|
|
68
67
|
// (available, softened-denied, or karpenterless-with-managers/groups) and
|
|
69
68
|
// returns null otherwise — the outer gate only excludes states with nothing
|
|
@@ -87,25 +86,6 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
87
86
|
&& getVersionUpdateStatus(versionInfo.currentVersion, versionInfo.latestVersion).tier !== 'none'
|
|
88
87
|
const { data: installationManager, isLoading: installationManagerLoading } = useCloudConnectSelf(showHomeUpgrade)
|
|
89
88
|
|
|
90
|
-
// SSE is cluster-wide on small/medium clusters; the picker only narrows the
|
|
91
|
-
// dashboard summary, so re-apply the filter here or the legend disagrees.
|
|
92
|
-
const scopedTopology = useMemo<Topology | null>(() => {
|
|
93
|
-
if (!topology) return null
|
|
94
|
-
if (namespaces.length === 0) return topology
|
|
95
|
-
const nsSet = new Set(namespaces)
|
|
96
|
-
const nodes = topology.nodes.filter(n => {
|
|
97
|
-
const ns = n.data.namespace as string | undefined
|
|
98
|
-
return !ns || nsSet.has(ns)
|
|
99
|
-
})
|
|
100
|
-
const nodeIds = new Set(nodes.map(n => n.id))
|
|
101
|
-
const edges = topology.edges.filter(e => nodeIds.has(e.source) && nodeIds.has(e.target))
|
|
102
|
-
// Carry the frame's own flags through the filter. A large cluster serves an
|
|
103
|
-
// empty graph flagged requiresNamespaceFilter until SSE picks the pick up
|
|
104
|
-
// server-side, and a consumer that sees only nodes/edges reads that
|
|
105
|
-
// declined build as a namespace holding nothing.
|
|
106
|
-
return { ...topology, nodes, edges }
|
|
107
|
-
}, [topology, namespaces])
|
|
108
|
-
const networkPolicyTarget = getNetworkPolicyResourceTarget(scopedTopology)
|
|
109
89
|
// CRDs and Helm load lazily after main dashboard to keep initial load fast
|
|
110
90
|
const { data: crdsData } = useDashboardCRDs(namespaces)
|
|
111
91
|
const { data: helmData } = useDashboardHelm(namespaces)
|
|
@@ -175,6 +155,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
175
155
|
cluster={data.cluster}
|
|
176
156
|
metrics={data.metrics}
|
|
177
157
|
metricsServerAvailable={data.metricsServerAvailable}
|
|
158
|
+
selectedNamespaces={namespaces}
|
|
178
159
|
topCRDs={crdsData?.topCRDs}
|
|
179
160
|
issueCount={issueCount}
|
|
180
161
|
hasCriticalIssues={hasCriticalIssues}
|
|
@@ -194,13 +175,11 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
194
175
|
These are the richest visuals and the most-used live views, so they get the width. */}
|
|
195
176
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
|
196
177
|
<TopologyPreview
|
|
197
|
-
|
|
198
|
-
namespaceSelected={namespaces.length > 0}
|
|
178
|
+
counts={data.resourceCounts}
|
|
199
179
|
onNavigate={() => onNavigateToView('topology')}
|
|
200
180
|
/>
|
|
201
181
|
<ActivitySummary
|
|
202
182
|
namespaces={namespaces}
|
|
203
|
-
topology={scopedTopology}
|
|
204
183
|
onNavigate={() => onNavigateToView('timeline')}
|
|
205
184
|
/>
|
|
206
185
|
</div>
|
|
@@ -244,6 +223,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
|
|
|
244
223
|
<NetworkPolicyCoverageCard
|
|
245
224
|
data={data.networkPolicyCoverage}
|
|
246
225
|
onNavigate={() => {
|
|
226
|
+
const networkPolicyTarget = getNetworkPolicyResourceTarget(data.networkPolicyCoverage)
|
|
247
227
|
if (networkPolicyTarget) {
|
|
248
228
|
onNavigateToResourceKind(networkPolicyTarget.kind, networkPolicyTarget.group)
|
|
249
229
|
} else {
|
|
@@ -345,7 +325,7 @@ interface ProblemsPanelProps {
|
|
|
345
325
|
error: unknown
|
|
346
326
|
totalReturned: number
|
|
347
327
|
onNavigateToIssues: () => void
|
|
348
|
-
onNavigateToIssue?: (
|
|
328
|
+
onNavigateToIssue?: (issue: Issue) => void
|
|
349
329
|
onResourceClick: (resource: SelectedResource) => void
|
|
350
330
|
}
|
|
351
331
|
|
|
@@ -480,7 +460,7 @@ export function ProblemsPanel({
|
|
|
480
460
|
onClick={() => {
|
|
481
461
|
recordUsageEvent({ type: 'ui', name: 'issue_action:open' })
|
|
482
462
|
if (onNavigateToIssue) {
|
|
483
|
-
onNavigateToIssue(issue
|
|
463
|
+
onNavigateToIssue(issue)
|
|
484
464
|
return
|
|
485
465
|
}
|
|
486
466
|
onResourceClick({
|
|
@@ -176,3 +176,12 @@ it('shows registered Helm tools independently of target namespace permissions',
|
|
|
176
176
|
const html = renderToStaticMarkup(<MCPSetupDialog open helmTools vulnerabilityTools mcpUrl={mcpEndpointUrl()} onClose={() => {}} />)
|
|
177
177
|
expect(html).toContain('manage_helm')
|
|
178
178
|
})
|
|
179
|
+
|
|
180
|
+
describe('MCP setup dialog Cloud line slot', () => {
|
|
181
|
+
it('renders the host-supplied line inside the endpoint section, before the client setup', () => {
|
|
182
|
+
const html = renderToStaticMarkup(<MCPSetupDialog open mcpUrl={mcpEndpointUrl()} onClose={() => {}} cloudLine={<p data-testid="cloud-line">cloud line</p>} />)
|
|
183
|
+
const line = html.indexOf('data-testid="cloud-line"')
|
|
184
|
+
expect(line).toBeGreaterThan(html.indexOf('>Endpoint<'))
|
|
185
|
+
expect(line).toBeLessThan(html.indexOf('Connect your AI tool'))
|
|
186
|
+
})
|
|
187
|
+
})
|