Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

phase 9 — retire stop-monitoring & legacy per-type shells

rcourtmand75b10df57ca
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index 422a9952e2..9fbff66193 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -3251,12 +3251,12 @@
},
{
"repo": "pulse",
- "path": "frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx",
+ "path": "frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx",
"kind": "file"
},
{
"repo": "pulse",
- "path": "frontend-modern/src/components/Settings/NodeModal.tsx",
+ "path": "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx",
"kind": "file"
},
{
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index caaf13e08a..c725adde20 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -33,28 +33,26 @@ management, and fleet control surfaces.
9. `frontend-modern/src/api/agentProfiles.ts`
10. `frontend-modern/src/components/Settings/AgentProfilesPanel.tsx`
11. `frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts`
-12. `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`
-13. `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`
-14. `frontend-modern/src/components/Settings/ConnectionsTable.tsx`
-15. `frontend-modern/src/components/Settings/connectionsTableModel.ts`
-16. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`
-17. `frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts`
-18. `frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx`
-19. `frontend-modern/src/components/Settings/proxmoxSettingsModel.ts`
-20. `frontend-modern/src/components/Settings/ProxmoxDirectWorkspace.tsx`
-21. `frontend-modern/src/components/Settings/ProxmoxConfiguredNodesTable.tsx`
-22. `frontend-modern/src/components/Settings/ProxmoxDirectConnectionsCard.tsx`
-23. `frontend-modern/src/components/Settings/ProxmoxDiscoveryResultsCard.tsx`
-24. `frontend-modern/src/components/Settings/ProxmoxDeleteNodeDialog.tsx`
-25. `frontend-modern/src/components/Settings/ProxmoxNodeModalStack.tsx`
+12. `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`
+13. `frontend-modern/src/components/Settings/ConnectionsTable.tsx`
+14. `frontend-modern/src/components/Settings/connectionsTableModel.ts`
+15. `frontend-modern/src/components/Settings/useConnectionsLedger.ts`
+16. `frontend-modern/src/components/Settings/ConnectionDetailDrawer.tsx`
+17. `frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx`
+18. `frontend-modern/src/components/Settings/ConnectionEditor/AddressProbeStep.tsx`
+19. `frontend-modern/src/components/Settings/ConnectionEditor/useConnectionEditor.ts`
+20. `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx`
+21. `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx`
+22. `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx`
+23. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`
+24. `frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts`
+25. `frontend-modern/src/components/Settings/proxmoxSettingsModel.ts`
26. `frontend-modern/src/components/Settings/ConfiguredNodeTables.tsx`
27. `frontend-modern/src/components/Settings/SettingsSectionNav.tsx`
28. `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`
29. `frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts`
-30. `frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts`
-31. `frontend-modern/src/components/Settings/NodeModal.tsx`
-32. `frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx`
-33. `frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx`
+30. `frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx`
+31. `frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx`
34. `frontend-modern/src/components/Settings/nodeModalModel.ts`
35. `frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx`
36. `frontend-modern/src/components/Settings/NodeModalSetupGuideSection.tsx`
@@ -66,13 +64,8 @@ management, and fleet control surfaces.
40. `frontend-modern/src/utils/agentInstallCommand.ts`
41. `frontend-modern/src/api/nodes.ts`
42. `frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx`
-43. `frontend-modern/src/components/Settings/InfrastructureInventorySection.tsx`
-44. `frontend-modern/src/components/Settings/InfrastructureActiveRowDetails.tsx`
-45. `frontend-modern/src/components/Settings/InfrastructureIgnoredRowDetails.tsx`
-46. `frontend-modern/src/components/Settings/InfrastructureStopMonitoringDialog.tsx`
-47. `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`
-48. `frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx`
-49. `frontend-modern/src/components/Settings/infrastructureSettingsModel.ts`
+43. `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`
+44. `frontend-modern/src/components/Settings/infrastructureSettingsModel.ts`
50. `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`
51. `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`
52. `frontend-modern/src/utils/infrastructureSettingsPresentation.ts`
@@ -85,24 +78,20 @@ management, and fleet control surfaces.
59. `frontend-modern/src/utils/clusterEndpointPresentation.ts`
60. `frontend-modern/src/utils/nodeModalPresentation.ts`
61. `frontend-modern/src/utils/proxmoxSettingsPresentation.ts`
-62. `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx`
-63. `frontend-modern/src/components/Settings/platformConnectionsModel.ts`
-64. `frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx`
-65. `frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts`
-66. `frontend-modern/src/components/Settings/VMwareSettingsPanel.tsx`
-67. `frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts`
-68. `frontend-modern/src/components/Settings/MonitoredSystemAdmissionPreview.tsx`
+62. `frontend-modern/src/components/Settings/platformConnectionsModel.ts`
+63. `frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts`
+64. `frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts`
+65. `frontend-modern/src/components/Settings/MonitoredSystemAdmissionPreview.tsx`
69. `internal/hostagent/proxmox_setup.go`
## Shared Boundaries
1. `frontend-modern/src/api/agentProfiles.ts` shared with `api-contracts`: the agent profiles frontend client is both an agent lifecycle control surface and a canonical API payload contract boundary.
2. `frontend-modern/src/api/nodes.ts` shared with `api-contracts`: the shared Proxmox node client is both an agent lifecycle setup/install control surface and a canonical API payload contract boundary.
-3. `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx` shared with `api-contracts`: the infrastructure operations controller is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary.
+3. `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx` shared with `api-contracts`: the inline node credential slot is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
4. `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx` shared with `api-contracts`: the pure infrastructure operations inventory/install model is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary.
-5. `frontend-modern/src/components/Settings/MonitoredSystemAdmissionPreview.tsx` shared with `cloud-paid`: the monitored-system admission preview is both a platform-connections lifecycle surface and a canonical cloud-paid monitored-system presentation boundary.
-6. `frontend-modern/src/components/Settings/NodeModal.tsx` shared with `api-contracts`: the node setup modal render shell is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
-7. `frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx` shared with `api-contracts`: the node setup authentication section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
+4. `frontend-modern/src/components/Settings/MonitoredSystemAdmissionPreview.tsx` shared with `cloud-paid`: the monitored-system admission preview is both a platform-connections lifecycle surface and a canonical cloud-paid monitored-system presentation boundary.
+5. `frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx` shared with `api-contracts`: the node setup authentication section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
8. `frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx` shared with `api-contracts`: the node setup basic-info section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
9. `frontend-modern/src/components/Settings/nodeModalModel.ts` shared with `api-contracts`: the pure node setup modal model is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
10. `frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx` shared with `api-contracts`: the node setup monitoring section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
@@ -112,8 +101,7 @@ management, and fleet control surfaces.
14. `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts` shared with `api-contracts`: the infrastructure discovery runtime state hook is both an agent lifecycle control surface and a shared discovery/settings API contract boundary.
15. `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx` shared with `api-contracts`: the infrastructure install state hook is both an agent fleet lifecycle control surface and an API token, lookup, and install transport contract boundary.
16. `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx` shared with `api-contracts`: the shared infrastructure operations state hook is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary.
-17. `frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx` shared with `api-contracts`: the infrastructure reporting state hook is both an agent fleet lifecycle control surface and an API-backed assignment, reporting, and reconnect contract boundary.
-18. `frontend-modern/src/components/Settings/useNodeModalState.ts` shared with `api-contracts`: the node setup modal state hook is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
+17. `frontend-modern/src/components/Settings/useNodeModalState.ts` shared with `api-contracts`: the node setup modal state hook is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
19. `frontend-modern/src/utils/agentInstallCommand.ts` shared with `api-contracts`: the shared frontend install-command helper is both an agent lifecycle control surface and a canonical API/install transport contract boundary.
20. `frontend-modern/src/utils/infrastructureSettingsPresentation.ts` shared with `api-contracts`: the infrastructure settings presentation helper is both an agent lifecycle control surface and an API-backed direct-node/discovery settings boundary.
21. `internal/api/agent_install_command_shared.go` shared with `api-contracts`: agent install command assembly is both an agent lifecycle control surface and a canonical API payload contract boundary.
@@ -204,7 +192,7 @@ an add-only capacity posture.
4. Keep legacy Unified Agent compatibility names explicitly secondary when touching shared `internal/api/` runtime helpers: the legacy host-route family and `host-agent:*` scope names may remain as ingress or migration aliases, but they must not retake primary ownership in router state, live runtime scope checks, handler commentary, or operator-facing guidance.
5. Add or change the unified agent CLI entrypoint, version/help exit semantics, or startup argument/error routing through `cmd/pulse-agent/main.go`.
6. Add or change installer flags, persisted service arguments, or upgrade-safe re-entry behavior through `scripts/install.sh` and `scripts/install.ps1`.
-7. Add or change profile management, the extracted agent profiles runtime owner, the top-level infrastructure ledger, the pure unified-agent inventory/install model, the connections-ledger workspace shell, route model, shared install/inventory/dialog section owners, the shared direct-node/discovery infrastructure settings owners plus their model, shared frontend install-command assembly, Proxmox setup/install API transport, TrueNAS platform-connection management, VMware platform-connection management, the shared monitored-system admission preview shell for those platform connections, setup-completion install handoff transport, deploy-fallback manual install transport, and fleet-control presentation through `frontend-modern/src/api/agentProfiles.ts`, `frontend-modern/src/api/nodes.ts`, `frontend-modern/src/components/Settings/AgentProfilesPanel.tsx`, `frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts`, `frontend-modern/src/components/Settings/ConnectionsTable.tsx`, `frontend-modern/src/components/Settings/connectionsTableModel.ts`, `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`, `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`, `frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx`, `frontend-modern/src/components/Settings/InfrastructureInventorySection.tsx`, `frontend-modern/src/components/Settings/InfrastructureActiveRowDetails.tsx`, `frontend-modern/src/components/Settings/InfrastructureIgnoredRowDetails.tsx`, `frontend-modern/src/components/Settings/InfrastructureStopMonitoringDialog.tsx`, `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`, `frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts`, `frontend-modern/src/components/Settings/MonitoredSystemAdmissionPreview.tsx`, `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx`, `frontend-modern/src/components/Settings/platformConnectionsModel.ts`, `frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx`, `frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts`, `frontend-modern/src/components/Settings/VMwareSettingsPanel.tsx`, `frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts`, `frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx`, `frontend-modern/src/components/Settings/proxmoxSettingsModel.ts`, `frontend-modern/src/components/Settings/ProxmoxDirectWorkspace.tsx`, `frontend-modern/src/components/Settings/ProxmoxConfiguredNodesTable.tsx`, `frontend-modern/src/components/Settings/ProxmoxDirectConnectionsCard.tsx`, `frontend-modern/src/components/Settings/ProxmoxDiscoveryResultsCard.tsx`, `frontend-modern/src/components/Settings/ProxmoxDeleteNodeDialog.tsx`, `frontend-modern/src/components/Settings/ProxmoxNodeModalStack.tsx`, `frontend-modern/src/components/Settings/ConfiguredNodeTables.tsx`, `frontend-modern/src/components/Settings/SettingsSectionNav.tsx`, `frontend-modern/src/components/Settings/infrastructureSettingsModel.ts`, `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`, `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`, `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`, `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`, `frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx`, `frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts`, `frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts`, `frontend-modern/src/components/Settings/NodeModal.tsx`, `frontend-modern/src/components/Settings/nodeModalModel.ts`, `frontend-modern/src/components/Settings/useNodeModalState.ts`, `frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx`, and `frontend-modern/src/utils/agentInstallCommand.ts`.
+7. Add or change profile management, the extracted agent profiles runtime owner, the top-level infrastructure ledger, the pure unified-agent inventory/install model, the connections-ledger workspace shell, the unified ConnectionEditor and its per-type credential slots, route model, shared install section owner, the shared direct-node/discovery infrastructure settings owners plus their model, shared frontend install-command assembly, Proxmox setup/install API transport, TrueNAS platform-connection management, VMware platform-connection management, the shared monitored-system admission preview shell for those platform connections, setup-completion install handoff transport, deploy-fallback manual install transport, and fleet-control presentation through `frontend-modern/src/api/agentProfiles.ts`, `frontend-modern/src/api/nodes.ts`, `frontend-modern/src/components/Settings/AgentProfilesPanel.tsx`, `frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts`, `frontend-modern/src/components/Settings/ConnectionsTable.tsx`, `frontend-modern/src/components/Settings/connectionsTableModel.ts`, `frontend-modern/src/components/Settings/useConnectionsLedger.ts`, `frontend-modern/src/components/Settings/ConnectionDetailDrawer.tsx`, `frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx`, `frontend-modern/src/components/Settings/ConnectionEditor/AddressProbeStep.tsx`, `frontend-modern/src/components/Settings/ConnectionEditor/useConnectionEditor.ts`, `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx`, `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx`, `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx`, `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`, `frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx`, `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`, `frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts`, `frontend-modern/src/components/Settings/MonitoredSystemAdmissionPreview.tsx`, `frontend-modern/src/components/Settings/platformConnectionsModel.ts`, `frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts`, `frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts`, `frontend-modern/src/components/Settings/proxmoxSettingsModel.ts`, `frontend-modern/src/components/Settings/ConfiguredNodeTables.tsx`, `frontend-modern/src/components/Settings/SettingsSectionNav.tsx`, `frontend-modern/src/components/Settings/infrastructureSettingsModel.ts`, `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`, `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`, `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`, `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`, `frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts`, `frontend-modern/src/components/Settings/nodeModalModel.ts`, `frontend-modern/src/components/Settings/useNodeModalState.ts`, `frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx`, and `frontend-modern/src/utils/agentInstallCommand.ts`. Phase 9 retired the legacy reporting/inventory surface (InfrastructureOperationsController, InfrastructureInventorySection, InfrastructureActiveRowDetails, InfrastructureIgnoredRowDetails, InfrastructureStopMonitoringDialog, useInfrastructureReportingState) and the per-type shells (PlatformConnectionsWorkspace, ProxmoxSettingsPanel, ProxmoxDirectWorkspace, ProxmoxConfiguredNodesTable, ProxmoxDirectConnectionsCard, ProxmoxDiscoveryResultsCard, ProxmoxDeleteNodeDialog, ProxmoxNodeModalStack, NodeModal shell, TrueNASSettingsPanel, VMwareSettingsPanel, useProxmoxDirectWorkspaceState); lifecycle extensions must route through the unified aggregator ledger plus ConnectionEditor credential slots rather than reintroducing those retired surfaces.
Those lifecycle-owned settings hooks may consume websocket state only through `frontend-modern/src/contexts/appRuntime.ts`; they must not import `frontend-modern/src/App.tsx` or recreate root-shell providers.
Public demo and other read-only settings posture must stay reporting-first
on that same lifecycle-owned workspace boundary: infrastructure workspace
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index e0cee8c9fb..91b89feaab 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -10,6 +10,7 @@
"status_file": "docs/release-control/v6/internal/status.json",
"registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
"dependency_subsystem_ids": [
+ "agent-lifecycle",
"ai-runtime",
"cloud-paid",
"patrol-intelligence"
@@ -30,12 +31,10 @@ Own canonical runtime payload shapes between backend and frontend.
6. `frontend-modern/src/api/responseUtils.ts`
7. `frontend-modern/src/components/Settings/APITokenManager.tsx`
8. `frontend-modern/src/components/Settings/apiTokenManagerModel.ts`
-9. `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`
-10. `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`
-11. `frontend-modern/src/components/Settings/useAPITokenManagerState.ts`
-12. `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`
-13. `frontend-modern/src/components/Settings/NodeModal.tsx`
-14. `frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx`
+9. `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`
+10. `frontend-modern/src/components/Settings/useAPITokenManagerState.ts`
+11. `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`
+12. `frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx`
15. `frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx`
16. `frontend-modern/src/components/Settings/nodeModalModel.ts`
17. `frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx`
@@ -50,8 +49,7 @@ Own canonical runtime payload shapes between backend and frontend.
26. `frontend-modern/src/api/monitoring.ts`
27. `internal/api/monitored_system_ledger.go`
28. `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`
-29. `frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx`
-30. `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`
+29. `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`
31. `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`
32. `frontend-modern/src/utils/apiTokenPresentation.ts`
33. `frontend-modern/src/utils/infrastructureSettingsPresentation.ts`
@@ -98,10 +96,9 @@ Own canonical runtime payload shapes between backend and frontend.
9. `frontend-modern/src/api/updates.ts` shared with `deployment-installability`: the updates frontend client is both a deployment-installability control surface and a canonical API payload contract boundary.
10. `frontend-modern/src/components/Settings/APITokenManager.tsx` shared with `security-privacy`: the API token settings surface is both a security/privacy control surface and a canonical API payload contract boundary.
11. `frontend-modern/src/components/Settings/apiTokenManagerModel.ts` shared with `security-privacy`: the pure API token settings model is both a security/privacy control surface and a canonical API payload contract boundary.
-12. `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx` shared with `agent-lifecycle`: the infrastructure operations controller is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary.
+12. `frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx` shared with `agent-lifecycle`: the inline node credential slot is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
13. `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx` shared with `agent-lifecycle`: the pure infrastructure operations inventory/install model is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary.
-14. `frontend-modern/src/components/Settings/NodeModal.tsx` shared with `agent-lifecycle`: the node setup modal render shell is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
-15. `frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx` shared with `agent-lifecycle`: the node setup authentication section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
+13. `frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx` shared with `agent-lifecycle`: the node setup authentication section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
16. `frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx` shared with `agent-lifecycle`: the node setup basic-info section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
17. `frontend-modern/src/components/Settings/nodeModalModel.ts` shared with `agent-lifecycle`: the pure node setup modal model is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
18. `frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx` shared with `agent-lifecycle`: the node setup monitoring section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
@@ -113,8 +110,7 @@ Own canonical runtime payload shapes between backend and frontend.
That same shared boundary also owns settings-route polling scope for discovery payloads: the `/api/discover` refresh loop and websocket-backed discovery status hydration may run only while the operator is on the infrastructure connections workspace under `/settings/infrastructure/platforms*`, not on the systems ledger or install workspace.
24. `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx` shared with `agent-lifecycle`: the infrastructure install state hook is both an agent fleet lifecycle control surface and an API token, lookup, and install transport contract boundary.
25. `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx` shared with `agent-lifecycle`: the shared infrastructure operations state hook is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary.
-26. `frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx` shared with `agent-lifecycle`: the infrastructure reporting state hook is both an agent fleet lifecycle control surface and an API-backed assignment, reporting, and reconnect contract boundary.
-27. `frontend-modern/src/components/Settings/useNodeModalState.ts` shared with `agent-lifecycle`: the node setup modal state hook is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
+26. `frontend-modern/src/components/Settings/useNodeModalState.ts` shared with `agent-lifecycle`: the node setup modal state hook is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary.
28. `frontend-modern/src/utils/agentInstallCommand.ts` shared with `agent-lifecycle`: the shared frontend install-command helper is both an agent lifecycle control surface and a canonical API/install transport contract boundary.
29. `frontend-modern/src/utils/apiTokenPresentation.ts` shared with `security-privacy`: the API token presentation helper is both a security/privacy control surface and a canonical API token management boundary.
30. `frontend-modern/src/utils/infrastructureSettingsPresentation.ts` shared with `agent-lifecycle`: the infrastructure settings presentation helper is both an agent lifecycle control surface and an API-backed direct-node/discovery settings boundary.
@@ -202,7 +198,7 @@ the canonical monitored-system blocked payload.
and the Patrol route-shell destination itself, so the thin page shell at `frontend-modern/src/pages/AIIntelligence.tsx` may continue to bridge the shared AI-runtime payload boundary while exposing `/patrol` as the canonical product route and preserving `/ai` only as a compatibility redirect
9. Route frontend API-client parsed error propagation, API-error-status fallback handling, allowed-status handling, custom status-specific error handling, command-trigger success envelope handling, shared response parsing pipelines, missing-resource lookup handling, metadata CRUD routing, stream event consumption, response status, collection normalization, scalar payload coercion, and structured error normalization through canonical shared helpers under `frontend-modern/src/api/`
10. Add or change API token scope, assignment, and revocation presentation through `frontend-modern/src/components/Settings/APITokenManager.tsx`, `frontend-modern/src/components/Settings/apiTokenManagerModel.ts`, and `frontend-modern/src/components/Settings/useAPITokenManagerState.ts`
-11. Add or change infrastructure operations token generation, lookup, assignment, the pure unified-agent inventory/install model, the split infrastructure install/reporting state owners, the split direct-node/discovery infrastructure settings owners, the shared infrastructure-operations state provider/context shell, and reporting/install presentation through `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`, `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`, `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`, `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`, `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`, `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`, and `frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx`
+11. Add or change infrastructure operations token generation, lookup, assignment, the pure unified-agent inventory/install model, the split infrastructure install state owner, the split direct-node/discovery infrastructure settings owners, the shared infrastructure-operations state provider/context shell, and install presentation through `frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`, `frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts`, `frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts`, `frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx`, and `frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx`. Phase 9 retired the InfrastructureOperationsController shell and the useInfrastructureReportingState reporting path; they must not be reintroduced, and aggregator-backed reporting reads are owned by `frontend-modern/src/components/Settings/useConnectionsLedger.ts` under the frontend-primitives contract.
That same governed infrastructure-operations API boundary also owns discovery polling activation: the shared discovery runtime may only poll `/api/discover` while the settings shell has the `infrastructure-connections` route active, so route-level IA changes cannot silently keep discovery traffic alive on unrelated systems or install screens.
12. Keep `internal/api/session_store.go` on a fail-closed auth-persistence boundary: persisted OIDC refresh tokens may only round-trip through encrypted-at-rest session payloads, and any missing-crypto or invalid-ciphertext path must drop the token instead of preserving plaintext-at-rest session state.
13. Keep tenant AI handler wiring on canonical provider ownership: `internal/api/ai_handlers.go` may wire tenant `ReadState` and tenant-scoped unified-resource providers into AI services, but it must not revive tenant snapshot-provider bridges once Patrol can initialize and verify from those canonical providers directly.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index b116ec416c..17f30876d8 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -213,7 +213,7 @@ work extends shared components instead of creating new local variants.
helper plus runtime `monitored_system_capacity` reads rather than
reconstructing raw `current / limit` slash math or `0 remaining` copy in
the banner shell, state owner, or shared model.
-5. Keep shared platform-connections shell state on the reusable settings boundary: `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`, `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`, and `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx` must continue to derive provider counts, availability, and shared subtab copy from one infrastructure-settings source instead of creating provider-local summary fetches or VMware-only shell vocabulary.
+5. Keep shared infrastructure shell state on the reusable settings boundary: `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts` and `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx` must continue to derive provider counts, availability, and shared subtab copy from one infrastructure-settings source — via the unified aggregator through `frontend-modern/src/components/Settings/useConnectionsLedger.ts` — instead of creating provider-local summary fetches or VMware-only shell vocabulary. Phase 9 retired the old `PlatformConnectionsWorkspace` per-type shell and the `Platform connections` nomenclature.
That same shared shell boundary now owns the default posture for
`/settings/infrastructure`: the landing route should read as one ledger-first
workspace with one row per top-level monitored system. Configured platform
@@ -261,13 +261,20 @@ work extends shared components instead of creating new local variants.
`frontend-modern/src/components/Settings/useConnectionsLedger.ts`
(polling `GET /api/connections`) and the unified row click opens
`frontend-modern/src/components/Settings/ConnectionDetailDrawer.tsx`,
- which reads the aggregator fields directly. The workspace must not
- reconstruct the table's state, coverage, or last-seen columns from
- `useInfrastructureReportingState` for configured connection rows, and
- the legacy `InfrastructureActiveRowDetails` drawer must not be
- mounted for those rows. Monitoring-stopped inventory still routes to
- `InfrastructureIgnoredRowDetails` pending phase 9 cleanup, but that
- fallback must not be extended to cover configured connections.
+ which reads the aggregator fields directly. Phase 9 retired the
+ parallel reporting/inventory surface entirely:
+ `useInfrastructureReportingState`, `InfrastructureOperationsController`,
+ `InfrastructureInventorySection`, `InfrastructureActiveRowDetails`,
+ `InfrastructureIgnoredRowDetails`, `InfrastructureStopMonitoringDialog`,
+ and the per-type shells `PlatformConnectionsWorkspace`,
+ `ProxmoxSettingsPanel`, `ProxmoxDirectWorkspace`, `NodeModal.tsx`,
+ `TrueNASSettingsPanel`, and `VMwareSettingsPanel` no longer exist.
+ The aggregator plus `ConnectionEditor` is the only path; no
+ parallel reporting state, stop-surface dialog, ignored-row fallback,
+ or per-type workspace may be reintroduced. `connectionsTableModel.ts`
+ carries only the connection-scoped `SystemManageAction` variant —
+ `inventory-active` / `inventory-ignored` manage kinds must not
+ return.
6. Keep Proxmox deep-link route selection on the shared settings-navigation boundary. `frontend-modern/src/components/Settings/settingsNavigationModel.ts` and `frontend-modern/src/components/Settings/useSettingsNavigation.ts` must treat the canonical PBS and PMG Proxmox deep links as agent-selection authority even though those URLs resolve to the shared `infrastructure-operations` tab. Reloading or remounting on a PBS or PMG deep link must not silently fall back to the PVE selector state.
7. Keep shared storage feature presenters on canonical platform truth. When reusable storage presenters under `frontend-modern/src/features/storageBackups/` classify canonical resources for the shared storage route, API-backed virtualization datastores such as VMware must stay inventory-only datastores instead of inheriting PBS-specific backup-repository or protected-target copy from older fallback branches.
8. Keep shared source/platform vocabulary on the governed manifest boundary. `frontend-modern/src/utils/platformSupportManifest.generated.ts` must be the tracked frontend projection of `docs/release-control/v6/internal/PLATFORM_SUPPORT_MANIFEST.json`, `frontend-modern/src/utils/platformSupportManifest.ts`, `frontend-modern/src/utils/sourcePlatforms.ts`, and `frontend-modern/src/utils/sourcePlatformOptions.ts` must consume that generated projection instead of embedding divergent future-label lists, setup/onboarding path allowlists, or presentation-only guesses, and `frontend-modern/scripts/canonical-platform-audit.mjs` must fail when the generated projection drifts from the governed manifest.
@@ -563,20 +570,26 @@ connections` visible as the API-backed alternative for Proxmox and
shared page.
29. Keep infrastructure settings-shell API alternatives on the shared shell
contract. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`,
- `frontend-modern/src/components/Settings/settingsHeaderMeta.ts`,
- `frontend-modern/src/components/Settings/settingsNavigationModel.ts`, and
- shared empty-state/setup guidance must
- present `Platform connections` as the canonical API-backed alternative for
- Proxmox, TrueNAS, and future provider integrations instead of reviving
- top-level `Direct Proxmox` wording or shell-local provider routes.
-30. Keep the infrastructure settings platform-connections summary and provider
- workspaces on one shared state source. `frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts`,
- `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`,
- `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`,
- `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx`, and `frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx` must
- derive TrueNAS connection counts and availability from the shared
- infrastructure settings state instead of letting the top-level ledger and
- the provider-specific panel issue separate connection fetches.
+ `frontend-modern/src/components/Settings/settingsHeaderMeta.ts`, and
+ `frontend-modern/src/components/Settings/settingsNavigationModel.ts` must
+ present the unified add flow as the canonical API-backed entry for
+ Proxmox, TrueNAS, VMware, and future provider integrations instead of
+ reviving top-level `Direct Proxmox` wording or shell-local provider
+ routes. Phase 9 retired the `Platform connections` nomenclature along
+ with the shells that owned it — there is no `PlatformConnectionsWorkspace`
+ and no per-type `ProxmoxSettingsPanel` / `TrueNASSettingsPanel` /
+ `VMwareSettingsPanel` to route through; the provider is a field inside
+ one `ConnectionEditor`, not a destination.
+30. Keep the infrastructure settings connection inventory on one shared
+ source. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`
+ composes rows exclusively from
+ `frontend-modern/src/components/Settings/useConnectionsLedger.ts`,
+ which polls `GET /api/connections`. Provider connection counts and
+ availability must derive from that aggregator, not from a top-level
+ ledger plus parallel provider-specific fetches. The retired
+ `PlatformConnectionsWorkspace` / `TrueNASSettingsPanel` /
+ `VMwareSettingsPanel` panels must not be reintroduced as a second
+ fetch path.
31. Keep alert-history feature composition on the current owned state contract.
`frontend-modern/src/features/alerts/tabs/HistoryTab.tsx` must react to the
shared `alertData()` history state instead of reviving deleted aliases, and
@@ -2199,28 +2212,34 @@ reference cases, and
locks that direct-root contract so single-surface pages do not quietly regain
redundant outer spacing chrome.
The same shared settings-shell boundary now also owns the API-backed
-alternative path inside Infrastructure. `frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`,
+alternative path inside Infrastructure.
+`frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`,
`frontend-modern/src/components/Settings/settingsHeaderMeta.ts`,
-`frontend-modern/src/components/Settings/settingsNavigationModel.ts`, `frontend-modern/src/utils/dashboardEmptyStatePresentation.ts`,
-`frontend-modern/src/utils/infrastructureEmptyStatePresentation.ts`, and adjacent setup guidance must
-treat `Platform connections` as the canonical API-backed alternative for
-Proxmox, TrueNAS, and future provider integrations instead of reviving
-top-level `Direct Proxmox` wording or shell-local provider routes.
-That same settings-shell contract also owns the shared platform-connections
-summary state. `frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts`,
+`frontend-modern/src/components/Settings/settingsNavigationModel.ts`,
+`frontend-modern/src/utils/dashboardEmptyStatePresentation.ts`,
+`frontend-modern/src/utils/infrastructureEmptyStatePresentation.ts`, and
+adjacent setup guidance may still use `Platform connections` as the
+operator-facing first-run label for API-backed onboarding, but that label must
+resolve to the shared `Infrastructure` destination and its inline
+`ConnectionEditor` add flow rather than reviving a standalone platform shell
+or provider-local route.
+That same settings-shell contract also owns the shared infrastructure summary
+state. `frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts`,
`frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`,
`frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx`,
-`frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx`, `frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx`, and
-`frontend-modern/src/components/Settings/VMwareSettingsPanel.tsx` must derive Proxmox/PBS/PMG/TrueNAS/VMware counts
-and availability from one shared infrastructure settings state source instead
-of letting the top-level ledger and the provider-specific panels fetch the
-same connection state separately.
+`frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts`, and
+`frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts` must
+derive Proxmox/PBS/PMG/TrueNAS/VMware counts and availability from one shared
+infrastructure settings state source instead of letting the top-level ledger
+and inline credential flows fetch the same connection state separately. Phase
+9 retired the standalone `PlatformConnectionsWorkspace.tsx`,
+`TrueNASSettingsPanel.tsx`, and `VMwareSettingsPanel.tsx` shells; they remain
+labels and proof history, not live presentation surfaces.
That same shared settings-shell boundary also owns provider parity inside the
-platform workspace. Adding VMware to the shared `Platform connections`
-subtabs may extend the same card, empty-state, dialog, and summary-shell
-patterns used by TrueNAS, but it must not introduce a VMware-only outer page
-shell, alternate settings route hierarchy, or another summary vocabulary for
-connection health and contribution counts.
+inline add flow. Adding VMware may extend the same card, empty-state, dialog,
+and summary-shell patterns used by TrueNAS, but it must not introduce a
+VMware-only outer page shell, alternate settings route hierarchy, or another
+summary vocabulary for connection health and contribution counts.
That same shared filter-presentation boundary also owns infrastructure
route-filter continuity. `frontend-modern/src/features/infrastructure/`
must keep a route-owned canonical source option such as `truenas` visible in
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index adf74687b4..a5da1f59b4 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -202,19 +202,19 @@
]
},
{
- "path": "frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx",
- "rationale": "the general settings privacy panel is both a security/privacy control surface and a canonical settings-shell presentation boundary",
+ "path": "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx",
+ "rationale": "the inline node credential slot is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary",
"subsystems": [
- "frontend-primitives",
- "security-privacy"
+ "agent-lifecycle",
+ "api-contracts"
]
},
{
- "path": "frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx",
- "rationale": "the infrastructure operations controller is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary",
+ "path": "frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx",
+ "rationale": "the general settings privacy panel is both a security/privacy control surface and a canonical settings-shell presentation boundary",
"subsystems": [
- "agent-lifecycle",
- "api-contracts"
+ "frontend-primitives",
+ "security-privacy"
]
},
{
@@ -233,14 +233,6 @@
"cloud-paid"
]
},
- {
- "path": "frontend-modern/src/components/Settings/NodeModal.tsx",
- "rationale": "the node setup modal render shell is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary",
- "subsystems": [
- "agent-lifecycle",
- "api-contracts"
- ]
- },
{
"path": "frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx",
"rationale": "the node setup authentication section is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary",
@@ -345,14 +337,6 @@
"api-contracts"
]
},
- {
- "path": "frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx",
- "rationale": "the infrastructure reporting state hook is both an agent fleet lifecycle control surface and an API-backed assignment, reporting, and reconnect contract boundary",
- "subsystems": [
- "agent-lifecycle",
- "api-contracts"
- ]
- },
{
"path": "frontend-modern/src/components/Settings/useNodeModalState.ts",
"rationale": "the node setup modal state hook is both an agent lifecycle control surface and a shared API-backed install/setup contract boundary",
@@ -602,20 +586,21 @@
"frontend-modern/src/components/Infrastructure/deploy/ResultsStep.tsx",
"frontend-modern/src/components/Settings/AgentProfilesPanel.tsx",
"frontend-modern/src/components/Settings/ConfiguredNodeTables.tsx",
+ "frontend-modern/src/components/Settings/ConnectionDetailDrawer.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/AddressProbeStep.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/useConnectionEditor.ts",
"frontend-modern/src/components/Settings/ConnectionsTable.tsx",
"frontend-modern/src/components/Settings/connectionsTableModel.ts",
- "frontend-modern/src/components/Settings/InfrastructureActiveRowDetails.tsx",
- "frontend-modern/src/components/Settings/InfrastructureIgnoredRowDetails.tsx",
"frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx",
- "frontend-modern/src/components/Settings/InfrastructureInventorySection.tsx",
- "frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx",
"frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx",
"frontend-modern/src/components/Settings/infrastructureSettingsModel.ts",
- "frontend-modern/src/components/Settings/InfrastructureStopMonitoringDialog.tsx",
"frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx",
"frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts",
"frontend-modern/src/components/Settings/MonitoredSystemAdmissionPreview.tsx",
- "frontend-modern/src/components/Settings/NodeModal.tsx",
"frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx",
"frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx",
"frontend-modern/src/components/Settings/nodeModalModel.ts",
@@ -623,29 +608,18 @@
"frontend-modern/src/components/Settings/NodeModalSetupGuideSection.tsx",
"frontend-modern/src/components/Settings/NodeModalStatusFooter.tsx",
"frontend-modern/src/components/Settings/platformConnectionsModel.ts",
- "frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx",
- "frontend-modern/src/components/Settings/ProxmoxConfiguredNodesTable.tsx",
- "frontend-modern/src/components/Settings/ProxmoxDeleteNodeDialog.tsx",
- "frontend-modern/src/components/Settings/ProxmoxDirectConnectionsCard.tsx",
- "frontend-modern/src/components/Settings/ProxmoxDirectWorkspace.tsx",
- "frontend-modern/src/components/Settings/ProxmoxDiscoveryResultsCard.tsx",
- "frontend-modern/src/components/Settings/ProxmoxNodeModalStack.tsx",
"frontend-modern/src/components/Settings/proxmoxSettingsModel.ts",
- "frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx",
"frontend-modern/src/components/Settings/SettingsSectionNav.tsx",
- "frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx",
"frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts",
+ "frontend-modern/src/components/Settings/useConnectionsLedger.ts",
"frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts",
"frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts",
"frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx",
"frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx",
- "frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx",
"frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts",
"frontend-modern/src/components/Settings/useNodeModalState.ts",
- "frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts",
"frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts",
"frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts",
- "frontend-modern/src/components/Settings/VMwareSettingsPanel.tsx",
"frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx",
"frontend-modern/src/utils/agentCapabilityPresentation.ts",
"frontend-modern/src/utils/agentInstallCommand.ts",
@@ -791,7 +765,6 @@
"exact_files": [
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/agentProfilesPresentation.test.ts"
]
},
@@ -826,7 +799,7 @@
"label": "node setup/install command proof",
"match_prefixes": [],
"match_files": [
- "frontend-modern/src/components/Settings/NodeModal.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx",
"frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx",
"frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx",
"frontend-modern/src/components/Settings/nodeModalModel.ts",
@@ -839,7 +812,8 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts",
+ "frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
+ "frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts",
"frontend-modern/src/utils/__tests__/nodeModalPresentation.test.ts"
]
},
@@ -874,23 +848,16 @@
"label": "unified agent settings lifecycle proof",
"match_prefixes": [],
"match_files": [
- "frontend-modern/src/components/Settings/InfrastructureActiveRowDetails.tsx",
- "frontend-modern/src/components/Settings/InfrastructureIgnoredRowDetails.tsx",
"frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx",
- "frontend-modern/src/components/Settings/InfrastructureInventorySection.tsx",
- "frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx",
"frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx",
- "frontend-modern/src/components/Settings/InfrastructureStopMonitoringDialog.tsx",
"frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx",
- "frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx",
- "frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx"
+ "frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx"
],
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx"
]
},
@@ -906,7 +873,6 @@
"test_prefixes": [],
"exact_files": [
"frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts",
"frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
"frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts"
]
@@ -917,44 +883,37 @@
"match_prefixes": [],
"match_files": [
"frontend-modern/src/components/Settings/ConfiguredNodeTables.tsx",
+ "frontend-modern/src/components/Settings/ConnectionDetailDrawer.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/AddressProbeStep.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/useConnectionEditor.ts",
"frontend-modern/src/components/Settings/infrastructureSettingsModel.ts",
"frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx",
"frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts",
"frontend-modern/src/components/Settings/MonitoredSystemAdmissionPreview.tsx",
"frontend-modern/src/components/Settings/platformConnectionsModel.ts",
- "frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx",
- "frontend-modern/src/components/Settings/ProxmoxConfiguredNodesTable.tsx",
- "frontend-modern/src/components/Settings/ProxmoxDeleteNodeDialog.tsx",
- "frontend-modern/src/components/Settings/ProxmoxDirectConnectionsCard.tsx",
- "frontend-modern/src/components/Settings/ProxmoxDirectWorkspace.tsx",
- "frontend-modern/src/components/Settings/ProxmoxDiscoveryResultsCard.tsx",
- "frontend-modern/src/components/Settings/ProxmoxNodeModalStack.tsx",
"frontend-modern/src/components/Settings/proxmoxSettingsModel.ts",
- "frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx",
"frontend-modern/src/components/Settings/SettingsSectionNav.tsx",
- "frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx",
+ "frontend-modern/src/components/Settings/useConnectionsLedger.ts",
"frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts",
"frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts",
"frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts",
- "frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts",
"frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts",
"frontend-modern/src/components/Settings/useVMwareSettingsPanelState.ts",
- "frontend-modern/src/components/Settings/VMwareSettingsPanel.tsx",
"frontend-modern/src/utils/clusterEndpointPresentation.ts",
"frontend-modern/src/utils/proxmoxSettingsPresentation.ts"
],
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
- "frontend-modern/src/components/Settings/__tests__/PlatformConnectionsWorkspace.test.tsx",
"frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts",
- "frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx",
"frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/VMwareSettingsPanel.test.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/__tests__/ConnectionEditor.test.tsx",
"frontend-modern/src/utils/__tests__/clusterEndpointPresentation.test.ts",
"frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts",
"frontend-modern/src/utils/__tests__/proxmoxSettingsPresentation.test.ts",
@@ -977,7 +936,6 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/agentCapabilityPresentation.test.ts",
"frontend-modern/src/utils/__tests__/agentProfileSuggestionPresentation.test.ts",
"frontend-modern/src/utils/__tests__/configuredNodeCapabilityPresentation.test.ts",
@@ -1106,7 +1064,6 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/aiChatPresentation.test.ts",
"frontend-modern/src/utils/__tests__/aiControlLevelPresentation.test.ts",
"frontend-modern/src/utils/__tests__/aiExplorePresentation.test.ts",
@@ -1275,7 +1232,6 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/alertActivationPresentation.test.ts",
"frontend-modern/src/utils/__tests__/alertAdministrationPresentation.test.ts",
"frontend-modern/src/utils/__tests__/alertBulkEditPresentation.test.ts",
@@ -1391,9 +1347,8 @@
"owned_files": [
"frontend-modern/src/components/Settings/APITokenManager.tsx",
"frontend-modern/src/components/Settings/apiTokenManagerModel.ts",
- "frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx",
"frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx",
- "frontend-modern/src/components/Settings/NodeModal.tsx",
"frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx",
"frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx",
"frontend-modern/src/components/Settings/nodeModalModel.ts",
@@ -1405,7 +1360,6 @@
"frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts",
"frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx",
"frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx",
- "frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx",
"frontend-modern/src/components/Settings/useNodeModalState.ts",
"frontend-modern/src/types/api.ts",
"frontend-modern/src/utils/agentInstallCommand.ts",
@@ -1593,7 +1547,7 @@
"label": "node setup client consumer proof",
"match_prefixes": [],
"match_files": [
- "frontend-modern/src/components/Settings/NodeModal.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx",
"frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx",
"frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx",
"frontend-modern/src/components/Settings/nodeModalModel.ts",
@@ -1606,7 +1560,8 @@
"test_prefixes": [],
"exact_files": [
"frontend-modern/src/api/__tests__/nodes.test.ts",
- "frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts",
+ "frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
+ "frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts",
"frontend-modern/src/types/api.ts"
]
},
@@ -1658,13 +1613,11 @@
"label": "infrastructure operations API proof",
"match_prefixes": [],
"match_files": [
- "frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx",
"frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx",
"frontend-modern/src/components/Settings/useInfrastructureConfiguredNodesState.ts",
"frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts",
"frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx",
- "frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx",
- "frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx"
+ "frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx"
],
"allow_same_subsystem_tests": false,
"test_prefixes": [],
@@ -1672,7 +1625,6 @@
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
"frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx"
]
},
@@ -1726,6 +1678,7 @@
"frontend-modern/src/pages/CloudPricing.tsx",
"frontend-modern/src/pages/HostedSignup.tsx",
"frontend-modern/src/pages/PricingHandoff.tsx",
+ "frontend-modern/src/pages/RuntimeHome.tsx",
"frontend-modern/src/useAppRuntimeState.ts",
"frontend-modern/src/utils/apiClient.ts",
"frontend-modern/src/utils/cloudPlans.ts",
@@ -2237,8 +2190,6 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/VMwareSettingsPanel.test.tsx",
"frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts",
"tests/integration/tests/21-truenas-settings-platform-connections.spec.ts",
"tests/integration/tests/22-vmware-settings-platform-connections.spec.ts"
@@ -2255,7 +2206,6 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/licensePresentation.test.ts",
"frontend-modern/src/utils/__tests__/upgradePresentation.test.ts"
]
@@ -2352,6 +2302,19 @@
"frontend-modern/src/utils/__tests__/pricingHandoff.test.ts"
]
},
+ {
+ "id": "runtime-home-landing",
+ "label": "hosted runtime landing proof",
+ "match_prefixes": [],
+ "match_files": [
+ "frontend-modern/src/pages/RuntimeHome.tsx"
+ ],
+ "allow_same_subsystem_tests": false,
+ "test_prefixes": [],
+ "exact_files": [
+ "frontend-modern/src/pages/__tests__/RuntimeHome.test.tsx"
+ ]
+ },
{
"id": "checkout-funnel-analytics",
"label": "checkout funnel analytics proof",
@@ -2984,7 +2947,6 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/dashboardEmptyStatePresentation.test.ts",
"frontend-modern/src/utils/__tests__/dashboardGuestPresentation.test.ts",
"frontend-modern/src/utils/__tests__/dashboardKpiPresentation.test.ts",
@@ -3694,7 +3656,6 @@
"test_prefixes": [],
"exact_files": [
"frontend-modern/src/api/__tests__/orgs.test.ts",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/components/Settings/__tests__/OrganizationAccessPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/OrganizationOverviewPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/OrganizationSharingPanel.test.tsx",
@@ -3799,7 +3760,6 @@
"test_prefixes": [],
"exact_files": [
"frontend-modern/src/components/Brand/__tests__/PulsePatrolLogo.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx",
"frontend-modern/src/stores/__tests__/aiIntelligence.test.ts",
"frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts",
diff --git a/frontend-modern/src/components/Settings/InfrastructureActiveRowDetails.tsx b/frontend-modern/src/components/Settings/InfrastructureActiveRowDetails.tsx
deleted file mode 100644
index 7ff3641367..0000000000
--- a/frontend-modern/src/components/Settings/InfrastructureActiveRowDetails.tsx
+++ /dev/null
@@ -1,402 +0,0 @@
-import type { Accessor, Component } from 'solid-js';
-import { For, Show } from 'solid-js';
-import { useNavigate } from '@solidjs/router';
-import { copyToClipboard } from '@/utils/clipboard';
-import { formatAbsoluteTime, formatRelativeTime } from '@/utils/format';
-import { notificationStore } from '@/stores/notifications';
-import {
- getAgentCapabilityBadgeClass,
- getAgentCapabilityLabel,
-} from '@/utils/agentCapabilityPresentation';
-import {
- getUnifiedAgentClipboardCopyErrorMessage,
- getUnifiedAgentClipboardCopySuccessMessage,
-} from '@/utils/unifiedAgentInventoryPresentation';
-import {
- createSurfaceScopedRow,
- getCapabilityManagementPath,
- getRowSurfaceBreakdown,
- hasMachineInstallActions,
- type UnifiedAgentRow,
-} from './infrastructureOperationsModel';
-import { useInfrastructureOperationsContext } from './useInfrastructureOperationsState';
-
-export interface InfrastructureActiveRowDetailsProps {
- rowAccessor: Accessor<UnifiedAgentRow>;
-}
-
-export const InfrastructureActiveRowDetails: Component<InfrastructureActiveRowDetailsProps> = (
- props,
-) => {
- const state = useInfrastructureOperationsContext();
- const navigate = useNavigate();
- const row = () => props.rowAccessor();
- const isKubernetes = () =>
- row().capabilities.includes('kubernetes') && !row().capabilities.includes('agent');
- const resolvedAgentId = () => row().agentId || '';
- const assignment = () =>
- resolvedAgentId() ? state.assignmentByAgent().get(resolvedAgentId()) : undefined;
- const isScopeUpdating = () =>
- resolvedAgentId() ? Boolean(state.pendingScopeUpdates()[resolvedAgentId()]) : false;
- const agentName = () => row().displayName || row().hostname || row().name;
- const surfaces = () => getRowSurfaceBreakdown(row());
- const hasLocalMachineActions = () => hasMachineInstallActions(row()) || Boolean(row().isOutdatedBinary);
-
- return (
- <div id={`agent-details-${row().rowKey}`} class="flex h-full flex-col overflow-y-auto">
- <div class="border-b border-border bg-surface-alt px-4 py-4">
- <div class="flex items-start justify-between gap-4">
- <div class="min-w-0 space-y-3">
- <div>
- <div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted">
- Selected reporting item
- </div>
- <div class="mt-2 text-lg font-semibold text-base-content">{row().name}</div>
- <Show when={row().displayName && row().hostname && row().displayName !== row().hostname}>
- <div class="mt-1 text-xs text-muted">{row().hostname}</div>
- </Show>
- <div class="mt-2 text-sm text-base-content">
- Use surface controls to stop specific reporting without removing the machine.
- </div>
- </div>
- <div class="flex flex-wrap items-center gap-2 text-xs">
- <For each={row().capabilities}>
- {(cap) => (
- <span
- class={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${getAgentCapabilityBadgeClass(cap)}`}
- >
- {getAgentCapabilityLabel(cap)}
- </span>
- )}
- </For>
- <Show when={row().isOutdatedBinary}>
- <span class="inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-800 dark:bg-amber-900 dark:text-amber-200">
- Outdated
- </span>
- </Show>
- <Show when={row().linkedNodeId}>
- <span class="inline-flex items-center rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900 dark:text-blue-300">
- Linked
- </span>
- </Show>
- </div>
- </div>
- <button
- type="button"
- onClick={() => state.setExpandedRowKey(null)}
- class="rounded-md p-1 hover:bg-surface-hover hover:text-base-content"
- aria-label="Close"
- >
- <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M6 18L18 6M6 6l12 12"
- />
- </svg>
- </button>
- </div>
- </div>
-
- <div class="space-y-4 p-4 text-sm text-muted">
- <div class="rounded-lg border border-border bg-surface-alt px-4 py-4">
- <div class="text-xs font-semibold uppercase tracking-wide text-muted">Machine overview</div>
- <div class="mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-1">
- <div class="space-y-2 text-xs text-muted">
- <div>
- Item ID: <span class="font-mono text-base-content">{row().id}</span>
- </div>
- <Show when={row().agentActionId && row().agentActionId !== row().id}>
- <div>
- Agent ID: <span class="font-mono text-base-content">{row().agentActionId}</span>
- </div>
- </Show>
- <Show when={row().dockerActionId && row().dockerActionId !== row().id}>
- <div>
- Container Agent ID:{' '}
- <span class="font-mono text-base-content">{row().dockerActionId}</span>
- </div>
- </Show>
- <Show when={row().kubernetesActionId && row().kubernetesActionId !== row().id}>
- <div>
- Cluster ID:{' '}
- <span class="font-mono text-base-content">{row().kubernetesActionId}</span>
- </div>
- </Show>
- <Show when={row().agentId && row().agentId !== row().id}>
- <div>
- Reporting agent ID:{' '}
- <span class="font-mono text-base-content">{row().agentId}</span>
- </div>
- </Show>
- <Show when={row().linkedNodeId}>
- <div>
- Linked node ID:{' '}
- <span class="font-mono text-base-content">{row().linkedNodeId}</span>
- </div>
- </Show>
- </div>
- <div class="space-y-2 text-xs text-muted">
- <Show when={row().lastSeen}>
- <div>
- Last seen {formatRelativeTime(row().lastSeen!)} ({formatAbsoluteTime(row().lastSeen!)})
- </div>
- </Show>
- <Show when={row().scope.category !== 'na'}>
- <div>
- <div class="mb-1">Scope profile</div>
- <Show
- when={resolvedAgentId()}
- fallback={
- <span class="text-base-content" title={row().scope.detail}>
- {row().scope.label}
- </span>
- }
- >
- <Show
- when={isKubernetes()}
- fallback={
- <Show
- when={state.profiles().length > 0}
- fallback={
- <span class="text-base-content" title={row().scope.detail}>
- {row().scope.label}
- </span>
- }
- >
- <div class="flex items-center gap-2">
- <select
- value={assignment()?.profile_id || ''}
- onChange={(event) => {
- const nextValue = event.currentTarget.value;
- const currentValue = assignment()?.profile_id || '';
- if (nextValue === currentValue) {
- return;
- }
- void state.updateScopeAssignment(
- resolvedAgentId(),
- nextValue || null,
- agentName(),
- );
- }}
- disabled={isScopeUpdating()}
- class="min-h-10 sm:min-h-9 rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60 dark:focus:border-blue-400 dark:focus:ring-blue-800"
- >
- <option value="">Default (Auto-detect)</option>
- <Show
- when={
- assignment()?.profile_id &&
- !state.profileById().has(assignment()!.profile_id)
- }
- >
- <option value={assignment()!.profile_id}>
- {state.getProfileOptionLabel(assignment()!.profile_id)}
- </option>
- </Show>
- <For each={state.profiles()}>
- {(profile) => (
- <option value={profile.id}>
- {state.getProfileOptionLabel(profile.id)}
- </option>
- )}
- </For>
- </select>
- <Show when={isScopeUpdating()}>
- <span class="text-[10px] text-muted">Updating…</span>
- </Show>
- </div>
- </Show>
- }
- >
- <span class="text-base-content" title={row().scope.detail}>
- {row().scope.label}
- </span>
- </Show>
- </Show>
- </div>
- </Show>
- <Show
- when={
- row().kubernetesInfo &&
- (row().kubernetesInfo?.server ||
- row().kubernetesInfo?.context ||
- row().kubernetesInfo?.tokenName)
- }
- >
- <div class="space-y-1 pt-1">
- <div class="text-[11px] font-semibold uppercase tracking-wide text-muted">
- Kubernetes connection
- </div>
- <Show when={row().kubernetesInfo?.server}>
- <div>
- Server: <span class="text-base-content">{row().kubernetesInfo?.server}</span>
- </div>
- </Show>
- <Show when={row().kubernetesInfo?.context}>
- <div>
- Context: <span class="text-base-content">{row().kubernetesInfo?.context}</span>
- </div>
- </Show>
- <Show when={row().kubernetesInfo?.tokenName}>
- <div>
- Token: <span class="text-base-content">{row().kubernetesInfo?.tokenName}</span>
- </div>
- </Show>
- </div>
- </Show>
- </div>
- </div>
- <Show when={assignment()}>
- <div class="mt-3 border-t border-border pt-3">
- <div class="text-[11px] text-amber-600 dark:text-amber-400">
- Restart required to apply scope changes.
- </div>
- <button
- type="button"
- onClick={() => void state.handleResetScope(resolvedAgentId(), agentName() || resolvedAgentId())}
- class="mt-2 text-left text-xs text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"
- >
- Reset to default
- </button>
- </div>
- </Show>
- </div>
-
- <Show when={surfaces().length > 0}>
- <div class="rounded-lg border border-border bg-surface-alt px-4 py-4">
- <div class="flex flex-col gap-1">
- <div class="text-xs font-semibold uppercase tracking-wide text-muted">Surface controls</div>
- <div class="text-xs text-muted">
- Stop a specific surface. Other surfaces keep reporting.
- </div>
- </div>
- <div class="mt-3 overflow-hidden rounded-md border border-border">
- <div class="grid grid-cols-[minmax(0,1.1fr)_minmax(0,1.35fr)_minmax(0,0.9fr)_auto] gap-0 border-b border-border bg-surface px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted">
- <div>Surface</div>
- <div>What Pulse receives</div>
- <div>ID</div>
- <div class="text-right">Control</div>
- </div>
- <For each={surfaces()}>
- {(surface) => (
- <div class="grid grid-cols-[minmax(0,1.1fr)_minmax(0,1.35fr)_minmax(0,0.9fr)_auto] gap-0 border-b border-border bg-surface-alt px-3 py-2 text-xs last:border-b-0">
- <div class="pr-3 font-medium text-base-content">{surface.label}</div>
- <div class="pr-3 text-muted">{surface.detail}</div>
- <div class="text-muted">
- <Show
- when={surface.idLabel && surface.idValue}
- fallback={<span class="text-muted">Not separately addressed</span>}
- >
- <div class="space-y-1">
- <div class="text-[11px]">{surface.idLabel}</div>
- <div class="font-mono text-base-content">{surface.idValue}</div>
- </div>
- </Show>
- </div>
- <div class="pl-3 text-right">
- <Show
- when={
- surface.key === 'docker' ||
- surface.key === 'agent' ||
- surface.key === 'kubernetes'
- }
- fallback={
- <Show
- when={getCapabilityManagementPath(surface.kind)}
- fallback={
- <span class="text-[11px] text-muted">Managed by this reporting item</span>
- }
- >
- {(path) => (
- <button
- type="button"
- data-row-action
- onClick={(event) => {
- event.stopPropagation();
- navigate(path(), { scroll: false });
- }}
- class="inline-flex min-h-9 items-center rounded-md px-2.5 py-1.5 text-xs font-medium text-blue-600 hover:bg-blue-50 hover:text-blue-900 dark:text-blue-400 dark:hover:bg-blue-900 dark:hover:text-blue-300"
- >
- Manage connection
- </button>
- )}
- </Show>
- }
- >
- <button
- type="button"
- data-row-action
- onClick={(event) => {
- event.stopPropagation();
- state.openStopMonitoringDialog(
- createSurfaceScopedRow(
- row(),
- surface.key as 'agent' | 'docker' | 'kubernetes',
- ),
- );
- }}
- class="inline-flex min-h-9 items-center rounded-md px-2.5 py-1.5 text-xs font-medium text-red-600 hover:bg-red-50 hover:text-red-900 dark:text-red-400 dark:hover:bg-red-900 dark:hover:text-red-300"
- >
- Stop this surface
- </button>
- </Show>
- </div>
- </div>
- )}
- </For>
- </div>
- </div>
- </Show>
-
- <Show when={hasLocalMachineActions()}>
- <div class="rounded-lg border border-border bg-surface-alt px-4 py-4">
- <div class="text-xs font-semibold uppercase tracking-wide text-muted">Machine actions</div>
- <div class="mt-2 text-xs text-muted">Machine-level utilities.</div>
- <div class="mt-4 flex flex-col gap-2">
- <Show when={!isKubernetes() && hasMachineInstallActions(row())}>
- <button
- type="button"
- onClick={async () => {
- const success = await copyToClipboard(
- state.getPlatformUninstallCommand(row().upgradePlatform, row()),
- );
- if (success) {
- notificationStore.success(getUnifiedAgentClipboardCopySuccessMessage());
- } else {
- notificationStore.error(getUnifiedAgentClipboardCopyErrorMessage());
- }
- }}
- class="rounded-md border border-border px-3 py-2 text-left text-xs text-slate-600 hover:bg-surface hover:text-base-content"
- >
- Copy uninstall command
- </button>
- </Show>
- <Show when={row().isOutdatedBinary}>
- <button
- type="button"
- onClick={async () => {
- const success = await copyToClipboard(state.getUpgradeCommand(row()));
- if (success) {
- notificationStore.success(getUnifiedAgentClipboardCopySuccessMessage());
- } else {
- notificationStore.error(getUnifiedAgentClipboardCopyErrorMessage());
- }
- }}
- class="rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-left text-xs text-amber-700 hover:bg-amber-100 hover:text-amber-900 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-300 dark:hover:bg-amber-900/60 dark:hover:text-amber-200"
- >
- Copy upgrade command
- </button>
- </Show>
- <div class="rounded-md border border-blue-200 bg-blue-50 px-3 py-3 text-xs text-blue-900 dark:border-blue-800 dark:bg-blue-950/40 dark:text-blue-100">
- Use surface controls above to stop reporting without uninstalling.
- </div>
- </div>
- </div>
- </Show>
- </div>
- </div>
- );
-};
-
-export default InfrastructureActiveRowDetails;
diff --git a/frontend-modern/src/components/Settings/InfrastructureIgnoredRowDetails.tsx b/frontend-modern/src/components/Settings/InfrastructureIgnoredRowDetails.tsx
deleted file mode 100644
index 32f9735eef..0000000000
--- a/frontend-modern/src/components/Settings/InfrastructureIgnoredRowDetails.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import type { Accessor, Component } from 'solid-js';
-import {
- getReconnectActionLabel,
- getCapabilitySurfaceLabel,
- type UnifiedAgentRow,
-} from './infrastructureOperationsModel';
-import { useInfrastructureOperationsContext } from './useInfrastructureOperationsState';
-
-export interface InfrastructureIgnoredRowDetailsProps {
- rowAccessor: Accessor<UnifiedAgentRow>;
-}
-
-export const InfrastructureIgnoredRowDetails: Component<InfrastructureIgnoredRowDetailsProps> = (
- props,
-) => {
- const state = useInfrastructureOperationsContext();
- const row = () => props.rowAccessor();
- const pendingAction = () => state.getPendingInventoryAction(row().rowKey);
- const isAllowingReconnect = () => pendingAction() === 'allow-reconnect';
- const reconnectLabel = () => getReconnectActionLabel(row());
- const blockedId = () =>
- row().dockerActionId || row().kubernetesActionId || row().agentActionId || row().id;
-
- return (
- <div
- id={`ignored-details-${row().rowKey}`}
- class="flex h-full flex-col overflow-y-auto bg-amber-50/70 dark:bg-amber-950/30"
- >
- <div class="border-b border-amber-200 bg-amber-100/80 px-4 py-4 dark:border-amber-800 dark:bg-amber-900/30">
- <div class="flex items-start justify-between gap-4">
- <div class="min-w-0">
- <div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-amber-900 dark:text-amber-100">
- Selected ignored item
- </div>
- <div class="mt-2 text-lg font-semibold text-base-content">{row().name}</div>
- <div class="mt-2 text-xs font-medium uppercase tracking-wide text-amber-800 dark:text-amber-200">
- Ignored by Pulse
- </div>
- <div class="mt-2 text-sm text-amber-950 dark:text-amber-100">
- Pulse is blocking reports from this surface.
- </div>
- </div>
- <button
- type="button"
- onClick={() => state.setSelectedIgnoredRowKey(null)}
- class="rounded-md p-1 hover:bg-amber-200/70 hover:text-base-content dark:hover:bg-amber-800/50"
- aria-label="Close"
- >
- <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M6 18L18 6M6 6l12 12"
- />
- </svg>
- </button>
- </div>
- </div>
-
- <div class="space-y-4 p-4 text-sm text-muted">
- <div class="rounded-lg border border-amber-200/80 bg-white/70 px-4 py-4 dark:border-amber-800/80 dark:bg-amber-950/20">
- <div class="text-xs font-semibold uppercase tracking-wide text-muted">Ignored surface</div>
- <div class="mt-3 overflow-hidden rounded-md border border-amber-200/80 dark:border-amber-800/80">
- <div class="grid grid-cols-[minmax(0,1.2fr)_minmax(0,1.5fr)_minmax(0,1fr)_auto] gap-0 border-b border-amber-200/80 bg-white/80 px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-amber-900 dark:border-amber-800/80 dark:bg-amber-950/30 dark:text-amber-100">
- <div>Ignored surface</div>
- <div>What Pulse is ignoring</div>
- <div>ID</div>
- <div class="text-right">Recovery</div>
- </div>
- <div class="grid grid-cols-[minmax(0,1.2fr)_minmax(0,1.5fr)_minmax(0,1fr)_auto] gap-0 bg-transparent px-3 py-2 text-xs">
- <div class="pr-3 font-medium text-base-content">
- {row().capabilities.map(getCapabilitySurfaceLabel).join(', ')}
- </div>
- <div class="pr-3 text-muted">
- Pulse will ignore new reports for this surface until reconnect is allowed.
- </div>
- <div class="pr-3 text-muted">
- <span class="font-mono text-base-content">{blockedId()}</span>
- </div>
- <div class="text-right text-[11px] text-muted">Ready to return</div>
- </div>
- </div>
- </div>
-
- <div class="rounded-lg border border-amber-200/80 bg-white/70 px-4 py-4 dark:border-amber-800/80 dark:bg-amber-950/20">
- <div class="text-xs font-semibold uppercase tracking-wide text-muted">Recovery action</div>
- <div class="mt-2 text-xs text-muted">Allow this blocked ID to report again.</div>
- <div class="mt-4 flex flex-col gap-3">
- <button
- onClick={() =>
- row().capabilities.includes('docker')
- ? void state.handleAllowDockerReconnect(row())
- : row().capabilities.includes('kubernetes')
- ? void state.handleAllowKubernetesReconnect(row())
- : void state.handleAllowHostReconnect(row())
- }
- disabled={Boolean(pendingAction())}
- class="inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-white px-3 py-2 text-sm font-medium text-blue-600 shadow-sm ring-1 ring-border hover:bg-blue-50 hover:text-blue-900 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-slate-900 dark:text-blue-400 dark:ring-slate-700 dark:hover:bg-blue-900 dark:hover:text-blue-300"
- >
- {isAllowingReconnect() ? 'Allowing reconnect…' : reconnectLabel()}
- </button>
- <div class="text-xs text-muted">
- This only changes Pulse. It does not reinstall software.
- </div>
- </div>
- </div>
- </div>
- </div>
- );
-};
-
-export default InfrastructureIgnoredRowDetails;
diff --git a/frontend-modern/src/components/Settings/InfrastructureInventorySection.tsx b/frontend-modern/src/components/Settings/InfrastructureInventorySection.tsx
deleted file mode 100644
index 837b65f8b6..0000000000
--- a/frontend-modern/src/components/Settings/InfrastructureInventorySection.tsx
+++ /dev/null
@@ -1,375 +0,0 @@
-import type { Component } from 'solid-js';
-import { For, Show } from 'solid-js';
-import Users from 'lucide-solid/icons/users';
-import { Dialog } from '@/components/shared/Dialog';
-import { PulseDataGrid } from '@/components/shared/PulseDataGrid';
-import { SearchField } from '@/components/shared/SearchField';
-import SettingsPanel from '@/components/shared/SettingsPanel';
-import { formatAbsoluteTime, formatRelativeTime } from '@/utils/format';
-import { getMonitoringStoppedEmptyState, getRemovedUnifiedAgentItemLabel } from '@/utils/unifiedAgentInventoryPresentation';
-import type { AgentCapability } from '@/utils/agentCapabilityPresentation';
-import type { ScopeCategory } from './infrastructureOperationsModel';
-import { getCapabilitySurfaceLabel } from './infrastructureOperationsModel';
-import { InfrastructureActiveRowDetails } from './InfrastructureActiveRowDetails';
-import { InfrastructureIgnoredRowDetails } from './InfrastructureIgnoredRowDetails';
-import { useInfrastructureOperationsContext } from './useInfrastructureOperationsState';
-
-export const InfrastructureInventorySection: Component = () => {
- const state = useInfrastructureOperationsContext();
-
- return (
- <div class="space-y-6">
- <div class="rounded-md border border-border bg-surface-alt px-4 py-3 text-sm">
- <p class="text-base-content">{state.inventoryStatusSummaryText()}</p>
- </div>
-
- <SettingsPanel
- title="Reporting now"
- description="Systems, platforms, and runtimes currently checking in to Pulse."
- icon={<Users class="h-5 w-5" strokeWidth={2} />}
- bodyClass="space-y-4"
- >
- <div class="rounded-md border border-border bg-surface-alt px-4 py-3">
- <p class="text-sm font-medium text-base-content">{state.reportingCoverageSummaryText()}</p>
- <p class="mt-2 text-xs text-muted">
- This workspace does not list every asset Pulse has discovered. It focuses on systems
- plus platform-integrated runtimes that are actively checking in right now.
- </p>
- </div>
-
- <div class="rounded-md border border-emerald-200 bg-emerald-50 px-4 py-4 dark:border-emerald-800 dark:bg-emerald-950/40">
- <p class="text-xs font-semibold uppercase tracking-wide text-emerald-800 dark:text-emerald-300">
- Active reporting
- </p>
- <p class="mt-2 text-2xl font-semibold text-emerald-900 dark:text-emerald-100">
- {state.filteredActiveRows().length}
- </p>
- <p class="mt-2 text-sm text-emerald-900 dark:text-emerald-200">
- Item{state.filteredActiveRows().length === 1 ? '' : 's'} actively checking in to Pulse.
- </p>
- </div>
-
- <Show when={state.hasLinkedAgents()}>
- <div class="flex items-start gap-2 rounded-md border border-blue-200 bg-blue-50 px-3 py-2 dark:border-blue-800 dark:bg-blue-900">
- <svg
- class="mt-0.5 h-4 w-4 shrink-0 text-blue-500 dark:text-blue-400"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- stroke-width="2"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
- />
- </svg>
- <p class="text-xs text-blue-700 dark:text-blue-300">
- <span class="font-medium">{state.linkedAgents().length}</span> agent
- {state.linkedAgents().length > 1 ? 's are' : ' is'} linked to Proxmox node
- {state.linkedAgents().length > 1 ? 's' : ''} and flagged with a{' '}
- <span class="font-medium text-blue-700 dark:text-blue-300">Linked</span> badge.
- </p>
- </div>
- </Show>
-
- <Show when={state.hasOutdatedAgents()}>
- <div class="rounded-md border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-700 dark:bg-amber-900">
- <div class="flex items-start gap-3">
- <svg
- class="mt-0.5 h-5 w-5 shrink-0 text-amber-500 dark:text-amber-400"
- viewBox="0 0 20 20"
- fill="currentColor"
- >
- <path
- fill-rule="evenodd"
- d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z"
- clip-rule="evenodd"
- />
- </svg>
- <div class="flex-1 space-y-1">
- <p class="text-sm font-medium text-amber-800 dark:text-amber-200">
- {state.outdatedAgents().length} outdated agent
- {state.outdatedAgents().length > 1 ? ' binaries' : ' binary'} detected
- </p>
- <p class="text-sm text-amber-700 dark:text-amber-300">
- Older standalone agent binaries are deprecated. Expand a row to copy the upgrade
- command.
- </p>
- </div>
- </div>
- </div>
- </Show>
-
- <div class="space-y-3">
- <div class="min-w-[220px] space-y-1">
- <label for="agent-filter-search" class="text-xs font-medium text-muted">
- Search reporting items
- </label>
- <SearchField
- placeholder="Search name, hostname, or ID"
- value={state.filterSearch()}
- onChange={state.setFilterSearch}
- class="w-full"
- inputClass="min-h-10 sm:min-h-9 px-3 py-2 sm:py-1.5 shadow-sm focus:ring-1"
- />
- </div>
-
- <div class="flex flex-wrap items-end gap-3">
- <div class="pb-2 text-xs font-medium uppercase tracking-wide text-muted">
- Refine results
- </div>
- <div class="space-y-1">
- <label for="agent-filter-capability" class="text-xs font-medium text-muted">
- Capability
- </label>
- <select
- id="agent-filter-capability"
- value={state.filterCapability()}
- onChange={(event) =>
- state.setFilterCapability(event.currentTarget.value as 'all' | AgentCapability)
- }
- class="min-h-10 sm:min-h-9 rounded-md border border-border bg-surface px-2.5 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:focus:border-blue-400 dark:focus:ring-blue-800 sm:py-1.5"
- >
- <option value="all">All capabilities</option>
- <option value="agent">Agent</option>
- <option value="docker">Docker</option>
- <option value="kubernetes">Kubernetes</option>
- <option value="proxmox">Proxmox</option>
- <option value="pbs">PBS</option>
- <option value="pmg">PMG</option>
- <option value="truenas">TrueNAS</option>
- </select>
- </div>
- <div class="space-y-1">
- <label for="agent-filter-scope" class="text-xs font-medium text-muted">
- Scope
- </label>
- <select
- id="agent-filter-scope"
- value={state.filterScope()}
- onChange={(event) =>
- state.setFilterScope(
- event.currentTarget.value as 'all' | Exclude<ScopeCategory, 'na'>,
- )
- }
- class="min-h-10 sm:min-h-9 rounded-md border border-border bg-surface px-2.5 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:focus:border-blue-400 dark:focus:ring-blue-800 sm:py-1.5"
- >
- <option value="all">All scopes</option>
- <option value="default">Default</option>
- <option value="profile">Profile assigned</option>
- <option value="ai-managed">Patrol-managed</option>
- </select>
- </div>
- <button
- type="button"
- onClick={state.resetFilters}
- disabled={!state.hasFilters()}
- class={`min-h-10 sm:min-h-9 rounded-md px-3 py-2 text-sm font-medium transition-colors ${
- state.hasFilters()
- ? 'text-base-content hover:bg-surface-alt'
- : 'cursor-not-allowed text-slate-400'
- }`}
- >
- Clear
- </button>
- </div>
- </div>
-
- <div class="flex flex-wrap items-center justify-between gap-3 text-xs text-muted">
- <span>
- Showing {state.filteredActiveRows().length} of {state.activeRows().length} active
- records.
- </span>
- <Show when={state.filteredMonitoringStoppedRows().length > 0}>
- <span>{state.filteredMonitoringStoppedRows().length} item(s) are currently ignored by Pulse.</span>
- </Show>
- </div>
-
- <div class="rounded-md border border-border bg-surface-hover px-4 py-3 text-sm text-muted">
- Stop monitoring removes an item from active reporting and moves it into the Ignored by
- Pulse list. The remote system keeps running; Pulse simply ignores new reports until you
- allow reconnect.
- </div>
-
- <Show when={state.inventoryActionNotice()}>
- {(notice) => (
- <div
- class={`rounded-md border px-4 py-3 text-sm ${
- notice().tone === 'success'
- ? 'border-emerald-200 bg-emerald-50 text-emerald-900 dark:border-emerald-700 dark:bg-emerald-900 dark:text-emerald-100'
- : 'border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-700 dark:bg-blue-900 dark:text-blue-100'
- }`}
- >
- <div class="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
- <div class="space-y-1">
- <p class="font-semibold">{notice().title}</p>
- <p class="text-xs opacity-90">{notice().detail}</p>
- </div>
- <div class="flex items-center gap-2">
- <Show when={notice().showRecoveryQueueLink}>
- <button
- type="button"
- onClick={state.scrollToRecoveryQueue}
- class="inline-flex min-h-10 sm:min-h-9 items-center rounded-md px-2.5 py-1.5 text-xs font-medium underline"
- >
- View ignored items
- </button>
- </Show>
- <button
- type="button"
- onClick={() => state.setInventoryActionNotice(null)}
- class="inline-flex min-h-10 sm:min-h-9 items-center rounded-md px-2.5 py-1.5 text-xs font-medium underline"
- aria-label="Dismiss inventory action message"
- >
- Dismiss
- </button>
- </div>
- </div>
- </div>
- )}
- </Show>
-
- <div class="grid gap-4">
- <div class="overflow-hidden rounded-xl border border-border bg-surface shadow-sm">
- <div class="border-b border-border bg-surface-alt px-4 py-3">
- <div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted">
- Browse reporting items
- </div>
- <div class="mt-2 text-sm text-base-content">
- Select a reporting item to open its details drawer.
- </div>
- </div>
- <PulseDataGrid
- data={state.filteredActiveRows()}
- emptyState={
- state.hasFilters()
- ? 'No reporting items match the current filters.'
- : 'Nothing is actively reporting to Pulse yet.'
- }
- desktopMinWidth="960px"
- columns={state.reportingColumns}
- keyExtractor={(row) => row.rowKey}
- onRowClick={(row) => state.toggleAgentDetails(row.rowKey)}
- />
- </div>
-
- <Dialog
- isOpen={Boolean(state.selectedActiveRow())}
- onClose={() => state.setExpandedRowKey(null)}
- layout="drawer-right"
- panelClass="max-w-[760px]"
- ariaLabel="Reporting item details"
- >
- <Show when={state.selectedActiveRow()}>
- {(rowAccessor) => <InfrastructureActiveRowDetails rowAccessor={rowAccessor} />}
- </Show>
- </Dialog>
- </div>
- </SettingsPanel>
-
- <Show when={state.showMonitoringStoppedSection()}>
- <div ref={state.setRecoveryQueueSectionRef}>
- <SettingsPanel
- title="Ignored by Pulse"
- description="Items you explicitly told Pulse to ignore stay out of live reporting until reconnect is allowed."
- icon={<Users class="h-5 w-5" strokeWidth={2} />}
- bodyClass="space-y-4"
- >
- <Show
- when={state.filteredMonitoringStoppedRows().length > 0}
- fallback={
- <div class="rounded-md border border-dashed border-border px-4 py-6 text-sm text-muted">
- {getMonitoringStoppedEmptyState(state.hasFilters())}
- </div>
- }
- >
- <div class="grid gap-4">
- <div class="overflow-hidden rounded-lg border border-amber-200 bg-amber-50/70 dark:border-amber-800 dark:bg-amber-950/30">
- <div class="border-b border-amber-200 px-4 py-3 dark:border-amber-800">
- <div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-amber-900 dark:text-amber-100">
- Browse ignored items
- </div>
- <div class="mt-2 text-sm text-amber-950 dark:text-amber-100">
- Select an ignored item to open its recovery drawer.
- </div>
- </div>
- <div class="divide-y divide-amber-200/80 dark:divide-amber-800/80">
- <For each={state.filteredMonitoringStoppedRows()}>
- {(row) => {
- const pendingAction = () => state.getPendingInventoryAction(row.rowKey);
- const isSelected = () => state.selectedIgnoredRowKey() === row.rowKey;
-
- return (
- <button
- type="button"
- onClick={() => state.setSelectedIgnoredRowKey(row.rowKey)}
- class={`flex w-full flex-col gap-2 px-4 py-3 text-left transition-colors ${
- isSelected()
- ? 'bg-amber-100/80 ring-1 ring-inset ring-amber-300 dark:bg-amber-900/40 dark:ring-amber-700'
- : 'hover:bg-amber-100/50 dark:hover:bg-amber-900/20'
- }`}
- >
- <div class="flex flex-wrap items-center justify-between gap-3">
- <div class="min-w-0">
- <div class="flex flex-wrap items-center gap-2">
- <h4 class="truncate text-sm font-semibold text-base-content">
- {row.name}
- </h4>
- <span class="inline-flex items-center rounded-full bg-white/80 px-2 py-0.5 text-[11px] font-medium uppercase tracking-wide text-amber-800 dark:bg-amber-900/60 dark:text-amber-200">
- {getRemovedUnifiedAgentItemLabel(row)}
- </span>
- </div>
- <div class="mt-1 text-xs text-muted">
- {row.capabilities.map(getCapabilitySurfaceLabel).join(', ')}
- </div>
- </div>
- <div class="text-[11px] text-muted">
- {pendingAction() === 'allow-reconnect'
- ? 'Reconnect in progress'
- : 'Select to review'}
- </div>
- </div>
- <div class="flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted">
- <Show
- when={
- row.displayName && row.hostname && row.displayName !== row.hostname
- }
- >
- <span>Hostname: {row.hostname}</span>
- </Show>
- <span>
- Stopped{' '}
- {row.removedAt
- ? `${formatRelativeTime(row.removedAt)} (${formatAbsoluteTime(row.removedAt)})`
- : 'at an unknown time'}
- </span>
- </div>
- </button>
- );
- }}
- </For>
- </div>
- </div>
-
- <Dialog
- isOpen={Boolean(state.selectedIgnoredRow())}
- onClose={() => state.setSelectedIgnoredRowKey(null)}
- layout="drawer-right"
- panelClass="max-w-[720px]"
- ariaLabel="Ignored item details"
- >
- <Show when={state.selectedIgnoredRow()}>
- {(rowAccessor) => <InfrastructureIgnoredRowDetails rowAccessor={rowAccessor} />}
- </Show>
- </Dialog>
- </div>
- </Show>
- </SettingsPanel>
- </div>
- </Show>
- </div>
- );
-};
-
-export default InfrastructureInventorySection;
diff --git a/frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx b/frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx
deleted file mode 100644
index dbe9fcf13d..0000000000
--- a/frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import type { Component } from 'solid-js';
-import { Show } from 'solid-js';
-import { InfrastructureInstallerSection } from './InfrastructureInstallerSection';
-import { InfrastructureInventorySection } from './InfrastructureInventorySection';
-import { InfrastructureStopMonitoringDialog } from './InfrastructureStopMonitoringDialog';
-import {
- InfrastructureOperationsStateProvider,
- type InfrastructureOperationsStateOptions,
-} from './useInfrastructureOperationsState';
-
-export interface InfrastructureOperationsControllerProps extends InfrastructureOperationsStateOptions {
- showInstaller?: boolean;
- showInventory?: boolean;
-}
-
-export const InfrastructureOperationsController: Component<
- InfrastructureOperationsControllerProps
-> = (props) => {
- return (
- <InfrastructureOperationsStateProvider embedded={props.embedded}>
- <div class="space-y-6">
- <Show when={props.showInventory ?? true}>
- <InfrastructureStopMonitoringDialog />
- </Show>
- <Show when={props.showInstaller ?? true}>
- <InfrastructureInstallerSection />
- </Show>
- <Show when={props.showInventory ?? true}>
- <InfrastructureInventorySection />
- </Show>
- </div>
- </InfrastructureOperationsStateProvider>
- );
-};
-
-export default InfrastructureOperationsController;
diff --git a/frontend-modern/src/components/Settings/InfrastructureStopMonitoringDialog.tsx b/frontend-modern/src/components/Settings/InfrastructureStopMonitoringDialog.tsx
deleted file mode 100644
index 86ffa7b19e..0000000000
--- a/frontend-modern/src/components/Settings/InfrastructureStopMonitoringDialog.tsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import type { Component } from 'solid-js';
-import { For, Show } from 'solid-js';
-import { Dialog } from '@/components/shared/Dialog';
-import { getStopMonitoringSurfaces } from './infrastructureOperationsModel';
-import { useInfrastructureOperationsContext } from './useInfrastructureOperationsState';
-
-export const InfrastructureStopMonitoringDialog: Component = () => {
- const state = useInfrastructureOperationsContext();
-
- return (
- <Dialog
- isOpen={Boolean(state.stopMonitoringDialog())}
- onClose={() => {
- if (!state.stopMonitoringDialog()) return;
- const row = state.stopMonitoringDialog()!.row;
- if (state.getPendingInventoryAction(row.rowKey)) return;
- state.setStopMonitoringDialog(null);
- }}
- panelClass="max-w-lg"
- closeOnBackdrop={
- !state.stopMonitoringDialog() ||
- !state.getPendingInventoryAction(state.stopMonitoringDialog()!.row.rowKey)
- }
- ariaLabel="Confirm stop monitoring"
- >
- <Show when={state.stopMonitoringDialog()}>
- {(dialog) => {
- const row = () => dialog().row;
- const pending = () => state.getPendingInventoryAction(row().rowKey) === 'stop-monitoring';
- const isKubernetes = () =>
- row().capabilities.includes('kubernetes') && !row().capabilities.includes('agent');
- const affectedSurfaces = () => getStopMonitoringSurfaces(row());
-
- return (
- <div class="flex max-h-[90vh] flex-col">
- <div class="border-b border-border px-6 py-4">
- <h2 class="text-lg font-semibold text-base-content">Stop monitoring?</h2>
- <p class="mt-1 text-sm text-muted">
- Pulse will remove{' '}
- <span class="font-medium text-base-content">{dialog().subject}</span> from
- active reporting.
- </p>
- </div>
- <div class="space-y-4 px-6 py-4">
- <div class="rounded-md border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-900 dark:text-amber-100">
- <p class="font-medium">{dialog().scopeLabel} will stop in Pulse.</p>
- <p class="mt-1 text-xs opacity-90">
- The remote system keeps running. Pulse will ignore future reports and move this
- item into Ignored by Pulse until you allow reconnect.
- </p>
- </div>
- <Show when={affectedSurfaces().length > 0}>
- <div class="rounded-md border border-border bg-surface-hover px-4 py-3 text-sm text-muted">
- <p class="font-medium text-base-content">
- Pulse will stop these reporting surfaces
- </p>
- <div class="mt-3 grid gap-2">
- <For each={affectedSurfaces()}>
- {(surface) => (
- <div class="rounded-md border border-border bg-surface px-3 py-2">
- <div class="text-sm font-medium text-base-content">{surface.label}</div>
- <div class="mt-1 text-xs text-muted">{surface.detail}</div>
- <Show when={surface.idLabel && surface.idValue}>
- <div class="mt-2 text-[11px] text-muted">
- {surface.idLabel}:{' '}
- <span class="font-mono text-base-content">{surface.idValue}</span>
- </div>
- </Show>
- </div>
- )}
- </For>
- </div>
- </div>
- </Show>
- <div class="rounded-md border border-border bg-surface-hover px-4 py-3 text-sm text-muted">
- <p class="font-medium text-base-content">What stays unchanged</p>
- <p class="mt-1 text-xs">
- {isKubernetes()
- ? 'The cluster itself is not uninstalled or shut down.'
- : 'The host, containers, and installed agent binaries are not uninstalled or shut down.'}
- </p>
- </div>
- </div>
- <div class="flex flex-col-reverse gap-2 border-t border-border px-6 py-4 sm:flex-row sm:justify-end">
- <button
- type="button"
- onClick={() => state.setStopMonitoringDialog(null)}
- disabled={pending()}
- class="inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-border px-4 py-2 text-sm font-medium text-base-content hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60"
- >
- Cancel
- </button>
- <button
- type="button"
- onClick={() =>
- isKubernetes()
- ? void state.handleRemoveKubernetesCluster(row())
- : void state.handleRemoveAgent(row())
- }
- disabled={pending()}
- class="inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-60"
- >
- {pending() ? 'Stopping…' : 'Confirm stop monitoring'}
- </button>
- </div>
- </div>
- );
- }}
- </Show>
- </Dialog>
- );
-};
-
-export default InfrastructureStopMonitoringDialog;
diff --git a/frontend-modern/src/components/Settings/NodeModal.tsx b/frontend-modern/src/components/Settings/NodeModal.tsx
deleted file mode 100644
index 947ee05963..0000000000
--- a/frontend-modern/src/components/Settings/NodeModal.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { Component } from 'solid-js';
-import { NodeModalAuthenticationSection } from '@/components/Settings/NodeModalAuthenticationSection';
-import { NodeModalBasicInfoSection } from '@/components/Settings/NodeModalBasicInfoSection';
-import { NodeModalMonitoringSection } from '@/components/Settings/NodeModalMonitoringSection';
-import { NodeModalStatusFooter } from '@/components/Settings/NodeModalStatusFooter';
-import type { NodeModalProps } from '@/components/Settings/nodeModalModel';
-import { useNodeModalState } from '@/components/Settings/useNodeModalState';
-import { Dialog } from '@/components/shared/Dialog';
-import { SectionHeader } from '@/components/shared/SectionHeader';
-import { getNodeProductName } from '@/utils/nodeModalPresentation';
-
-export const NodeModal: Component<NodeModalProps> = (props) => {
- const state = useNodeModalState(props);
-
- return (
- <Dialog
- isOpen={props.isOpen}
- onClose={props.onClose}
- panelClass="max-w-2xl"
- ariaLabel={`${state.isEditingExistingNode() ? 'Edit' : 'Add'} ${getNodeProductName(props.nodeType)} node`}
- >
- <div class="relative w-full">
- <form onSubmit={state.handleSubmit}>
- <div class="flex items-center justify-between p-4 border-b border-border">
- <SectionHeader
- title={`${state.isEditingExistingNode() ? 'Edit' : 'Add'} ${getNodeProductName(props.nodeType)} node`}
- size="md"
- class="flex-1"
- />
- <button type="button" onClick={props.onClose} class="text-slate-400 hover:text-muted">
- <svg
- width="20"
- height="20"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- >
- <line x1="18" y1="6" x2="6" y2="18"></line>
- <line x1="6" y1="6" x2="18" y2="18"></line>
- </svg>
- </button>
- </div>
-
- <div class="p-6 space-y-6">
- <NodeModalBasicInfoSection modalProps={props} state={state} />
- <NodeModalAuthenticationSection modalProps={props} state={state} />
- <NodeModalMonitoringSection modalProps={props} state={state} />
- </div>
-
- <NodeModalStatusFooter modalProps={props} state={state} />
- </form>
- </div>
- </Dialog>
- );
-};
diff --git a/frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx b/frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx
deleted file mode 100644
index 8872389fbc..0000000000
--- a/frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import type { Component } from 'solid-js';
-import { Match, Switch, createMemo } from 'solid-js';
-import { useLocation, useNavigate } from '@solidjs/router';
-import { Subtabs } from '@/components/shared/Subtabs';
-import { ProxmoxSettingsPanel } from './ProxmoxSettingsPanel';
-import {
- PLATFORM_CONNECTIONS_TABS,
- buildPlatformConnectionsPath,
- getPlatformConnectionsViewFromPath,
-} from './platformConnectionsModel';
-import { TrueNASSettingsPanel } from './TrueNASSettingsPanel';
-import { VMwareSettingsPanel } from './VMwareSettingsPanel';
-import type { InfrastructurePlatformSettingsProps } from './proxmoxSettingsModel';
-
-export const PlatformConnectionsWorkspace: Component<InfrastructurePlatformSettingsProps> = (
- props,
-) => {
- const navigate = useNavigate();
- const location = useLocation();
- const activeView = createMemo(() => getPlatformConnectionsViewFromPath(location.pathname));
-
- return (
- <div class="space-y-6">
- <Subtabs
- value={activeView()}
- onChange={(value) =>
- navigate(buildPlatformConnectionsPath(value as 'proxmox' | 'truenas' | 'vmware'))
- }
- ariaLabel="Platform connections"
- tabs={PLATFORM_CONNECTIONS_TABS.map((tab) => ({
- value: tab.id,
- label: tab.label,
- }))}
- />
-
- <Switch>
- <Match when={activeView() === 'truenas'}>
- <TrueNASSettingsPanel state={props.trueNASSettings} />
- </Match>
-
- <Match when={activeView() === 'vmware'}>
- <VMwareSettingsPanel state={props.vmwareSettings} />
- </Match>
-
- <Match when={activeView() === 'proxmox'}>
- <ProxmoxSettingsPanel {...props} embedded />
- </Match>
- </Switch>
- </div>
- );
-};
-
-export default PlatformConnectionsWorkspace;
diff --git a/frontend-modern/src/components/Settings/ProxmoxConfiguredNodesTable.tsx b/frontend-modern/src/components/Settings/ProxmoxConfiguredNodesTable.tsx
deleted file mode 100644
index f01bb987de..0000000000
--- a/frontend-modern/src/components/Settings/ProxmoxConfiguredNodesTable.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import type { Component } from 'solid-js';
-import type { Resource } from '@/types/resource';
-import type { PBSInstance, PMGInstance } from '@/types/api';
-import type { NodeConfigWithStatus } from '@/types/nodes';
-import { PveNodesTable, PbsNodesTable, PmgNodesTable } from './ConfiguredNodeTables';
-import type { NodeType } from './infrastructureSettingsModel';
-
-interface ProxmoxConfiguredNodesTableProps {
- activeAgent: NodeType;
- pveNodes: NodeConfigWithStatus[];
- pbsNodes: NodeConfigWithStatus[];
- pmgNodes: NodeConfigWithStatus[];
- agentStateResources: Resource[];
- pbsInstances: PBSInstance[];
- pmgInstances: PMGInstance[];
- temperatureMonitoringEnabled: boolean;
- onTestConnection: (nodeId: string) => void;
- onEditNode: (type: NodeType, node: NodeConfigWithStatus) => void;
- onDeleteNode: (node: NodeConfigWithStatus) => void;
- onRefreshClusterNodes: (nodeId: string) => Promise<void>;
-}
-
-export const ProxmoxConfiguredNodesTable: Component<ProxmoxConfiguredNodesTableProps> = (
- props,
-) => {
- switch (props.activeAgent) {
- case 'pve':
- return (
- <PveNodesTable
- nodes={props.pveNodes}
- stateNodes={props.agentStateResources}
- globalTemperatureMonitoringEnabled={props.temperatureMonitoringEnabled}
- onTestConnection={props.onTestConnection}
- onEdit={(node) => props.onEditNode('pve', node)}
- onDelete={props.onDeleteNode}
- onRefreshCluster={props.onRefreshClusterNodes}
- />
- );
- case 'pbs':
- return (
- <PbsNodesTable
- nodes={props.pbsNodes}
- statePbs={props.pbsInstances}
- globalTemperatureMonitoringEnabled={props.temperatureMonitoringEnabled}
- onTestConnection={props.onTestConnection}
- onEdit={(node) => props.onEditNode('pbs', node)}
- onDelete={props.onDeleteNode}
- />
- );
- case 'pmg':
- return (
- <PmgNodesTable
- nodes={props.pmgNodes}
- statePmg={props.pmgInstances}
- globalTemperatureMonitoringEnabled={props.temperatureMonitoringEnabled}
- onTestConnection={props.onTestConnection}
- onEdit={(node) => props.onEditNode('pmg', node)}
- onDelete={props.onDeleteNode}
- />
- );
- }
-};
-
-export default ProxmoxConfiguredNodesTable;
diff --git a/frontend-modern/src/components/Settings/ProxmoxDeleteNodeDialog.tsx b/frontend-modern/src/components/Settings/ProxmoxDeleteNodeDialog.tsx
deleted file mode 100644
index 48f4987f8a..0000000000
--- a/frontend-modern/src/components/Settings/ProxmoxDeleteNodeDialog.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import type { Component } from 'solid-js';
-import { Show } from 'solid-js';
-import { Card } from '@/components/shared/Card';
-import { Dialog } from '@/components/shared/Dialog';
-import { SectionHeader } from '@/components/shared/SectionHeader';
-
-interface ProxmoxDeleteNodeDialogProps {
- deleteNodeLoading: boolean;
- nodePendingDeleteHost: string;
- nodePendingDeleteLabel: string;
- nodePendingDeleteType: string;
- nodePendingDeleteTypeLabel: string;
- onCancel: () => void;
- onDelete: () => Promise<void>;
-}
-
-export const ProxmoxDeleteNodeDialog: Component<ProxmoxDeleteNodeDialogProps> = (props) => {
- return (
- <Dialog
- isOpen={true}
- onClose={props.onCancel}
- panelClass="max-w-lg"
- closeOnBackdrop={false}
- ariaLabel={`Remove ${props.nodePendingDeleteLabel}`}
- >
- <Card padding="lg" class="w-full max-w-lg space-y-5">
- <SectionHeader title={`Remove ${props.nodePendingDeleteLabel}`} size="md" class="mb-1" />
- <div class="space-y-3 text-sm text-gray-600">
- <p>
- Removing this {props.nodePendingDeleteTypeLabel.toLowerCase()} also scrubs the Pulse
- footprint on the host - the proxy service, SSH key, API token, and bind mount are all
- cleaned up automatically.
- </p>
- <div class="rounded-md border border-blue-200 bg-blue-50 p-3 text-sm leading-relaxed dark:border-blue-800 dark:bg-blue-900 dark:text-blue-100">
- <p class="font-medium text-blue-900 dark:text-blue-100">What happens next</p>
- <ul class="mt-2 list-disc space-y-1 pl-4 text-blue-800 dark:text-blue-200 text-sm">
- <li>Pulse removes the node entry and clears related alerts.</li>
- <li>
- {props.nodePendingDeleteHost ? (
- <>
- The host <span class="font-semibold">{props.nodePendingDeleteHost}</span>{' '}
- loses the proxy service, SSH key, and API token.
- </>
- ) : (
- 'The host loses the proxy service, SSH key, and API token.'
- )}
- </li>
- <li>
- If the host comes back later, rerunning the setup script reinstalls everything with
- a fresh key.
- </li>
- <Show when={props.nodePendingDeleteType === 'pbs'}>
- <li>
- Backup user tokens on the PBS are removed, so jobs referencing them will no
- longer authenticate until the node is re-added.
- </li>
- </Show>
- <Show when={props.nodePendingDeleteType === 'pmg'}>
- <li>
- Mail gateway tokens are removed as part of the cleanup; re-enroll to restore
- outbound telemetry.
- </li>
- </Show>
- </ul>
- </div>
- </div>
-
- <div class="flex items-center justify-end gap-3 pt-2">
- <button
- type="button"
- onClick={props.onCancel}
- class="rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover"
- disabled={props.deleteNodeLoading}
- >
- Keep node
- </button>
- <button
- type="button"
- onClick={props.onDelete}
- disabled={props.deleteNodeLoading}
- class="rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-red-500 dark:hover:bg-red-400"
- >
- {props.deleteNodeLoading ? 'Removing…' : 'Remove node'}
- </button>
- </div>
- </Card>
- </Dialog>
- );
-};
diff --git a/frontend-modern/src/components/Settings/ProxmoxDirectConnectionsCard.tsx b/frontend-modern/src/components/Settings/ProxmoxDirectConnectionsCard.tsx
deleted file mode 100644
index bf34abe0f6..0000000000
--- a/frontend-modern/src/components/Settings/ProxmoxDirectConnectionsCard.tsx
+++ /dev/null
@@ -1,144 +0,0 @@
-import type { Component, JSX } from 'solid-js';
-import { Dynamic } from 'solid-js/web';
-import { Show } from 'solid-js';
-import { Card } from '@/components/shared/Card';
-import { Toggle } from '@/components/shared/Toggle';
-import type { ToggleChangeEvent } from '@/components/shared/Toggle';
-import { getSettingsConfigurationLoadingState } from '@/utils/settingsShellPresentation';
-import type { ProxmoxVariantPresentation } from '@/utils/proxmoxSettingsPresentation';
-import type { NodeConfigWithStatus } from '@/types/nodes';
-import type { DiscoveredServer, NodeType } from './infrastructureSettingsModel';
-
-interface ProxmoxDirectConnectionsCardProps {
- activeAgent: NodeType;
- activeConfig: ProxmoxVariantPresentation;
- activeConfiguredNodes: NodeConfigWithStatus[];
- activeDiscoveredNodes: DiscoveredServer[];
- configuredTable: JSX.Element;
- discoveryEnabled: boolean;
- envOverrides: Record<string, boolean>;
- initialLoadComplete: boolean;
- onDiscoveryToggle: (event: ToggleChangeEvent) => Promise<void>;
- onOpenCreateNode: (type: NodeType) => void;
- onRefreshDiscovery: () => Promise<void>;
- savingDiscoverySettings: boolean;
-}
-
-export const ProxmoxDirectConnectionsCard: Component<ProxmoxDirectConnectionsCardProps> = (
- props,
-) => {
- return (
- <>
- <Show when={!props.initialLoadComplete}>
- <div class="flex items-center justify-center rounded-md border border-dashed border-border bg-surface-alt py-12 text-sm text-muted">
- {getSettingsConfigurationLoadingState().text}
- </div>
- </Show>
-
- <Show when={props.initialLoadComplete}>
- <Card padding="none" class="rounded-xl border border-border shadow-sm">
- <div class="px-3 py-4 sm:px-6 sm:py-6 space-y-4">
- <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
- <div class="space-y-2">
- <h4 class="text-base font-semibold text-base-content">{props.activeConfig.title}</h4>
- <div class="flex flex-wrap items-center gap-2 text-xs">
- <span class="inline-flex items-center rounded-full bg-surface-alt px-2.5 py-1 font-medium text-base-content">
- {props.activeConfiguredNodes.length} configured
- </span>
- <Show when={props.discoveryEnabled}>
- <span class="inline-flex items-center rounded-full bg-blue-50 px-2.5 py-1 font-medium text-blue-700 dark:bg-blue-950/40 dark:text-blue-300">
- {props.activeDiscoveredNodes.length} discovered
- </span>
- </Show>
- </div>
- </div>
- <div class="flex flex-wrap items-center justify-start gap-2 sm:justify-end">
- <div
- class="flex items-center gap-2 sm:gap-3"
- title="Enable automatic discovery of Proxmox servers on your network"
- >
- <span class="text-xs sm:text-sm text-muted">Discovery</span>
- <Toggle
- checked={props.discoveryEnabled}
- onChange={props.onDiscoveryToggle}
- disabled={
- props.envOverrides.discoveryEnabled || props.savingDiscoverySettings
- }
- containerClass="gap-2"
- label={
- <span class="text-xs font-medium text-muted">
- {props.discoveryEnabled ? 'On' : 'Off'}
- </span>
- }
- />
- </div>
-
- <Show when={props.discoveryEnabled}>
- <button
- type="button"
- onClick={props.onRefreshDiscovery}
- class="px-2 sm:px-4 py-1.5 sm:py-2 text-xs sm:text-sm bg-gray-600 text-white rounded-md hover:bg-gray-700 transition-colors flex items-center gap-1"
- title="Refresh discovered servers"
- >
- <svg
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- >
- <polyline points="23 4 23 10 17 10"></polyline>
- <polyline points="1 20 1 14 7 14"></polyline>
- <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
- </svg>
- <span class="hidden sm:inline">Refresh</span>
- </button>
- </Show>
-
- <button
- type="button"
- onClick={() => props.onOpenCreateNode(props.activeAgent)}
- class="px-2 sm:px-4 py-1.5 sm:py-2 text-xs sm:text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors flex items-center gap-1"
- >
- <svg
- width="16"
- height="16"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- >
- <line x1="12" y1="5" x2="12" y2="19"></line>
- <line x1="5" y1="12" x2="19" y2="12"></line>
- </svg>
- <span class="sm:hidden">Add</span>
- <span class="hidden sm:inline">{props.activeConfig.addLabel}</span>
- </button>
- </div>
- </div>
-
- <Show when={props.activeConfiguredNodes.length > 0}>{props.configuredTable}</Show>
-
- <Show
- when={
- props.activeConfiguredNodes.length === 0 &&
- props.activeDiscoveredNodes.length === 0
- }
- >
- <div class="flex flex-col items-center justify-center py-12 px-4 text-center">
- <div class="rounded-full bg-surface-alt p-4 mb-4">
- <Dynamic component={props.activeConfig.emptyIcon} class="h-8 w-8 text-muted" />
- </div>
- <p class="text-base font-medium text-base-content mb-1">
- {props.activeConfig.emptyTitle}
- </p>
- <p class="text-sm text-muted">{props.activeConfig.emptyDescription}</p>
- </div>
- </Show>
- </div>
- </Card>
- </Show>
- </>
- );
-};
diff --git a/frontend-modern/src/components/Settings/ProxmoxDirectWorkspace.tsx b/frontend-modern/src/components/Settings/ProxmoxDirectWorkspace.tsx
deleted file mode 100644
index 0065ebaa09..0000000000
--- a/frontend-modern/src/components/Settings/ProxmoxDirectWorkspace.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import { Component, Show } from 'solid-js';
-import type { ToggleChangeEvent } from '@/components/shared/Toggle';
-import { ProxmoxConfiguredNodesTable } from './ProxmoxConfiguredNodesTable';
-import { ProxmoxDeleteNodeDialog } from './ProxmoxDeleteNodeDialog';
-import { ProxmoxDirectConnectionsCard } from './ProxmoxDirectConnectionsCard';
-import { ProxmoxDiscoveryResultsCard } from './ProxmoxDiscoveryResultsCard';
-import { ProxmoxNodeModalStack } from './ProxmoxNodeModalStack';
-import type { InfrastructurePlatformSettingsProps } from './proxmoxSettingsModel';
-import { useProxmoxDirectWorkspaceState } from './useProxmoxDirectWorkspaceState';
-
-export const ProxmoxDirectWorkspace: Component<InfrastructurePlatformSettingsProps> = (props) => {
- const state = useProxmoxDirectWorkspaceState(props);
-
- const handleDiscoveryToggle = async (event: ToggleChangeEvent) => {
- const nextValue = await state.handleDiscoveryToggle(event.currentTarget.checked);
- if (nextValue !== event.currentTarget.checked) {
- event.preventDefault();
- event.currentTarget.checked = nextValue;
- }
- };
-
- return (
- <>
- <div class="space-y-6 mt-6">
- <div class="space-y-4">
- <ProxmoxDirectConnectionsCard
- activeAgent={state.activeAgent()}
- activeConfig={state.activeConfig()}
- activeConfiguredNodes={state.activeConfiguredNodes()}
- activeDiscoveredNodes={state.activeDiscoveredNodes()}
- configuredTable={
- <ProxmoxConfiguredNodesTable
- activeAgent={state.activeAgent()}
- pveNodes={props.pveNodes()}
- pbsNodes={props.pbsNodes()}
- pmgNodes={props.pmgNodes()}
- agentStateResources={props.agentStateResources()}
- pbsInstances={props.pbsInstances()}
- pmgInstances={props.pmgInstances()}
- temperatureMonitoringEnabled={props.temperatureMonitoringEnabled()}
- onTestConnection={props.testNodeConnection}
- onEditNode={state.openEditNode}
- onDeleteNode={props.requestDeleteNode}
- onRefreshClusterNodes={props.refreshClusterNodes}
- />
- }
- discoveryEnabled={props.discoveryEnabled()}
- envOverrides={props.envOverrides()}
- initialLoadComplete={props.initialLoadComplete()}
- onDiscoveryToggle={handleDiscoveryToggle}
- onOpenCreateNode={state.openCreateNode}
- onRefreshDiscovery={state.handleRefreshDiscovery}
- savingDiscoverySettings={props.savingDiscoverySettings()}
- />
-
- <Show when={props.discoveryEnabled()}>
- <ProxmoxDiscoveryResultsCard
- activeConfig={state.activeConfig()}
- activeDiscoveredNodes={state.activeDiscoveredNodes()}
- discoveryScanStatus={props.discoveryScanStatus()}
- hasDiscoveryTimeouts={state.hasDiscoveryTimeouts()}
- onOpenDiscoveredNode={state.openDiscoveredNode}
- />
- </Show>
- </div>
- </div>
-
- <Show when={props.showDeleteNodeModal()}>
- <ProxmoxDeleteNodeDialog
- deleteNodeLoading={props.deleteNodeLoading()}
- nodePendingDeleteHost={props.nodePendingDeleteHost()}
- nodePendingDeleteLabel={props.nodePendingDeleteLabel()}
- nodePendingDeleteType={props.nodePendingDeleteType()}
- nodePendingDeleteTypeLabel={props.nodePendingDeleteTypeLabel()}
- onCancel={props.cancelDeleteNode}
- onDelete={props.deleteNode}
- />
- </Show>
-
- <ProxmoxNodeModalStack
- modalResetKey={props.modalResetKey()}
- prefillNode={state.prefillNode()}
- editingNodeType={props.editingNode()?.type ?? null}
- editingNode={props.editingNode}
- isNodeModalVisible={props.isNodeModalVisible}
- securityStatus={props.securityStatus()}
- resolveTemperatureMonitoringEnabled={props.resolveTemperatureMonitoringEnabled}
- temperatureMonitoringLocked={props.temperatureMonitoringLocked()}
- savingTemperatureSetting={props.savingTemperatureSetting()}
- handleNodeTemperatureMonitoringChange={props.handleNodeTemperatureMonitoringChange}
- handleTemperatureMonitoringChange={props.handleTemperatureMonitoringChange}
- saveNode={props.saveNode}
- onClose={state.closeNodeModal}
- />
- </>
- );
-};
diff --git a/frontend-modern/src/components/Settings/ProxmoxDiscoveryResultsCard.tsx b/frontend-modern/src/components/Settings/ProxmoxDiscoveryResultsCard.tsx
deleted file mode 100644
index c22e66b5ce..0000000000
--- a/frontend-modern/src/components/Settings/ProxmoxDiscoveryResultsCard.tsx
+++ /dev/null
@@ -1,140 +0,0 @@
-import type { Component } from 'solid-js';
-import { For, Show } from 'solid-js';
-import Loader from 'lucide-solid/icons/loader';
-import { Card } from '@/components/shared/Card';
-import { formatRelativeTime } from '@/utils/format';
-import type { ProxmoxVariantPresentation } from '@/utils/proxmoxSettingsPresentation';
-import type { DiscoveryScanStatus, DiscoveredServer } from './infrastructureSettingsModel';
-
-interface ProxmoxDiscoveryResultsCardProps {
- activeConfig: ProxmoxVariantPresentation;
- activeDiscoveredNodes: DiscoveredServer[];
- discoveryScanStatus: DiscoveryScanStatus;
- hasDiscoveryTimeouts: boolean;
- onOpenDiscoveredNode: (server: DiscoveredServer) => void;
-}
-
-export const ProxmoxDiscoveryResultsCard: Component<ProxmoxDiscoveryResultsCardProps> = (
- props,
-) => {
- return (
- <Card padding="lg" class="rounded-xl border border-border shadow-sm">
- <div class="space-y-4">
- <div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
- <div>
- <h4 class="text-base font-semibold text-base-content">Discovery results</h4>
- <p class="text-sm text-muted">
- Found servers that can be turned into direct connections for this Proxmox type.
- </p>
- </div>
- <div class="text-xs text-muted">
- <Show when={props.discoveryScanStatus.scanning}>
- <span class="flex items-center gap-2">
- <Loader class="h-4 w-4 animate-spin" />
- <span>{props.activeConfig.scanningLabel}</span>
- </span>
- </Show>
- <Show
- when={
- !props.discoveryScanStatus.scanning &&
- (props.discoveryScanStatus.lastResultAt ||
- props.discoveryScanStatus.lastScanStartedAt)
- }
- >
- <span>
- Last scan{' '}
- {formatRelativeTime(
- props.discoveryScanStatus.lastResultAt ??
- props.discoveryScanStatus.lastScanStartedAt,
- { compact: true },
- )}
- </span>
- </Show>
- </div>
- </div>
-
- <Show
- when={
- props.discoveryScanStatus.errors && props.discoveryScanStatus.errors.length > 0
- }
- >
- <div class="text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900 border border-amber-200 dark:border-amber-800 rounded-md p-2">
- <span class="font-medium">Discovery issues:</span>
- <ul class="list-disc ml-4 mt-1 space-y-0.5">
- <For each={props.discoveryScanStatus.errors ?? []}>{(error) => <li>{error}</li>}</For>
- </ul>
- <Show when={props.hasDiscoveryTimeouts}>
- <p class="mt-2 text-[0.7rem] font-medium text-amber-700 dark:text-amber-300">
- Large networks can time out in auto mode. Switch to a custom subnet for faster,
- targeted scans.
- </p>
- </Show>
- </div>
- </Show>
-
- <Show when={props.discoveryScanStatus.scanning && props.activeDiscoveredNodes.length === 0}>
- <div class="flex items-center gap-2 text-xs text-muted">
- <Loader class="h-4 w-4 animate-spin" />
- <span>
- Waiting for responses… this can take up to a minute depending on your network size.
- </span>
- </div>
- </Show>
-
- <Show
- when={props.activeDiscoveredNodes.length > 0}
- fallback={
- <div class="rounded-md border border-dashed border-border px-4 py-6 text-sm text-muted">
- No discovery matches for this Proxmox type yet. You can still add a direct
- connection manually.
- </div>
- }
- >
- <div class="space-y-3">
- <For each={props.activeDiscoveredNodes}>
- {(server) => (
- <button
- type="button"
- class="w-full bg-surface-hover rounded-md p-4 border border-border text-left opacity-75 hover:opacity-100 hover:border-blue-300 dark:hover:border-blue-700 transition-all"
- onClick={() => props.onOpenDiscoveredNode(server)}
- >
- <div class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2">
- <div class="flex-1 min-w-0">
- <div class="flex items-start gap-3">
- <div class="flex-shrink-0 w-3 h-3 mt-1.5 rounded-full bg-gray-400 animate-pulse"></div>
- <div class="flex-1 min-w-0">
- <h4 class="font-medium text-base-content">
- {props.activeConfig.titleFromServer(server)}
- </h4>
- <p class="text-sm mt-1">
- {server.ip}:{server.port}
- </p>
- <div class="flex items-center gap-2 mt-2">
- <span class="text-xs px-2 py-1 bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-400 rounded">
- Discovered
- </span>
- <span class="text-xs text-muted">
- Click to configure this connection
- </span>
- </div>
- </div>
- </div>
- </div>
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="mt-1">
- <path
- d="M12 5v14m-7-7h14"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- />
- </svg>
- </div>
- </button>
- )}
- </For>
- </div>
- </Show>
- </div>
- </Card>
- );
-};
diff --git a/frontend-modern/src/components/Settings/ProxmoxNodeModalStack.tsx b/frontend-modern/src/components/Settings/ProxmoxNodeModalStack.tsx
deleted file mode 100644
index ad23415a71..0000000000
--- a/frontend-modern/src/components/Settings/ProxmoxNodeModalStack.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import { Show, type Component } from 'solid-js';
-import type { NodeConfig, NodeConfigWithStatus } from '@/types/nodes';
-import type { SecurityStatus as SecurityStatusInfo } from '@/types/config';
-import { NodeModal } from './NodeModal';
-import type { NodeType } from './infrastructureSettingsModel';
-
-interface ProxmoxNodeModalStackProps {
- modalResetKey: number;
- prefillNode: Partial<NodeConfig> | null;
- editingNodeType: NodeType | null;
- editingNode: () => NodeConfigWithStatus | null;
- isNodeModalVisible: (type: NodeType) => boolean;
- securityStatus: SecurityStatusInfo | null;
- resolveTemperatureMonitoringEnabled: (node?: NodeConfigWithStatus | null) => boolean;
- temperatureMonitoringLocked: boolean;
- savingTemperatureSetting: boolean;
- handleNodeTemperatureMonitoringChange: (nodeId: string, enabled: boolean | null) => Promise<void>;
- handleTemperatureMonitoringChange: (enabled: boolean) => Promise<void>;
- saveNode: (nodeData: Partial<NodeConfig>) => Promise<void>;
- onClose: () => void;
-}
-
-const PROXMOX_NODE_TYPES: readonly NodeType[] = ['pve', 'pbs', 'pmg'];
-
-export const ProxmoxNodeModalStack: Component<ProxmoxNodeModalStackProps> = (props) => {
- return (
- <>
- {PROXMOX_NODE_TYPES.map((type) => (
- <Show when={props.isNodeModalVisible(type)}>
- <NodeModal
- isOpen={true}
- resetKey={props.modalResetKey}
- onClose={props.onClose}
- nodeType={type}
- editingNode={props.editingNodeType === type ? props.editingNode() ?? undefined : undefined}
- prefillNode={props.prefillNode?.type === type ? props.prefillNode ?? undefined : undefined}
- securityStatus={props.securityStatus ?? undefined}
- temperatureMonitoringEnabled={props.resolveTemperatureMonitoringEnabled(
- props.editingNodeType === type ? props.editingNode() : null,
- )}
- temperatureMonitoringLocked={props.temperatureMonitoringLocked}
- savingTemperatureSetting={props.savingTemperatureSetting}
- onToggleTemperatureMonitoring={
- props.editingNode()?.id
- ? (enabled: boolean) =>
- props.handleNodeTemperatureMonitoringChange(props.editingNode()!.id, enabled)
- : props.handleTemperatureMonitoringChange
- }
- onSave={props.saveNode}
- />
- </Show>
- ))}
- </>
- );
-};
-
-export default ProxmoxNodeModalStack;
diff --git a/frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx b/frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx
deleted file mode 100644
index 10373637fa..0000000000
--- a/frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Component } from 'solid-js';
-import { ProxmoxDirectWorkspace } from './ProxmoxDirectWorkspace';
-import { SettingsSectionNav } from './SettingsSectionNav';
-import type { InfrastructurePlatformSettingsProps } from './proxmoxSettingsModel';
-
-export const ProxmoxSettingsPanel: Component<InfrastructurePlatformSettingsProps> = (props) => {
- return (
- <>
- <SettingsSectionNav
- current={props.selectedAgent()}
- onSelect={props.onSelectAgent}
- class="mb-6"
- />
-
- <ProxmoxDirectWorkspace {...props} />
- </>
- );
-};
diff --git a/frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx b/frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx
deleted file mode 100644
index acf340a44f..0000000000
--- a/frontend-modern/src/components/Settings/TrueNASSettingsPanel.tsx
+++ /dev/null
@@ -1,679 +0,0 @@
-import type { Component } from 'solid-js';
-import { For, Show } from 'solid-js';
-import Database from 'lucide-solid/icons/database';
-import ShieldAlert from 'lucide-solid/icons/shield-alert';
-import { CalloutCard } from '@/components/shared/CalloutCard';
-import { Card } from '@/components/shared/Card';
-import { Dialog } from '@/components/shared/Dialog';
-import type { TrueNASConnection } from '@/api/truenas';
-import {
- buildInfrastructurePath,
- buildRecoveryPath,
- buildStoragePath,
- buildWorkloadsPath,
-} from '@/routing/resourceLinks';
-import { formatNumber, formatRelativeTime } from '@/utils/format';
-import {
- formCheckbox,
- formControl,
- formField,
- formHelpText,
- formLabel,
- formSelect,
-} from '@/components/shared/Form';
-import { getSettingsConfigurationLoadingState } from '@/utils/settingsShellPresentation';
-import { MonitoredSystemAdmissionPreview } from './MonitoredSystemAdmissionPreview';
-import type { TrueNASSettingsPanelState } from './useTrueNASSettingsPanelState';
-
-const buttonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
-const primaryButtonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60';
-const dangerButtonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-red-300 px-3 py-2 text-sm font-medium text-red-700 transition-colors hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-800 dark:text-red-300 dark:hover:bg-red-950/30';
-
-const connectionMetaBadgeClass =
- 'inline-flex items-center rounded-full border border-border bg-surface px-2 py-0.5 text-xs font-medium text-muted';
-
-const getPollIntervalLabel = (seconds: number | undefined): string => {
- const value = seconds && Number.isFinite(seconds) && seconds > 0 ? seconds : 60;
- if (value % 60 === 0) {
- const minutes = value / 60;
- return minutes === 1 ? 'Poll every 1 minute' : `Poll every ${minutes} minutes`;
- }
- return value === 1 ? 'Poll every 1 second' : `Poll every ${value} seconds`;
-};
-
-const getConnectionHealthPresentation = (connection: TrueNASConnection) => {
- if (!connection.enabled) {
- return {
- label: 'Paused',
- className: 'bg-surface text-muted',
- detail: 'Polling paused',
- error: null,
- };
- }
-
- const poll = connection.poll;
- const lastSuccessAt = poll?.lastSuccessAt;
- const lastError = poll?.lastError;
- const lastErrorAfterSuccess =
- !!lastError?.at &&
- (!lastSuccessAt || new Date(lastError.at).getTime() >= new Date(lastSuccessAt).getTime());
-
- if (lastError && lastErrorAfterSuccess) {
- return {
- label: 'Sync failing',
- className: 'bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-300',
- detail: lastError.at
- ? `Last error ${formatRelativeTime(lastError.at, { compact: true })}`
- : 'Last poll failed',
- error: lastError.message || null,
- };
- }
-
- if (lastSuccessAt) {
- return {
- label: 'Healthy',
- className: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300',
- detail: `Last sync ${formatRelativeTime(lastSuccessAt, { compact: true })}`,
- error: null,
- };
- }
-
- return {
- label: 'Awaiting first sync',
- className: 'bg-amber-50 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300',
- detail: 'Pulse has not completed the first poll yet',
- error: null,
- };
-};
-
-const getConnectionObservedMetrics = (connection: TrueNASConnection) => {
- const observed = connection.observed;
- if (!observed) return [];
- return [
- { label: 'system', value: observed.systems },
- { label: 'pool', value: observed.storagePools },
- { label: 'dataset', value: observed.datasets },
- { label: 'app', value: observed.apps },
- { label: 'disk', value: observed.disks },
- { label: 'recovery artifact', value: observed.recoveryArtifacts },
- ].filter((item) => item.value > 0);
-};
-
-const pluralize = (count: number, singular: string): string =>
- count === 1 ? singular : `${singular}s`;
-
-const getConnectionHandoffs = (connection: TrueNASConnection) => {
- const host = (connection.observed?.host || '').trim();
- const resourceId = (connection.observed?.resourceId || host).trim();
- if (!host && !resourceId) {
- return null;
- }
- return {
- infrastructure: buildInfrastructurePath({
- source: 'truenas',
- ...(resourceId ? { resource: resourceId } : {}),
- }),
- workloads: buildWorkloadsPath({
- type: 'app-container',
- platform: 'truenas',
- ...(host ? { agent: host } : {}),
- }),
- storage: buildStoragePath({
- source: 'truenas',
- ...(resourceId ? { node: resourceId } : {}),
- }),
- recovery: buildRecoveryPath({
- platform: 'truenas',
- ...(host ? { node: host } : {}),
- }),
- };
-};
-
-interface TrueNASSettingsPanelProps {
- state: TrueNASSettingsPanelState;
-}
-
-export const TrueNASSettingsPanel: Component<TrueNASSettingsPanelProps> = (props) => {
- const state = props.state;
-
- return (
- <div class="space-y-6">
- <CalloutCard
- tone="info"
- title="TrueNAS platform integration"
- description={
- <>
- <p>
- Connect TrueNAS through its API so Pulse can ingest pools, datasets, disks, disk
- temperatures, apps, alerts, and recovery artifacts as a first-class platform instead
- of treating the NAS like a generic host.
- </p>
- <p class="mt-2">
- Use the unified agent on TrueNAS only as optional augmentation later if there is extra
- host telemetry the API cannot provide.
- </p>
- </>
- }
- icon={<Database class="h-5 w-5" />}
- />
-
- <Show when={state.featureDisabled()}>
- <CalloutCard
- tone="warning"
- title="TrueNAS integration is disabled"
- description={
- <>
- <p>
- {state.featureDisabledMessage() ||
- 'TrueNAS integration has been explicitly disabled on this Pulse server.'}
- </p>
- <p class="mt-2">
- Remove <code>PULSE_ENABLE_TRUENAS=false</code> or set it back to <code>true</code>{' '}
- on the Pulse server, then restart the service before managing TrueNAS connections.
- </p>
- </>
- }
- icon={<ShieldAlert class="h-5 w-5" />}
- />
- </Show>
-
- <Show when={!state.featureDisabled()}>
- <Card padding="lg" class="rounded-xl border border-border shadow-sm">
- <div class="space-y-4">
- <div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
- <div class="space-y-1">
- <h3 class="text-base font-semibold text-base-content">TrueNAS connections</h3>
- <p class="text-sm text-muted">
- Manage the API-backed TrueNAS systems Pulse should poll and normalize into the
- unified resource model for infrastructure, workloads, alerts, storage, and
- recovery.
- </p>
- </div>
- <div class="flex items-center gap-2">
- <button
- type="button"
- class={buttonClass}
- onClick={() => void state.loadConnections()}
- disabled={state.loading()}
- >
- Refresh
- </button>
- <button type="button" class={primaryButtonClass} onClick={state.openCreateDialog}>
- Add TrueNAS connection
- </button>
- </div>
- </div>
-
- <Show when={state.loading()}>
- <div class="flex items-center justify-center rounded-md border border-dashed border-border bg-surface-alt py-12 text-sm text-muted">
- {getSettingsConfigurationLoadingState().text}
- </div>
- </Show>
-
- <Show when={!state.loading() && state.loadingError()}>
- <CalloutCard
- tone="danger"
- title="Failed to load TrueNAS connections"
- description={
- <>
- <p>{state.loadingError()}</p>
- <button
- type="button"
- class={`mt-3 ${buttonClass}`}
- onClick={() => void state.loadConnections()}
- >
- Retry
- </button>
- </>
- }
- />
- </Show>
-
- <Show
- when={!state.loading() && !state.loadingError() && state.connections().length === 0}
- >
- <div class="rounded-lg border border-dashed border-border bg-surface-alt px-6 py-12 text-center">
- <p class="text-base font-medium text-base-content">No TrueNAS connections yet</p>
- <p class="mt-1 text-sm text-muted">
- Add the first TrueNAS API endpoint Pulse should poll.
- </p>
- </div>
- </Show>
-
- <Show
- when={!state.loading() && !state.loadingError() && state.connections().length > 0}
- >
- <div class="space-y-3">
- <For each={state.connections()}>
- {(connection) => {
- const health = () => getConnectionHealthPresentation(connection);
- const observedMetrics = () => getConnectionObservedMetrics(connection);
- const handoffs = () => getConnectionHandoffs(connection);
-
- return (
- <div
- class="rounded-lg border border-border bg-surface-alt px-4 py-4"
- data-testid={`truenas-connection-${connection.id}`}
- >
- <div class="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
- <div class="space-y-3">
- <div class="space-y-2">
- <div class="flex flex-wrap items-center gap-2">
- <h4 class="text-sm font-semibold text-base-content">
- {connection.name || connection.host}
- </h4>
- <span
- class={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${
- connection.enabled
- ? 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300'
- : 'bg-surface text-muted'
- }`}
- >
- {connection.enabled ? 'Enabled' : 'Disabled'}
- </span>
- <span
- class={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${health().className}`}
- >
- {health().label}
- </span>
- </div>
-
- <p class="text-sm text-muted">
- {connection.host}
- {connection.port ? `:${connection.port}` : ''}
- </p>
-
- <div class="flex flex-wrap items-center gap-2 text-xs text-muted">
- <span>
- {connection.apiKey ? 'API key auth' : 'Username/password auth'}
- </span>
- <span aria-hidden="true">•</span>
- <span>{connection.useHttps ? 'HTTPS' : 'HTTP'}</span>
- <Show when={connection.insecureSkipVerify}>
- <>
- <span aria-hidden="true">•</span>
- <span>Skip TLS verification</span>
- </>
- </Show>
- <span aria-hidden="true">•</span>
- <span>{getPollIntervalLabel(connection.pollIntervalSeconds)}</span>
- <Show when={connection.poll?.lastAttemptAt || health().detail}>
- <>
- <span aria-hidden="true">•</span>
- <span>{health().detail}</span>
- </>
- </Show>
- </div>
-
- <Show when={health().error}>
- <p class="text-xs font-medium text-red-700 dark:text-red-300">
- {health().error}
- </p>
- </Show>
- </div>
-
- <Show when={connection.observed}>
- <div class="space-y-2">
- <div class="flex flex-wrap gap-2">
- <Show when={connection.observed?.collectedAt}>
- <span class={connectionMetaBadgeClass}>
- Synced{' '}
- {formatRelativeTime(connection.observed?.collectedAt, {
- compact: true,
- })}
- </span>
- </Show>
- <For each={observedMetrics()}>
- {(item) => (
- <span class={connectionMetaBadgeClass}>
- {formatNumber(item.value)}{' '}
- {pluralize(item.value, item.label)}
- </span>
- )}
- </For>
- </div>
-
- <Show when={handoffs()}>
- {(links) => (
- <div class="flex flex-wrap items-center gap-2">
- <a
- href={links().infrastructure}
- class={buttonClass}
- data-testid={`truenas-connection-${connection.id}-infrastructure`}
- >
- Infrastructure
- </a>
- <a
- href={links().workloads}
- class={buttonClass}
- data-testid={`truenas-connection-${connection.id}-workloads`}
- >
- Workloads
- </a>
- <a
- href={links().storage}
- class={buttonClass}
- data-testid={`truenas-connection-${connection.id}-storage`}
- >
- Storage
- </a>
- <a
- href={links().recovery}
- class={buttonClass}
- data-testid={`truenas-connection-${connection.id}-recovery`}
- >
- Recovery
- </a>
- </div>
- )}
- </Show>
- </div>
- </Show>
- </div>
-
- <div class="flex flex-wrap items-center gap-2">
- <button
- type="button"
- class={buttonClass}
- onClick={() => void state.testSavedConnection(connection)}
- disabled={state.testing()}
- >
- Test
- </button>
- <button
- type="button"
- class={buttonClass}
- onClick={() => state.openEditDialog(connection)}
- >
- Edit
- </button>
- <button
- type="button"
- class={dangerButtonClass}
- onClick={() => state.openDeleteDialog(connection)}
- >
- Delete
- </button>
- </div>
- </div>
- </div>
- );
- }}
- </For>
- </div>
- </Show>
- </div>
- </Card>
- </Show>
-
- <Dialog
- isOpen={state.dialogOpen()}
- onClose={state.closeDialog}
- ariaLabel={state.editingConnection() ? 'Edit TrueNAS connection' : 'Add TrueNAS connection'}
- panelClass="w-full max-w-2xl"
- >
- <div class="space-y-6 p-6">
- <div class="space-y-1">
- <h3 class="text-lg font-semibold text-base-content">
- {state.editingConnection() ? 'Edit TrueNAS connection' : 'Add TrueNAS connection'}
- </h3>
- <p class="text-sm text-muted">
- Configure the API endpoint Pulse should poll for this TrueNAS system.
- </p>
- </div>
-
- <div class="grid gap-4 sm:grid-cols-2">
- <label class={formField}>
- <span class={formLabel}>Name</span>
- <input
- class={formControl}
- value={state.form().name}
- onInput={(event) => state.updateForm({ name: event.currentTarget.value })}
- placeholder="tower"
- />
- </label>
- <label class={formField}>
- <span class={formLabel}>Host</span>
- <input
- class={formControl}
- value={state.form().host}
- onInput={(event) => state.updateForm({ host: event.currentTarget.value })}
- placeholder="truenas.local"
- />
- </label>
- <label class={formField}>
- <span class={formLabel}>Port</span>
- <input
- class={formControl}
- inputMode="numeric"
- value={state.form().port}
- onInput={(event) => state.updateForm({ port: event.currentTarget.value })}
- placeholder={state.form().useHttps ? '443' : '80'}
- />
- </label>
- <label class={formField}>
- <span class={formLabel}>Poll interval (seconds)</span>
- <input
- class={formControl}
- inputMode="numeric"
- value={state.form().pollIntervalSeconds}
- onInput={(event) =>
- state.updateForm({ pollIntervalSeconds: event.currentTarget.value })
- }
- placeholder="60"
- />
- <span class={formHelpText}>
- How often Pulse should refresh this TrueNAS connection.
- </span>
- </label>
- <label class={formField}>
- <span class={formLabel}>Authentication</span>
- <select
- class={formSelect}
- value={state.form().authMode}
- onChange={(event) =>
- state.updateForm({
- authMode: event.currentTarget.value as 'apiKey' | 'userpass',
- apiKey: '',
- password: '',
- })
- }
- >
- <option value="apiKey">API key</option>
- <option value="userpass">Username and password</option>
- </select>
- </label>
- </div>
-
- <Show when={state.form().authMode === 'apiKey'}>
- <label class={formField}>
- <span class={formLabel}>API key</span>
- <input
- class={formControl}
- type="password"
- value={state.form().apiKey}
- onInput={(event) => state.updateForm({ apiKey: event.currentTarget.value })}
- placeholder={
- state.form().hasStoredApiKey ? 'Saved API key retained unless replaced' : ''
- }
- />
- <Show when={state.form().hasStoredApiKey}>
- <span class={formHelpText}>Leave this blank to keep the saved API key.</span>
- </Show>
- </label>
- </Show>
-
- <Show when={state.form().authMode === 'userpass'}>
- <div class="grid gap-4 sm:grid-cols-2">
- <label class={formField}>
- <span class={formLabel}>Username</span>
- <input
- class={formControl}
- value={state.form().username}
- onInput={(event) => state.updateForm({ username: event.currentTarget.value })}
- placeholder="admin"
- />
- </label>
- <label class={formField}>
- <span class={formLabel}>Password</span>
- <input
- class={formControl}
- type="password"
- value={state.form().password}
- onInput={(event) => state.updateForm({ password: event.currentTarget.value })}
- placeholder={
- state.form().hasStoredPassword ? 'Saved password retained unless replaced' : ''
- }
- />
- <Show when={state.form().hasStoredPassword}>
- <span class={formHelpText}>Leave this blank to keep the saved password.</span>
- </Show>
- </label>
- </div>
- </Show>
-
- <div class="grid gap-4 sm:grid-cols-2">
- <label class={formField}>
- <span class={formLabel}>TLS fingerprint</span>
- <input
- class={formControl}
- value={state.form().fingerprint}
- onInput={(event) => state.updateForm({ fingerprint: event.currentTarget.value })}
- placeholder="Optional SHA256 fingerprint"
- />
- <span class={formHelpText}>Optional certificate pin for HTTPS connections.</span>
- </label>
- <div class="space-y-3 rounded-md border border-border bg-surface-alt px-4 py-3">
- <label class="flex items-center gap-3">
- <input
- type="checkbox"
- class={formCheckbox}
- checked={state.form().useHttps}
- onChange={(event) => state.updateForm({ useHttps: event.currentTarget.checked })}
- />
- <span class="text-sm text-base-content">Use HTTPS</span>
- </label>
- <label class="flex items-center gap-3">
- <input
- type="checkbox"
- class={formCheckbox}
- checked={state.form().insecureSkipVerify}
- onChange={(event) =>
- state.updateForm({ insecureSkipVerify: event.currentTarget.checked })
- }
- />
- <span class="text-sm text-base-content">Skip TLS verification</span>
- </label>
- <label class="flex items-center gap-3">
- <input
- type="checkbox"
- class={formCheckbox}
- checked={state.form().enabled}
- onChange={(event) => state.updateForm({ enabled: event.currentTarget.checked })}
- />
- <span class="text-sm text-base-content">Enable polling immediately</span>
- </label>
- </div>
- </div>
-
- <MonitoredSystemAdmissionPreview
- preview={state.monitoredSystemPreview()}
- loading={state.previewing()}
- error={state.monitoredSystemPreviewError()}
- errorTitle={state.monitoredSystemPreviewErrorTitle()}
- />
-
- <div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
- <button
- type="button"
- class={buttonClass}
- onClick={state.closeDialog}
- disabled={state.saving() || state.testing()}
- >
- Cancel
- </button>
- <button
- type="button"
- class={buttonClass}
- onClick={() => void state.testCurrentForm()}
- disabled={state.saving() || state.testing()}
- >
- {state.testing() ? 'Testing…' : 'Test connection'}
- </button>
- <button
- type="button"
- class={buttonClass}
- onClick={() => void state.previewCurrentForm()}
- disabled={state.saving() || state.testing() || state.previewing()}
- >
- {state.previewing() ? 'Previewing…' : 'Preview impact'}
- </button>
- <button
- type="button"
- class={primaryButtonClass}
- onClick={() => void state.saveCurrentForm()}
- disabled={
- state.saving() ||
- state.testing() ||
- state.previewing() ||
- state.monitoredSystemAdmissionSaveBlocked()
- }
- >
- {state.saving()
- ? state.editingConnection()
- ? 'Saving…'
- : 'Adding…'
- : state.editingConnection()
- ? 'Save connection'
- : 'Add connection'}
- </button>
- </div>
- </div>
- </Dialog>
-
- <Dialog
- isOpen={state.deleteDialogOpen()}
- onClose={state.closeDeleteDialog}
- ariaLabel="Delete TrueNAS connection"
- panelClass="w-full max-w-lg"
- >
- <div class="space-y-5 p-6">
- <div class="space-y-1">
- <h3 class="text-lg font-semibold text-base-content">Delete TrueNAS connection</h3>
- <p class="text-sm text-muted">
- Remove{' '}
- <span class="font-medium text-base-content">
- {state.pendingDeleteConnection()?.name || state.pendingDeleteConnection()?.host}
- </span>{' '}
- from the configured TrueNAS API integrations.
- </p>
- </div>
-
- <div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
- <button
- type="button"
- class={buttonClass}
- onClick={state.closeDeleteDialog}
- disabled={state.deleting()}
- >
- Cancel
- </button>
- <button
- type="button"
- class={dangerButtonClass}
- onClick={() => void state.deletePendingConnection()}
- disabled={state.deleting()}
- >
- {state.deleting() ? 'Deleting…' : 'Delete connection'}
- </button>
- </div>
- </div>
- </Dialog>
- </div>
- );
-};
-
-export default TrueNASSettingsPanel;
diff --git a/frontend-modern/src/components/Settings/VMwareSettingsPanel.tsx b/frontend-modern/src/components/Settings/VMwareSettingsPanel.tsx
deleted file mode 100644
index a11592d232..0000000000
--- a/frontend-modern/src/components/Settings/VMwareSettingsPanel.tsx
+++ /dev/null
@@ -1,625 +0,0 @@
-import type { Component } from 'solid-js';
-import { For, Show } from 'solid-js';
-import Boxes from 'lucide-solid/icons/boxes';
-import ShieldAlert from 'lucide-solid/icons/shield-alert';
-import { CalloutCard } from '@/components/shared/CalloutCard';
-import { Card } from '@/components/shared/Card';
-import { Dialog } from '@/components/shared/Dialog';
-import type { VMwareConnection } from '@/api/vmware';
-import { formatNumber, formatRelativeTime } from '@/utils/format';
-import {
- formCheckbox,
- formControl,
- formField,
- formHelpText,
- formLabel,
-} from '@/components/shared/Form';
-import { getSettingsConfigurationLoadingState } from '@/utils/settingsShellPresentation';
-import { MonitoredSystemAdmissionPreview } from './MonitoredSystemAdmissionPreview';
-import type { VMwareSettingsPanelState } from './useVMwareSettingsPanelState';
-import { buildVMwareConnectionFailurePresentation } from './vmwareConnectionFailurePresentation';
-
-const buttonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
-const primaryButtonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60';
-const dangerButtonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-red-300 px-3 py-2 text-sm font-medium text-red-700 transition-colors hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-800 dark:text-red-300 dark:hover:bg-red-950/30';
-
-const connectionMetaBadgeClass =
- 'inline-flex items-center rounded-full border border-border bg-surface px-2 py-0.5 text-xs font-medium text-muted';
-
-const getObservedIssuePresentation = (connection: VMwareConnection) => {
- const observed = connection.observed;
- const firstIssue = observed?.issues?.find((issue) => !!issue.message);
- if (!firstIssue?.message) return null;
- const issueCount = observed?.issueCount ?? observed?.issues?.length ?? 0;
- const message =
- issueCount > 1
- ? `${firstIssue.message} (+${issueCount - 1} more degraded reads)`
- : firstIssue.message;
- return buildVMwareConnectionFailurePresentation({
- category: firstIssue.category,
- message,
- fallback: 'VMware optional inventory enrichment is degraded',
- defaultGuidance:
- 'Review the saved connection runtime health and VMware read access, then refresh or retest this vCenter.',
- defaultTitle: 'Partial VMware data is unavailable',
- defaultTone: 'warning',
- });
-};
-
-const getRuntimeFailurePresentation = (connection: VMwareConnection) => {
- const lastError = connection.poll?.lastError;
- if (!lastError?.message) return null;
- return buildVMwareConnectionFailurePresentation({
- category: lastError.category,
- message: lastError.message,
- fallback: 'VMware runtime validation failed',
- defaultGuidance:
- 'Retry the saved connection test after reviewing the VMware runtime status for this vCenter.',
- defaultTitle: 'Runtime validation failed',
- });
-};
-
-const getConnectionHealthPresentation = (connection: VMwareConnection) => {
- if (!connection.enabled) {
- return {
- label: 'Disabled',
- className: 'bg-surface text-muted',
- detail: 'Manual validation paused',
- noteGuidance: null,
- noteMessage: null,
- noteTitle: null,
- noteClassName: '',
- guidanceClassName: '',
- };
- }
-
- const poll = connection.poll;
- const lastSuccessAt = poll?.lastSuccessAt;
- const lastError = poll?.lastError;
- const lastErrorAfterSuccess =
- !!lastError?.at &&
- (!lastSuccessAt || new Date(lastError.at).getTime() >= new Date(lastSuccessAt).getTime());
-
- if (lastError && lastErrorAfterSuccess) {
- const failure = getRuntimeFailurePresentation(connection);
- return {
- label: 'Runtime failing',
- className: 'bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-300',
- detail: lastError.at
- ? `Last check ${formatRelativeTime(lastError.at, { compact: true })}`
- : 'Last check failed',
- noteGuidance: failure?.guidance ?? null,
- noteMessage: failure?.message ?? lastError.message ?? null,
- noteTitle: failure?.title ?? null,
- noteClassName: 'text-red-700 dark:text-red-300',
- guidanceClassName: 'text-red-700/90 dark:text-red-300/90',
- };
- }
-
- if (lastSuccessAt && connection.observed?.degraded) {
- const issue = getObservedIssuePresentation(connection);
- return {
- label: 'Degraded',
- className: 'bg-amber-50 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300',
- detail: `Last check ${formatRelativeTime(lastSuccessAt, { compact: true })} with partial enrichment`,
- noteGuidance: issue?.guidance ?? null,
- noteMessage: issue?.message ?? null,
- noteTitle: issue?.title ?? null,
- noteClassName: 'text-amber-700 dark:text-amber-300',
- guidanceClassName: 'text-amber-700/90 dark:text-amber-300/90',
- };
- }
-
- if (lastSuccessAt) {
- return {
- label: 'Healthy',
- className: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300',
- detail: `Last check ${formatRelativeTime(lastSuccessAt, { compact: true })}`,
- noteGuidance: null,
- noteMessage: null,
- noteTitle: null,
- noteClassName: '',
- guidanceClassName: '',
- };
- }
-
- return {
- label: 'Awaiting first poll',
- className: 'bg-amber-50 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300',
- detail: 'Pulse has not completed the first vCenter poll yet',
- noteGuidance: null,
- noteMessage: null,
- noteTitle: null,
- noteClassName: '',
- guidanceClassName: '',
- };
-};
-
-const getConnectionObservedMetrics = (connection: VMwareConnection) => {
- const observed = connection.observed;
- if (!observed) return [];
- return [
- { label: 'host', value: observed.hosts },
- { label: 'vm', value: observed.vms },
- { label: 'datastore', value: observed.datastores },
- ].filter((item) => item.value > 0);
-};
-
-const pluralize = (count: number, singular: string): string =>
- count === 1 ? singular : `${singular}s`;
-
-interface VMwareSettingsPanelProps {
- state: VMwareSettingsPanelState;
-}
-
-export const VMwareSettingsPanel: Component<VMwareSettingsPanelProps> = (props) => {
- const state = props.state;
-
- return (
- <div class="space-y-6">
- <CalloutCard
- tone="info"
- title="VMware vSphere platform integration"
- description={
- <>
- <p>
- Connect VMware through vCenter so Pulse can validate API-backed access and stage the
- canonical phase-1 floor for hosts, virtual machines, datastores, and shared alert or
- assistant read paths.
- </p>
- <p class="mt-2">
- Phase 1 is vCenter-only and API-first. Direct ESXi onboarding and write-path control
- stay out of scope here.
- </p>
- </>
- }
- icon={<Boxes class="h-5 w-5" />}
- />
-
- <Show when={state.featureDisabled()}>
- <CalloutCard
- tone="warning"
- title="VMware integration is disabled"
- description={
- <>
- <p>
- {state.featureDisabledMessage() ||
- 'VMware integration has been explicitly disabled on this Pulse server.'}
- </p>
- <p class="mt-2">
- Remove <code>PULSE_ENABLE_VMWARE=false</code> or set it back to <code>true</code> on
- the Pulse server, then restart the service before managing VMware connections.
- </p>
- </>
- }
- icon={<ShieldAlert class="h-5 w-5" />}
- />
- </Show>
-
- <Show when={!state.featureDisabled()}>
- <Card padding="lg" class="rounded-xl border border-border shadow-sm">
- <div class="space-y-4">
- <div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
- <div class="space-y-1">
- <h3 class="text-base font-semibold text-base-content">VMware connections</h3>
- <p class="text-sm text-muted">
- Manage the vCenter endpoints Pulse should validate and use as the shared VMware
- platform onboarding boundary.
- </p>
- </div>
- <div class="flex items-center gap-2">
- <button
- type="button"
- class={buttonClass}
- onClick={() => void state.loadConnections()}
- disabled={state.loading()}
- >
- Refresh
- </button>
- <button type="button" class={primaryButtonClass} onClick={state.openCreateDialog}>
- Add VMware connection
- </button>
- </div>
- </div>
-
- <Show when={state.loading()}>
- <div class="flex items-center justify-center rounded-md border border-dashed border-border bg-surface-alt py-12 text-sm text-muted">
- {getSettingsConfigurationLoadingState().text}
- </div>
- </Show>
-
- <Show when={!state.loading() && state.loadingError()}>
- <CalloutCard
- tone="danger"
- title="Failed to load VMware connections"
- description={
- <>
- <p>{state.loadingError()}</p>
- <button
- type="button"
- class={`mt-3 ${buttonClass}`}
- onClick={() => void state.loadConnections()}
- >
- Retry
- </button>
- </>
- }
- />
- </Show>
-
- <Show
- when={!state.loading() && !state.loadingError() && state.connections().length === 0}
- >
- <div class="rounded-lg border border-dashed border-border bg-surface-alt px-6 py-12 text-center">
- <p class="text-base font-medium text-base-content">No VMware connections yet</p>
- <p class="mt-1 text-sm text-muted">
- Add the first vCenter endpoint Pulse should validate.
- </p>
- </div>
- </Show>
-
- <Show
- when={!state.loading() && !state.loadingError() && state.connections().length > 0}
- >
- <div class="space-y-3">
- <For each={state.connections()}>
- {(connection) => {
- const health = () => getConnectionHealthPresentation(connection);
- const observedMetrics = () => getConnectionObservedMetrics(connection);
-
- return (
- <div
- class="rounded-lg border border-border bg-surface-alt px-4 py-4"
- data-testid={`vmware-connection-${connection.id}`}
- >
- <div class="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
- <div class="space-y-3">
- <div class="space-y-2">
- <div class="flex flex-wrap items-center gap-2">
- <h4 class="text-sm font-semibold text-base-content">
- {connection.name || connection.host}
- </h4>
- <span
- class={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${
- connection.enabled
- ? 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300'
- : 'bg-surface text-muted'
- }`}
- >
- {connection.enabled ? 'Enabled' : 'Disabled'}
- </span>
- <span
- class={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${health().className}`}
- >
- {health().label}
- </span>
- </div>
-
- <p class="text-sm text-muted">
- {connection.host}
- {connection.port ? `:${connection.port}` : ''}
- </p>
-
- <div class="flex flex-wrap items-center gap-2 text-xs text-muted">
- <span>{connection.username || 'Username not set'}</span>
- <span aria-hidden="true">•</span>
- <span>vCenter</span>
- <Show when={connection.insecureSkipVerify}>
- <>
- <span aria-hidden="true">•</span>
- <span>Skip TLS verification</span>
- </>
- </Show>
- <Show when={connection.poll?.lastAttemptAt || health().detail}>
- <>
- <span aria-hidden="true">•</span>
- <span>{health().detail}</span>
- </>
- </Show>
- </div>
-
- <Show when={health().noteTitle || health().noteMessage}>
- <div class="space-y-1">
- <Show when={health().noteTitle}>
- <p class={`text-xs font-semibold ${health().noteClassName}`}>
- {health().noteTitle}
- </p>
- </Show>
- <Show when={health().noteMessage}>
- <p class={`text-xs font-medium ${health().noteClassName}`}>
- {health().noteMessage}
- </p>
- </Show>
- <Show when={health().noteGuidance}>
- <p class={`text-xs ${health().guidanceClassName}`}>
- {health().noteGuidance}
- </p>
- </Show>
- </div>
- </Show>
- </div>
-
- <Show when={connection.observed}>
- <div class="space-y-2">
- <div class="flex flex-wrap gap-2">
- <Show when={connection.observed?.collectedAt}>
- <span class={connectionMetaBadgeClass}>
- Observed{' '}
- {formatRelativeTime(connection.observed?.collectedAt, {
- compact: true,
- })}
- </span>
- </Show>
- <For each={observedMetrics()}>
- {(item) => (
- <span class={connectionMetaBadgeClass}>
- {formatNumber(item.value)}{' '}
- {pluralize(item.value, item.label)}
- </span>
- )}
- </For>
- <Show when={connection.observed?.viRelease}>
- <span class={connectionMetaBadgeClass}>
- VI JSON {connection.observed?.viRelease}
- </span>
- </Show>
- <Show when={connection.observed?.degraded}>
- <span class="inline-flex items-center rounded-full border border-amber-300 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-300">
- {formatNumber(connection.observed?.issueCount ?? 0)} degraded{' '}
- {pluralize(connection.observed?.issueCount ?? 0, 'read')}
- </span>
- </Show>
- </div>
- </div>
- </Show>
- </div>
-
- <div class="flex flex-wrap items-center gap-2">
- <button
- type="button"
- class={buttonClass}
- onClick={() => void state.testSavedConnection(connection)}
- disabled={state.testing()}
- >
- Test
- </button>
- <button
- type="button"
- class={buttonClass}
- onClick={() => state.openEditDialog(connection)}
- >
- Edit
- </button>
- <button
- type="button"
- class={dangerButtonClass}
- onClick={() => state.openDeleteDialog(connection)}
- >
- Delete
- </button>
- </div>
- </div>
- </div>
- );
- }}
- </For>
- </div>
- </Show>
- </div>
- </Card>
- </Show>
-
- <Dialog
- isOpen={state.dialogOpen()}
- onClose={state.closeDialog}
- ariaLabel={state.editingConnection() ? 'Edit VMware connection' : 'Add VMware connection'}
- panelClass="w-full max-w-2xl"
- >
- <div class="space-y-6 p-6">
- <div class="space-y-1">
- <h3 class="text-lg font-semibold text-base-content">
- {state.editingConnection() ? 'Edit VMware connection' : 'Add VMware connection'}
- </h3>
- <p class="text-sm text-muted">
- Configure the vCenter endpoint Pulse should validate for the VMware platform.
- </p>
- </div>
-
- <Show when={state.connectionFailure()}>
- {(failure) => (
- <CalloutCard
- data-testid="vmware-connection-test-feedback"
- tone={failure().tone}
- title={failure().title}
- description={
- <>
- <p>{failure().message}</p>
- <Show when={failure().guidance}>
- <p class="mt-2">{failure().guidance}</p>
- </Show>
- </>
- }
- icon={<ShieldAlert class="h-5 w-5" />}
- />
- )}
- </Show>
-
- <div class="grid gap-4 sm:grid-cols-2">
- <label class={formField}>
- <span class={formLabel}>Name</span>
- <input
- class={formControl}
- value={state.form().name}
- onInput={(event) => state.updateForm({ name: event.currentTarget.value })}
- placeholder="lab-vcenter"
- />
- </label>
- <label class={formField}>
- <span class={formLabel}>Host</span>
- <input
- class={formControl}
- value={state.form().host}
- onInput={(event) => state.updateForm({ host: event.currentTarget.value })}
- placeholder="vcsa.lab.local"
- />
- </label>
- <label class={formField}>
- <span class={formLabel}>Port</span>
- <input
- class={formControl}
- inputMode="numeric"
- value={state.form().port}
- onInput={(event) => state.updateForm({ port: event.currentTarget.value })}
- placeholder="443"
- />
- </label>
- <label class={formField}>
- <span class={formLabel}>Username</span>
- <input
- class={formControl}
- value={state.form().username}
- onInput={(event) => state.updateForm({ username: event.currentTarget.value })}
- placeholder="[email protected]"
- />
- </label>
- <label class={`${formField} sm:col-span-2`}>
- <span class={formLabel}>Password</span>
- <input
- class={formControl}
- type="password"
- value={state.form().password}
- onInput={(event) => state.updateForm({ password: event.currentTarget.value })}
- placeholder={
- state.form().hasStoredPassword ? 'Saved password retained unless replaced' : ''
- }
- />
- <Show when={state.form().hasStoredPassword}>
- <span class={formHelpText}>Leave this blank to keep the saved password.</span>
- </Show>
- </label>
- </div>
-
- <div class="space-y-3 rounded-md border border-border bg-surface-alt px-4 py-3">
- <label class="flex items-center gap-3">
- <input
- type="checkbox"
- class={formCheckbox}
- checked={state.form().insecureSkipVerify}
- onChange={(event) =>
- state.updateForm({ insecureSkipVerify: event.currentTarget.checked })
- }
- />
- <span class="text-sm text-base-content">Skip TLS verification</span>
- </label>
- <label class="flex items-center gap-3">
- <input
- type="checkbox"
- class={formCheckbox}
- checked={state.form().enabled}
- onChange={(event) => state.updateForm({ enabled: event.currentTarget.checked })}
- />
- <span class="text-sm text-base-content">Enable this vCenter connection</span>
- </label>
- </div>
-
- <MonitoredSystemAdmissionPreview
- preview={state.monitoredSystemPreview()}
- loading={state.previewing()}
- error={state.monitoredSystemPreviewError()}
- errorTitle={state.monitoredSystemPreviewErrorTitle()}
- />
-
- <div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
- <button
- type="button"
- class={buttonClass}
- onClick={state.closeDialog}
- disabled={state.saving() || state.testing()}
- >
- Cancel
- </button>
- <button
- type="button"
- class={buttonClass}
- onClick={() => void state.testCurrentForm()}
- disabled={state.saving() || state.testing()}
- >
- {state.testing() ? 'Testing…' : 'Test connection'}
- </button>
- <button
- type="button"
- class={buttonClass}
- onClick={() => void state.previewCurrentForm()}
- disabled={state.saving() || state.testing() || state.previewing()}
- >
- {state.previewing() ? 'Previewing…' : 'Preview impact'}
- </button>
- <button
- type="button"
- class={primaryButtonClass}
- onClick={() => void state.saveCurrentForm()}
- disabled={
- state.saving() ||
- state.testing() ||
- state.previewing() ||
- state.monitoredSystemAdmissionSaveBlocked()
- }
- >
- {state.saving()
- ? state.editingConnection()
- ? 'Saving…'
- : 'Adding…'
- : state.editingConnection()
- ? 'Save connection'
- : 'Add connection'}
- </button>
- </div>
- </div>
- </Dialog>
-
- <Dialog
- isOpen={state.deleteDialogOpen()}
- onClose={state.closeDeleteDialog}
- ariaLabel="Delete VMware connection"
- panelClass="w-full max-w-lg"
- >
- <div class="space-y-5 p-6">
- <div class="space-y-1">
- <h3 class="text-lg font-semibold text-base-content">Delete VMware connection</h3>
- <p class="text-sm text-muted">
- Remove{' '}
- <span class="font-medium text-base-content">
- {state.pendingDeleteConnection()?.name || state.pendingDeleteConnection()?.host}
- </span>{' '}
- from the configured VMware platform connections.
- </p>
- </div>
-
- <div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
- <button
- type="button"
- class={buttonClass}
- onClick={state.closeDeleteDialog}
- disabled={state.deleting()}
- >
- Cancel
- </button>
- <button
- type="button"
- class={dangerButtonClass}
- onClick={() => void state.deletePendingConnection()}
- disabled={state.deleting()}
- >
- {state.deleting() ? 'Deleting…' : 'Delete connection'}
- </button>
- </div>
- </div>
- </Dialog>
- </div>
- );
-};
-
-export default VMwareSettingsPanel;
diff --git a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
index c3d21590ef..928b796f75 100644
--- a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
@@ -14,7 +14,7 @@ const row = (overrides: Partial<InfrastructureSystemRow> = {}): InfrastructureSy
statusClassName: 'bg-green-100 text-green-800',
lastActivityText: '5s ago',
manageLabel: 'View details',
- manage: { kind: 'inventory-active', rowKey: 'agent:tower' },
+ manage: { kind: 'connection', connectionId: 'row-1' },
...overrides,
});
@@ -44,7 +44,7 @@ describe('ConnectionsTable', () => {
collectionLabel: 'API',
statusLabel: 'Ignored',
manageLabel: 'Review ignored',
- manage: { kind: 'inventory-ignored', rowKey: 'removed:pbs-docker' },
+ manage: { kind: 'connection', connectionId: 'row-2' },
}),
]}
/>
@@ -104,7 +104,7 @@ describe('ConnectionsTable', () => {
expect(onManageRow).toHaveBeenCalledWith(
expect.objectContaining({
id: 'row-1',
- manage: { kind: 'inventory-active', rowKey: 'agent:tower' },
+ manage: { kind: 'connection', connectionId: 'row-1' },
}),
);
});
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx
deleted file mode 100644
index ba1f73fa76..0000000000
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx
+++ /dev/null
@@ -1,3866 +0,0 @@
-import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
-import { render, fireEvent, screen, waitFor, cleanup, within } from '@solidjs/testing-library';
-import { createSignal } from 'solid-js';
-import { createStore } from 'solid-js/store';
-import { Router, Route } from '@solidjs/router';
-import { InfrastructureOperationsController } from '../InfrastructureOperationsController';
-import infrastructureInstallerSectionSource from '../InfrastructureInstallerSection.tsx?raw';
-import infrastructureOperationsControllerSource from '../InfrastructureOperationsController.tsx?raw';
-import infrastructureOperationsModelSource from '../infrastructureOperationsModel.tsx?raw';
-import infrastructureInventorySectionSource from '../InfrastructureInventorySection.tsx?raw';
-import infrastructureInstallStateSource from '../useInfrastructureInstallState.tsx?raw';
-import infrastructureOperationsStateSource from '../useInfrastructureOperationsState.tsx?raw';
-import infrastructureReportingStateSource from '../useInfrastructureReportingState.tsx?raw';
-import infrastructureConfiguredNodesStateSource from '../useInfrastructureConfiguredNodesState.ts?raw';
-import infrastructureDiscoveryRuntimeStateSource from '../useInfrastructureDiscoveryRuntimeState.ts?raw';
-import infrastructureStopMonitoringDialogSource from '../InfrastructureStopMonitoringDialog.tsx?raw';
-import type {
- Agent,
- ConnectedInfrastructureItem,
- DockerRuntime,
- KubernetesCluster,
- State,
-} from '@/types/api';
-import { STORAGE_KEYS } from '@/utils/localStorage';
-
-const createObjectURLMock = vi.fn(() => 'blob:mock-url');
-const revokeObjectURLMock = vi.fn();
-
-class MockBlob {
- readonly parts: string[];
- readonly type: string;
-
- constructor(parts: unknown[], options?: { type?: string }) {
- this.parts = parts.map((part) => String(part));
- this.type = options?.type || '';
- }
-
- async text() {
- return this.parts.join('');
- }
-}
-
-const { navigateMock } = vi.hoisted(() => ({
- navigateMock: vi.fn(),
-}));
-
-vi.mock('@solidjs/router', async () => {
- const actual = await vi.importActual<typeof import('@solidjs/router')>('@solidjs/router');
- return {
- ...actual,
- useNavigate: () => navigateMock,
- };
-});
-
-let mockWsStore: {
- state: Pick<State, 'connectedInfrastructure'>;
- connected: () => boolean;
- reconnecting: () => boolean;
- activeAlerts: unknown[];
-};
-
-const lookupMock = vi.fn();
-const getStateMock = vi.fn();
-const createTokenMock = vi.fn();
-const deleteAgentMock = vi.fn();
-const allowHostAgentReenrollMock = vi.fn();
-const updateAgentConfigMock = vi.fn();
-const deleteDockerRuntimeMock = vi.fn();
-const allowDockerRuntimeReenrollMock = vi.fn();
-const notificationSuccessMock = vi.fn();
-const notificationErrorMock = vi.fn();
-const notificationInfoMock = vi.fn();
-const clipboardSpy = vi.fn();
-const fetchMock = vi.fn();
-const listProfilesMock = vi.fn();
-const listAssignmentsMock = vi.fn();
-const assignProfileMock = vi.fn();
-const unassignProfileMock = vi.fn();
-const trackAgentInstallTokenGeneratedMock = vi.fn();
-const trackAgentInstallCommandCopiedMock = vi.fn();
-const trackAgentInstallProfileSelectedMock = vi.fn();
-const refetchResourcesMock = vi.fn();
-const [mockResources, setMockResources] = createSignal<any[]>([]);
-let securityStatusResponse = { requiresAuth: true, apiTokenConfigured: false };
-
-describe('InfrastructureOperationsController ownership guardrails', () => {
- it('routes controller and workspace panels through the shared infrastructure operations state owner', () => {
- expect(infrastructureOperationsControllerSource).toContain(
- 'InfrastructureOperationsStateProvider',
- );
- expect(infrastructureOperationsControllerSource).toContain('InfrastructureInstallerSection');
- expect(infrastructureOperationsControllerSource).toContain('InfrastructureInventorySection');
- expect(infrastructureOperationsControllerSource).toContain(
- 'InfrastructureStopMonitoringDialog',
- );
- expect(infrastructureOperationsStateSource).toContain('./infrastructureOperationsModel');
- expect(infrastructureOperationsStateSource).toContain('./useInfrastructureInstallState');
- expect(infrastructureOperationsStateSource).toContain('./useInfrastructureReportingState');
- expect(infrastructureOperationsStateSource).toContain(
- 'export const InfrastructureOperationsStateProvider',
- );
- expect(infrastructureOperationsStateSource).toContain(
- 'export const useInfrastructureOperationsContext',
- );
- expect(infrastructureOperationsStateSource).not.toContain('renderInstallerSection');
- expect(infrastructureOperationsStateSource).not.toContain('renderInventorySection');
- expect(infrastructureOperationsStateSource).not.toContain('renderStopMonitoringDialog');
- expect(infrastructureInstallStateSource).toContain(
- 'export const useInfrastructureInstallState',
- );
- expect(infrastructureInstallStateSource).toContain('MonitoringAPI.getState()');
- expect(infrastructureInstallStateSource).toContain('./infrastructureWorkspaceModel');
- expect(infrastructureInstallStateSource).toContain(
- "navigate(buildInfrastructureWorkspacePath())",
- );
- expect(infrastructureInstallStateSource).not.toContain(
- "navigate('/settings/infrastructure/proxmox')",
- );
- expect(infrastructureReportingStateSource).toContain(
- 'export const useInfrastructureReportingState',
- );
- expect(infrastructureConfiguredNodesStateSource).toContain(
- 'export const useInfrastructureConfiguredNodesState',
- );
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.getNodes');
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.updateNode');
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.deleteNode');
- expect(infrastructureDiscoveryRuntimeStateSource).toContain(
- 'export const useInfrastructureDiscoveryRuntimeState',
- );
- expect(infrastructureDiscoveryRuntimeStateSource).toContain("apiFetch('/api/discover'");
- expect(infrastructureDiscoveryRuntimeStateSource).toContain(
- "discoveryEnabled: Accessor<boolean>",
- );
- expect(infrastructureDiscoveryRuntimeStateSource).toContain('SettingsAPI.updateSystemSettings');
- expect(infrastructureInstallerSectionSource).toContain('useInfrastructureOperationsContext');
- expect(infrastructureInstallerSectionSource).toContain(
- 'Advanced connection and install options',
- );
- expect(infrastructureInstallerSectionSource).toContain(
- 'Show advanced connection and install options',
- );
- expect(infrastructureInventorySectionSource).toContain('useInfrastructureOperationsContext');
- expect(infrastructureStopMonitoringDialogSource).toContain(
- 'useInfrastructureOperationsContext',
- );
- expect(infrastructureOperationsModelSource).toContain('export const getRowReportingSummary');
- expect(infrastructureOperationsModelSource).toContain(
- 'export const getPowerShellInstallProfileEnvFromFlags',
- );
- });
-});
-
-vi.mock('@/contexts/appRuntime', () => ({
- useWebSocket: () => mockWsStore,
-}));
-
-vi.mock('@/api/monitoring', () => ({
- MonitoringAPI: {
- getState: (...args: unknown[]) => getStateMock(...args),
- lookupAgent: (...args: unknown[]) => lookupMock(...args),
- deleteAgent: (...args: unknown[]) => deleteAgentMock(...args),
- allowHostAgentReenroll: (...args: unknown[]) => allowHostAgentReenrollMock(...args),
- updateAgentConfig: (...args: unknown[]) => updateAgentConfigMock(...args),
- deleteDockerRuntime: (...args: unknown[]) => deleteDockerRuntimeMock(...args),
- allowDockerRuntimeReenroll: (...args: unknown[]) => allowDockerRuntimeReenrollMock(...args),
- },
-}));
-
-vi.mock('@/api/security', () => ({
- SecurityAPI: {
- createToken: (...args: unknown[]) => createTokenMock(...args),
- getStatus: () => Promise.resolve(securityStatusResponse),
- },
-}));
-
-vi.mock('@/api/agentProfiles', () => ({
- AgentProfilesAPI: {
- listProfiles: (...args: unknown[]) => listProfilesMock(...args),
- listAssignments: (...args: unknown[]) => listAssignmentsMock(...args),
- assignProfile: (...args: unknown[]) => assignProfileMock(...args),
- unassignProfile: (...args: unknown[]) => unassignProfileMock(...args),
- },
- MISSING_AGENT_PROFILE_ASSIGNMENT_MESSAGE:
- 'Selected profile no longer exists. Refresh and choose another profile.',
-}));
-
-// Build mock resources from the WebSocket store data.
-// The component uses resources() for agentResources (filtered by r.agent != null || r.type === 'docker-host')
-// and byType('k8s-cluster') for kubernetes clusters.
-const toAgentResource = (h: any) => ({
- id: h.id,
- type: 'agent' as const,
- platformType: 'agent' as const,
- sourceType: 'agent' as const,
- name: h.hostname || h.id,
- displayName: h.displayName,
- status: h.status || 'unknown',
- lastSeen: h.lastSeen,
- identity: { hostname: h.hostname },
- discoveryTarget: {
- resourceType: 'agent' as const,
- agentId: h.id,
- resourceId: h.id,
- },
- agent: {
- agentId: h.id,
- agentVersion: h.agentVersion,
- commandsEnabled: h.commandsEnabled,
- tokenName: h.tokenName,
- platform: h.platform,
- osName: h.osName,
- },
- platformData: {
- agent: {
- agentId: h.id,
- agentVersion: h.agentVersion,
- commandsEnabled: h.commandsEnabled,
- tokenName: h.tokenName,
- platform: h.platform,
- osName: h.osName,
- },
- agentVersion: h.agentVersion,
- isLegacy: h.isLegacy,
- linkedNodeId: h.linkedNodeId,
- commandsEnabled: h.commandsEnabled,
- agentId: h.id,
- platform: h.platform,
- osName: h.osName,
- },
-});
-
-const toDockerRuntimeResource = (d: any) => ({
- id: d.id,
- type: 'docker-host' as const,
- platformType: 'docker' as const,
- sourceType: 'agent' as const,
- name: d.hostname || d.id,
- displayName: d.displayName,
- status: d.status || 'unknown',
- lastSeen: d.lastSeen,
- identity: { hostname: d.hostname },
- discoveryTarget: {
- resourceType: 'app-container' as const,
- agentId: d.agentId || d.id,
- resourceId: d.id,
- },
- platformData: {
- agent: {
- agentId: d.agentId || d.id,
- agentVersion: d.agentVersion,
- },
- docker: {
- hostSourceId: d.id,
- agentVersion: d.agentVersion,
- dockerVersion: d.dockerVersion,
- },
- agentId: d.agentId || d.id,
- agentVersion: d.agentVersion,
- dockerVersion: d.dockerVersion,
- isLegacy: d.isLegacy,
- },
-});
-
-const toK8sClusterResource = (k: any) => ({
- id: k.id,
- type: 'k8s-cluster' as const,
- platformType: 'kubernetes' as const,
- sourceType: 'agent' as const,
- name: k.name || k.id,
- displayName: k.customDisplayName || k.displayName || k.name || k.id,
- status: k.status || 'unknown',
- lastSeen: k.lastSeen,
- discoveryTarget: {
- resourceType: 'k8s' as const,
- agentId: k.agentId || k.id,
- resourceId: k.id,
- },
- platformData: {
- kubernetes: {
- clusterId: k.id,
- clusterName: k.name,
- context: k.context,
- server: k.server,
- agentId: k.agentId,
- },
- agent: {
- agentId: k.agentId,
- agentVersion: k.agentVersion,
- tokenName: k.tokenName,
- },
- },
-});
-
-vi.mock('@/hooks/useResources', () => ({
- useResources: () => ({
- byType: (type: string) => mockResources().filter((resource) => resource.type === type),
- resources: () => mockResources(),
- mutate: (value: any[] | ((prev: any[]) => any[])) => {
- const next = typeof value === 'function' ? value(mockResources()) : value;
- setMockResources(next);
- return next;
- },
- refetch: (...args: unknown[]) => refetchResourcesMock(...args),
- }),
-}));
-
-vi.mock('@/stores/notifications', () => ({
- notificationStore: {
- success: (...args: unknown[]) => notificationSuccessMock(...args),
- error: (...args: unknown[]) => notificationErrorMock(...args),
- info: (...args: unknown[]) => notificationInfoMock(...args),
- },
-}));
-
-vi.mock('@/utils/upgradeMetrics', () => ({
- trackAgentInstallTokenGenerated: (...args: unknown[]) =>
- trackAgentInstallTokenGeneratedMock(...args),
- trackAgentInstallCommandCopied: (...args: unknown[]) =>
- trackAgentInstallCommandCopiedMock(...args),
- trackAgentInstallProfileSelected: (...args: unknown[]) =>
- trackAgentInstallProfileSelectedMock(...args),
-}));
-
-const createAgent = (overrides?: Partial<Agent>): Agent => ({
- id: 'host-1',
- hostname: 'host-1.local',
- displayName: 'Host One',
- platform: 'linux',
- osName: 'Ubuntu',
- osVersion: '22.04',
- kernelVersion: '6.5.0',
- architecture: 'x86_64',
- cpuCount: 4,
- cpuUsage: 12.5,
- memory: {
- total: 8 * 1024 * 1024 * 1024,
- used: 4 * 1024 * 1024 * 1024,
- free: 4 * 1024 * 1024 * 1024,
- usage: 50,
- balloon: 0,
- swapUsed: 0,
- swapTotal: 0,
- },
- loadAverage: [],
- disks: [],
- networkInterfaces: [],
- sensors: {
- temperatureCelsius: {},
- fanRpm: {},
- additional: {},
- },
- status: 'online',
- uptimeSeconds: 12_345,
- intervalSeconds: 30,
- lastSeen: Date.now(),
- agentVersion: '1.2.3',
- tags: ['prod'],
- ...overrides,
-});
-
-const createDockerHost = (overrides?: Partial<DockerRuntime>): DockerRuntime => ({
- id: 'docker-host-1',
- agentId: 'agent-1',
- hostname: 'docker-host-1.local',
- displayName: 'Docker Host One',
- cpus: 4,
- totalMemoryBytes: 8 * 1024 * 1024 * 1024,
- uptimeSeconds: 12_345,
- status: 'online',
- lastSeen: Date.now(),
- intervalSeconds: 30,
- containers: [],
- ...overrides,
-});
-
-const createKubernetesCluster = (overrides?: Partial<KubernetesCluster>): KubernetesCluster => ({
- id: 'cluster-1',
- agentId: 'cluster-agent-1',
- name: 'cluster-1',
- displayName: 'Cluster One',
- status: 'online',
- lastSeen: Date.now(),
- intervalSeconds: 30,
- ...overrides,
-});
-
-const buildConnectedInfrastructureFromFixtures = ({
- hosts = [],
- dockerHosts = [],
- kubernetesClusters = [],
- ignoredItems = [],
-}: {
- hosts?: Agent[];
- dockerHosts?: DockerRuntime[];
- kubernetesClusters?: KubernetesCluster[];
- ignoredItems?: ConnectedInfrastructureItem[];
-}): ConnectedInfrastructureItem[] => {
- const items: ConnectedInfrastructureItem[] = [];
-
- hosts.forEach((host) => {
- items.push({
- id: host.id,
- name: host.displayName || host.hostname || host.id,
- displayName: host.displayName,
- hostname: host.hostname,
- status: 'active',
- healthStatus: host.status,
- lastSeen: host.lastSeen,
- version: host.agentVersion,
- isOutdatedBinary: host.isLegacy,
- linkedNodeId: host.linkedNodeId,
- commandsEnabled: host.commandsEnabled,
- scopeAgentId: host.id,
- uninstallAgentId: host.id,
- uninstallHostname: host.hostname,
- upgradePlatform: host.platform?.toLowerCase().includes('windows') ? 'windows' : 'linux',
- surfaces: [
- {
- id: `agent:${host.id}`,
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'System health, inventory, and Pulse command connectivity.',
- controlId: host.id,
- action: 'stop-monitoring',
- idLabel: 'Agent ID',
- idValue: host.id,
- },
- ],
- });
- });
-
- dockerHosts.forEach((runtime) => {
- items.push({
- id: runtime.id,
- name: runtime.displayName || runtime.hostname || runtime.id,
- displayName: runtime.displayName,
- hostname: runtime.hostname,
- status: 'active',
- healthStatus: runtime.status,
- lastSeen: runtime.lastSeen,
- version: runtime.agentVersion || runtime.dockerVersion,
- isOutdatedBinary: runtime.isLegacy,
- scopeAgentId: runtime.agentId,
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: `docker:${runtime.id}`,
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Container runtime coverage reported from this machine.',
- controlId: runtime.id,
- action: 'stop-monitoring',
- idLabel: 'Docker runtime ID',
- idValue: runtime.id,
- },
- ],
- });
- });
-
- kubernetesClusters.forEach((cluster) => {
- items.push({
- id: cluster.id,
- name: cluster.displayName || cluster.name || cluster.id,
- displayName: cluster.displayName,
- status: 'active',
- healthStatus: cluster.status,
- lastSeen: cluster.lastSeen,
- version: cluster.agentVersion || cluster.version,
- scopeAgentId: cluster.agentId,
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: `kubernetes:${cluster.id}`,
- kind: 'kubernetes',
- label: 'Kubernetes cluster data',
- detail: 'Cluster inventory and Kubernetes telemetry reported through Pulse.',
- controlId: cluster.id,
- action: 'stop-monitoring',
- idLabel: 'Cluster ID',
- idValue: cluster.id,
- },
- ],
- });
- });
-
- return [...items, ...ignoredItems];
-};
-
-const buildMonitoringState = (
- connectedInfrastructure: ConnectedInfrastructureItem[] = [],
-): State => ({
- connectedInfrastructure,
- metrics: [],
- performance: {} as State['performance'],
- connectionHealth: {},
- stats: {} as State['stats'],
- activeAlerts: [],
- recentlyResolved: [],
- lastUpdate: Date.now(),
- resources: [],
-});
-
-const createIgnoredHostItem = (
- overrides?: Partial<ConnectedInfrastructureItem>,
-): ConnectedInfrastructureItem => ({
- id: 'ignored:agent:removed-host-1',
- name: 'old-host.local',
- hostname: 'old-host.local',
- status: 'ignored',
- removedAt: Date.now() - 60_000,
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'agent:removed-host-1',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'Pulse is blocking host telemetry from this machine.',
- controlId: 'removed-host-1',
- action: 'allow-reconnect',
- idLabel: 'Agent ID',
- idValue: 'removed-host-1',
- },
- ],
- ...overrides,
-});
-
-const createIgnoredDockerItem = (
- overrides?: Partial<ConnectedInfrastructureItem>,
-): ConnectedInfrastructureItem => ({
- id: 'ignored:docker:removed-docker-1',
- name: 'old-docker.local',
- hostname: 'old-docker.local',
- status: 'ignored',
- removedAt: Date.now() - 60_000,
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'docker:removed-docker-1',
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Pulse is blocking Docker runtime reports from this machine.',
- controlId: 'removed-docker-1',
- action: 'allow-reconnect',
- idLabel: 'Docker runtime ID',
- idValue: 'removed-docker-1',
- },
- ],
- ...overrides,
-});
-
-const setupComponent = (
- hosts: Agent[] = [],
- dockerHosts: DockerRuntime[] = [],
- kubernetesClusters: KubernetesCluster[] = [],
- ignoredItems: ConnectedInfrastructureItem[] = [],
-) => {
- setMockResources([
- ...hosts.map(toAgentResource),
- ...dockerHosts.map(toDockerRuntimeResource),
- ...kubernetesClusters.map(toK8sClusterResource),
- ]);
-
- const [state] = createStore<Pick<State, 'connectedInfrastructure'>>({
- connectedInfrastructure: buildConnectedInfrastructureFromFixtures({
- hosts,
- dockerHosts,
- kubernetesClusters,
- ignoredItems,
- }),
- });
-
- mockWsStore = {
- state,
- connected: () => true,
- reconnecting: () => false,
- activeAlerts: [],
- };
-
- return render(() => (
- <Router>
- <Route path="/" component={() => <InfrastructureOperationsController />} />
- </Router>
- ));
-};
-
-const setupWithResources = (
- resources: any[],
- connectedInfrastructure: ConnectedInfrastructureItem[],
-) => {
- setMockResources(resources);
-
- const [state] = createStore<Pick<State, 'connectedInfrastructure'>>({
- connectedInfrastructure,
- });
-
- mockWsStore = {
- state,
- connected: () => true,
- reconnecting: () => false,
- activeAlerts: [],
- };
-
- return render(() => (
- <Router>
- <Route path="/" component={() => <InfrastructureOperationsController />} />
- </Router>
- ));
-};
-
-const getConnectionUrlInput = (): HTMLInputElement => {
- openAdvancedInstallOptions();
- const urlBlock = screen.getByText(/Connection URL \(Agent → Pulse\)/i).closest('div');
- expect(urlBlock).not.toBeNull();
- const urlInput = urlBlock?.querySelector('input');
- expect(urlInput).not.toBeNull();
- return urlInput as HTMLInputElement;
-};
-
-const openAdvancedInstallOptions = (): void => {
- const toggle = screen.getByRole('button', {
- name: /Show advanced connection and install options|Hide advanced connection and install options/i,
- });
- if ((toggle.textContent ?? '').includes('Show advanced')) {
- fireEvent.click(toggle);
- }
-};
-
-const getCustomCaPathInput = (): HTMLElement => {
- openAdvancedInstallOptions();
- return screen.getByLabelText(/Custom CA certificate path \(optional\)/i);
-};
-
-const getSkipTlsCheckbox = (): HTMLElement => {
- openAdvancedInstallOptions();
- return screen.getByRole('checkbox', { name: /Skip TLS certificate verification/i });
-};
-
-const getEnableCommandsCheckbox = (): HTMLElement => {
- openAdvancedInstallOptions();
- return screen.getByRole('checkbox', { name: /Enable Pulse command execution/i });
-};
-
-const getTargetProfileSelect = (): HTMLElement => {
- openAdvancedInstallOptions();
- return screen.getByLabelText('Target profile (optional)');
-};
-
-beforeEach(() => {
- securityStatusResponse = { requiresAuth: true, apiTokenConfigured: false };
- sessionStorage.clear();
- navigateMock.mockReset();
- lookupMock.mockReset();
- getStateMock.mockReset();
- createTokenMock.mockReset();
- deleteAgentMock.mockReset();
- allowHostAgentReenrollMock.mockReset();
- updateAgentConfigMock.mockReset();
- deleteDockerRuntimeMock.mockReset();
- allowDockerRuntimeReenrollMock.mockReset();
- notificationSuccessMock.mockReset();
- notificationErrorMock.mockReset();
- notificationInfoMock.mockReset();
- listProfilesMock.mockReset();
- listAssignmentsMock.mockReset();
- assignProfileMock.mockReset();
- unassignProfileMock.mockReset();
- trackAgentInstallTokenGeneratedMock.mockReset();
- trackAgentInstallCommandCopiedMock.mockReset();
- trackAgentInstallProfileSelectedMock.mockReset();
- refetchResourcesMock.mockReset();
- refetchResourcesMock.mockResolvedValue(mockResources());
- getStateMock.mockResolvedValue(buildMonitoringState());
- clipboardSpy.mockReset().mockResolvedValue(undefined);
- fetchMock.mockReset();
- fetchMock.mockResolvedValue(
- new Response(JSON.stringify({ requiresAuth: true, apiTokenConfigured: false }), {
- status: 200,
- headers: { 'Content-Type': 'application/json' },
- }),
- );
- createObjectURLMock.mockReset().mockReturnValue('blob:mock-url');
- revokeObjectURLMock.mockReset();
- vi.stubGlobal('fetch', fetchMock);
- vi.stubGlobal('navigator', { clipboard: { writeText: clipboardSpy } } as unknown as Navigator);
- vi.stubGlobal('Blob', MockBlob as unknown as typeof Blob);
- vi.stubGlobal(
- 'URL',
- Object.assign(URL, {
- createObjectURL: createObjectURLMock,
- revokeObjectURL: revokeObjectURLMock,
- }),
- );
-
- listProfilesMock.mockResolvedValue([]);
- listAssignmentsMock.mockResolvedValue([]);
-});
-
-afterEach(() => {
- cleanup();
- sessionStorage.clear();
- vi.useRealTimers();
- vi.unstubAllGlobals();
-});
-
-describe('InfrastructureOperationsController token generation', () => {
- it('renders the token generation UI when auth is required', async () => {
- setupComponent();
-
- await waitFor(() => {
- expect(screen.getByText('Generate install token')).toBeInTheDocument();
- });
- expect(screen.getByRole('button', { name: /Generate token/i })).toBeInTheDocument();
- });
-
- it('auto-generates the first-host install token from setup handoff', async () => {
- createTokenMock.mockResolvedValue({
- token: 'handoff-install-token',
- record: {
- id: 'token-record-handoff',
- name: 'Agent 2026-03-27 10-56',
- prefix: 'agent',
- suffix: '1234',
- createdAt: new Date().toISOString(),
- },
- });
-
- sessionStorage.setItem(
- STORAGE_KEYS.SETUP_HANDOFF,
- JSON.stringify({
- username: 'admin',
- password: 'generated-password',
- apiToken: 'admin-token',
- createdAt: new Date().toISOString(),
- }),
- );
-
- setupComponent();
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => expect(screen.getByText(/First-host install token/i)).toBeInTheDocument(), {
- interval: 0,
- });
-
- expect(trackAgentInstallTokenGeneratedMock).toHaveBeenCalledWith(
- 'settings_unified_agents',
- 'setup_handoff',
- );
- expect(notificationSuccessMock).not.toHaveBeenCalled();
- expect(
- screen.getByText(/Security configured\. Save these first-run credentials now\./i),
- ).toBeInTheDocument();
- expect(
- screen.getByText(/Pulse already prepared the first scoped install token for this handoff/i),
- ).toBeInTheDocument();
- expect(screen.getByText('Installation commands')).toBeInTheDocument();
- });
-
- it('downloads first-run credentials that describe the prepared install token handoff', async () => {
- createTokenMock.mockResolvedValue({
- token: 'handoff-install-token',
- record: {
- id: 'token-record-handoff',
- name: 'Agent 2026-03-27 11-02',
- prefix: 'agent',
- suffix: '1234',
- createdAt: new Date().toISOString(),
- },
- });
-
- const anchorClickMock = vi.fn();
- const createElementSpy = vi.spyOn(document, 'createElement').mockImplementation((tagName) => {
- const element = document.createElementNS('http://www.w3.org/1999/xhtml', tagName);
- if (tagName.toLowerCase() === 'a') {
- Object.defineProperty(element, 'click', {
- value: anchorClickMock,
- configurable: true,
- });
- }
- return element as HTMLElement;
- });
-
- sessionStorage.setItem(
- STORAGE_KEYS.SETUP_HANDOFF,
- JSON.stringify({
- username: 'admin',
- password: 'generated-password',
- apiToken: 'admin-token',
- createdAt: new Date().toISOString(),
- }),
- );
-
- setupComponent();
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- fireEvent.click(screen.getByRole('button', { name: 'Download credentials' }));
-
- await waitFor(() => expect(createObjectURLMock).toHaveBeenCalled(), { interval: 0 });
-
- const createObjectURLCalls = createObjectURLMock.mock.calls as unknown[][];
- const lastCreateObjectURLCall = createObjectURLCalls[createObjectURLCalls.length - 1];
- const downloadedBlob = lastCreateObjectURLCall?.[0] as MockBlob | undefined;
- expect(downloadedBlob).toBeDefined();
- const content = await downloadedBlob!.text();
- expect(content).toContain('Canonical install workspace:');
- expect(content).toContain('/settings/infrastructure?add=agent');
- expect(content).toContain(
- 'Pulse prepares the first-host install token from setup so you can move straight to the generated Unified Agent install commands.',
- );
-
- createElementSpy.mockRestore();
- });
-
- it('generates a token and shows confirmation', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token-123',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abcdef',
- suffix: '1234',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Generate token/i })).toBeInTheDocument();
- });
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => expect(screen.getByText(/Token.*created/i)).toBeInTheDocument(), {
- interval: 0,
- });
- expect(trackAgentInstallTokenGeneratedMock).toHaveBeenCalledWith(
- 'settings_unified_agents',
- 'manual',
- );
- expect(notificationSuccessMock).toHaveBeenCalledWith(
- 'Token generated with Agent config + reporting, Docker, and Kubernetes permissions.',
- 4000,
- );
- });
-
- it('keeps advanced connection options collapsed until operators ask for them', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token-123',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abcdef',
- suffix: '1234',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- expect(
- screen.getByRole('button', { name: /Show advanced connection and install options/i }),
- ).toBeInTheDocument();
- expect(screen.queryByText(/Connection URL \(Agent → Pulse\)/i)).not.toBeInTheDocument();
-
- openAdvancedInstallOptions();
-
- expect(screen.getByText(/Connection URL \(Agent → Pulse\)/i)).toBeInTheDocument();
- expect(
- screen.getByRole('button', { name: /Hide advanced connection and install options/i }),
- ).toBeInTheDocument();
- });
-});
-
-describe('InfrastructureOperationsController agent lookup', () => {
- it('auto-detects the first connected host when install starts from zero active systems', async () => {
- vi.useFakeTimers();
- createTokenMock.mockResolvedValue({
- token: 'token-auto',
- record: {
- id: 'token-record-auto',
- name: 'Auto Token',
- prefix: 'auto',
- suffix: '1234',
- createdAt: new Date().toISOString(),
- },
- });
-
- const host = createAgent({ hostname: 'first-host.local', displayName: 'First Host' });
- getStateMock
- .mockResolvedValueOnce(buildMonitoringState())
- .mockResolvedValue(
- buildMonitoringState(buildConnectedInfrastructureFromFixtures({ hosts: [host] })),
- );
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- await waitFor(() => {
- expect(
- screen.getByText(/Pulse is watching for the first reporting host automatically\./i),
- ).toBeInTheDocument();
- });
-
- await vi.advanceTimersByTimeAsync(3000);
-
- await waitFor(() => expect(screen.getByText('First host connected')).toBeInTheDocument(), {
- interval: 0,
- });
- expect(
- screen.getByText(
- 'First Host started reporting and Pulse detected it automatically. Open the dashboard to verify your first overview, or open Inventory to inspect this host and add more infrastructure.',
- ),
- ).toBeInTheDocument();
- expect((screen.getByPlaceholderText('Hostname or agent ID') as HTMLInputElement).value).toBe(
- 'first-host.local',
- );
- });
-
- it('performs agent lookup and displays results', async () => {
- createTokenMock.mockResolvedValue({
- token: 'token-123',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abcdef',
- suffix: '1234',
- createdAt: new Date().toISOString(),
- },
- });
-
- const host = createAgent();
- setupComponent([host]);
-
- // Generate token first to unlock commands
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Generate token/i })).toBeInTheDocument();
- });
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- // Wait for commands to be unlocked and lookup UI to appear
- await waitFor(() => {
- expect(screen.getByPlaceholderText('Hostname or agent ID')).toBeInTheDocument();
- });
-
- lookupMock.mockResolvedValue({
- success: true,
- agent: {
- id: host.id,
- hostname: host.hostname,
- displayName: host.displayName,
- status: host.status,
- connected: true,
- lastSeen: host.lastSeen,
- agentVersion: host.agentVersion,
- },
- });
-
- const input = screen.getByPlaceholderText('Hostname or agent ID') as HTMLInputElement;
- fireEvent.input(input, { target: { value: host.id } });
-
- const checkButton = screen.getByRole('button', { name: /Check status/i });
- fireEvent.click(checkButton);
-
- await waitFor(() => expect(lookupMock).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => expect(screen.getByText('Connected')).toBeInTheDocument(), { interval: 0 });
- expect(screen.getByText('First host connected')).toBeInTheDocument();
- expect(
- screen.getByText(
- 'Host One is reporting live telemetry to Pulse. Open the dashboard to verify your first overview, or open Inventory to inspect this host and add more infrastructure.',
- ),
- ).toBeInTheDocument();
-
- fireEvent.click(screen.getByRole('button', { name: 'Open dashboard' }));
- expect(navigateMock).toHaveBeenCalledWith('/dashboard');
-
- fireEvent.click(screen.getByRole('button', { name: 'Open inventory' }));
- expect(navigateMock).toHaveBeenCalledWith('/settings/infrastructure');
- });
-
- it('shows error message when agent is not found', async () => {
- createTokenMock.mockResolvedValue({
- token: 'token-456',
- record: {
- id: 'token-record-2',
- name: 'Test Token 2',
- prefix: 'ghijkl',
- suffix: '5678',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- // Generate token first
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Generate token/i })).toBeInTheDocument();
- });
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- await waitFor(() => {
- expect(screen.getByPlaceholderText('Hostname or agent ID')).toBeInTheDocument();
- });
-
- lookupMock.mockResolvedValue(null);
-
- const query = 'missing-host';
- const input = screen.getByPlaceholderText('Hostname or agent ID') as HTMLInputElement;
- fireEvent.input(input, { target: { value: query } });
-
- const checkButton = screen.getByRole('button', { name: /Check status/i });
- fireEvent.click(checkButton);
-
- await waitFor(
- () =>
- expect(
- screen.getByText(
- `No agent has reported with "${query}" yet. Try again in a few seconds.`,
- ),
- ).toBeInTheDocument(),
- { interval: 0 },
- );
- });
-});
-
-describe('InfrastructureOperationsController managed agents table', () => {
- it('displays agents in the table', async () => {
- const host = createAgent({ hostname: 'test-server.local', displayName: 'Test Server' });
- setupComponent([host]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
- expect(
- screen.getByText(/Systems, platforms, and runtimes currently checking in to Pulse\./i),
- ).toBeInTheDocument();
- expect(screen.getByText('Reporting surfaces')).toBeInTheDocument();
-
- expect(screen.getAllByText('Test Server').length).toBeGreaterThan(0);
- expect(screen.getAllByText('Host telemetry').length).toBeGreaterThan(0);
- expect(screen.getByText('online')).toBeInTheDocument();
-
- const toggle = screen.getByRole('button', { name: /details for Test Server/i });
- fireEvent.click(toggle);
-
- const detailsRow = document.getElementById('agent-details-agent-host-1');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- expect(screen.getByText('Browse reporting items')).toBeInTheDocument();
- expect(
- screen.getByText('Select a reporting item to open its details drawer.'),
- ).toBeInTheDocument();
- expect(details.getByText('Selected reporting item')).toBeInTheDocument();
- expect(details.getByText('Machine overview')).toBeInTheDocument();
- expect(details.getByText('Surface controls')).toBeInTheDocument();
- });
-
- it('displays docker hosts in the table', async () => {
- const dockerHost = createDockerHost({
- hostname: 'docker-server.local',
- displayName: 'Docker Server',
- });
- setupComponent([], [dockerHost]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(screen.getAllByText('Docker Server').length).toBeGreaterThan(0);
- expect(screen.getAllByText('Docker runtime data').length).toBeGreaterThan(0);
-
- const toggle = screen.getByRole('button', { name: /details for Docker Server/i });
- fireEvent.click(toggle);
-
- const detailsRow = document.getElementById('agent-details-agent-docker-host-1');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- expect(details.getByText('Machine actions')).toBeInTheDocument();
- expect(details.getByText('Surface controls')).toBeInTheDocument();
- });
-
- it('summarizes mixed machine coverage in the active row', async () => {
- setupWithResources(
- [
- {
- id: 'delly-resource',
- type: 'agent',
- platformType: 'proxmox-pve',
- sourceType: 'hybrid',
- name: 'delly',
- displayName: 'delly',
- status: 'online',
- lastSeen: Date.now(),
- identity: { hostname: 'delly' },
- discoveryTarget: {
- resourceType: 'agent',
- agentId: 'delly-agent',
- resourceId: 'delly-resource',
- },
- agent: {
- agentId: 'delly-agent',
- agentVersion: '1.2.3',
- commandsEnabled: true,
- platform: 'linux',
- osName: 'Ubuntu',
- },
- platformData: {
- agent: {
- agentId: 'delly-agent',
- agentVersion: '1.2.3',
- commandsEnabled: true,
- platform: 'linux',
- osName: 'Ubuntu',
- },
- docker: {
- hostSourceId: 'delly-docker',
- dockerVersion: '26.0.0',
- },
- agentId: 'delly-agent',
- },
- proxmox: {
- node: 'delly',
- type: 'pve',
- },
- },
- ],
- [
- {
- id: 'delly-resource',
- name: 'delly',
- displayName: 'delly',
- hostname: 'delly',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '1.2.3',
- commandsEnabled: true,
- scopeAgentId: 'delly-agent',
- uninstallAgentId: 'delly-agent',
- uninstallHostname: 'delly',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'agent:delly-agent',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'System health, inventory, and Pulse command connectivity.',
- controlId: 'delly-agent',
- action: 'stop-monitoring',
- idLabel: 'Agent ID',
- idValue: 'delly-agent',
- },
- {
- id: 'docker:delly-docker',
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Container runtime coverage reported from this machine.',
- controlId: 'delly-docker',
- action: 'stop-monitoring',
- idLabel: 'Docker runtime ID',
- idValue: 'delly-docker',
- },
- {
- id: 'proxmox:delly-resource',
- kind: 'proxmox',
- label: 'Proxmox data',
- detail: 'Proxmox node telemetry linked to this machine.',
- idLabel: 'Node ID',
- idValue: 'delly-resource',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(
- screen.getByText(
- 'Pulse is receiving host telemetry, Docker runtime data, and Proxmox data from this item.',
- ),
- ).toBeInTheDocument();
-
- fireEvent.click(screen.getByRole('button', { name: /details for delly/i }));
-
- const detailsRow = document.getElementById('agent-details-agent-delly-resource');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- expect(screen.getByText('Browse reporting items')).toBeInTheDocument();
- expect(details.getByText('Selected reporting item')).toBeInTheDocument();
- expect(details.getByText('Machine overview')).toBeInTheDocument();
- expect(details.getByText('Surface controls')).toBeInTheDocument();
- expect(details.getByText('Machine actions')).toBeInTheDocument();
- expect(details.getByText('Surface')).toBeInTheDocument();
- expect(details.getByText('What Pulse receives')).toBeInTheDocument();
- expect(details.getByText('ID')).toBeInTheDocument();
- expect(details.getByText('Control')).toBeInTheDocument();
- expect(
- details.getByText(
- 'Use surface controls to stop specific reporting without removing the machine.',
- ),
- ).toBeInTheDocument();
- expect(details.getByText('Host telemetry')).toBeInTheDocument();
- expect(details.getByText('Docker runtime data')).toBeInTheDocument();
- expect(details.getByText('Proxmox data')).toBeInTheDocument();
- expect(
- details.getByText('System health, inventory, and Pulse command connectivity.'),
- ).toBeInTheDocument();
- expect(
- details.getByText('Container runtime coverage reported from this machine.'),
- ).toBeInTheDocument();
- expect(details.getByText('Proxmox node telemetry linked to this machine.')).toBeInTheDocument();
- expect(details.getByText('Agent ID')).toBeInTheDocument();
- expect(details.getByText('Docker runtime ID')).toBeInTheDocument();
- expect(details.getByText('Node ID')).toBeInTheDocument();
- expect(details.getAllByText('delly-resource').length).toBeGreaterThan(0);
- expect(details.getByRole('button', { name: /Manage connection/i })).toBeInTheDocument();
- expect(details.getAllByText('delly-agent').length).toBeGreaterThan(0);
- expect(details.getAllByText('delly-docker').length).toBeGreaterThan(0);
- });
-
- it('routes api-backed truenas rows to platform connections instead of machine uninstall actions', async () => {
- setupWithResources(
- [],
- [
- {
- id: 'truenas-main',
- name: 'Tower NAS',
- displayName: 'Tower NAS',
- hostname: 'truenas.local',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '25.04.0',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'truenas:truenas.local',
- kind: 'truenas',
- label: 'TrueNAS data',
- detail:
- 'System, storage, app, and recovery telemetry polled through the configured TrueNAS connection.',
- idLabel: 'Hostname',
- idValue: 'truenas.local',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(screen.getByText(/1 TrueNAS system/i)).toBeInTheDocument();
- fireEvent.click(screen.getByRole('button', { name: /details for Tower NAS/i }));
-
- const detailsRow = document.getElementById('agent-details-agent-truenas-main');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
-
- expect(details.queryByText('Machine actions')).not.toBeInTheDocument();
- expect(
- details.queryByRole('button', { name: /Copy uninstall command/i }),
- ).not.toBeInTheDocument();
-
- const openPlatformConnectionsButton = details.getByRole('button', {
- name: /Manage connection/i,
- });
- fireEvent.click(openPlatformConnectionsButton);
-
- expect(navigateMock).toHaveBeenCalledWith('/settings/infrastructure', {
- scroll: false,
- });
- });
-
- it('distinguishes PBS coverage from Proxmox nodes on non-Proxmox hosts', async () => {
- setupWithResources(
- [
- {
- id: 'tower-resource',
- type: 'agent',
- platformType: 'agent',
- sourceType: 'hybrid',
- name: 'Tower',
- displayName: 'Tower',
- status: 'online',
- lastSeen: Date.now(),
- identity: { hostname: 'tower.local' },
- discoveryTarget: {
- resourceType: 'agent',
- agentId: 'tower-agent',
- resourceId: 'tower-resource',
- },
- agent: {
- agentId: 'tower-agent',
- agentVersion: '1.2.3',
- commandsEnabled: true,
- platform: 'linux',
- osName: 'Unraid',
- },
- platformData: {
- agent: {
- agentId: 'tower-agent',
- agentVersion: '1.2.3',
- commandsEnabled: true,
- platform: 'linux',
- osName: 'Unraid',
- },
- docker: {
- hostSourceId: 'tower-docker',
- dockerVersion: '26.0.0',
- },
- pbs: {
- version: '3.4.1',
- },
- agentId: 'tower-agent',
- },
- },
- ],
- [
- {
- id: 'tower-resource',
- name: 'Tower',
- displayName: 'Tower',
- hostname: 'tower.local',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '1.2.3',
- commandsEnabled: true,
- scopeAgentId: 'tower-agent',
- uninstallAgentId: 'tower-agent',
- uninstallHostname: 'tower.local',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'agent:tower-agent',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'System health, inventory, and Pulse command connectivity.',
- controlId: 'tower-agent',
- action: 'stop-monitoring',
- idLabel: 'Agent ID',
- idValue: 'tower-agent',
- },
- {
- id: 'docker:tower-docker',
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Container runtime coverage reported from this machine.',
- controlId: 'tower-docker',
- action: 'stop-monitoring',
- idLabel: 'Docker runtime ID',
- idValue: 'tower-docker',
- },
- {
- id: 'pbs:tower-resource',
- kind: 'pbs',
- label: 'PBS data',
- detail: 'Proxmox Backup Server inventory and backup telemetry.',
- idLabel: 'PBS ID',
- idValue: 'tower-resource',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(
- screen.getByText(
- 'Pulse is receiving host telemetry, Docker runtime data, and PBS data from this item.',
- ),
- ).toBeInTheDocument();
- expect(screen.queryByText('Proxmox data')).not.toBeInTheDocument();
- expect(
- screen.getByText(
- 'Pulse is currently receiving live reports from 1 host, 1 Docker runtime, and 1 PBS server.',
- ),
- ).toBeInTheDocument();
-
- fireEvent.click(screen.getByRole('button', { name: /details for Tower/i }));
-
- const detailsRow = document.getElementById('agent-details-agent-tower-resource');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- expect(details.getByText('PBS data')).toBeInTheDocument();
- expect(
- details.getByText('Proxmox Backup Server inventory and backup telemetry.'),
- ).toBeInTheDocument();
- expect(details.queryByText('Proxmox data')).not.toBeInTheDocument();
- });
-
- it('can stop only the docker surface for a mixed host without removing the parent machine row', async () => {
- deleteDockerRuntimeMock.mockResolvedValue({});
-
- setupWithResources(
- [
- {
- id: 'delly-resource',
- type: 'agent',
- platformType: 'proxmox-pve',
- sourceType: 'hybrid',
- name: 'delly',
- displayName: 'delly',
- status: 'online',
- lastSeen: Date.now(),
- identity: { hostname: 'delly' },
- discoveryTarget: {
- resourceType: 'agent',
- agentId: 'delly-agent',
- resourceId: 'delly-resource',
- },
- agent: {
- agentId: 'delly-agent',
- agentVersion: '1.2.3',
- commandsEnabled: true,
- platform: 'linux',
- osName: 'Ubuntu',
- },
- platformData: {
- agent: {
- agentId: 'delly-agent',
- agentVersion: '1.2.3',
- commandsEnabled: true,
- platform: 'linux',
- osName: 'Ubuntu',
- },
- docker: {
- hostSourceId: 'delly-docker',
- dockerVersion: '26.0.0',
- },
- agentId: 'delly-agent',
- },
- proxmox: {
- node: 'delly',
- type: 'pve',
- },
- },
- ],
- [
- {
- id: 'delly-resource',
- name: 'delly',
- displayName: 'delly',
- hostname: 'delly',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '1.2.3',
- commandsEnabled: true,
- scopeAgentId: 'delly-agent',
- uninstallAgentId: 'delly-agent',
- uninstallHostname: 'delly',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'agent:delly-agent',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'System health, inventory, and Pulse command connectivity.',
- controlId: 'delly-agent',
- action: 'stop-monitoring',
- idLabel: 'Agent ID',
- idValue: 'delly-agent',
- },
- {
- id: 'docker:delly-docker',
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Container runtime coverage reported from this machine.',
- controlId: 'delly-docker',
- action: 'stop-monitoring',
- idLabel: 'Docker runtime ID',
- idValue: 'delly-docker',
- },
- {
- id: 'proxmox:delly-resource',
- kind: 'proxmox',
- label: 'Proxmox data',
- detail: 'Proxmox node telemetry linked to this machine.',
- idLabel: 'Node ID',
- idValue: 'delly-resource',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('delly').length).toBeGreaterThan(0);
- });
-
- fireEvent.click(screen.getByRole('button', { name: /details for delly/i }));
-
- const detailsRow = document.getElementById('agent-details-agent-delly-resource');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- const dockerSurfaceRow = details.getByText('Docker runtime data').closest('.grid');
- expect(dockerSurfaceRow).not.toBeNull();
-
- fireEvent.click(
- within(dockerSurfaceRow as HTMLElement).getByRole('button', { name: 'Stop this surface' }),
- );
-
- expect(screen.getByText('Stop monitoring?')).toBeInTheDocument();
- expect(screen.getByText(/Docker runtime data will stop in Pulse/i)).toBeInTheDocument();
-
- fireEvent.click(screen.getByRole('button', { name: 'Confirm stop monitoring' }));
-
- await waitFor(
- () => expect(deleteDockerRuntimeMock).toHaveBeenCalledWith('delly-docker', { force: true }),
- { interval: 0 },
- );
- expect(deleteAgentMock).not.toHaveBeenCalled();
-
- await waitFor(() => {
- expect(screen.getAllByText('delly').length).toBeGreaterThan(0);
- });
- expect(
- screen.queryByText(
- 'Pulse is receiving host telemetry, Docker runtime data, and Proxmox data from this item.',
- ),
- ).not.toBeInTheDocument();
- });
-
- it('lists affected reporting surfaces in the stop-monitoring dialog for mixed hosts', async () => {
- setupWithResources(
- [
- {
- id: 'delly-resource',
- type: 'agent',
- platformType: 'proxmox-pve',
- sourceType: 'hybrid',
- name: 'delly',
- displayName: 'delly',
- status: 'online',
- lastSeen: Date.now(),
- identity: { hostname: 'delly' },
- discoveryTarget: {
- resourceType: 'agent',
- agentId: 'delly-agent',
- resourceId: 'delly-resource',
- },
- agent: {
- agentId: 'delly-agent',
- agentVersion: '1.2.3',
- commandsEnabled: true,
- platform: 'linux',
- osName: 'Ubuntu',
- },
- platformData: {
- agent: {
- agentId: 'delly-agent',
- agentVersion: '1.2.3',
- commandsEnabled: true,
- platform: 'linux',
- osName: 'Ubuntu',
- },
- docker: {
- hostSourceId: 'delly-docker',
- dockerVersion: '26.0.0',
- },
- agentId: 'delly-agent',
- },
- proxmox: {
- node: 'delly',
- type: 'pve',
- },
- },
- ],
- [
- {
- id: 'delly-resource',
- name: 'delly',
- displayName: 'delly',
- hostname: 'delly',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '1.2.3',
- commandsEnabled: true,
- scopeAgentId: 'delly-agent',
- uninstallAgentId: 'delly-agent',
- uninstallHostname: 'delly',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'agent:delly-agent',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'System health, inventory, and Pulse command connectivity.',
- controlId: 'delly-agent',
- action: 'stop-monitoring',
- idLabel: 'Agent ID',
- idValue: 'delly-agent',
- },
- {
- id: 'docker:delly-docker',
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Container runtime coverage reported from this machine.',
- controlId: 'delly-docker',
- action: 'stop-monitoring',
- idLabel: 'Docker runtime ID',
- idValue: 'delly-docker',
- },
- {
- id: 'proxmox:delly-resource',
- kind: 'proxmox',
- label: 'Proxmox data',
- detail: 'Proxmox node telemetry linked to this machine.',
- idLabel: 'Node ID',
- idValue: 'delly-resource',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('delly').length).toBeGreaterThan(0);
- });
-
- fireEvent.click(screen.getByRole('button', { name: 'Stop monitoring' }));
-
- expect(screen.getByText('Stop monitoring?')).toBeInTheDocument();
- expect(
- screen.getByText(/Host telemetry and Docker runtime data will stop in Pulse/i),
- ).toBeInTheDocument();
- expect(screen.getByText('Pulse will stop these reporting surfaces')).toBeInTheDocument();
- expect(screen.getAllByText('Host telemetry').length).toBeGreaterThan(0);
- expect(screen.getAllByText('Docker runtime data').length).toBeGreaterThan(0);
- expect(screen.getAllByText('Proxmox data').length).toBeGreaterThan(0);
- expect(screen.getAllByText('delly-agent').length).toBeGreaterThan(0);
- expect(screen.getAllByText('delly-docker').length).toBeGreaterThan(0);
- });
-
- it('explains that stop monitoring moves items into the ignored-by-pulse list', async () => {
- setupComponent([createAgent({ displayName: 'Tower' })]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(
- screen.getByText(
- /Stop monitoring removes an item from active reporting and moves it into the Ignored by Pulse list/i,
- ),
- ).toBeInTheDocument();
- });
-
- it('includes canonical agent-facet resources without a legacy top-level agent payload', async () => {
- setupWithResources(
- [
- {
- id: 'resource-agent-platform-only',
- type: 'agent',
- platformType: 'proxmox-pve',
- sourceType: 'hybrid',
- name: 'tower',
- displayName: 'Tower',
- status: 'online',
- lastSeen: Date.now(),
- identity: { hostname: 'tower.local' },
- platformData: {
- agent: {
- agentId: 'agent-platform-only',
- agentVersion: '1.2.3',
- },
- agentId: 'agent-platform-only',
- },
- },
- ],
- [
- {
- id: 'resource-agent-platform-only',
- name: 'Tower',
- displayName: 'Tower',
- hostname: 'tower.local',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '1.2.3',
- scopeAgentId: 'agent-platform-only',
- uninstallAgentId: 'agent-platform-only',
- uninstallHostname: 'tower.local',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'agent:agent-platform-only',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'System health, inventory, and Pulse command connectivity.',
- controlId: 'agent-platform-only',
- action: 'stop-monitoring',
- idLabel: 'Agent ID',
- idValue: 'agent-platform-only',
- },
- {
- id: 'proxmox:resource-agent-platform-only',
- kind: 'proxmox',
- label: 'Proxmox data',
- detail: 'Proxmox node telemetry linked to this machine.',
- idLabel: 'Node ID',
- idValue: 'resource-agent-platform-only',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
-
- const toggle = screen.getByRole('button', { name: /details for Tower/i });
- fireEvent.click(toggle);
-
- const detailsRow = document.getElementById('agent-details-agent-resource-agent-platform-only');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- expect(details.getByText('Machine overview')).toBeInTheDocument();
- });
-
- it('shows empty state when no agents are installed', async () => {
- setupComponent();
-
- await waitFor(() => {
- expect(screen.getByText('Nothing is actively reporting to Pulse yet.')).toBeInTheDocument();
- });
- });
-
- it('shows outdated agent warning when older agent binaries are present', async () => {
- const legacyHost = createAgent({ isLegacy: true });
- setupComponent([legacyHost]);
-
- await waitFor(() => {
- expect(screen.getByText(/outdated agent binar(y|ies).*detected/i)).toBeInTheDocument();
- });
-
- const toggle = screen.getByRole('button', { name: /details for Host One/i });
- fireEvent.click(toggle);
-
- const detailsRow = document.getElementById('agent-details-agent-host-1');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- expect(details.getByText('Outdated')).toBeInTheDocument();
- });
-
- it('preserves docker-only flags in copied upgrade commands for outdated docker agents', async () => {
- const dockerHost = createDockerHost({
- id: 'docker-host-legacy',
- agentId: 'docker-agent-legacy',
- displayName: 'Docker Legacy',
- hostname: 'docker-legacy.local',
- isLegacy: true,
- agentVersion: '1.2.3',
- });
-
- setupComponent([], [dockerHost]);
-
- await waitFor(() => {
- expect(screen.getByText(/outdated agent binar(y|ies).*detected/i)).toBeInTheDocument();
- });
-
- const toggle = screen.getByRole('button', { name: /details for Docker Legacy/i });
- fireEvent.click(toggle);
-
- const copyUpgradeButton = screen.getByRole('button', { name: /Copy upgrade command/i });
- fireEvent.click(copyUpgradeButton);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('--enable-docker');
- expect(copied).toContain('--disable-host');
- expect(copied).toContain("--agent-id 'docker-agent-legacy'");
- expect(copied).toContain("--hostname 'docker-legacy.local'");
- });
-
- it('uses PowerShell upgrade commands for outdated Windows agents', async () => {
- const windowsHost = createAgent({
- id: 'windows-host-1',
- hostname: 'windows-host.local',
- displayName: 'Windows Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- isLegacy: true,
- });
-
- setupComponent([windowsHost]);
-
- await waitFor(() => {
- expect(screen.getByText(/outdated agent binar(y|ies).*detected/i)).toBeInTheDocument();
- });
-
- const toggle = screen.getByRole('button', { name: /details for Windows Host/i });
- fireEvent.click(toggle);
-
- const copyUpgradeButton = screen.getByRole('button', { name: /Copy upgrade command/i });
- fireEvent.click(copyUpgradeButton);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('install.ps1');
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$env:PULSE_TOKEN=');
- expect(copied).toContain('$env:PULSE_AGENT_ID="windows-host-1"');
- expect(copied).toContain('$env:PULSE_HOSTNAME="windows-host.local"');
- expect(copied).not.toContain('| bash -s --');
- });
-
- it('uses PowerShell uninstall commands for Windows agents', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- const windowsHost = createAgent({
- id: 'windows-host-2',
- hostname: 'windows-uninstall.local',
- displayName: 'Windows Uninstall Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- });
-
- setupComponent([windowsHost]);
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- const toggle = screen.getByRole('button', { name: /details for Windows Uninstall Host/i });
- fireEvent.click(toggle);
-
- const copyUninstallButton = screen.getByRole('button', { name: /Copy uninstall command/i });
- fireEvent.click(copyUninstallButton);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_UNINSTALL="true"');
- expect(copied).toContain('install.ps1');
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$env:PULSE_TOKEN="test-token"');
- expect(copied).toContain('$env:PULSE_AGENT_ID="windows-host-2"');
- expect(copied).toContain('$env:PULSE_HOSTNAME="windows-uninstall.local"');
- expect(copied).not.toContain('| bash -s --');
- expect(copied).not.toContain('token-record');
- });
-
- it('preserves PULSE_URL in token-optional Windows uninstall commands', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
-
- const windowsHost = createAgent({
- id: 'windows-host-3',
- hostname: 'windows-no-token.local',
- displayName: 'Windows No Token Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- });
-
- setupComponent([windowsHost]);
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Confirm without token/i })).toBeInTheDocument();
- });
- fireEvent.click(screen.getByRole('button', { name: /Confirm without token/i }));
-
- const toggle = screen.getByRole('button', { name: /details for Windows No Token Host/i });
- fireEvent.click(toggle);
-
- const copyUninstallButton = screen.getByRole('button', { name: /Copy uninstall command/i });
- fireEvent.click(copyUninstallButton);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$env:PULSE_UNINSTALL="true"');
- expect(copied).toContain('$pulseScriptUrl="http://localhost:3000/install.ps1"');
- expect(copied).not.toContain('$env:PULSE_TOKEN=');
- });
-
- it('fails closed for required-auth Windows uninstall commands without a token', async () => {
- const windowsHost = createAgent({
- id: 'windows-host-required-token',
- hostname: 'windows-required-token.local',
- displayName: 'Windows Required Token Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- });
-
- setupComponent([windowsHost]);
-
- fireEvent.click(
- screen.getByRole('button', { name: /details for Windows Required Token Host/i }),
- );
- fireEvent.click(screen.getByRole('button', { name: /Copy uninstall command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$env:PULSE_TOKEN="<api-token>"');
- expect(copied).toContain('$env:PULSE_UNINSTALL="true"');
- });
-
- it('PowerShell-escapes canonical identity in copied Windows uninstall commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- const windowsHost = createAgent({
- id: 'windows-$agent`"id',
- hostname: 'windows-$host`"name.local',
- displayName: 'Windows Escaped Uninstall Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- });
-
- setupComponent([windowsHost]);
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- fireEvent.click(
- screen.getByRole('button', { name: /details for Windows Escaped Uninstall Host/i }),
- );
- fireEvent.click(screen.getByRole('button', { name: /Copy uninstall command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_AGENT_ID="windows-`$agent```"id"');
- expect(copied).toContain('$env:PULSE_HOSTNAME="windows-`$host```"name.local"');
- });
-
- it('quotes copied Windows uninstall script URLs', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-$token`"value',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- const windowsHost = createAgent({
- id: 'windows-uninstall-url-host',
- hostname: 'windows-uninstall-url.local',
- displayName: 'Windows Uninstall URL Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- });
-
- setupComponent([windowsHost]);
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'https://pulse.example.com/base path/$url`"value' },
- });
-
- fireEvent.click(
- screen.getByRole('button', { name: /details for Windows Uninstall URL Host/i }),
- );
- fireEvent.click(screen.getByRole('button', { name: /Copy uninstall command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL="https://pulse.example.com/base path/`$url```"value"');
- expect(copied).toContain('$env:PULSE_TOKEN="test-`$token```"value"');
- expect(copied).toContain(
- '$pulseScriptUrl="https://pulse.example.com/base path/`$url```"value/install.ps1"',
- );
- expect(copied).toContain('irm $pulseScriptUrl');
- });
-
- it('preserves insecure TLS mode in Windows uninstall commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- const windowsHost = createAgent({
- id: 'windows-host-4',
- hostname: 'windows-self-signed.local',
- displayName: 'Windows Self-Signed Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- });
-
- setupComponent([windowsHost]);
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- openAdvancedInstallOptions();
- await waitFor(() => {
- expect(getSkipTlsCheckbox()).toBeInTheDocument();
- });
- fireEvent.click(getSkipTlsCheckbox());
-
- const toggle = screen.getByRole('button', { name: /details for Windows Self-Signed Host/i });
- fireEvent.click(toggle);
-
- const copyUninstallButton = screen.getByRole('button', { name: /Copy uninstall command/i });
- fireEvent.click(copyUninstallButton);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_INSECURE_SKIP_VERIFY="true"');
- expect(copied).toContain('$env:PULSE_TOKEN="test-token"');
- expect(copied).toContain('$env:PULSE_UNINSTALL="true"');
- expect(copied).toContain('$pulseScriptUrl="http://localhost:3000/install.ps1"');
- expect(copied).toContain(
- '[System.Net.ServicePointManager]::ServerCertificateValidationCallback',
- );
- });
-
- it('does not fall back to token record IDs in shell uninstall commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'linux-secret-token',
- record: {
- id: 'token-record-id',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent([
- createAgent({
- id: 'linux-host-2',
- hostname: 'linux-uninstall.local',
- displayName: 'Linux Uninstall Host',
- platform: 'linux',
- osName: 'Ubuntu',
- }),
- ]);
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- const toggle = screen.getByRole('button', { name: /details for Linux Uninstall Host/i });
- fireEvent.click(toggle);
-
- const copyUninstallButton = screen.getByRole('button', { name: /Copy uninstall command/i });
- fireEvent.click(copyUninstallButton);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('--uninstall');
- expect(copied).toContain("--token 'linux-secret-token'");
- expect(copied).toContain("--agent-id 'linux-host-2'");
- expect(copied).toContain("--hostname 'linux-uninstall.local'");
- expect(copied).not.toContain('token-record-id');
- });
-
- it('fails closed for required-auth shell uninstall commands without a token', async () => {
- setupComponent([
- createAgent({
- id: 'linux-required-token',
- hostname: 'linux-required-token.local',
- displayName: 'Linux Required Token Host',
- }),
- ]);
-
- fireEvent.click(screen.getByRole('button', { name: /details for Linux Required Token Host/i }));
- fireEvent.click(screen.getByRole('button', { name: /Copy uninstall command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('--uninstall');
- expect(copied).toContain("--token '<api-token>'");
- expect(copied).toContain("--agent-id 'linux-required-token'");
- expect(copied).toContain("--hostname 'linux-required-token.local'");
- });
-
- it('shell-escapes canonical identity in copied Unix uninstall commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'shell-secret-token',
- record: {
- id: 'token-record-id',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent([
- createAgent({
- id: "agent id's canonical",
- hostname: "host name's canonical",
- displayName: 'Escaped Linux Uninstall Host',
- platform: 'linux',
- osName: 'Ubuntu',
- }),
- ]);
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- fireEvent.click(
- screen.getByRole('button', { name: /details for Escaped Linux Uninstall Host/i }),
- );
- fireEvent.click(screen.getByRole('button', { name: /Copy uninstall command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain("--agent-id 'agent id'\"'\"'s canonical'");
- expect(copied).toContain("--hostname 'host name'\"'\"'s canonical'");
- });
-
- it('separates active and ignored items into dedicated sections', async () => {
- const host = createAgent({ displayName: 'Active Host' });
- const ignoredDocker = createIgnoredDockerItem();
- setupComponent([host], [], [], [ignoredDocker]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(
- screen.getByText(
- '1 item is actively reporting right now, and 1 item is currently ignored by Pulse. Stopping monitoring in Pulse does not uninstall software on the remote system.',
- ),
- ).toBeInTheDocument();
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- expect(screen.getAllByText('Ignored by Pulse').length).toBeGreaterThan(0);
- expect(screen.getByText('Active reporting')).toBeInTheDocument();
- expect(screen.getByText('Showing 1 of 1 active records.')).toBeInTheDocument();
- expect(screen.getAllByText('Ignored by Pulse').length).toBeGreaterThan(0);
- expect(screen.getAllByText('Active Host').length).toBeGreaterThan(0);
- expect(screen.getAllByText('old-docker.local').length).toBeGreaterThan(0);
- expect(screen.getByText('Docker runtime')).toBeInTheDocument();
- expect(screen.getByText('1 item(s) are currently ignored by Pulse.')).toBeInTheDocument();
- expect(
- screen.getByText('Pulse is currently receiving live reports from 1 host.'),
- ).toBeInTheDocument();
- expect(screen.queryByText('Missing expected coverage')).not.toBeInTheDocument();
- expect(
- screen.queryByText('No Kubernetes reporter is currently connected.'),
- ).not.toBeInTheDocument();
- expect(
- screen.getByText(
- /Items you explicitly told Pulse to ignore stay out of live reporting until reconnect is allowed\./i,
- ),
- ).toBeInTheDocument();
- expect(
- screen.getByText(/This workspace does not list every asset Pulse has discovered\./i),
- ).toBeInTheDocument();
- expect(
- screen.getByText('Select an ignored item to open its recovery drawer.'),
- ).toBeInTheDocument();
- });
-
- it('renders the canonical ignored docker entry without an overlapping active row', async () => {
- const ignoredDocker = createIgnoredDockerItem({
- id: 'ignored:docker:tower-docker',
- hostname: 'tower.local',
- name: 'Tower',
- displayName: 'Tower',
- surfaces: [
- {
- id: 'docker:tower-docker',
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Pulse is blocking Docker runtime reports from this machine.',
- controlId: 'tower-docker',
- action: 'allow-reconnect',
- idLabel: 'Docker runtime ID',
- idValue: 'tower-docker',
- },
- ],
- });
- setupComponent([], [], [], [ignoredDocker]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(screen.getAllByText('Ignored by Pulse').length).toBeGreaterThan(0);
- const ignoredTowerButton = screen.getByText('Select to review').closest('button');
- expect(ignoredTowerButton).not.toBeNull();
- fireEvent.click(ignoredTowerButton as HTMLButtonElement);
- expect(screen.getAllByText('Ignored surface').length).toBeGreaterThan(0);
- expect(screen.getAllByText('What Pulse is ignoring').length).toBeGreaterThan(0);
- expect(screen.getAllByText('Recovery').length).toBeGreaterThan(0);
- expect(screen.getAllByText('Docker runtime data').length).toBeGreaterThan(0);
- const ignoredDrawer = screen.getByRole('dialog', { name: 'Ignored item details' });
- const ignoredDetails = within(ignoredDrawer);
- expect(
- ignoredDetails.getByRole('button', { name: /Allow Docker reconnect/i }),
- ).toBeInTheDocument();
- expect(
- ignoredDetails.queryByRole('button', { name: 'Stop monitoring' }),
- ).not.toBeInTheDocument();
- expect(screen.getByText('Showing 0 of 0 active records.')).toBeInTheDocument();
- expect(screen.getByText('1 item(s) are currently ignored by Pulse.')).toBeInTheDocument();
- });
-
- it('allows reconnect for removed host agents from the ignored-by-pulse list', async () => {
- const ignoredHost = createIgnoredHostItem({
- id: 'ignored:agent:tower-agent',
- hostname: 'tower.local',
- name: 'Tower',
- displayName: 'Tower',
- surfaces: [
- {
- id: 'agent:tower-agent',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'Pulse is blocking host telemetry from this machine.',
- controlId: 'tower-agent',
- action: 'allow-reconnect',
- idLabel: 'Agent ID',
- idValue: 'tower-agent',
- },
- ],
- });
- allowHostAgentReenrollMock.mockResolvedValue(undefined);
-
- setupComponent([], [], [], [ignoredHost]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Ignored by Pulse').length).toBeGreaterThan(0);
- });
-
- const ignoredTowerButton = screen.getByText('Select to review').closest('button');
- expect(ignoredTowerButton).not.toBeNull();
- fireEvent.click(ignoredTowerButton as HTMLButtonElement);
- expect(screen.getAllByText('Host telemetry').length).toBeGreaterThan(0);
- expect(screen.getByRole('button', { name: /Allow host reconnect/i })).toBeInTheDocument();
-
- fireEvent.click(screen.getByRole('button', { name: /Allow host reconnect/i }));
-
- await waitFor(() => expect(allowHostAgentReenrollMock).toHaveBeenCalledWith('tower-agent'), {
- interval: 0,
- });
- expect(notificationSuccessMock).toHaveBeenCalledWith(
- 'Reconnect allowed for Tower. Pulse will accept reports from it again.',
- );
- });
-
- it('shows Kubernetes clusters in the unified table', async () => {
- const cluster = createKubernetesCluster({ displayName: 'K8s Alpha' });
- setupComponent([], [], [cluster]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- expect(screen.getAllByText('K8s Alpha').length).toBeGreaterThan(0);
-
- const capSelect = screen.getByLabelText('Capability');
- fireEvent.change(capSelect, { target: { value: 'kubernetes' } });
-
- expect(screen.getAllByText('K8s Alpha').length).toBeGreaterThan(0);
- });
-
- it('removes an agent row immediately after successful deletion', async () => {
- deleteAgentMock.mockResolvedValue(undefined);
-
- const host = createAgent({ displayName: 'Tower' });
- setupComponent([host]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
- });
-
- fireEvent.click(screen.getByRole('button', { name: 'Stop monitoring' }));
- expect(screen.getByText('Stop monitoring?')).toBeInTheDocument();
- expect(screen.getByText(/Host telemetry.*will stop in Pulse/i)).toBeInTheDocument();
- expect(screen.getByText('Pulse will stop these reporting surfaces')).toBeInTheDocument();
- fireEvent.click(screen.getByRole('button', { name: 'Confirm stop monitoring' }));
-
- await waitFor(() => expect(deleteAgentMock).toHaveBeenCalledWith('host-1'), { interval: 0 });
- await waitFor(
- () =>
- expect(screen.queryByRole('button', { name: 'Stop monitoring' })).not.toBeInTheDocument(),
- {
- interval: 0,
- },
- );
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
- fireEvent.click(screen.getAllByText('Tower')[0]);
- expect(screen.getAllByRole('button', { name: 'Allow host reconnect' }).length).toBeGreaterThan(
- 0,
- );
- expect(notificationSuccessMock).toHaveBeenCalledWith(
- 'Monitoring stopped for Tower. Pulse will ignore future reports until reconnect is allowed.',
- );
- expect(refetchResourcesMock).toHaveBeenCalled();
- expect(screen.getByText('Monitoring stopped for Tower')).toBeInTheDocument();
- expect(
- screen.getByText(/Pulse removed it from active reporting and will ignore new reports/i),
- ).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'View ignored items' })).toBeInTheDocument();
- });
-
- it('shows row-level progress while stop monitoring is in flight', async () => {
- let resolveDelete: (() => void) | undefined;
- deleteAgentMock.mockImplementation(
- () =>
- new Promise<void>((resolve) => {
- resolveDelete = resolve;
- }),
- );
-
- setupComponent([createAgent({ displayName: 'Tower' })]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
- });
-
- fireEvent.click(screen.getByRole('button', { name: 'Stop monitoring' }));
- fireEvent.click(screen.getByRole('button', { name: 'Confirm stop monitoring' }));
-
- await waitFor(() => {
- expect(screen.getAllByRole('button', { name: 'Stopping…' }).length).toBeGreaterThan(0);
- });
-
- resolveDelete?.();
-
- await waitFor(() => expect(deleteAgentMock).toHaveBeenCalledWith('host-1'), { interval: 0 });
- await waitFor(
- () =>
- expect(screen.queryByRole('button', { name: 'Stop monitoring' })).not.toBeInTheDocument(),
- {
- interval: 0,
- },
- );
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
- expect(screen.getByText('Monitoring stopped for Tower')).toBeInTheDocument();
- });
-
- it('moves a stopped host into the ignored-by-pulse list immediately after deletion succeeds', async () => {
- deleteAgentMock.mockResolvedValue(undefined);
-
- setupComponent([createAgent({ displayName: 'Tower' })]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
- });
-
- fireEvent.click(screen.getByRole('button', { name: 'Stop monitoring' }));
- fireEvent.click(screen.getByRole('button', { name: 'Confirm stop monitoring' }));
-
- await waitFor(() => expect(deleteAgentMock).toHaveBeenCalledWith('host-1'), { interval: 0 });
-
- await waitFor(() => {
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
- });
- expect(screen.getAllByText('Ignored by Pulse').length).toBeGreaterThan(0);
- fireEvent.click(screen.getAllByText('Tower')[0]);
- expect(screen.getAllByRole('button', { name: 'Allow host reconnect' }).length).toBeGreaterThan(
- 0,
- );
- });
-
- it('force-removes docker runtimes from Pulse inventory', async () => {
- deleteDockerRuntimeMock.mockResolvedValue({});
-
- const dockerHost = createDockerHost({ displayName: 'Tower', status: 'online' });
- setupComponent([], [dockerHost]);
-
- await waitFor(() => {
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
- });
-
- fireEvent.click(screen.getByRole('button', { name: 'Stop monitoring' }));
- expect(screen.getByText('Stop monitoring?')).toBeInTheDocument();
- expect(screen.getByText(/will stop in Pulse/i)).toBeInTheDocument();
- fireEvent.click(screen.getByRole('button', { name: 'Confirm stop monitoring' }));
-
- await waitFor(
- () => expect(deleteDockerRuntimeMock).toHaveBeenCalledWith('docker-host-1', { force: true }),
- { interval: 0 },
- );
- await waitFor(
- () =>
- expect(screen.queryByRole('button', { name: 'Stop monitoring' })).not.toBeInTheDocument(),
- {
- interval: 0,
- },
- );
- fireEvent.click(screen.getAllByText('Tower')[0]);
- expect(
- screen.getAllByRole('button', { name: 'Allow Docker reconnect' }).length,
- ).toBeGreaterThan(0);
- expect(notificationSuccessMock).toHaveBeenCalledWith(
- 'Monitoring stopped for Tower. Pulse will ignore future reports until reconnect is allowed.',
- );
- });
-
- it('uses the canonical docker machine id for active runtime stop-monitoring actions', async () => {
- deleteDockerRuntimeMock.mockResolvedValue({});
-
- setupWithResources(
- [
- {
- id: 'agent-2de76498a76c287b',
- type: 'docker-host',
- name: 'Tower',
- displayName: 'Tower',
- platformId: 'Tower',
- platformType: 'docker',
- sourceType: 'hybrid',
- status: 'online',
- lastSeen: Date.now(),
- identity: {
- hostname: 'Tower',
- machineId: 'de6d3fee-2595-6c2b-6b08-43db6b0ab427',
- },
- discoveryTarget: {
- resourceType: 'agent',
- agentId: 'agent-2de76498a76c287b',
- resourceId: 'agent-2de76498a76c287b',
- },
- platformData: {
- agentId: 'Tower',
- dockerVersion: '27.5.1',
- },
- },
- ],
- [
- {
- id: 'agent-2de76498a76c287b',
- name: 'Tower',
- displayName: 'Tower',
- hostname: 'Tower',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '27.5.1',
- scopeAgentId: 'Tower',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'docker:de6d3fee-2595-6c2b-6b08-43db6b0ab427',
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Container runtime coverage reported from this machine.',
- controlId: 'de6d3fee-2595-6c2b-6b08-43db6b0ab427',
- action: 'stop-monitoring',
- idLabel: 'Docker runtime ID',
- idValue: 'de6d3fee-2595-6c2b-6b08-43db6b0ab427',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);
- });
-
- fireEvent.click(screen.getByRole('button', { name: 'Stop monitoring' }));
- fireEvent.click(screen.getByRole('button', { name: 'Confirm stop monitoring' }));
-
- await waitFor(
- () =>
- expect(deleteDockerRuntimeMock).toHaveBeenCalledWith(
- 'de6d3fee-2595-6c2b-6b08-43db6b0ab427',
- { force: true },
- ),
- { interval: 0 },
- );
- });
-});
-
-describe('InfrastructureOperationsController platform commands', () => {
- it('shows installation commands for all platforms after token generation', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- await waitFor(() => {
- expect(screen.getByText('Install on Linux')).toBeInTheDocument();
- });
- expect(screen.getByText('Install on macOS')).toBeInTheDocument();
- expect(screen.getByText('Install on Windows')).toBeInTheDocument();
- });
-
- it('includes insecure flag when TLS skip is enabled', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- await waitFor(() => {
- expect(getSkipTlsCheckbox()).toBeInTheDocument();
- });
-
- // TLS skip is disabled by default
- const checkbox = getSkipTlsCheckbox();
- expect(checkbox).not.toBeChecked();
-
- // Enable it
- fireEvent.click(checkbox);
- expect(checkbox).toBeChecked();
-
- // Find a copy button and check that the command includes the insecure flag
- const copyButtons = screen.getAllByRole('button', { name: /Copy command/i });
- expect(copyButtons.length).toBeGreaterThan(0);
- });
-
- it('applies Proxmox PBS target profile flags to shell install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => {
- expect(getTargetProfileSelect()).toBeInTheDocument();
- });
-
- const profileSelect = getTargetProfileSelect();
- fireEvent.change(profileSelect, { target: { value: 'proxmox-pbs' } });
-
- expect(trackAgentInstallProfileSelectedMock).toHaveBeenCalledWith(
- 'settings_unified_agents',
- 'proxmox-pbs',
- );
- await waitFor(() => {
- const commandBlocks = screen.getAllByText(/--proxmox-type pbs/i);
- expect(commandBlocks.length).toBeGreaterThan(0);
- });
- });
-
- it('applies Proxmox PBS target profile env to copied Windows install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => {
- expect(getTargetProfileSelect()).toBeInTheDocument();
- });
-
- const profileSelect = getTargetProfileSelect();
- fireEvent.change(profileSelect, { target: { value: 'proxmox-pbs' } });
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[copyButtons.length - 1]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_ENABLE_PROXMOX="true"');
- expect(copied).toContain('$env:PULSE_PROXMOX_TYPE="pbs"');
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('install.ps1');
- });
-
- it('applies Docker target profile flags to shell install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => {
- expect(getTargetProfileSelect()).toBeInTheDocument();
- });
-
- const profileSelect = getTargetProfileSelect();
- fireEvent.change(profileSelect, { target: { value: 'docker' } });
-
- expect(trackAgentInstallProfileSelectedMock).toHaveBeenCalledWith(
- 'settings_unified_agents',
- 'docker',
- );
- await waitFor(() => {
- const dockerBlocks = screen.getAllByText(/--enable-docker/i);
- expect(dockerBlocks.length).toBeGreaterThan(0);
- });
- await waitFor(() => {
- const hostDisableBlocks = screen.getAllByText(/--disable-host/i);
- expect(hostDisableBlocks.length).toBeGreaterThan(0);
- });
- await waitFor(() => {
- const dockerEnvBlocks = screen.getAllByText(/\$env:PULSE_ENABLE_DOCKER="true"/i);
- expect(dockerEnvBlocks.length).toBeGreaterThan(0);
- });
- await waitFor(() => {
- const hostDisableEnvBlocks = screen.getAllByText(/\$env:PULSE_ENABLE_HOST="false"/i);
- expect(hostDisableEnvBlocks.length).toBeGreaterThan(0);
- });
- });
-
- it('keeps TrueNAS out of host install profiles and routes the alternative CTA to platform connections', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => {
- expect(getTargetProfileSelect()).toBeInTheDocument();
- });
-
- expect(screen.queryByRole('option', { name: 'TrueNAS SCALE agent' })).toBeNull();
-
- expect(
- screen.getByText(/API-backed platforms such as TrueNAS connect through Add infrastructure/i),
- ).toBeInTheDocument();
- });
-
- it('tracks install command copies', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- const copyButton = screen.getAllByRole('button', { name: /Copy command/i })[0];
- fireEvent.click(copyButton);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => expect(trackAgentInstallCommandCopiedMock).toHaveBeenCalled(), {
- interval: 0,
- });
- const [surface, capability] = trackAgentInstallCommandCopiedMock.mock.calls[0] as [
- string,
- string,
- ];
- expect(surface).toBe('settings_unified_agents');
- expect(capability).toContain(':auto:');
- });
-
- it('omits token arguments from copied install commands when tokens are optional', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
-
- setupComponent();
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Confirm without token/i })).toBeInTheDocument();
- });
-
- fireEvent.click(screen.getByRole('button', { name: /Confirm without token/i }));
-
- await waitFor(() => {
- expect(screen.getByText('Install on Linux')).toBeInTheDocument();
- });
-
- fireEvent.click(screen.getAllByRole('button', { name: /Copy command/i })[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('--url ');
- expect(copied).not.toContain('--token');
- expect(copied).not.toContain('disabled');
- expect(copied).not.toContain('PULSE_TOKEN');
- });
-
- it('preserves generated tokens in copied install commands when auth is optional', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
- createTokenMock.mockResolvedValue({
- token: 'optional-token',
- record: {
- id: 'token-record',
- name: 'Optional Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Generate token/i })).toBeInTheDocument();
- });
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$env:PULSE_TOKEN="optional-token"');
- expect(copied).not.toContain('<api-token>');
- });
-
- it('preserves installer arguments when wrapping copied shell commands with privilege escalation', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
- await waitFor(() => {
- expect(getTargetProfileSelect()).toBeInTheDocument();
- });
-
- const profileSelect = getTargetProfileSelect();
- fireEvent.change(profileSelect, { target: { value: 'docker' } });
-
- const enableCommandsCheckbox = getEnableCommandsCheckbox();
- fireEvent.click(enableCommandsCheckbox);
-
- const copyButton = screen.getAllByRole('button', { name: /Copy command/i })[0];
- fireEvent.click(copyButton);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('sudo bash -s -- --url ');
- expect(copied).toContain("--token 'test-token'");
- expect(copied).toContain('--enable-docker');
- expect(copied).toContain('--disable-host');
- expect(copied).toContain('--enable-commands');
- expect(copied).not.toContain('bash -s -- $1');
- });
-
- it('shell-escapes copied Unix install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: "token'withquote",
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: "https://pulse.example.com/base path/agent's" },
- });
-
- fireEvent.click(screen.getAllByRole('button', { name: /Copy command/i })[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain(
- "curl -fsSL 'https://pulse.example.com/base path/agent'\"'\"'s/install.sh'",
- );
- expect(copied).toContain("--url 'https://pulse.example.com/base path/agent'\"'\"'s'");
- expect(copied).toContain("--token 'token'\"'\"'withquote'");
- });
-
- it('preserves plain-http insecure continuity in copied Unix install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'http-token',
- record: {
- id: 'token-record',
- name: 'HTTP Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'http://pulse.example:7655' },
- });
-
- fireEvent.click(screen.getAllByRole('button', { name: /Copy command/i })[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain("--url 'http://pulse.example:7655'");
- expect(copied).toContain("--token 'http-token'");
- expect(copied).toContain('--insecure');
- expect(copied).not.toContain('curl -kfsSL');
- });
-
- it('preserves custom CA transport in copied Unix install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'custom-ca-token',
- record: {
- id: 'token-record',
- name: 'Custom CA Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- fireEvent.input(getCustomCaPathInput(), {
- target: { value: '/etc/pulse/custom-ca.pem' },
- });
-
- fireEvent.click(screen.getAllByRole('button', { name: /Copy command/i })[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain("curl -fsSL --cacert '/etc/pulse/custom-ca.pem'");
- expect(copied).toContain("--cacert '/etc/pulse/custom-ca.pem'");
- });
-
- it('renders installer snippets with the same Unix transport and flags that copy uses', async () => {
- createTokenMock.mockResolvedValue({
- token: 'rendered-token',
- record: {
- id: 'token-record',
- name: 'Rendered Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'http://pulse.example:7655/' },
- });
- fireEvent.input(getCustomCaPathInput(), {
- target: { value: '/etc/pulse/custom-ca.pem' },
- });
- fireEvent.click(getEnableCommandsCheckbox());
- fireEvent.change(getTargetProfileSelect(), {
- target: { value: 'docker' },
- });
-
- const linuxHeading = screen.getByText('Install on Linux');
- const linuxSection = linuxHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(linuxSection).not.toBeNull();
-
- const rendered = within(linuxSection as HTMLElement).getByText((content) =>
- content.includes('curl -fsSL'),
- );
- expect(rendered.textContent).toContain(
- "curl -fsSL --cacert '/etc/pulse/custom-ca.pem' 'http://pulse.example:7655/install.sh'",
- );
- expect(rendered.textContent).toContain("--url 'http://pulse.example:7655'");
- expect(rendered.textContent).toContain("--token 'rendered-token'");
- expect(rendered.textContent).toContain('--enable-docker --disable-host --enable-commands');
- expect(rendered.textContent).toContain('--insecure');
- });
-
- it('renders installer snippets with the same Windows env continuity that copy uses', async () => {
- createTokenMock.mockResolvedValue({
- token: 'windows-rendered-token',
- record: {
- id: 'token-record',
- name: 'Windows Rendered Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- fireEvent.input(getCustomCaPathInput(), {
- target: { value: 'C:\\Pulse\\custom-ca.cer' },
- });
- fireEvent.click(getSkipTlsCheckbox());
- fireEvent.click(getEnableCommandsCheckbox());
- fireEvent.change(getTargetProfileSelect(), {
- target: { value: 'proxmox-pbs' },
- });
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const rendered = within(windowsSection as HTMLElement).getAllByText((content) =>
- content.includes('$pulseScriptUrl='),
- )[0];
- expect(rendered.textContent).toContain('$env:PULSE_URL="http://localhost:3000"');
- expect(rendered.textContent).toContain('$env:PULSE_TOKEN="windows-rendered-token"');
- expect(rendered.textContent).toContain('$env:PULSE_INSECURE_SKIP_VERIFY="true"');
- expect(rendered.textContent).toContain('$env:PULSE_CACERT="C:\\Pulse\\custom-ca.cer"');
- expect(rendered.textContent).toContain('$env:PULSE_ENABLE_PROXMOX="true"');
- expect(rendered.textContent).toContain('$env:PULSE_PROXMOX_TYPE="pbs"');
- expect(rendered.textContent).toContain('$env:PULSE_ENABLE_COMMANDS="true"');
- });
-
- it('normalizes trailing slashes in copied install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'trimmed-token',
- record: {
- id: 'token-record',
- name: 'Trimmed Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'https://pulse.example.com/base/' },
- });
-
- fireEvent.click(screen.getAllByRole('button', { name: /Copy command/i })[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain("curl -fsSL 'https://pulse.example.com/base/install.sh'");
- expect(copied).toContain("--url 'https://pulse.example.com/base'");
- expect(copied).not.toContain('//install.sh');
- expect(copied).not.toContain("--url 'https://pulse.example.com/base/'");
- });
-
- it('falls back to the canonical endpoint when the custom install URL is only whitespace', async () => {
- createTokenMock.mockResolvedValue({
- token: 'fallback-token',
- record: {
- id: 'token-record',
- name: 'Fallback Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: ' ' },
- });
-
- fireEvent.click(screen.getAllByRole('button', { name: /Copy command/i })[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain("curl -fsSL 'http://localhost:3000/install.sh'");
- expect(copied).toContain("--url 'http://localhost:3000'");
- });
-
- it('preserves insecure and command-execution env in copied Windows install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const insecureCheckbox = getSkipTlsCheckbox();
- fireEvent.click(insecureCheckbox);
-
- const enableCommandsCheckbox = getEnableCommandsCheckbox();
- fireEvent.click(enableCommandsCheckbox);
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[copyButtons.length - 1]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_ENABLE_COMMANDS="true"');
- expect(copied).toContain('$env:PULSE_INSECURE_SKIP_VERIFY="true"');
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$env:PULSE_TOKEN="test-token"');
- expect(copied).toContain('$pulseScriptUrl="http://localhost:3000/install.ps1"');
- expect(copied).toContain(
- '[System.Net.ServicePointManager]::ServerCertificateValidationCallback',
- );
- });
-
- it('PowerShell-escapes copied Windows install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-$token`"value',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'https://pulse.example.com/$url`"value' },
- });
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[copyButtons.length - 1]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL="https://pulse.example.com/`$url```"value"');
- expect(copied).toContain('$env:PULSE_TOKEN="test-`$token```"value"');
- expect(copied).toContain(
- '$pulseScriptUrl="https://pulse.example.com/`$url```"value/install.ps1"',
- );
- expect(copied).toContain('irm $pulseScriptUrl');
- });
-
- it('preserves PULSE_URL in copied interactive Windows install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'https://pulse.example.com/base path/interactive' },
- });
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL="https://pulse.example.com/base path/interactive"');
- expect(copied).toContain('$env:PULSE_TOKEN="test-token"');
- expect(copied).toContain(
- '$pulseScriptUrl="https://pulse.example.com/base path/interactive/install.ps1"',
- );
- expect(copied).toContain('irm $pulseScriptUrl');
- });
-
- it('normalizes trailing slashes in copied interactive Windows install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'https://pulse.example.com/base/' },
- });
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL="https://pulse.example.com/base"');
- expect(copied).toContain('$pulseScriptUrl="https://pulse.example.com/base/install.ps1"');
- expect(copied).not.toContain('//install.ps1');
- expect(copied).not.toContain('$env:PULSE_URL="https://pulse.example.com/base/"');
- });
-
- it('uses the selected token instead of a placeholder in copied interactive Windows install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$env:PULSE_TOKEN="test-token"');
- expect(copied).not.toContain('<api-token>');
- });
-
- it('omits token transport in copied interactive Windows install commands when auth is optional', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
-
- setupComponent();
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Confirm without token/i })).toBeInTheDocument();
- });
- fireEvent.click(screen.getByRole('button', { name: /Confirm without token/i }));
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[0]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$pulseScriptUrl="http://localhost:3000/install.ps1"');
- expect(copied).not.toContain('$env:PULSE_TOKEN=');
- expect(copied).not.toContain('<api-token>');
- });
-
- it('preserves custom CA transport in copied Windows install commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'windows-ca-token',
- record: {
- id: 'token-record',
- name: 'Windows CA Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- setupComponent();
-
- fireEvent.click(screen.getByRole('button', { name: /Generate token/i }));
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- fireEvent.input(getCustomCaPathInput(), {
- target: { value: 'C:\\Pulse\\custom-ca.cer' },
- });
-
- const windowsHeading = screen.getByText('Install on Windows');
- const windowsSection = windowsHeading.closest('.space-y-3.rounded-md.border.border-border.p-4');
- expect(windowsSection).not.toBeNull();
-
- const copyButtons = within(windowsSection as HTMLElement).getAllByRole('button', {
- name: /Copy command/i,
- });
- fireEvent.click(copyButtons[copyButtons.length - 1]);
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_CACERT="C:\\Pulse\\custom-ca.cer"');
- expect(copied).toContain('$pulseScriptUrl="http://localhost:3000/install.ps1"');
- expect(copied).toContain(
- '$pulseCustomCaBytes = [System.IO.File]::ReadAllBytes($env:PULSE_CACERT)',
- );
- expect(copied).toContain('$pulseCustomCaText.Contains("-----BEGIN CERTIFICATE-----")');
- expect(copied).toContain(
- '[System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromPem($pulseCustomCaText)',
- );
- });
-
- it('preserves insecure and command-execution env in Windows upgrade commands', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-token',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- const windowsHost = createAgent({
- id: 'windows-host-upgrade-env',
- hostname: 'windows-upgrade-env.local',
- displayName: 'Windows Upgrade Env',
- platform: 'windows',
- osName: 'Windows Server 2022',
- isLegacy: true,
- });
-
- setupComponent([windowsHost]);
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const insecureCheckbox = getSkipTlsCheckbox();
- fireEvent.click(insecureCheckbox);
-
- const enableCommandsCheckbox = getEnableCommandsCheckbox();
- fireEvent.click(enableCommandsCheckbox);
-
- fireEvent.click(screen.getByRole('button', { name: /details for Windows Upgrade Env/i }));
- fireEvent.click(screen.getByRole('button', { name: /Copy upgrade command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_ENABLE_COMMANDS="true"');
- expect(copied).toContain('$env:PULSE_INSECURE_SKIP_VERIFY="true"');
- expect(copied).toContain('$env:PULSE_URL=');
- expect(copied).toContain('$env:PULSE_TOKEN=');
- expect(copied).toContain('$env:PULSE_AGENT_ID="windows-host-upgrade-env"');
- expect(copied).toContain('$env:PULSE_HOSTNAME="windows-upgrade-env.local"');
- expect(copied).toContain('$pulseScriptUrl="http://localhost:3000/install.ps1"');
- });
-
- it('PowerShell-escapes canonical identity in copied Windows upgrade commands', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
-
- const windowsHost = createAgent({
- id: 'windows-$upgrade`"id',
- hostname: 'windows-$upgrade`"host.local',
- displayName: 'Windows Escaped Upgrade Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- isLegacy: true,
- });
-
- setupComponent([windowsHost]);
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Confirm without token/i })).toBeInTheDocument();
- });
- fireEvent.click(screen.getByRole('button', { name: /Confirm without token/i }));
- fireEvent.click(
- screen.getByRole('button', { name: /details for Windows Escaped Upgrade Host/i }),
- );
- fireEvent.click(screen.getByRole('button', { name: /Copy upgrade command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_AGENT_ID="windows-`$upgrade```"id"');
- expect(copied).toContain('$env:PULSE_HOSTNAME="windows-`$upgrade```"host.local"');
- });
-
- it('PowerShell-quotes copied Windows upgrade script URLs', async () => {
- createTokenMock.mockResolvedValue({
- token: 'test-$token`"value',
- record: {
- id: 'token-record',
- name: 'Test Token',
- prefix: 'abc',
- suffix: '123',
- createdAt: new Date().toISOString(),
- },
- });
-
- const windowsHost = createAgent({
- id: 'windows-upgrade-url-host',
- hostname: 'windows-upgrade-url.local',
- displayName: 'Windows Upgrade URL Host',
- platform: 'windows',
- osName: 'Windows Server 2022',
- isLegacy: true,
- });
-
- setupComponent([windowsHost]);
-
- const generateButton = screen.getByRole('button', { name: /Generate token/i });
- fireEvent.click(generateButton);
-
- await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'https://pulse.example.com/base path/$url`"value' },
- });
-
- fireEvent.click(screen.getByRole('button', { name: /details for Windows Upgrade URL Host/i }));
- fireEvent.click(screen.getByRole('button', { name: /Copy upgrade command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('$env:PULSE_URL="https://pulse.example.com/base path/`$url```"value"');
- expect(copied).toContain('$env:PULSE_TOKEN="test-`$token```"value"');
- expect(copied).toContain(
- '$pulseScriptUrl="https://pulse.example.com/base path/`$url```"value/install.ps1"',
- );
- expect(copied).toContain('irm $pulseScriptUrl');
- });
-
- it('omits token arguments from copied upgrade commands when tokens are optional', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
-
- const legacyHost = createAgent({
- id: 'legacy-host-no-token',
- hostname: 'legacy-no-token.local',
- displayName: 'Legacy No Token',
- isLegacy: true,
- });
-
- setupComponent([legacyHost]);
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Confirm without token/i })).toBeInTheDocument();
- });
-
- fireEvent.click(screen.getByRole('button', { name: /Confirm without token/i }));
-
- await waitFor(() => {
- expect(screen.getByText(/outdated agent binar(y|ies).*detected/i)).toBeInTheDocument();
- });
-
- fireEvent.click(screen.getByRole('button', { name: /details for Legacy No Token/i }));
- fireEvent.click(screen.getByRole('button', { name: /Copy upgrade command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain('--url ');
- expect(copied).not.toContain('--token');
- expect(copied).not.toContain('disabled');
- expect(copied).toContain("--agent-id 'legacy-host-no-token'");
- expect(copied).toContain("--hostname 'legacy-no-token.local'");
- });
-
- it('shell-escapes canonical identity in copied Unix upgrade commands', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
-
- const legacyHost = createAgent({
- id: "legacy host's canonical",
- hostname: "legacy name's canonical",
- displayName: 'Escaped Legacy Host',
- isLegacy: true,
- });
-
- setupComponent([legacyHost]);
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Confirm without token/i })).toBeInTheDocument();
- });
-
- fireEvent.click(screen.getByRole('button', { name: /Confirm without token/i }));
- fireEvent.click(screen.getByRole('button', { name: /details for Escaped Legacy Host/i }));
- fireEvent.click(screen.getByRole('button', { name: /Copy upgrade command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain("--agent-id 'legacy host'\"'\"'s canonical'");
- expect(copied).toContain("--hostname 'legacy name'\"'\"'s canonical'");
- });
-
- it('preserves plain-http insecure continuity in copied Unix upgrade commands', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
-
- const legacyHost = createAgent({
- id: 'legacy-http-upgrade',
- hostname: 'legacy-http-upgrade.local',
- displayName: 'Legacy HTTP Upgrade',
- isLegacy: true,
- });
-
- setupComponent([legacyHost]);
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Confirm without token/i })).toBeInTheDocument();
- });
-
- fireEvent.click(screen.getByRole('button', { name: /Confirm without token/i }));
-
- const urlInput = getConnectionUrlInput();
- fireEvent.input(urlInput, {
- target: { value: 'http://pulse.example:7655' },
- });
-
- fireEvent.click(screen.getByRole('button', { name: /details for Legacy HTTP Upgrade/i }));
- fireEvent.click(screen.getByRole('button', { name: /Copy upgrade command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain("--url 'http://pulse.example:7655'");
- expect(copied).toContain('--insecure');
- expect(copied).not.toContain('curl -kfsSL');
- });
-
- it('preserves custom CA transport in copied Unix upgrade commands', async () => {
- securityStatusResponse = { requiresAuth: false, apiTokenConfigured: false };
-
- const legacyHost = createAgent({
- id: 'legacy-upgrade-ca',
- hostname: 'legacy-upgrade-ca.local',
- displayName: 'Legacy Upgrade CA',
- isLegacy: true,
- });
-
- setupComponent([legacyHost]);
-
- await waitFor(() => {
- expect(screen.getByRole('button', { name: /Confirm without token/i })).toBeInTheDocument();
- });
-
- fireEvent.click(screen.getByRole('button', { name: /Confirm without token/i }));
- fireEvent.input(getCustomCaPathInput(), {
- target: { value: '/etc/pulse/upgrade-ca.pem' },
- });
-
- fireEvent.click(screen.getByRole('button', { name: /details for Legacy Upgrade CA/i }));
- fireEvent.click(screen.getByRole('button', { name: /Copy upgrade command/i }));
-
- await waitFor(() => expect(clipboardSpy).toHaveBeenCalled(), { interval: 0 });
- const copied = clipboardSpy.mock.calls.at(-1)?.[0] as string;
- expect(copied).toContain("curl -fsSL --cacert '/etc/pulse/upgrade-ca.pem'");
- expect(copied).toContain("--cacert '/etc/pulse/upgrade-ca.pem'");
- });
-
- it('keeps missing assigned profiles visible instead of collapsing scope to default', async () => {
- listProfilesMock.mockResolvedValue([
- {
- id: 'profile-a',
- name: 'Profile A',
- config: {},
- created_at: new Date().toISOString(),
- updated_at: new Date().toISOString(),
- },
- ]);
- listAssignmentsMock.mockResolvedValue([
- {
- agent_id: 'agent-platform-only',
- profile_id: 'missing-profile',
- updated_at: new Date().toISOString(),
- },
- ]);
-
- setupWithResources(
- [
- {
- id: 'resource-agent-platform-only',
- type: 'agent',
- platformType: 'proxmox-pve',
- sourceType: 'hybrid',
- name: 'tower',
- displayName: 'Tower',
- status: 'online',
- lastSeen: Date.now(),
- identity: { hostname: 'tower.local' },
- discoveryTarget: {
- resourceType: 'agent',
- agentId: 'agent-platform-only',
- resourceId: 'resource-agent-platform-only',
- },
- agent: {
- agentId: 'agent-platform-only',
- agentVersion: '1.2.3',
- },
- platformData: {
- agent: {
- agentId: 'agent-platform-only',
- agentVersion: '1.2.3',
- },
- agentId: 'agent-platform-only',
- },
- },
- ],
- [
- {
- id: 'resource-agent-platform-only',
- name: 'Tower',
- displayName: 'Tower',
- hostname: 'tower.local',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '1.2.3',
- scopeAgentId: 'agent-platform-only',
- uninstallAgentId: 'agent-platform-only',
- uninstallHostname: 'tower.local',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'agent:agent-platform-only',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'System health, inventory, and Pulse command connectivity.',
- controlId: 'agent-platform-only',
- action: 'stop-monitoring',
- idLabel: 'Agent ID',
- idValue: 'agent-platform-only',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- const toggle = screen.getByRole('button', { name: /details for Tower/i });
- fireEvent.click(toggle);
-
- const detailsRow = document.getElementById('agent-details-agent-resource-agent-platform-only');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- await waitFor(() => {
- expect(details.getByRole('combobox')).toBeInTheDocument();
- });
- const select = details.getByRole('combobox') as HTMLSelectElement;
-
- await waitFor(() => {
- expect(select.value).toBe('missing-profile');
- });
- expect(
- within(select).getByRole('option', { name: 'Missing profile (missing-profile)' }),
- ).toBeInTheDocument();
- expect(within(select).getByRole('option', { name: 'Profile A' })).toBeInTheDocument();
- });
-
- it('resyncs scope options after a missing-profile assignment rejection', async () => {
- listProfilesMock
- .mockResolvedValueOnce([
- {
- id: 'profile-a',
- name: 'Profile A',
- config: {},
- created_at: new Date().toISOString(),
- updated_at: new Date().toISOString(),
- },
- ])
- .mockResolvedValueOnce([]);
- listAssignmentsMock.mockResolvedValueOnce([]).mockResolvedValueOnce([]);
- assignProfileMock.mockRejectedValueOnce(
- new Error('Selected profile no longer exists. Refresh and choose another profile.'),
- );
-
- setupWithResources(
- [
- {
- id: 'resource-agent-profile-resync',
- type: 'agent',
- platformType: 'agent',
- sourceType: 'agent',
- name: 'tower',
- displayName: 'Tower',
- status: 'online',
- lastSeen: Date.now(),
- identity: { hostname: 'tower.local' },
- discoveryTarget: {
- resourceType: 'agent',
- agentId: 'agent-profile-resync',
- resourceId: 'resource-agent-profile-resync',
- },
- agent: {
- agentId: 'agent-profile-resync',
- agentVersion: '1.2.3',
- },
- platformData: {
- agent: {
- agentId: 'agent-profile-resync',
- agentVersion: '1.2.3',
- },
- agentId: 'agent-profile-resync',
- },
- },
- ],
- [
- {
- id: 'resource-agent-profile-resync',
- name: 'Tower',
- displayName: 'Tower',
- hostname: 'tower.local',
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- version: '1.2.3',
- scopeAgentId: 'agent-profile-resync',
- uninstallAgentId: 'agent-profile-resync',
- uninstallHostname: 'tower.local',
- upgradePlatform: 'linux',
- surfaces: [
- {
- id: 'agent:agent-profile-resync',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'System health, inventory, and Pulse command connectivity.',
- controlId: 'agent-profile-resync',
- action: 'stop-monitoring',
- idLabel: 'Agent ID',
- idValue: 'agent-profile-resync',
- },
- ],
- },
- ],
- );
-
- await waitFor(() => {
- expect(screen.getAllByText('Reporting now').length).toBeGreaterThan(0);
- });
-
- fireEvent.click(screen.getByRole('button', { name: /details for Tower/i }));
-
- const detailsRow = document.getElementById('agent-details-agent-resource-agent-profile-resync');
- expect(detailsRow).not.toBeNull();
- const details = within(detailsRow as HTMLElement);
- await waitFor(() => {
- expect(details.getByRole('combobox')).toBeInTheDocument();
- });
-
- const select = details.getByRole('combobox') as HTMLSelectElement;
- fireEvent.change(select, { target: { value: 'profile-a' } });
-
- await waitFor(() => {
- expect(assignProfileMock).toHaveBeenCalledWith('agent-profile-resync', 'profile-a');
- });
- await waitFor(() => {
- expect(listProfilesMock).toHaveBeenCalledTimes(2);
- expect(listAssignmentsMock).toHaveBeenCalledTimes(2);
- });
- await waitFor(() => {
- expect(notificationErrorMock).toHaveBeenCalledWith(
- 'Selected profile no longer exists. Refresh and choose another profile.',
- );
- });
- await waitFor(() => {
- expect(details.queryByRole('combobox')).not.toBeInTheDocument();
- });
- expect(details.getByText('Default')).toBeInTheDocument();
- });
-
- it('surfaces malformed profile list responses instead of failing open to empty profile state', async () => {
- listProfilesMock.mockRejectedValueOnce(
- new Error('Invalid agent profile list response from Pulse.'),
- );
-
- setupWithResources([], []);
-
- await waitFor(() => {
- expect(notificationErrorMock).toHaveBeenCalledWith(
- 'Invalid agent profile list response from Pulse.',
- );
- });
- });
-});
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
index 1dfa9e7489..c1aca3c3db 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx
@@ -152,4 +152,11 @@ describe('infrastructure operations model', () => {
it('keeps api-backed TrueNAS out of the host install profile list', () => {
expect(INSTALL_PROFILE_OPTIONS.map((option) => option.value)).not.toContain('truenas');
});
+
+ it('does not reintroduce the retired reporting state hook on the operations state', async () => {
+ const operationsStateSource = await import(
+ '../useInfrastructureOperationsState?raw'
+ ).then((mod) => (mod as { default: string }).default);
+ expect(operationsStateSource).not.toContain('useInfrastructureReportingState');
+ });
});
diff --git a/frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts b/frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts
deleted file mode 100644
index d9c32885b6..0000000000
--- a/frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import nodeModalAuthenticationSectionSource from '../NodeModalAuthenticationSection.tsx?raw';
-import nodeModalBasicInfoSectionSource from '../NodeModalBasicInfoSection.tsx?raw';
-import nodeModalMonitoringSectionSource from '../NodeModalMonitoringSection.tsx?raw';
-import nodeModalSetupGuideSectionSource from '../NodeModalSetupGuideSection.tsx?raw';
-import nodeModalStatusFooterSource from '../NodeModalStatusFooter.tsx?raw';
-import nodeModalSource from '../NodeModal.tsx?raw';
-import nodeModalModelSource from '../nodeModalModel.ts?raw';
-import nodeModalStateSource from '../useNodeModalState.ts?raw';
-
-const nodeModalSettingsOwnerSource = [
- nodeModalAuthenticationSectionSource,
- nodeModalBasicInfoSectionSource,
- nodeModalMonitoringSectionSource,
- nodeModalSetupGuideSectionSource,
- nodeModalStatusFooterSource,
- nodeModalSource,
- nodeModalModelSource,
- nodeModalStateSource,
-].join('\n');
-
-describe('NodeModal guardrails', () => {
- it('keeps the node modal shell focused on extracted section owners', () => {
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalBasicInfoSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalAuthenticationSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalMonitoringSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalStatusFooter');
- expect(nodeModalSource).not.toContain('title="Basic information"');
- expect(nodeModalSource).not.toContain('title="Authentication"');
- expect(nodeModalSource).not.toContain('title="Monitoring coverage"');
- expect(nodeModalSource).not.toContain('Start your free 14-day trial');
- expect(nodeModalAuthenticationSectionSource).toContain(
- '@/components/Settings/NodeModalSetupGuideSection',
- );
- expect(nodeModalSetupGuideSectionSource).toContain("await state.copyProxmoxAgentInstallCommand(");
- expect(nodeModalMonitoringSectionSource).toContain('title="Monitoring coverage"');
- expect(nodeModalStatusFooterSource).toContain('Start your free 14-day trial');
- expect(nodeModalStateSource).toContain('runStartProTrialAction({');
- expect(nodeModalStateSource).not.toContain('startProTrial()');
- });
-
- it('keeps the manual PVE permission snippet aligned with the canonical setup script', () => {
- expect(nodeModalSettingsOwnerSource).toContain('export const PVE_MANUAL_PERMISSION_COMMAND = `');
- expect(nodeModalSettingsOwnerSource).toContain(
- 'PRIV_STRING="$(IFS=,; echo "\\${EXTRA_PRIVS[*]}")"',
- );
- expect(nodeModalSettingsOwnerSource).toContain(
- 'pveum role modify PulseMonitor -privs "$PRIV_STRING" 2>/dev/null || pveum role add PulseMonitor -privs "$PRIV_STRING" 2>/dev/null',
- );
- expect(nodeModalSettingsOwnerSource).not.toContain('PRIV_STRING="${EXTRA_PRIVS[*]}"');
- expect(nodeModalSettingsOwnerSource).not.toContain('pveum role delete PulseMonitor 2>/dev/null');
- });
-
- it('routes proxmox agent-install commands through the canonical NodesAPI client for both PVE and PBS', () => {
- expect(nodeModalSource).toContain('useNodeModalState');
- expect(nodeModalStateSource).toContain("from '@/stores/licenseCommercial';");
- expect(nodeModalStateSource).not.toContain("from '@/stores/license';\n");
- expect(nodeModalStateSource).not.toContain('loadCommercialPosture(');
- expect(nodeModalStateSource).toContain('canStartCommercialTrial');
- expect(nodeModalStateSource).toContain('const canStartTrial = createMemo(() => canStartCommercialTrial());');
- expect(nodeModalStateSource).not.toContain('commercialPosture()');
- expect(nodeModalStateSource).toContain('const copyProxmoxAgentInstallCommand = async (');
- expect(nodeModalStateSource).toContain("const data = await NodesAPI.getAgentInstallCommand({");
- expect(nodeModalStateSource).toContain('type,');
- expect(nodeModalStateSource).toContain('enableProxmox: true,');
- expect(nodeModalSettingsOwnerSource).toContain("await state.copyProxmoxAgentInstallCommand(");
- expect(nodeModalSettingsOwnerSource).toContain("'pve',");
- expect(nodeModalSettingsOwnerSource).toContain("'pbs',");
- expect(nodeModalStateSource).toContain(
- "const message = error instanceof Error ? error.message : 'Failed to generate install command';",
- );
- expect(nodeModalStateSource).toContain("setAgentCommandError(copyFailureMessage);");
- expect(nodeModalStateSource).toContain("notificationStore.error(copyFailureMessage);");
- expect(nodeModalStateSource).toContain("notificationStore.error(message);");
- expect(nodeModalSettingsOwnerSource).not.toContain("apiFetch('/api/agent-install-command'");
- });
-
- it('routes proxmox setup command and script download transport through the canonical NodesAPI client', () => {
- expect(nodeModalStateSource).toContain(
- 'const [quickSetupBootstrap, setQuickSetupBootstrap] = createSignal<',
- );
- expect(nodeModalStateSource).toContain('const loadQuickSetupBootstrap = async (');
- expect(nodeModalStateSource).toContain('await NodesAPI.getProxmoxSetupCommand({');
- expect(nodeModalStateSource).toContain(
- 'const bootstrap = await loadQuickSetupBootstrap(type, backupPerms);',
- );
- expect(nodeModalStateSource).toContain(
- 'const data = await NodesAPI.downloadProxmoxSetupScript(bootstrap);',
- );
- expect(nodeModalStateSource).toContain('setQuickSetupTokenHint(response.tokenHint);');
- expect(nodeModalStateSource).toContain('setQuickSetupExpiry(response.expires);');
- expect(nodeModalStateSource).toContain(
- 'setQuickSetupPreviewCommand(response.commandWithoutEnv ?? response.commandWithEnv);',
- );
- expect(nodeModalStateSource).toContain('copyToClipboard(data.commandWithEnv)');
- expect(nodeModalSettingsOwnerSource).toContain(
- "Command copied to clipboard! Run it on the server; the one-time setup token is already embedded.",
- );
- expect(nodeModalSettingsOwnerSource).toContain('Setup token hint:');
- expect(nodeModalStateSource).toContain(
- "notificationStore.error('Please enter the Endpoint URL first');",
- );
- expect(nodeModalStateSource).toContain('setQuickSetupBootstrap({ cacheKey, response });');
- expect(nodeModalStateSource).toContain(
- 'if (cached && cached.cacheKey === cacheKey && cached.response.expires > nowUnix)',
- );
- expect(nodeModalStateSource).toContain('const blob = new Blob([data.content], {');
- expect(nodeModalStateSource).toContain('type: data.contentType,');
- expect(nodeModalStateSource).toContain('anchor.download = data.fileName;');
- expect(nodeModalStateSource).toContain(
- 'const setupScriptRunHint = (fileName: string) => `bash ${fileName}`;',
- );
- expect(nodeModalStateSource).toContain('setupScriptRunHint(data.fileName)');
- expect(nodeModalSettingsOwnerSource).not.toContain('Download pulse-setup.sh');
- expect(nodeModalSettingsOwnerSource).not.toContain('Download pulse-pbs-setup.sh');
- expect(nodeModalSettingsOwnerSource).not.toContain("apiFetch('/api/setup-script-url'");
- expect(nodeModalSettingsOwnerSource).not.toContain("const scriptUrl = `/api/setup-script?");
- expect(nodeModalSettingsOwnerSource).not.toContain('Setup token:</span>');
- expect(nodeModalSettingsOwnerSource).not.toContain(
- "const [quickSetupToken, setQuickSetupToken] = createSignal('');",
- );
- expect(nodeModalSettingsOwnerSource).not.toContain(
- 'setQuickSetupPreviewCommand(response.commandWithEnv);',
- );
- expect(nodeModalSettingsOwnerSource).not.toContain('quickSetupCommand()');
- expect(nodeModalSettingsOwnerSource).not.toContain(
- 'Paste the setup token shown below when prompted.',
- );
- expect(nodeModalSettingsOwnerSource).not.toContain('setQuickSetupToken(');
- });
-
- it('keeps proxmox setup/install guidance on the monitored-system model instead of reviving agent-era limit copy', () => {
- expect(nodeModalStateSource).toContain(
- 'API-managed PVE/PBS/PMG connections are governed when the connection is',
- );
- expect(nodeModalStateSource).toContain('const hostLimitReached = createMemo(() => false);');
- expect(nodeModalStateSource).toContain('canStartCommercialTrial');
- expect(nodeModalStateSource).not.toContain('subscription_state');
- expect(nodeModalStateSource).not.toContain('trial_eligible');
- expect(nodeModalStateSource).toContain('monitored-system limit banner.');
- expect(nodeModalSettingsOwnerSource).not.toContain('Under agents-only counting');
- expect(nodeModalSettingsOwnerSource).not.toContain('the agent limit');
- });
-});
diff --git a/frontend-modern/src/components/Settings/__tests__/NodeModal.installCommand.test.tsx b/frontend-modern/src/components/Settings/__tests__/NodeModal.installCommand.test.tsx
deleted file mode 100644
index c9eae122e0..0000000000
--- a/frontend-modern/src/components/Settings/__tests__/NodeModal.installCommand.test.tsx
+++ /dev/null
@@ -1,115 +0,0 @@
-import type { JSX } from 'solid-js';
-import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { render, screen, fireEvent, waitFor } from '@solidjs/testing-library';
-import { NodeModal } from '../NodeModal';
-
-const { getAgentInstallCommandMock, copyToClipboardMock, successMock, errorMock } = vi.hoisted(
- () => ({
- getAgentInstallCommandMock: vi.fn(),
- copyToClipboardMock: vi.fn(),
- successMock: vi.fn(),
- errorMock: vi.fn(),
- }),
-);
-
-vi.mock('@/api/nodes', async () => {
- const actual = await vi.importActual<typeof import('@/api/nodes')>('@/api/nodes');
- return {
- ...actual,
- NodesAPI: {
- ...actual.NodesAPI,
- getAgentInstallCommand: getAgentInstallCommandMock,
- },
- };
-});
-
-vi.mock('@/utils/clipboard', () => ({
- copyToClipboard: copyToClipboardMock,
-}));
-
-vi.mock('@/stores/notifications', () => ({
- notificationStore: {
- success: successMock,
- error: errorMock,
- },
-}));
-
-vi.mock('@/components/shared/Dialog', () => ({
- Dialog: (props: { isOpen: boolean; children: JSX.Element }) =>
- props.isOpen ? <div>{props.children}</div> : null,
-}));
-
-vi.mock('@/stores/licenseCommercial', () => ({
- canStartCommercialTrial: () => false,
- startProTrial: vi.fn(),
-}));
-
-const renderNodeModal = (nodeType: 'pve' | 'pbs') =>
- render(() => (
- <NodeModal
- isOpen
- nodeType={nodeType}
- onClose={vi.fn()}
- onSave={vi.fn()}
- />
- ));
-
-describe('NodeModal proxmox agent install command', () => {
- beforeEach(() => {
- vi.clearAllMocks();
- });
-
- it('surfaces canonical install-command validation errors for PVE agent setup', async () => {
- getAgentInstallCommandMock.mockRejectedValueOnce(new Error('Invalid agent install command response'));
-
- renderNodeModal('pve');
-
- fireEvent.click(screen.getByTitle('Copy command'));
-
- await waitFor(() => {
- expect(getAgentInstallCommandMock).toHaveBeenCalledWith({
- type: 'pve',
- enableProxmox: true,
- });
- expect(screen.getByText('Invalid agent install command response')).toBeInTheDocument();
- });
-
- expect(errorMock).toHaveBeenCalledWith('Invalid agent install command response');
- });
-
- it('surfaces canonical install-command validation errors for PBS agent setup', async () => {
- getAgentInstallCommandMock.mockRejectedValueOnce(new Error('Invalid agent install command response'));
-
- renderNodeModal('pbs');
-
- fireEvent.click(screen.getByTitle('Copy to clipboard'));
-
- await waitFor(() => {
- expect(getAgentInstallCommandMock).toHaveBeenCalledWith({
- type: 'pbs',
- enableProxmox: true,
- });
- expect(screen.getByText('Invalid agent install command response')).toBeInTheDocument();
- });
-
- expect(errorMock).toHaveBeenCalledWith('Invalid agent install command response');
- });
-
- it('shows a concrete copy failure for Proxmox agent setup', async () => {
- getAgentInstallCommandMock.mockResolvedValueOnce({
- command: 'curl -fsSL https://pulse.example/install.sh | bash',
- });
- copyToClipboardMock.mockResolvedValueOnce(false);
-
- renderNodeModal('pve');
-
- fireEvent.click(screen.getByTitle('Copy command'));
-
- await waitFor(() => {
- expect(screen.getByText('Failed to copy to clipboard')).toBeInTheDocument();
- });
-
- expect(errorMock).toHaveBeenCalledWith('Failed to copy to clipboard');
- expect(successMock).not.toHaveBeenCalled();
- });
-});
diff --git a/frontend-modern/src/components/Settings/__tests__/PlatformConnectionsWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/PlatformConnectionsWorkspace.test.tsx
deleted file mode 100644
index 16ed25670d..0000000000
--- a/frontend-modern/src/components/Settings/__tests__/PlatformConnectionsWorkspace.test.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { PlatformConnectionsWorkspace } from '../PlatformConnectionsWorkspace';
-
-let mockPathname = '/settings/infrastructure/platforms/proxmox';
-const navigateSpy = vi.hoisted(() => vi.fn());
-const trueNASStateSpy = vi.hoisted(() => vi.fn());
-const vmwareStateSpy = vi.hoisted(() => vi.fn());
-
-vi.mock('@solidjs/router', async () => {
- const actual = await vi.importActual<typeof import('@solidjs/router')>('@solidjs/router');
- return {
- ...actual,
- useLocation: () => ({ pathname: mockPathname }),
- useNavigate: () => navigateSpy,
- };
-});
-
-vi.mock('../ProxmoxSettingsPanel', () => ({
- ProxmoxSettingsPanel: () => <div data-testid="proxmox-settings">proxmox</div>,
-}));
-
-vi.mock('../TrueNASSettingsPanel', () => ({
- TrueNASSettingsPanel: (props: { state: unknown }) => {
- trueNASStateSpy(props.state);
- return <div data-testid="truenas-settings">truenas</div>;
- },
-}));
-
-vi.mock('../VMwareSettingsPanel', () => ({
- VMwareSettingsPanel: (props: { state: unknown }) => {
- vmwareStateSpy(props.state);
- return <div data-testid="vmware-settings">vmware</div>;
- },
-}));
-
-describe('PlatformConnectionsWorkspace', () => {
- beforeEach(() => {
- navigateSpy.mockReset();
- trueNASStateSpy.mockReset();
- vmwareStateSpy.mockReset();
- mockPathname = '/settings/infrastructure/platforms/proxmox';
- });
-
- afterEach(() => {
- cleanup();
- });
-
- const renderWorkspace = () =>
- render(
- () =>
- (
- <PlatformConnectionsWorkspace
- {...({
- pveNodes: () => [],
- pbsNodes: () => [],
- pmgNodes: () => [],
- trueNASSettings: { connections: () => [], featureDisabled: () => false },
- vmwareSettings: { connections: () => [], featureDisabled: () => false },
- } as any)}
- />
- ) as any,
- );
-
- it('renders the Proxmox workspace by default', () => {
- renderWorkspace();
-
- expect(screen.getByRole('tab', { name: 'Proxmox' })).toHaveAttribute('aria-selected', 'true');
- expect(screen.getByRole('tab', { name: 'TrueNAS' })).toHaveAttribute('aria-selected', 'false');
- expect(screen.getByRole('tab', { name: 'VMware' })).toHaveAttribute('aria-selected', 'false');
- expect(screen.getByTestId('proxmox-settings')).toBeInTheDocument();
- });
-
- it('navigates to the canonical TrueNAS route from the shared subtabs', () => {
- renderWorkspace();
-
- fireEvent.click(screen.getByRole('tab', { name: 'TrueNAS' }));
-
- expect(navigateSpy).toHaveBeenCalledWith('/settings/infrastructure/platforms/truenas');
- });
-
- it('navigates to the canonical VMware route from the shared subtabs', () => {
- renderWorkspace();
-
- fireEvent.click(screen.getByRole('tab', { name: 'VMware' }));
-
- expect(navigateSpy).toHaveBeenCalledWith('/settings/infrastructure/platforms/vmware');
- });
-
- it('treats legacy TrueNAS routes as the TrueNAS workspace', () => {
- mockPathname = '/settings/infrastructure/truenas';
- renderWorkspace();
-
- expect(screen.getByRole('tab', { name: 'TrueNAS' })).toHaveAttribute('aria-selected', 'true');
- expect(screen.getByTestId('truenas-settings')).toBeInTheDocument();
- expect(trueNASStateSpy).toHaveBeenCalledWith(
- expect.objectContaining({
- connections: expect.any(Function),
- featureDisabled: expect.any(Function),
- }),
- );
- });
-
- it('treats the canonical VMware route as the VMware workspace', () => {
- mockPathname = '/settings/infrastructure/platforms/vmware';
- renderWorkspace();
-
- expect(screen.getByRole('tab', { name: 'VMware' })).toHaveAttribute('aria-selected', 'true');
- expect(screen.getByTestId('vmware-settings')).toBeInTheDocument();
- expect(vmwareStateSpy).toHaveBeenCalledWith(
- expect.objectContaining({
- connections: expect.any(Function),
- featureDisabled: expect.any(Function),
- }),
- );
- });
-});
diff --git a/frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx
deleted file mode 100644
index 67d4001bdd..0000000000
--- a/frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx
+++ /dev/null
@@ -1,279 +0,0 @@
-import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { MonitoredSystemLedgerPreviewResponse } from '@/api/monitoredSystemLedger';
-import type { TrueNASConnection } from '@/api/truenas';
-import { TrueNASSettingsPanel } from '../TrueNASSettingsPanel';
-import type { TrueNASSettingsPanelState } from '../useTrueNASSettingsPanelState';
-
-const mockState = vi.hoisted(() => ({
- closeDeleteDialog: vi.fn(),
- closeDialog: vi.fn(),
- connections: vi.fn<() => TrueNASConnection[]>(() => []),
- deleteDialogOpen: vi.fn(() => false),
- deletePendingConnection: vi.fn(),
- deleting: vi.fn(() => false),
- dialogOpen: vi.fn(() => false),
- editingConnection: vi.fn<() => TrueNASConnection | null>(() => null),
- featureDisabled: vi.fn(() => false),
- featureDisabledMessage: vi.fn(() => ''),
- form: vi.fn(() => ({
- name: '',
- host: '',
- port: '',
- pollIntervalSeconds: '60',
- authMode: 'apiKey' as const,
- apiKey: '',
- username: '',
- password: '',
- useHttps: true,
- insecureSkipVerify: false,
- fingerprint: '',
- enabled: true,
- hasStoredApiKey: false,
- hasStoredPassword: false,
- })),
- loadConnections: vi.fn(),
- loading: vi.fn(() => false),
- loadingError: vi.fn(() => null),
- openCreateDialog: vi.fn(),
- openDeleteDialog: vi.fn(),
- openEditDialog: vi.fn(),
- pendingDeleteConnection: vi.fn<() => TrueNASConnection | null>(() => null),
- monitoredSystemPreview: vi.fn<() => MonitoredSystemLedgerPreviewResponse | null>(() => null),
- monitoredSystemPreviewError: vi.fn<() => string | null>(() => null),
- monitoredSystemPreviewErrorTitle: vi.fn<() => string | null>(() => null),
- monitoredSystemAdmissionSaveBlocked: vi.fn(() => true),
- previewCurrentForm: vi.fn(),
- previewing: vi.fn(() => false),
- saveCurrentForm: vi.fn(),
- saving: vi.fn(() => false),
- testCurrentForm: vi.fn(),
- testSavedConnection: vi.fn(),
- testing: vi.fn(() => false),
- updateForm: vi.fn(),
-}));
-
-describe('TrueNASSettingsPanel', () => {
- beforeEach(() => {
- Object.values(mockState).forEach((value) => {
- if (typeof value === 'function' && 'mockReset' in value) {
- value.mockReset();
- }
- });
- mockState.connections.mockReturnValue([]);
- mockState.deleteDialogOpen.mockReturnValue(false);
- mockState.deleting.mockReturnValue(false);
- mockState.dialogOpen.mockReturnValue(false);
- mockState.editingConnection.mockReturnValue(null);
- mockState.featureDisabled.mockReturnValue(false);
- mockState.featureDisabledMessage.mockReturnValue('');
- mockState.form.mockReturnValue({
- name: '',
- host: '',
- port: '',
- pollIntervalSeconds: '60',
- authMode: 'apiKey',
- apiKey: '',
- username: '',
- password: '',
- useHttps: true,
- insecureSkipVerify: false,
- fingerprint: '',
- enabled: true,
- hasStoredApiKey: false,
- hasStoredPassword: false,
- });
- mockState.loading.mockReturnValue(false);
- mockState.loadingError.mockReturnValue(null);
- mockState.pendingDeleteConnection.mockReturnValue(null);
- mockState.monitoredSystemPreview.mockReturnValue(null);
- mockState.monitoredSystemPreviewError.mockReturnValue(null);
- mockState.monitoredSystemPreviewErrorTitle.mockReturnValue(null);
- mockState.monitoredSystemAdmissionSaveBlocked.mockReturnValue(true);
- mockState.previewing.mockReturnValue(false);
- mockState.saving.mockReturnValue(false);
- mockState.testing.mockReturnValue(false);
- });
-
- afterEach(() => {
- cleanup();
- });
-
- const renderPanel = () =>
- render(() => (
- <TrueNASSettingsPanel state={mockState as unknown as TrueNASSettingsPanelState} />
- ));
-
- it('renders the settings shell and existing connections', () => {
- mockState.connections.mockReturnValue([
- {
- id: 'conn-1',
- name: 'tower',
- host: 'truenas.local',
- port: 443,
- apiKey: '********',
- pollIntervalSeconds: 60,
- useHttps: true,
- insecureSkipVerify: false,
- enabled: true,
- monitorDatasets: true,
- monitorPools: true,
- monitorReplication: true,
- poll: {
- intervalSeconds: 60,
- lastSuccessAt: new Date(Date.now() - 60_000).toISOString(),
- },
- observed: {
- host: 'tower',
- resourceId: 'tower',
- collectedAt: new Date(Date.now() - 60_000).toISOString(),
- systems: 1,
- storagePools: 2,
- datasets: 12,
- apps: 4,
- disks: 8,
- recoveryArtifacts: 18,
- },
- },
- {
- id: 'conn-2',
- name: 'vault',
- host: 'vault.local',
- username: 'admin',
- useHttps: true,
- insecureSkipVerify: false,
- enabled: false,
- pollIntervalSeconds: 300,
- monitorDatasets: true,
- monitorPools: true,
- monitorReplication: true,
- },
- ]);
-
- renderPanel();
-
- expect(screen.getByText('TrueNAS platform integration')).toBeInTheDocument();
- expect(screen.getByText('TrueNAS connections')).toBeInTheDocument();
- expect(screen.getByText('tower')).toBeInTheDocument();
- expect(screen.getByText('API key auth')).toBeInTheDocument();
- expect(screen.getByText('Healthy')).toBeInTheDocument();
- expect(screen.getByText('Paused')).toBeInTheDocument();
- expect(screen.getByText('Poll every 1 minute')).toBeInTheDocument();
- expect(screen.getByText('Poll every 5 minutes')).toBeInTheDocument();
- expect(screen.getByRole('link', { name: 'Infrastructure' })).toHaveAttribute(
- 'href',
- '/infrastructure?source=truenas&resource=tower',
- );
- expect(screen.getByRole('link', { name: 'Workloads' })).toHaveAttribute(
- 'href',
- '/workloads?type=app-container&platform=truenas&agent=tower',
- );
- expect(screen.getByRole('link', { name: 'Storage' })).toHaveAttribute(
- 'href',
- '/storage?source=truenas&node=tower',
- );
- expect(screen.getByRole('link', { name: 'Recovery' })).toHaveAttribute(
- 'href',
- '/recovery?platform=truenas&node=tower',
- );
- expect(screen.getByRole('button', { name: 'Add TrueNAS connection' })).toBeInTheDocument();
- fireEvent.click(screen.getByRole('button', { name: 'Add TrueNAS connection' }));
- expect(mockState.openCreateDialog).toHaveBeenCalledTimes(1);
-
- fireEvent.click(
- within(screen.getByTestId('truenas-connection-conn-1')).getByRole('button', { name: 'Test' }),
- );
- expect(mockState.testSavedConnection).toHaveBeenCalledWith(
- expect.objectContaining({ id: 'conn-1' }),
- );
- });
-
- it('shows the feature gate warning when the backend path is disabled', () => {
- mockState.featureDisabled.mockReturnValue(true);
- mockState.featureDisabledMessage.mockReturnValue(
- 'TrueNAS integration has been explicitly disabled',
- );
-
- renderPanel();
-
- expect(screen.getByText('TrueNAS integration is disabled')).toBeInTheDocument();
- expect(
- screen.getByText('TrueNAS integration has been explicitly disabled'),
- ).toBeInTheDocument();
- expect(screen.getByText(/PULSE_ENABLE_TRUENAS=false/)).toBeInTheDocument();
- expect(screen.queryByText('TrueNAS connections')).not.toBeInTheDocument();
- });
-
- it('renders preview-required guidance and blocks save before safe capacity is known', () => {
- mockState.dialogOpen.mockReturnValue(true);
-
- renderPanel();
-
- expect(screen.getByText('Preview monitored-system impact before saving')).toBeInTheDocument();
- expect(
- screen.getByText(
- 'Pulse must verify monitored-system capacity for this platform connection before it can be saved.',
- ),
- ).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add connection' })).toBeDisabled();
- });
-
- it('renders monitored-system preview inside the dialog and blocks save over the limit', () => {
- mockState.dialogOpen.mockReturnValue(true);
- mockState.monitoredSystemPreview.mockReturnValue({
- current_count: 9,
- projected_count: 11,
- additional_count: 2,
- limit: 10,
- would_exceed_limit: true,
- effect: 'splits_existing',
- current_systems: [],
- projected_systems: [
- {
- name: 'tower',
- type: 'truenas-system',
- status: 'online',
- source: 'truenas',
- status_explanation: { summary: '', reasons: [] },
- latest_included_signal: { name: '', type: '', at: '' },
- explanation: { summary: '', reasons: [], surfaces: [] },
- },
- ],
- current_system: null,
- projected_system: null,
- });
- mockState.monitoredSystemAdmissionSaveBlocked.mockReturnValue(true);
-
- renderPanel();
-
- expect(screen.getByText('This change exceeds your monitored-system limit')).toBeInTheDocument();
- expect(screen.getByText(/Current usage 9 \/ 10/)).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add connection' })).toBeDisabled();
-
- fireEvent.click(screen.getByRole('button', { name: 'Preview impact' }));
- expect(mockState.previewCurrentForm).toHaveBeenCalledTimes(1);
- });
-
- it('renders canonical unavailable guidance and blocks save while preview usage is unsettled', () => {
- mockState.dialogOpen.mockReturnValue(true);
- mockState.monitoredSystemPreviewErrorTitle.mockReturnValue(
- 'Monitored-system capacity is temporarily unavailable',
- );
- mockState.monitoredSystemPreviewError.mockReturnValue(
- 'Pulse is still settling provider-owned inventory for this platform connection, so the monitored-system check is not safe yet. Retry preview after the first baseline finishes.',
- );
- mockState.monitoredSystemAdmissionSaveBlocked.mockReturnValue(true);
-
- renderPanel();
-
- expect(
- screen.getByText('Monitored-system capacity is temporarily unavailable'),
- ).toBeInTheDocument();
- expect(
- screen.getByText(
- 'Pulse is still settling provider-owned inventory for this platform connection, so the monitored-system check is not safe yet. Retry preview after the first baseline finishes.',
- ),
- ).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add connection' })).toBeDisabled();
- });
-});
diff --git a/frontend-modern/src/components/Settings/__tests__/VMwareSettingsPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/VMwareSettingsPanel.test.tsx
deleted file mode 100644
index 0bc14fedf0..0000000000
--- a/frontend-modern/src/components/Settings/__tests__/VMwareSettingsPanel.test.tsx
+++ /dev/null
@@ -1,337 +0,0 @@
-import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { MonitoredSystemLedgerPreviewResponse } from '@/api/monitoredSystemLedger';
-import type { VMwareConnection } from '@/api/vmware';
-import { VMwareSettingsPanel } from '../VMwareSettingsPanel';
-import type { VMwareSettingsPanelState } from '../useVMwareSettingsPanelState';
-import type { VMwareConnectionFailurePresentation } from '../vmwareConnectionFailurePresentation';
-
-const mockState = vi.hoisted(() => ({
- closeDeleteDialog: vi.fn(),
- closeDialog: vi.fn(),
- connectionFailure: vi.fn<() => VMwareConnectionFailurePresentation | null>(() => null),
- connections: vi.fn((): VMwareConnection[] => []),
- deleteDialogOpen: vi.fn(() => false),
- deletePendingConnection: vi.fn(),
- deleting: vi.fn(() => false),
- dialogOpen: vi.fn(() => false),
- editingConnection: vi.fn((): VMwareConnection | null => null),
- featureDisabled: vi.fn(() => false),
- featureDisabledMessage: vi.fn(() => ''),
- form: vi.fn(() => ({
- name: '',
- host: '',
- port: '443',
- username: '',
- password: '',
- insecureSkipVerify: false,
- enabled: true,
- hasStoredPassword: false,
- })),
- loadConnections: vi.fn(),
- loading: vi.fn(() => false),
- loadingError: vi.fn(() => null),
- openCreateDialog: vi.fn(),
- openDeleteDialog: vi.fn(),
- openEditDialog: vi.fn(),
- pendingDeleteConnection: vi.fn((): VMwareConnection | null => null),
- monitoredSystemPreview: vi.fn<() => MonitoredSystemLedgerPreviewResponse | null>(() => null),
- monitoredSystemPreviewError: vi.fn<() => string | null>(() => null),
- monitoredSystemPreviewErrorTitle: vi.fn<() => string | null>(() => null),
- monitoredSystemAdmissionSaveBlocked: vi.fn(() => true),
- previewCurrentForm: vi.fn(),
- previewing: vi.fn(() => false),
- saveCurrentForm: vi.fn(),
- saving: vi.fn(() => false),
- testCurrentForm: vi.fn(),
- testSavedConnection: vi.fn(),
- testing: vi.fn(() => false),
- updateForm: vi.fn(),
-}));
-
-describe('VMwareSettingsPanel', () => {
- beforeEach(() => {
- Object.values(mockState).forEach((value) => {
- if (typeof value === 'function' && 'mockReset' in value) {
- value.mockReset();
- }
- });
- mockState.connections.mockReturnValue([]);
- mockState.connectionFailure.mockReturnValue(null);
- mockState.deleteDialogOpen.mockReturnValue(false);
- mockState.deleting.mockReturnValue(false);
- mockState.dialogOpen.mockReturnValue(false);
- mockState.editingConnection.mockReturnValue(null);
- mockState.featureDisabled.mockReturnValue(false);
- mockState.featureDisabledMessage.mockReturnValue('');
- mockState.form.mockReturnValue({
- name: '',
- host: '',
- port: '443',
- username: '',
- password: '',
- insecureSkipVerify: false,
- enabled: true,
- hasStoredPassword: false,
- });
- mockState.loading.mockReturnValue(false);
- mockState.loadingError.mockReturnValue(null);
- mockState.pendingDeleteConnection.mockReturnValue(null);
- mockState.monitoredSystemPreview.mockReturnValue(null);
- mockState.monitoredSystemPreviewError.mockReturnValue(null);
- mockState.monitoredSystemPreviewErrorTitle.mockReturnValue(null);
- mockState.monitoredSystemAdmissionSaveBlocked.mockReturnValue(true);
- mockState.previewing.mockReturnValue(false);
- mockState.saving.mockReturnValue(false);
- mockState.testing.mockReturnValue(false);
- });
-
- afterEach(() => {
- cleanup();
- });
-
- const renderPanel = () =>
- render(() => <VMwareSettingsPanel state={mockState as unknown as VMwareSettingsPanelState} />);
-
- it('renders the settings shell and existing connections', () => {
- mockState.connections.mockReturnValue([
- {
- id: 'conn-1',
- name: 'lab-vcenter',
- host: 'vcsa.lab.local',
- port: 443,
- username: '[email protected]',
- password: '********',
- insecureSkipVerify: false,
- enabled: true,
- monitorVms: true,
- monitorHosts: true,
- monitorDatastores: true,
- poll: {
- lastSuccessAt: new Date(Date.now() - 60_000).toISOString(),
- },
- observed: {
- collectedAt: new Date(Date.now() - 60_000).toISOString(),
- hosts: 3,
- vms: 42,
- datastores: 6,
- viRelease: '8.0.3',
- },
- },
- {
- id: 'conn-2',
- name: 'staging-vcenter',
- host: 'staging.lab.local',
- username: '[email protected]',
- insecureSkipVerify: true,
- enabled: true,
- monitorVms: true,
- monitorHosts: true,
- monitorDatastores: true,
- poll: {
- lastAttemptAt: new Date(Date.now() - 30_000).toISOString(),
- lastError: {
- at: new Date(Date.now() - 30_000).toISOString(),
- category: 'auth',
- message: 'VMware authentication failed while creating the VI JSON API session',
- },
- },
- },
- {
- id: 'conn-3',
- name: 'partial-vcenter',
- host: 'partial.lab.local',
- username: '[email protected]',
- insecureSkipVerify: false,
- enabled: true,
- monitorVms: true,
- monitorHosts: true,
- monitorDatastores: true,
- poll: {
- lastSuccessAt: new Date(Date.now() - 120_000).toISOString(),
- },
- observed: {
- collectedAt: new Date(Date.now() - 120_000).toISOString(),
- hosts: 2,
- vms: 18,
- datastores: 4,
- viRelease: '8.0.3',
- degraded: true,
- issueCount: 3,
- issues: [
- {
- stage: 'signals',
- category: 'permission',
- message: 'VMware permissions are insufficient for host overall status',
- occurrences: 2,
- },
- ],
- },
- },
- ]);
-
- renderPanel();
-
- expect(screen.getByText('VMware vSphere platform integration')).toBeInTheDocument();
- expect(screen.getByText('VMware connections')).toBeInTheDocument();
- expect(screen.getByText('lab-vcenter')).toBeInTheDocument();
- expect(screen.getByText('Healthy')).toBeInTheDocument();
- expect(screen.getByText('staging-vcenter')).toBeInTheDocument();
- expect(screen.getByText('Runtime failing')).toBeInTheDocument();
- expect(screen.getByText('Authentication failed')).toBeInTheDocument();
- expect(
- screen.getByText('VMware authentication failed while creating the VI JSON API session'),
- ).toBeInTheDocument();
- expect(
- screen.getByText(
- 'Verify the username, password, and account scope in vCenter before retrying.',
- ),
- ).toBeInTheDocument();
- expect(screen.getByText('partial-vcenter')).toBeInTheDocument();
- expect(screen.getByText('Degraded')).toBeInTheDocument();
- expect(screen.getByText('3 hosts')).toBeInTheDocument();
- expect(screen.getByText('42 vms')).toBeInTheDocument();
- expect(screen.getByText('6 datastores')).toBeInTheDocument();
- expect(
- within(screen.getByTestId('vmware-connection-conn-1')).getByText('VI JSON 8.0.3'),
- ).toBeInTheDocument();
- expect(
- within(screen.getByTestId('vmware-connection-conn-3')).getByText('3 degraded reads'),
- ).toBeInTheDocument();
- expect(
- within(screen.getByTestId('vmware-connection-conn-3')).getByText(
- /VMware permissions are insufficient for host overall status/,
- ),
- ).toBeInTheDocument();
- expect(screen.getByText('Permissions are insufficient')).toBeInTheDocument();
- expect(
- screen.getByText(
- 'Grant the minimum VMware read privileges required for phase-1 inventory and health reads, then retry.',
- ),
- ).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add VMware connection' })).toBeInTheDocument();
-
- fireEvent.click(screen.getByRole('button', { name: 'Add VMware connection' }));
- expect(mockState.openCreateDialog).toHaveBeenCalledTimes(1);
-
- fireEvent.click(
- within(screen.getByTestId('vmware-connection-conn-1')).getByRole('button', { name: 'Test' }),
- );
- expect(mockState.testSavedConnection).toHaveBeenCalledWith(
- expect.objectContaining({ id: 'conn-1' }),
- );
- });
-
- it('shows the feature gate warning when the backend path is disabled', () => {
- mockState.featureDisabled.mockReturnValue(true);
- mockState.featureDisabledMessage.mockReturnValue(
- 'VMware integration has been explicitly disabled',
- );
-
- renderPanel();
-
- expect(screen.getByText('VMware integration is disabled')).toBeInTheDocument();
- expect(screen.getByText('VMware integration has been explicitly disabled')).toBeInTheDocument();
- expect(screen.getByText(/PULSE_ENABLE_VMWARE=false/)).toBeInTheDocument();
- expect(screen.queryByText('VMware connections')).not.toBeInTheDocument();
- });
-
- it('renders categorized draft test guidance inside the connection dialog', () => {
- mockState.dialogOpen.mockReturnValue(true);
- mockState.connectionFailure.mockReturnValue({
- title: 'Unsupported vCenter version',
- message: 'VMware vCenter 6.7 is below the supported VI JSON release floor',
- guidance:
- 'Use a supported vCenter release within the current VI JSON phase-1 floor, then retry this connection test.',
- tone: 'warning',
- category: 'unsupported_version',
- code: 'vmware_connection_failed',
- });
-
- renderPanel();
-
- expect(screen.getByTestId('vmware-connection-test-feedback')).toBeInTheDocument();
- expect(screen.getByText('Unsupported vCenter version')).toBeInTheDocument();
- expect(
- screen.getByText('VMware vCenter 6.7 is below the supported VI JSON release floor'),
- ).toBeInTheDocument();
- expect(
- screen.getByText(
- 'Use a supported vCenter release within the current VI JSON phase-1 floor, then retry this connection test.',
- ),
- ).toBeInTheDocument();
- });
-
- it('renders preview-required guidance and blocks save before safe capacity is known', () => {
- mockState.dialogOpen.mockReturnValue(true);
-
- renderPanel();
-
- expect(screen.getByText('Preview monitored-system impact before saving')).toBeInTheDocument();
- expect(
- screen.getByText(
- 'Pulse must verify monitored-system capacity for this platform connection before it can be saved.',
- ),
- ).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add connection' })).toBeDisabled();
- });
-
- it('renders monitored-system preview inside the dialog and blocks save over the limit', () => {
- mockState.dialogOpen.mockReturnValue(true);
- mockState.monitoredSystemPreview.mockReturnValue({
- current_count: 5,
- projected_count: 7,
- additional_count: 2,
- limit: 6,
- would_exceed_limit: true,
- effect: 'creates_multiple',
- current_systems: [],
- projected_systems: [
- {
- name: 'esxi-01',
- type: 'host',
- status: 'online',
- source: 'vmware',
- status_explanation: { summary: '', reasons: [] },
- latest_included_signal: { name: '', type: '', at: '' },
- explanation: { summary: '', reasons: [], surfaces: [] },
- },
- ],
- current_system: null,
- projected_system: null,
- });
- mockState.monitoredSystemAdmissionSaveBlocked.mockReturnValue(true);
-
- renderPanel();
-
- expect(screen.getByText('This change exceeds your monitored-system limit')).toBeInTheDocument();
- expect(screen.getByText(/Current usage 5 \/ 6/)).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add connection' })).toBeDisabled();
-
- fireEvent.click(screen.getByRole('button', { name: 'Preview impact' }));
- expect(mockState.previewCurrentForm).toHaveBeenCalledTimes(1);
- });
-
- it('renders canonical unavailable guidance and blocks save while preview usage is rebuilding', () => {
- mockState.dialogOpen.mockReturnValue(true);
- mockState.monitoredSystemPreviewErrorTitle.mockReturnValue(
- 'Monitored-system capacity is temporarily unavailable',
- );
- mockState.monitoredSystemPreviewError.mockReturnValue(
- 'Pulse has settled provider-owned inventory and is rebuilding the canonical monitored-system view, so this connection cannot be saved yet. Retry preview in a moment.',
- );
- mockState.monitoredSystemAdmissionSaveBlocked.mockReturnValue(true);
-
- renderPanel();
-
- expect(
- screen.getByText('Monitored-system capacity is temporarily unavailable'),
- ).toBeInTheDocument();
- expect(
- screen.getByText(
- 'Pulse has settled provider-owned inventory and is rebuilding the canonical monitored-system view, so this connection cannot be saved yet. Retry preview in a moment.',
- ),
- ).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Add connection' })).toBeDisabled();
- });
-});
diff --git a/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts b/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts
deleted file mode 100644
index 9dc056ce77..0000000000
--- a/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts
+++ /dev/null
@@ -1,127 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import type { UnifiedAgentRow } from '../infrastructureOperationsModel';
-import { buildInfrastructureSystemRows } from '../connectionsTableModel';
-
-const activeRow = (overrides: Partial<UnifiedAgentRow> = {}): UnifiedAgentRow =>
- ({
- rowKey: 'agent:tower',
- id: 'tower',
- name: 'tower',
- hostname: 'tower.local',
- capabilities: ['agent'],
- status: 'active',
- healthStatus: 'online',
- lastSeen: Date.now(),
- upgradePlatform: 'linux',
- scope: { label: 'Default', category: 'default' },
- installFlags: [],
- searchText: 'tower tower.local',
- surfaces: [
- {
- key: 'agent',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'Host telemetry',
- action: 'stop-monitoring',
- controlId: 'tower',
- },
- ],
- ...overrides,
- }) as UnifiedAgentRow;
-
-const ignoredRow = (overrides: Partial<UnifiedAgentRow> = {}): UnifiedAgentRow =>
- ({
- ...activeRow(),
- rowKey: 'removed:tower',
- status: 'removed',
- removedAt: Date.now(),
- surfaces: [
- {
- key: 'agent',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'Host telemetry',
- action: 'allow-reconnect',
- controlId: 'tower',
- },
- ],
- ...overrides,
- }) as UnifiedAgentRow;
-
-describe('connectionsTableModel', () => {
- it('builds one alpha-sorted row per monitored top-level system', () => {
- const rows = buildInfrastructureSystemRows({
- activeRows: [activeRow({ name: 'tower' })],
- monitoringStoppedRows: [ignoredRow({ name: 'archive' })],
- });
-
- expect(rows.map((row) => row.name)).toEqual(['archive', 'tower']);
- expect(rows.find((row) => row.name === 'archive')).toMatchObject({
- subtitle: 'Ignored by Pulse',
- manageLabel: 'Review ignored',
- });
- expect(rows.find((row) => row.name === 'tower')).toMatchObject({
- subtitle: undefined,
- manageLabel: 'View details',
- });
- });
-
- it('keeps platform-collected systems as system rows instead of separate connection rows', () => {
- const rows = buildInfrastructureSystemRows({
- activeRows: [
- activeRow({
- name: 'tower',
- capabilities: ['truenas'],
- surfaces: [
- {
- key: 'truenas',
- kind: 'truenas',
- label: 'TrueNAS data',
- detail: 'TrueNAS data',
- idValue: '10.0.0.20',
- },
- ],
- }),
- ],
- monitoringStoppedRows: [],
- });
-
- expect(rows).toHaveLength(1);
- expect(rows[0].name).toBe('tower');
- expect(rows[0].collectionLabel).toBe('API');
- expect(rows[0].coverageLabels).toEqual(['TrueNAS data']);
- });
-
- it('keeps guest-linked agents out of the top-level infrastructure ledger', () => {
- const rows = buildInfrastructureSystemRows({
- activeRows: [
- activeRow({ name: 'tower' }),
- activeRow({
- rowKey: 'agent:guest-101',
- id: 'guest-101',
- name: 'debian-go',
- linkedVmId: '101',
- }),
- ],
- monitoringStoppedRows: [
- ignoredRow({
- rowKey: 'removed:guest-102',
- id: 'guest-102',
- name: 'archive-guest',
- linkedContainerId: '102',
- }),
- ],
- });
-
- expect(rows.map((row) => row.name)).toEqual(['tower']);
- });
-
- it('returns no rows when nothing is being monitored yet', () => {
- expect(
- buildInfrastructureSystemRows({
- activeRows: [],
- monitoringStoppedRows: [],
- }),
- ).toEqual([]);
- });
-});
diff --git a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts
deleted file mode 100644
index 8ed179579a..0000000000
--- a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts
+++ /dev/null
@@ -1,1664 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import agentProfilesPanelSource from '../AgentProfilesPanel.tsx?raw';
-import agentProfilesPanelStateSource from '../useAgentProfilesPanelState.ts?raw';
-import apiTokenManagerSource from '../APITokenManager.tsx?raw';
-import apiTokenManagerModelSource from '../apiTokenManagerModel.ts?raw';
-import apiTokenManagerStateSource from '../useAPITokenManagerState.ts?raw';
-import infrastructureActiveRowDetailsSource from '../InfrastructureActiveRowDetails.tsx?raw';
-import infrastructureIgnoredRowDetailsSource from '../InfrastructureIgnoredRowDetails.tsx?raw';
-import infrastructureInstallerSectionSource from '../InfrastructureInstallerSection.tsx?raw';
-import infrastructureInventorySectionSource from '../InfrastructureInventorySection.tsx?raw';
-import infrastructureInstallStateSource from '../useInfrastructureInstallState.tsx?raw';
-import infrastructureOperationsStateSource from '../useInfrastructureOperationsState.tsx?raw';
-import infrastructureReportingStateSource from '../useInfrastructureReportingState.tsx?raw';
-import infrastructureSettingsModelSource from '../infrastructureSettingsModel.ts?raw';
-import infrastructureConfiguredNodesStateSource from '../useInfrastructureConfiguredNodesState.ts?raw';
-import infrastructureDiscoveryRuntimeStateSource from '../useInfrastructureDiscoveryRuntimeState.ts?raw';
-import infrastructureStopMonitoringDialogSource from '../InfrastructureStopMonitoringDialog.tsx?raw';
-import agentLedgerPanelSource from '../MonitoredSystemLedgerPanel.tsx?raw';
-import alertsPageSource from '@/pages/Alerts.tsx?raw';
-import setupCompletionPanelSource from '@/components/SetupWizard/SetupCompletionPanel.tsx?raw';
-import infrastructureSelectorSource from '@/components/shared/InfrastructureSelector.tsx?raw';
-import infrastructureSelectorModelSource from '@/components/shared/infrastructureSelectorModel.ts?raw';
-import aiChatSource from '@/components/AI/Chat/index.tsx?raw';
-import aiChatPresentationSource from '@/utils/aiChatPresentation.ts?raw';
-import diagnosticsPanelSource from '../DiagnosticsPanel.tsx?raw';
-import auditLogPanelSource from '../AuditLogPanel.tsx?raw';
-import auditWebhookPanelSource from '../AuditWebhookPanel.tsx?raw';
-import systemSettingsStateSource from '../useSystemSettingsState.ts?raw';
-import infrastructureSettingsStateSource from '../useInfrastructureSettingsState.ts?raw';
-import infrastructureWorkspaceSource from '../InfrastructureWorkspace.tsx?raw';
-import infrastructureWorkspaceModelSource from '../infrastructureWorkspaceModel.ts?raw';
-import monitoredSystemAdmissionPreviewSource from '../MonitoredSystemAdmissionPreview.tsx?raw';
-import settingsPanelRegistrySource from '../useSettingsPanelRegistry.tsx?raw';
-import settingsSystemPanelsSource from '../useSettingsSystemPanels.tsx?raw';
-import infrastructureSummarySource from '@/components/Infrastructure/InfrastructureSummary.tsx?raw';
-import infrastructureSelectorComponentSource from '@/components/shared/InfrastructureSelector.tsx?raw';
-import infrastructureSelectorStateSource from '@/components/shared/useInfrastructureSelectorState.ts?raw';
-import workloadsLinkSource from '@/components/Infrastructure/workloadsLink.ts?raw';
-import unifiedResourceHostTableCardSource from '@/components/Infrastructure/UnifiedResourceHostTableCard.tsx?raw';
-import unifiedResourceTableSource from '@/components/Infrastructure/UnifiedResourceTable.tsx?raw';
-import thresholdsTableSource from '@/components/Alerts/ThresholdsTable.tsx?raw';
-import thresholdsTableAgentDisksSectionSource from '@/components/Alerts/ThresholdsTableAgentDisksSection.tsx?raw';
-import thresholdsTableAgentsResourcesSectionSource from '@/components/Alerts/ThresholdsTableAgentsResourcesSection.tsx?raw';
-import alertsConfigurationSurfaceSource from '@/features/alerts/AlertsConfigurationSurface.tsx?raw';
-import thresholdsDataHookSource from '@/features/alerts/thresholds/hooks/useThresholdsData.ts?raw';
-import thresholdsHostDataHookSource from '@/features/alerts/thresholds/hooks/useThresholdsHostData.ts?raw';
-import thresholdsTableStateSource from '@/features/alerts/thresholds/hooks/useThresholdsTableState.ts?raw';
-import collapsibleSectionSource from '@/components/Alerts/Thresholds/sections/CollapsibleSection.tsx?raw';
-import alertThresholdsPresentationSource from '@/utils/alertThresholdsPresentation.ts?raw';
-import alertThresholdsSectionPresentationSource from '@/utils/alertThresholdsSectionPresentation.ts?raw';
-import monitoredSystemLedgerApiSource from '@/api/monitoredSystemLedger.ts?raw';
-import monitoredSystemPresentationSource from '@/utils/monitoredSystemPresentation.ts?raw';
-import loginSource from '@/components/Login.tsx?raw';
-import settingsSource from '../Settings.tsx?raw';
-import aiSettingsShellSource from '../AISettings.tsx?raw';
-import aiChatMaintenanceSectionSource from '../AIChatMaintenanceSection.tsx?raw';
-import aiProviderConfigurationSectionSource from '../AIProviderConfigurationSection.tsx?raw';
-import aiSettingsDialogsSource from '../AISettingsDialogs.tsx?raw';
-import aiModelSelectionSectionSource from '../AIModelSelectionSection.tsx?raw';
-import aiSettingsModelSource from '../aiSettingsModel.ts?raw';
-import aiRuntimeControlsSectionSource from '../AIRuntimeControlsSection.tsx?raw';
-import aiSettingsStatusAndActionsSource from '../AISettingsStatusAndActions.tsx?raw';
-import aiSettingsStateSource from '../useAISettingsState.ts?raw';
-import reportingPanelSource from '../ReportingPanel.tsx?raw';
-import reportingCatalogModelSource from '../reportingCatalogModel.ts?raw';
-import reportingPanelModelSource from '../reportingPanelModel.ts?raw';
-import reportingInventoryExportModelSource from '../reportingInventoryExportModel.ts?raw';
-import updatesSettingsPanelSource from '../UpdatesSettingsPanel.tsx?raw';
-import suggestProfileModalSource from '../SuggestProfileModal.tsx?raw';
-import aiIntelligenceSource from '@/pages/AIIntelligence.tsx?raw';
-import patrolIntelligenceBannersSource from '@/features/patrol/PatrolIntelligenceBanners.tsx?raw';
-import patrolIntelligenceHeaderSource from '@/features/patrol/PatrolIntelligenceHeader.tsx?raw';
-import patrolIntelligenceSummarySource from '@/features/patrol/PatrolIntelligenceSummary.tsx?raw';
-import patrolIntelligenceSurfaceSource from '@/features/patrol/PatrolIntelligenceSurface.tsx?raw';
-import patrolIntelligenceStateSource from '@/features/patrol/usePatrolIntelligenceState.ts?raw';
-import patrolIntelligenceWorkspaceSource from '@/features/patrol/PatrolIntelligenceWorkspace.tsx?raw';
-import aiPatrolSchedulePresentationSource from '@/utils/aiPatrolSchedulePresentation.ts?raw';
-import patrolSummaryPresentationSource from '@/utils/patrolSummaryPresentation.ts?raw';
-import aiCostDashboardSource from '@/components/AI/AICostDashboard.tsx?raw';
-import aiCostPresentationSource from '@/utils/aiCostPresentation.ts?raw';
-import aiControlLevelPresentationSource from '@/utils/aiControlLevelPresentation.ts?raw';
-import agentProfilesPresentationSource from '@/utils/agentProfilesPresentation.ts?raw';
-import agentProfileSuggestionPresentationSource from '@/utils/agentProfileSuggestionPresentation.ts?raw';
-import reportingPresentationSource from '@/utils/reportingPresentation.ts?raw';
-import reportingPanelStateSource from '../useReportingPanelState.ts?raw';
-import aiSettingsPresentationSource from '@/utils/aiSettingsPresentation.ts?raw';
-import aiSessionDiffPresentationSource from '@/utils/aiSessionDiffPresentation.ts?raw';
-import settingsShellPresentationSource from '@/utils/settingsShellPresentation.ts?raw';
-import upgradePresentationSource from '@/utils/upgradePresentation.ts?raw';
-import appSource from '@/App.tsx?raw';
-import apiTypesSource from '@/types/api.ts?raw';
-import aiTypesSource from '@/types/ai.ts?raw';
-import resourceTypesSource from '@/types/resource.ts?raw';
-import unifiedResourcesHookSource from '@/hooks/useUnifiedResources.ts?raw';
-import discoveryTypesSource from '@/types/discovery.ts?raw';
-import discoveryTargetUtilsSource from '@/utils/discoveryTarget.ts?raw';
-import mentionAutocompleteSource from '@/components/AI/Chat/MentionAutocomplete.tsx?raw';
-import commandPaletteSource from '@/components/shared/CommandPaletteModal.tsx?raw';
-import organizationAccessPanelSource from '../OrganizationAccessPanel.tsx?raw';
-import organizationAccessLoadingStateSource from '../OrganizationAccessLoadingState.tsx?raw';
-import organizationAccessManagementSectionSource from '../OrganizationAccessManagementSection.tsx?raw';
-import organizationAccessMembersSectionSource from '../OrganizationAccessMembersSection.tsx?raw';
-import organizationOverviewPanelSource from '../OrganizationOverviewPanel.tsx?raw';
-import organizationOverviewLoadingStateSource from '../OrganizationOverviewLoadingState.tsx?raw';
-import organizationOverviewDetailsSectionSource from '../OrganizationOverviewDetailsSection.tsx?raw';
-import organizationOverviewMembersSectionSource from '../OrganizationOverviewMembersSection.tsx?raw';
-import organizationSharingPanelSource from '../OrganizationSharingPanel.tsx?raw';
-import organizationSharingCreateSectionSource from '../OrganizationSharingCreateSection.tsx?raw';
-import organizationSharingLoadingStateSource from '../OrganizationSharingLoadingState.tsx?raw';
-import organizationOutgoingSharesSectionSource from '../OrganizationOutgoingSharesSection.tsx?raw';
-import organizationIncomingSharesSectionSource from '../OrganizationIncomingSharesSection.tsx?raw';
-import organizationAccessStateSource from '../useOrganizationAccessPanelState.ts?raw';
-import organizationOverviewStateSource from '../useOrganizationOverviewPanelState.ts?raw';
-import organizationSharingStateSource from '../useOrganizationSharingPanelState.ts?raw';
-import canonicalResourceTypesSource from '@/utils/canonicalResourceTypes.ts?raw';
-import organizationRolePresentationSource from '@/utils/organizationRolePresentation.ts?raw';
-import organizationSettingsPresentationSource from '@/utils/organizationSettingsPresentation.ts?raw';
-import resourceLinksSource from '@/routing/resourceLinks.ts?raw';
-import alertsApiSource from '@/api/alerts.ts?raw';
-import licenseApiSource from '@/api/license.ts?raw';
-import monitoringApiSource from '@/api/monitoring.ts?raw';
-import chartsApiSource from '@/api/charts.ts?raw';
-import resourceStateAdaptersSource from '@/utils/resourceStateAdapters.ts?raw';
-import resourceDetailMappersSource from '@/components/Infrastructure/resourceDetailMappers.ts?raw';
-import resourceDetailDiscoveryModelSource from '@/components/Infrastructure/resourceDetailDiscoveryModel.ts?raw';
-import resourceBadgesSource from '@/components/Infrastructure/resourceBadges.ts?raw';
-import resourceBadgePresentationSource from '@/utils/resourceBadgePresentation.ts?raw';
-import recoveryComponentSource from '@/components/Recovery/Recovery.tsx?raw';
-import recoveryActivitySectionSource from '@/components/Recovery/RecoveryActivitySection.tsx?raw';
-import recoveryHistorySectionSource from '@/components/Recovery/RecoveryHistorySection.tsx?raw';
-import recoveryHistoryTableSource from '@/components/Recovery/RecoveryHistoryTable.tsx?raw';
-import recoveryProtectedInventorySectionSource from '@/components/Recovery/RecoveryProtectedInventorySection.tsx?raw';
-import recoveryHistorySectionStateSource from '@/components/Recovery/useRecoveryHistorySectionState.ts?raw';
-import recoveryTablePresentationSource from '@/utils/recoveryTablePresentation.ts?raw';
-import problemResourcesTableSource from '@/features/dashboardOverview/ProblemResourcesTable.tsx?raw';
-import workloadTypeBadgesSource from '@/components/shared/workloadTypeBadges.ts?raw';
-import workloadTypePresentationSource from '@/utils/workloadTypePresentation.ts?raw';
-
-const aiSettingsSource = [
- aiSettingsShellSource,
- aiModelSelectionSectionSource,
- aiRuntimeControlsSectionSource,
- aiChatMaintenanceSectionSource,
- aiSettingsStatusAndActionsSource,
- aiProviderConfigurationSectionSource,
- aiSettingsDialogsSource,
- aiSettingsModelSource,
- aiSettingsStateSource,
-].join('\n');
-const infrastructureOperationsSource = [
- infrastructureInstallStateSource,
- infrastructureOperationsStateSource,
- infrastructureReportingStateSource,
- infrastructureInstallerSectionSource,
- infrastructureInventorySectionSource,
- infrastructureActiveRowDetailsSource,
- infrastructureIgnoredRowDetailsSource,
- infrastructureStopMonitoringDialogSource,
-].join('\n');
-import dashboardGuestPresentationSource from '@/utils/dashboardGuestPresentation.ts?raw';
-import containerUpdatesSource from '@/stores/containerUpdates.ts?raw';
-import websocketStoreSource from '@/stores/websocket.ts?raw';
-import guestRowSource from '@/components/Dashboard/GuestRow.tsx?raw';
-import guestRowCellsSource from '@/components/Dashboard/GuestRowCells.tsx?raw';
-import guestRowStateSource from '@/components/Dashboard/useGuestRowState.ts?raw';
-import dashboardDiskListSource from '@/components/Dashboard/DiskList.tsx?raw';
-import dashboardDiskListStateSource from '@/components/Dashboard/useDiskListState.ts?raw';
-import guestDrawerSource from '@/components/Dashboard/GuestDrawer.tsx?raw';
-import resourcePickerSource from '../ResourcePicker.tsx?raw';
-import reportableResourceTypesSource from '@/utils/reportableResourceTypes.ts?raw';
-import sourcePlatformsSource from '@/utils/sourcePlatforms.ts?raw';
-import agentCapabilityPresentationSource from '@/utils/agentCapabilityPresentation.ts?raw';
-import statusUtilsSource from '@/utils/status.ts?raw';
-import unifiedAgentStatusPresentationSource from '@/utils/unifiedAgentStatusPresentation.ts?raw';
-import unifiedAgentInventoryPresentationSource from '@/utils/unifiedAgentInventoryPresentation.ts?raw';
-import relayPresentationSource from '@/utils/relayPresentation.ts?raw';
-import relayPairingSectionSource from '../RelayPairingSection.tsx?raw';
-import relaySettingsPanelSource from '../RelaySettingsPanel.tsx?raw';
-import relaySettingsPanelStateSource from '../useRelaySettingsPanelState.ts?raw';
-import proxmoxDeleteNodeDialogSource from '../ProxmoxDeleteNodeDialog.tsx?raw';
-import proxmoxConfiguredNodesTableSource from '../ProxmoxConfiguredNodesTable.tsx?raw';
-import proxmoxDirectWorkspaceSource from '../ProxmoxDirectWorkspace.tsx?raw';
-import proxmoxDirectConnectionsCardSource from '../ProxmoxDirectConnectionsCard.tsx?raw';
-import proxmoxDiscoveryResultsCardSource from '../ProxmoxDiscoveryResultsCard.tsx?raw';
-import proxmoxNodeModalStackSource from '../ProxmoxNodeModalStack.tsx?raw';
-import proxmoxSettingsPanelSource from '../ProxmoxSettingsPanel.tsx?raw';
-import proxmoxSettingsModelSource from '../proxmoxSettingsModel.ts?raw';
-import proxmoxDirectWorkspaceStateSource from '../useProxmoxDirectWorkspaceState.ts?raw';
-import trueNASApiSource from '@/api/truenas.ts?raw';
-import trueNASSettingsPanelSource from '../TrueNASSettingsPanel.tsx?raw';
-import trueNASSettingsPanelStateSource from '../useTrueNASSettingsPanelState.ts?raw';
-import vmwareApiSource from '@/api/vmware.ts?raw';
-import vmwareSettingsPanelSource from '../VMwareSettingsPanel.tsx?raw';
-import vmwareSettingsPanelStateSource from '../useVMwareSettingsPanelState.ts?raw';
-import generalSettingsPanelSource from '../GeneralSettingsPanel.tsx?raw';
-import networkBoundarySettingsSectionSource from '../NetworkBoundarySettingsSection.tsx?raw';
-import networkDiscoverySectionSource from '../NetworkDiscoverySection.tsx?raw';
-import networkSettingsPanelSource from '../NetworkSettingsPanel.tsx?raw';
-import recoverySettingsPanelSource from '../RecoverySettingsPanel.tsx?raw';
-import rbacFeatureGateSectionSource from '../RBACFeatureGateSection.tsx?raw';
-import rbacFeatureGateStateSource from '../useRBACFeatureGateState.ts?raw';
-import rolesPanelSource from '../RolesPanel.tsx?raw';
-import rolesEditorDialogSource from '../RolesEditorDialog.tsx?raw';
-import rolesPanelStateSource from '../useRolesPanelState.ts?raw';
-import userAssignmentsPanelSource from '../UserAssignmentsPanel.tsx?raw';
-import userAssignmentsDialogSource from '../UserAssignmentsDialog.tsx?raw';
-import userAssignmentsPanelStateSource from '../useUserAssignmentsPanelState.ts?raw';
-import ssoProvidersPanelSource from '../SSOProvidersPanel.tsx?raw';
-import ssoProvidersStateSource from '../useSSOProvidersState.ts?raw';
-import ssoProvidersModelSource from '../ssoProvidersModel.ts?raw';
-import rbacPermissionsSource from '@/utils/rbacPermissions.ts?raw';
-import rbacPresentationSource from '@/utils/rbacPresentation.ts?raw';
-import apiTokenPresentationSource from '@/utils/apiTokenPresentation.ts?raw';
-import ssoProviderPresentationSource from '@/utils/ssoProviderPresentation.ts?raw';
-import systemSettingsPresentationSource from '@/utils/systemSettingsPresentation.ts?raw';
-
-const recoverySource = [
- recoveryComponentSource,
- recoveryProtectedInventorySectionSource,
- recoveryActivitySectionSource,
- recoveryHistorySectionSource,
- recoveryHistoryTableSource,
- recoveryHistorySectionStateSource,
-].join('\n');
-
-describe('monitored-system model guardrails', () => {
- it('keeps AgentProfilesPanel on unified resources (not host-only slices)', () => {
- expect(agentProfilesPanelSource).toContain('import { useAgentProfilesPanelState }');
- expect(agentProfilesPanelSource).toContain('useAgentProfilesPanelState()');
- expect(agentProfilesPanelSource).toContain('@/utils/agentProfilesPresentation');
- expect(agentProfilesPanelSource).toContain('getAgentProfilesEmptyState');
- expect(agentProfilesPanelSource).toContain('getAgentProfileAssignmentsEmptyState');
- expect(agentProfilesPanelSource).not.toContain('const loadData = async () =>');
- expect(agentProfilesPanelSource).not.toContain('const handleSave = async () =>');
- expect(agentProfilesPanelSource).not.toContain('AIAPI.getSettings()');
- expect(agentProfilesPanelSource).not.toContain("const hosts = byType('host')");
- expect(agentProfilesPanelSource).not.toContain('No profiles yet. Create one to get started.');
- expect(agentProfilesPanelSource).not.toContain(
- 'No agents connected. Install an agent to assign profiles.',
- );
- expect(agentProfilesPanelStateSource).toContain('const { resources } = useResources()');
- expect(agentProfilesPanelStateSource).toContain('const loadData = async () =>');
- expect(agentProfilesPanelStateSource).toContain('const handleSave = async () =>');
- expect(agentProfilesPanelStateSource).toContain('aiChatStore.enabled === true');
- expect(agentProfilesPanelStateSource).not.toContain('AIAPI.getSettings()');
- expect(agentProfilesPanelStateSource).toContain('AgentProfilesAPI.listProfiles()');
- expect(agentProfilesPanelStateSource).toContain('AgentProfilesAPI.listAssignments()');
- expect(agentProfilesPresentationSource).toContain('export function getAgentProfilesEmptyState');
- expect(agentProfilesPresentationSource).toContain(
- 'export function getAgentProfileAssignmentsEmptyState',
- );
- expect(agentLedgerPanelSource).toContain('getSimpleStatusIndicator');
- expect(agentLedgerPanelSource).toContain('getMonitoredSystemLedgerLoadingState');
- expect(agentLedgerPanelSource).toContain('getMonitoredSystemLedgerErrorState');
- expect(agentLedgerPanelSource).not.toContain('Loading monitored system ledger...');
- expect(agentLedgerPanelSource).not.toContain('Failed to load monitored system ledger.');
- expect(agentLedgerPanelSource).not.toContain('function statusVariant(');
- expect(monitoredSystemLedgerApiSource).toContain('@/utils/monitoredSystemPresentation');
- expect(monitoredSystemLedgerApiSource).toContain('getMonitoredSystemStatusFallbackSummary');
- expect(monitoredSystemLedgerApiSource).toContain(
- 'getMonitoredSystemExplanationFallbackSummary',
- );
- expect(monitoredSystemLedgerApiSource).toContain('type MonitoredSystemLedgerRawEntry =');
- expect(monitoredSystemLedgerApiSource).toContain('systems?: MonitoredSystemLedgerRawEntry[];');
- expect(monitoredSystemLedgerApiSource).toContain('reported_at: string;');
- expect(monitoredSystemLedgerApiSource).not.toContain('last_seen: string;');
- expect(monitoredSystemLedgerApiSource).not.toContain('latest_included_signal_at?: string;');
- expect(monitoredSystemLedgerApiSource).not.toContain('latest_included_signal_source?: string;');
- expect(monitoredSystemLedgerApiSource).not.toContain('last_seen?: string;');
- expect(monitoredSystemLedgerApiSource).not.toContain(
- 'All included top-level collection paths currently report online status.',
- );
- expect(monitoredSystemLedgerApiSource).not.toContain(
- 'At least one included top-level collection path is degraded, so Pulse marks this monitored system as warning.',
- );
- expect(monitoredSystemLedgerApiSource).not.toContain(
- 'Pulse cannot determine a canonical runtime status for this monitored system yet.',
- );
- expect(monitoredSystemPresentationSource).toContain('statusSummaryByStatus');
- expect(agentLedgerPanelSource).not.toContain('getMonitoredSystemExplanationFallbackSummary');
- expect(agentLedgerPanelSource).not.toContain('getMonitoredSystemStatusFallbackSummary');
- expect(agentLedgerPanelSource).not.toContain('function systemExplanation(');
- expect(agentLedgerPanelSource).not.toContain('function systemStatusExplanation(');
- });
-
- it('keeps platform-connection admission preview on the shared monitored-system model', () => {
- expect(monitoredSystemAdmissionPreviewSource).toContain(
- 'formatMonitoredSystemSurfaceAttribution',
- );
- expect(monitoredSystemAdmissionPreviewSource).toContain(
- 'getMonitoredSystemAdmissionPreviewRequiredState',
- );
- expect(monitoredSystemAdmissionPreviewSource).toContain('Current matched systems');
- expect(monitoredSystemAdmissionPreviewSource).toContain('Projected systems');
- expect(monitoredSystemAdmissionPreviewSource).not.toContain('TrueNASAPI.');
- expect(monitoredSystemAdmissionPreviewSource).not.toContain('VMwareAPI.');
-
- expect(trueNASSettingsPanelSource).toContain(
- "import { MonitoredSystemAdmissionPreview } from './MonitoredSystemAdmissionPreview';",
- );
- expect(trueNASSettingsPanelSource).toContain('<MonitoredSystemAdmissionPreview');
- expect(trueNASSettingsPanelSource).toContain('Preview impact');
- expect(trueNASSettingsPanelStateSource).toContain('const [previewing, setPreviewing]');
- expect(trueNASSettingsPanelStateSource).toContain('const previewCurrentForm = async () =>');
- expect(trueNASSettingsPanelStateSource).toContain(
- 'buildMonitoredSystemAdmissionPreviewUnavailableState',
- );
- expect(trueNASSettingsPanelStateSource).toContain(
- 'getMonitoredSystemAdmissionPreviewSaveBlockedMessage',
- );
- expect(trueNASSettingsPanelStateSource).not.toContain('monitored_system_usage_unavailable');
- expect(trueNASSettingsPanelStateSource).toContain('TrueNASAPI.previewConnection(payload)');
- expect(trueNASSettingsPanelStateSource).toContain(
- 'TrueNASAPI.previewSavedConnection(editingConnectionId()!, payload)',
- );
- expect(trueNASApiSource).toContain('static async previewConnection(');
- expect(trueNASApiSource).toContain('static async previewSavedConnection(');
-
- expect(vmwareSettingsPanelSource).toContain(
- "import { MonitoredSystemAdmissionPreview } from './MonitoredSystemAdmissionPreview';",
- );
- expect(vmwareSettingsPanelSource).toContain('<MonitoredSystemAdmissionPreview');
- expect(vmwareSettingsPanelSource).toContain('Preview impact');
- expect(vmwareSettingsPanelStateSource).toContain('const [previewing, setPreviewing]');
- expect(vmwareSettingsPanelStateSource).toContain('const previewCurrentForm = async () =>');
- expect(vmwareSettingsPanelStateSource).toContain(
- 'buildMonitoredSystemAdmissionPreviewUnavailableState',
- );
- expect(vmwareSettingsPanelStateSource).toContain(
- 'getMonitoredSystemAdmissionPreviewSaveBlockedMessage',
- );
- expect(vmwareSettingsPanelStateSource).not.toContain('monitored_system_usage_unavailable');
- expect(vmwareSettingsPanelStateSource).toContain('VMwareAPI.previewConnection(payload)');
- expect(vmwareSettingsPanelStateSource).toContain(
- 'VMwareAPI.previewSavedConnection(editingConnectionId()!, payload)',
- );
- expect(vmwareApiSource).toContain('static async previewConnection(');
- expect(vmwareApiSource).toContain('static async previewSavedConnection(');
- expect(monitoredSystemPresentationSource).toContain('monitored_system_usage_unavailable');
- });
-
- it('keeps APITokenManager runtime usage mapped from unified resources', () => {
- expect(apiTokenManagerSource).toContain('import { useAPITokenManagerState }');
- expect(apiTokenManagerSource).toContain('useAPITokenManagerState(props)');
- expect(apiTokenManagerSource).not.toContain('const agentCapableResources = createMemo(() =>');
- expect(apiTokenManagerSource).not.toContain('@/utils/apiTokenPresentation');
- expect(apiTokenManagerStateSource).toContain('const agentCapableResources = createMemo(() =>');
- expect(apiTokenManagerStateSource).toContain('@/utils/apiTokenPresentation');
- expect(apiTokenManagerStateSource).toContain(
- "const dockerRuntimeResources = createMemo(() => byType('docker-host'))",
- );
- expect(apiTokenManagerModelSource).toContain('export const hasAgentScopeResource =');
- expect(apiTokenManagerModelSource).toContain("resource.type === 'agent'");
- expect(apiTokenManagerModelSource).toContain("resource.type === 'pbs'");
- expect(apiTokenManagerModelSource).toContain("resource.type === 'pmg'");
- expect(apiTokenManagerModelSource).not.toContain("resource.type === 'truenas'");
- expect(apiTokenManagerModelSource).toContain('resourceHasAgentFacet(resource)');
- expect(apiTokenManagerModelSource).toContain(
- 'getActionableDockerRuntimeIdFromResource(resource)',
- );
- expect(apiTokenManagerStateSource).toContain('markDockerRuntimesTokenRevoked');
- expect(apiTokenManagerStateSource).not.toContain('markDockerHostsTokenRevoked');
- expect(apiTokenManagerModelSource).not.toContain("resource.type === 'host'");
- expect(apiTokenManagerStateSource).not.toContain('markHostsTokenRevoked');
- expect(apiTokenManagerStateSource).not.toContain(
- "const hostResources = createMemo(() => byType('host'))",
- );
- expect(apiTokenManagerModelSource).not.toContain('isAppContainerDiscoveryResourceType');
- expect(apiTokenManagerStateSource).not.toContain(
- "notificationStore.error('Failed to load API tokens')",
- );
- expect(apiTokenManagerStateSource).not.toContain(
- "notificationStore.error('Failed to generate API token')",
- );
- expect(apiTokenManagerStateSource).not.toContain(
- "notificationStore.error('Failed to revoke API token')",
- );
- expect(apiTokenPresentationSource).toContain('export function getAPITokensLoadErrorMessage');
- });
-
- it('keeps infrastructure operations free of v5 merge-workaround patterns', () => {
- expect(infrastructureOperationsStateSource).not.toContain('previousHostTypes');
- expect(infrastructureOperationsStateSource).not.toContain('const allHosts = createMemo(');
- expect(infrastructureOperationsSource).toContain('@/utils/unifiedAgentStatusPresentation');
- expect(infrastructureOperationsSource).not.toContain('const MONITORING_STOPPED_STATUS_LABEL =');
- expect(infrastructureOperationsSource).not.toContain('const ALLOW_RECONNECT_LABEL =');
- expect(infrastructureOperationsStateSource).toContain('withPrivilegeEscalation');
- expect(infrastructureOperationsStateSource).toContain('./useInfrastructureInstallState');
- expect(infrastructureOperationsStateSource).toContain('./useInfrastructureReportingState');
- expect(infrastructureOperationsSource).toContain('@/utils/agentCapabilityPresentation');
- expect(infrastructureOperationsSource).not.toContain('const getCapabilityLabel =');
- expect(infrastructureOperationsSource).not.toContain('const getCapabilityBadgeClass =');
- expect(agentCapabilityPresentationSource).toContain('export type AgentCapability =');
- expect(agentCapabilityPresentationSource).toContain("| 'agent'");
- expect(agentCapabilityPresentationSource).toContain("| 'truenas'");
- expect(agentCapabilityPresentationSource).toContain('export function getAgentCapabilityLabel');
- expect(agentCapabilityPresentationSource).toContain(
- 'export function getAgentCapabilityBadgeClass',
- );
- expect(infrastructureReportingStateSource).not.toContain('isConnectedHealthStatus');
- expect(infrastructureReportingStateSource).not.toContain('const connectedFromStatus =');
- expect(agentProfilesPanelStateSource).toContain('isConnectedHealthStatus');
- expect(agentProfilesPanelSource).not.toContain('const connectedFromStatus =');
- expect(statusUtilsSource).toContain('export function isConnectedHealthStatus');
- expect(infrastructureOperationsSource).toContain('@/utils/unifiedAgentStatusPresentation');
- expect(infrastructureOperationsSource).not.toContain('const statusBadgeClass =');
- expect(infrastructureOperationsSource).not.toContain('const statusBadgeClasses =');
- expect(infrastructureOperationsSource).toContain('getUnifiedAgentLookupStatusPresentation');
- expect(unifiedAgentStatusPresentationSource).toContain(
- 'export function getUnifiedAgentStatusPresentation',
- );
- expect(unifiedAgentStatusPresentationSource).toContain(
- 'export function getUnifiedAgentLookupStatusPresentation',
- );
- expect(infrastructureOperationsSource).toContain('getInventorySubjectLabel');
- expect(infrastructureOperationsSource).toContain('getMonitoringStoppedEmptyState');
- expect(infrastructureOperationsSource).toContain('getRemovedUnifiedAgentItemLabel');
- expect(infrastructureOperationsSource).toContain('getUnifiedAgentLastSeenLabel');
- expect(infrastructureOperationsSource).not.toContain('const getInventorySubjectLabel =');
- expect(infrastructureOperationsSource).not.toContain('const getRemovedItemLabel =');
- expect(infrastructureOperationsSource).not.toContain('const lastSeenLabel = () => {');
- expect(infrastructureOperationsSource).not.toContain(
- 'No monitoring-stopped items match the current filters.',
- );
- expect(unifiedAgentInventoryPresentationSource).toContain(
- 'export function getInventorySubjectLabel',
- );
- expect(unifiedAgentInventoryPresentationSource).toContain(
- 'export function getRemovedUnifiedAgentItemLabel',
- );
- expect(unifiedAgentInventoryPresentationSource).toContain(
- 'export function getUnifiedAgentLastSeenLabel',
- );
- expect(unifiedAgentInventoryPresentationSource).toContain(
- 'export function getMonitoringStoppedEmptyState',
- );
- expect(unifiedAgentInventoryPresentationSource).not.toContain(
- 'export function getMonitoredSystemLedgerLoadingState',
- );
- expect(unifiedAgentInventoryPresentationSource).not.toContain(
- 'export function getMonitoredSystemLedgerErrorState',
- );
- expect(monitoredSystemPresentationSource).toContain(
- 'export function getMonitoredSystemLedgerLoadingState',
- );
- expect(monitoredSystemPresentationSource).toContain(
- 'export function getMonitoredSystemLedgerErrorState',
- );
- expect(unifiedAgentInventoryPresentationSource).toContain(
- 'export function getUnifiedAgentStopMonitoringSuccessMessage',
- );
- expect(unifiedAgentInventoryPresentationSource).toContain(
- 'export function getUnifiedAgentAllowReconnectSuccessMessage',
- );
- expect(unifiedAgentInventoryPresentationSource).toContain(
- 'export function getUnifiedAgentConfigUpdateSuccessMessage',
- );
- expect(unifiedAgentInventoryPresentationSource).toContain(
- 'export function getUnifiedAgentClipboardCopySuccessMessage',
- );
- expect(infrastructureOperationsSource).not.toContain(
- 'No host identifiers are available to stop monitoring.',
- );
- expect(infrastructureOperationsSource).not.toContain('Failed to update agent configuration');
- expect(infrastructureOperationsSource).not.toContain('Uninstall command copied');
- expect(infrastructureOperationsSource).not.toContain('Upgrade command copied');
- expect(infrastructureOperationsSource).not.toContain(
- "notificationStore.error('Failed to copy')",
- );
- expect(relaySettingsPanelSource).toContain('./useRelaySettingsPanelState');
- expect(relaySettingsPanelSource).toContain('./RelayPairingSection');
- expect(relaySettingsPanelSource).toContain('getSettingsConfigurationLoadingState');
- expect(relaySettingsPanelSource).toContain('@/utils/upgradePresentation');
- expect(relaySettingsPanelSource).toContain('UPGRADE_TRIAL_LABEL');
- expect(relaySettingsPanelSource).not.toContain('createSignal(');
- expect(relaySettingsPanelSource).not.toContain('Loading configuration...');
- expect(relaySettingsPanelSource).not.toContain('>Start free trial<');
- expect(relaySettingsPanelStateSource).toContain('getRelayConnectionPresentation');
- expect(relaySettingsPanelStateSource).toContain('trackPaywallViewed');
- expect(relayPairingSectionSource).toContain('getRelayDiagnosticClass');
- expect(proxmoxSettingsPanelSource).not.toContain('Loading configuration...');
- expect(proxmoxSettingsPanelSource).toContain('./ProxmoxDirectWorkspace');
- expect(proxmoxDirectWorkspaceSource).toContain('./useProxmoxDirectWorkspaceState');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxConfiguredNodesTable');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxDirectConnectionsCard');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxDiscoveryResultsCard');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxDeleteNodeDialog');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxNodeModalStack');
- expect(proxmoxSettingsPanelSource).not.toContain('setPrefillNode(');
- expect(proxmoxSettingsPanelSource).not.toContain('const renderConfiguredTable = () =>');
- expect(proxmoxSettingsPanelSource).not.toContain('const renderNodeModal = (type: NodeType)');
- expect(proxmoxSettingsPanelSource).not.toContain(
- 'No discovery matches for this Proxmox type yet.',
- );
- expect(proxmoxSettingsPanelSource).not.toContain('What happens next');
- expect(proxmoxConfiguredNodesTableSource).toContain('PveNodesTable');
- expect(proxmoxDirectConnectionsCardSource).toContain('getSettingsConfigurationLoadingState');
- expect(proxmoxDiscoveryResultsCardSource).toContain('formatRelativeTime');
- expect(proxmoxDeleteNodeDialogSource).toContain('SectionHeader');
- expect(proxmoxNodeModalStackSource).toContain('<NodeModal');
- expect(proxmoxDirectWorkspaceStateSource).toContain('buildProxmoxDiscoveryPrefillNode');
- expect(proxmoxSettingsModelSource).toContain('./infrastructureSettingsModel');
- expect(infrastructureSettingsStateSource).toContain('./useInfrastructureConfiguredNodesState');
- expect(infrastructureSettingsStateSource).toContain('./useInfrastructureDiscoveryRuntimeState');
- expect(infrastructureSettingsStateSource).not.toContain('NodesAPI.getNodes');
- expect(infrastructureSettingsStateSource).not.toContain('SettingsAPI.updateSystemSettings');
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.getNodes');
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.deleteNode');
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.refreshClusterNodes');
- expect(infrastructureConfiguredNodesStateSource).not.toContain("apiFetch('/api/discover'");
- expect(infrastructureDiscoveryRuntimeStateSource).toContain("apiFetch('/api/discover'");
- expect(infrastructureDiscoveryRuntimeStateSource).toContain('SettingsAPI.updateSystemSettings');
- expect(infrastructureDiscoveryRuntimeStateSource).toContain("eventBus.on('discovery_status'");
- expect(infrastructureDiscoveryRuntimeStateSource).not.toContain('NodesAPI.getNodes');
- expect(infrastructureSettingsModelSource).toContain('collectConfiguredInfrastructureHosts');
- expect(infrastructureSettingsModelSource).toContain('matchConfiguredNodeToResource');
- expect(infrastructureInstallStateSource).toContain('STORAGE_KEYS.SETUP_HANDOFF');
- expect(infrastructureInstallerSectionSource).toContain(
- 'Security configured. Save these first-run credentials now.',
- );
- expect(infrastructureInstallerSectionSource).toContain(
- 'Pulse generated the first scoped install token automatically. The install commands below are ready for the first host.',
- );
- expect(setupCompletionPanelSource).not.toContain('@/utils/relayPresentation');
- expect(setupCompletionPanelSource).not.toContain('RELAY_ONBOARDING_SETUP_LABEL');
- expect(setupCompletionPanelSource).not.toContain('RELAY_ONBOARDING_TRIAL_STARTING_LABEL');
- expect(setupCompletionPanelSource).not.toContain('RELAY_ONBOARDING_SETUP_WIZARD_TRIAL_LABEL');
- expect(setupCompletionPanelSource).not.toContain('RELAY_ONBOARDING_TRIAL_HINT');
- expect(setupCompletionPanelSource).not.toContain('Start Free Trial & Set Up Mobile');
- expect(setupCompletionPanelSource).not.toContain('14-DAY PRO TRIAL');
- expect(relayPresentationSource).toContain('export function getRelayConnectionPresentation');
- expect(relayPresentationSource).toContain('export function getRelayDiagnosticClass');
- expect(relayPresentationSource).toContain('export const RELAY_ONBOARDING_TITLE');
- expect(relayPresentationSource).toContain('export const RELAY_ONBOARDING_DESCRIPTION');
- expect(relayPresentationSource).toContain('export const RELAY_ONBOARDING_UPGRADE_LABEL');
- expect(relayPresentationSource).toContain(
- 'export const RELAY_ONBOARDING_SETUP_WIZARD_TRIAL_LABEL',
- );
- expect(relayPresentationSource).toContain('export const RELAY_ONBOARDING_TRIAL_HINT');
- expect(aiSettingsSource).toContain('@/utils/aiControlLevelPresentation');
- expect(aiSettingsSource).toContain('@/utils/aiSettingsPresentation');
- expect(aiSettingsSource).toContain('getAIControlLevelPanelClass');
- expect(aiSettingsSource).toContain('getAIControlLevelBadgeClass');
- expect(aiSettingsSource).toContain('getAIControlLevelDescription');
- expect(aiSettingsSource).toContain('getAISettingsReadinessPresentation');
- expect(aiSettingsSource).toContain('getAISettingsLoadingState');
- expect(aiSettingsSource).toContain('getAIChatSessionsLoadingState');
- expect(aiSettingsSource).toContain('getAIChatSessionsEmptyState');
- expect(aiSettingsSource).toContain('getAIOAuthErrorMessage');
- expect(aiSettingsSource).toContain('getAISessionSummarizeErrorMessage');
- expect(aiSettingsSource).toContain('getAISessionDiffErrorMessage');
- expect(aiSettingsSource).toContain('getAISessionRevertErrorMessage');
- expect(aiSettingsSource).toContain('getAISettingsSaveErrorMessage');
- expect(aiSettingsSource).toContain('getAICredentialsClearErrorMessage');
- expect(aiSettingsSource).toContain('getAISettingsToggleErrorMessage');
- expect(aiSettingsShellSource).toContain('@/components/Settings/useAISettingsState');
- expect(aiSettingsShellSource).toContain('@/components/Settings/AIModelSelectionSection');
- expect(aiSettingsShellSource).toContain('@/components/Settings/AIRuntimeControlsSection');
- expect(aiSettingsShellSource).toContain('@/components/Settings/AIChatMaintenanceSection');
- expect(aiSettingsShellSource).toContain('@/components/Settings/AISettingsStatusAndActions');
- expect(aiRuntimeControlsSectionSource).toContain('@/utils/upgradePresentation');
- expect(aiRuntimeControlsSectionSource).toContain('UPGRADE_ACTION_LABEL');
- expect(aiRuntimeControlsSectionSource).toContain('UPGRADE_TRIAL_LABEL');
- expect(aiSettingsSource).not.toContain('Loading Pulse Assistant settings...');
- expect(aiSettingsSource).not.toContain('Loading chat sessions...');
- expect(aiSettingsSource).not.toContain('No chat sessions yet. Start a chat to create one.');
- expect(aiSettingsSource).not.toContain("'Failed to summarize session.'");
- expect(aiSettingsSource).not.toContain("'Failed to get session diff.'");
- expect(aiSettingsSource).not.toContain("'Failed to revert session.'");
- expect(aiSettingsSource).not.toContain("'Failed to save Pulse Assistant settings'");
- expect(aiSettingsSource).not.toContain("'Failed to clear credentials'");
- expect(aiRuntimeControlsSectionSource).not.toContain('>Upgrade to Pro<');
- expect(aiRuntimeControlsSectionSource).not.toContain('>Start free trial<');
- expect(aiSettingsSource).not.toContain("'Failed to update Pulse Assistant setting'");
- expect(aiSettingsSource).not.toContain('const normalizeControlLevel =');
- expect(aiSettingsSource).not.toContain('const errorMessages: Record<string, string> =');
- expect(aiSettingsShellSource).not.toContain(
- 'const [loading, setLoading] = createSignal(false);',
- );
- expect(aiSettingsShellSource).not.toContain('const handleSave = async (event?: Event) =>');
- expect(aiSettingsShellSource).not.toContain('Chat Session Maintenance');
- expect(aiSettingsShellSource).not.toContain('Discovery Settings');
- expect(aiSettingsShellSource).not.toContain('Pulse Permission Level');
- expect(aiSettingsStateSource).toContain('export const useAISettingsState =');
- expect(aiSettingsStateSource).toContain('export type AISettingsState =');
- expect(aiSettingsStateSource).toContain('const [loading, setLoading] = createSignal(false);');
- expect(aiSettingsStateSource).toContain('const handleSave = async (event?: Event) =>');
- expect(aiSettingsStateSource).toContain(
- 'const handleEnabledToggle = async (newValue: boolean) =>',
- );
- expect(aiControlLevelPresentationSource).toContain('export function normalizeAIControlLevel');
- expect(aiControlLevelPresentationSource).toContain(
- 'export function getAIControlLevelPanelClass',
- );
- expect(aiControlLevelPresentationSource).toContain(
- 'export function getAIControlLevelBadgeClass',
- );
- expect(aiControlLevelPresentationSource).toContain(
- 'export function getAIControlLevelDescription',
- );
- expect(aiControlLevelPresentationSource).toContain(
- 'export function getAIChatControlLevelPresentation',
- );
- expect(aiSettingsPresentationSource).toContain(
- 'export function getAISettingsReadinessPresentation',
- );
- expect(aiSettingsPresentationSource).toContain('export function getAISettingsLoadingState');
- expect(aiSettingsPresentationSource).toContain('export function getAISettingsLoadErrorMessage');
- expect(aiSettingsPresentationSource).toContain('export function getAISettingsRetryLabel');
- expect(aiSettingsDialogsSource).toContain('SelectionCardGroup');
- expect(aiSettingsDialogsSource).toContain('variant="compact"');
- expect(updatesSettingsPanelSource).toContain('SelectionCardGroup');
- expect(updatesSettingsPanelSource).toContain('variant="detail"');
- expect(aiSettingsPresentationSource).toContain('export function getAIChatSessionsLoadingState');
- expect(aiSettingsPresentationSource).toContain('export function getAIChatSessionsEmptyState');
- expect(aiSettingsPresentationSource).toContain('export function getAIModelsLoadErrorMessage');
- expect(aiSettingsPresentationSource).toContain(
- 'export function getAIChatSessionsLoadErrorMessage',
- );
- expect(aiSettingsPresentationSource).toContain('export function getAIOAuthErrorMessage');
- expect(suggestProfileModalSource).toContain('@/utils/agentProfileSuggestionPresentation');
- expect(suggestProfileModalSource).toContain('AGENT_PROFILE_SUGGESTION_EXAMPLE_PROMPTS');
- expect(suggestProfileModalSource).toContain('getAgentProfileSuggestionLoadingState');
- expect(suggestProfileModalSource).toContain('getAgentProfileSuggestionKeyLabel');
- expect(suggestProfileModalSource).toContain('formatAgentProfileSuggestionValue');
- expect(suggestProfileModalSource).toContain('hasAgentProfileSuggestionValue');
- expect(suggestProfileModalSource).toContain('getAgentProfileSuggestionRiskHints');
- expect(suggestProfileModalSource).toContain('getAgentProfileSuggestionValueBadgeClass');
- expect(suggestProfileModalSource).not.toContain('const formatValueBadgeClass =');
- expect(suggestProfileModalSource).not.toContain('Generating suggestion...');
- expect(suggestProfileModalSource).not.toContain('const toTitleCase =');
- expect(suggestProfileModalSource).not.toContain('const formatDisplayValue =');
- expect(suggestProfileModalSource).not.toContain('const hasValue =');
- expect(suggestProfileModalSource).not.toContain('const examplePrompts =');
- expect(agentProfileSuggestionPresentationSource).toContain(
- 'export function getAgentProfileSuggestionValueBadgeClass',
- );
- expect(agentProfileSuggestionPresentationSource).toContain(
- 'export const AGENT_PROFILE_SUGGESTION_EXAMPLE_PROMPTS',
- );
- expect(agentProfileSuggestionPresentationSource).toContain(
- 'export function getAgentProfileSuggestionKeyLabel',
- );
- expect(agentProfileSuggestionPresentationSource).toContain(
- 'export function formatAgentProfileSuggestionValue',
- );
- expect(agentProfileSuggestionPresentationSource).toContain(
- 'export function hasAgentProfileSuggestionValue',
- );
- expect(agentProfileSuggestionPresentationSource).toContain(
- 'export function getAgentProfileSuggestionRiskHints',
- );
- expect(reportingPanelSource).toContain('FilterButtonGroup');
- expect(reportingPanelSource).toContain('CalloutCard');
- expect(reportingPanelSource).toContain('variant="prominent"');
- expect(reportingPanelSource).toContain('@/utils/upgradePresentation');
- expect(reportingPanelSource).toContain('@/components/Settings/useReportingPanelState');
- expect(reportingPanelSource).toContain('@/components/Settings/reportingCatalogModel');
- expect(reportingPanelSource).toContain('@/components/Settings/reportingPanelModel');
- expect(reportingPanelSource).toContain('reportingCatalog');
- expect(reportingPanelSource).toContain('getUpgradeActionButtonClass');
- expect(reportingPanelSource).toContain('UPGRADE_ACTION_LABEL');
- expect(reportingPanelSource).toContain('UPGRADE_TRIAL_LABEL');
- expect(reportingPanelSource).not.toContain('>Upgrade to Pro<');
- expect(reportingPanelSource).not.toContain('>Start free trial<');
- expect(reportingPanelSource).not.toContain("<For each={['24h', '7d', '30d']}>");
- expect(reportingPanelSource).not.toContain('window.URL.createObjectURL');
- expect(reportingPanelStateSource).toContain('buildReportingRequest');
- expect(reportingPanelStateSource).toContain('buildReportingCatalogRequest');
- expect(reportingPanelStateSource).toContain('parseReportingCatalog');
- expect(reportingPanelStateSource).toContain('getReportingGenerateSelectionRequiredMessage');
- expect(reportingPanelStateSource).toContain('getReportingGenerateSuccessMessage');
- expect(reportingPanelStateSource).toContain('getReportingGenerateErrorMessage');
- expect(reportingPanelStateSource).toContain('buildVMInventoryExportRequest');
- expect(reportingPanelStateSource).toContain('getReportingInventoryExportSuccessMessage');
- expect(reportingCatalogModelSource).toContain('export function buildReportingCatalogRequest');
- expect(reportingCatalogModelSource).toContain('export function parseReportingCatalog');
- expect(reportingPanelModelSource).toContain('export function getReportingRangeStart');
- expect(reportingPanelModelSource).toContain('export function buildReportingRequest');
- expect(reportingInventoryExportModelSource).toContain(
- 'export function buildVMInventoryExportRequest',
- );
- expect(reportingPresentationSource).toContain(
- 'export function getReportingGenerateSelectionRequiredMessage',
- );
- expect(reportingPresentationSource).toContain(
- 'export function getReportingGenerateSuccessMessage',
- );
- expect(reportingPresentationSource).toContain(
- 'export function getReportingGenerateErrorMessage',
- );
- expect(reportingPresentationSource).toContain(
- 'export function getReportingInventoryExportSuccessMessage',
- );
- expect(reportingPresentationSource).not.toContain('getReportingToggleButtonClass');
- expect(aiIntelligenceSource).toContain(
- "import { PatrolIntelligenceSurface } from '@/features/patrol/PatrolIntelligenceSurface';",
- );
- expect(aiIntelligenceSource).not.toContain('buildPatrolScheduleOptions');
- expect(aiIntelligenceSource).not.toContain('PATROL_NO_ISSUES_LABEL');
- expect(patrolIntelligenceSurfaceSource).toContain('./usePatrolIntelligenceState');
- expect(patrolIntelligenceSurfaceSource).toContain('./PatrolIntelligenceHeader');
- expect(patrolIntelligenceSurfaceSource).toContain('./PatrolIntelligenceBanners');
- expect(patrolIntelligenceSurfaceSource).toContain('./PatrolIntelligenceSummary');
- expect(patrolIntelligenceSurfaceSource).toContain('./PatrolIntelligenceWorkspace');
- expect(patrolIntelligenceSurfaceSource).not.toContain('buildPatrolScheduleOptions');
- expect(patrolIntelligenceSurfaceSource).not.toContain('PATROL_NO_ISSUES_LABEL');
- expect(patrolIntelligenceStateSource).toContain('export function usePatrolIntelligenceState');
- expect(patrolIntelligenceStateSource).toContain('export type PatrolIntelligenceState =');
- expect(patrolIntelligenceStateSource).toContain('getPatrolStatus');
- expect(patrolIntelligenceStateSource).toContain('usePatrolStream');
- expect(patrolIntelligenceStateSource).toContain('updatePatrolAutonomySettings');
- expect(patrolIntelligenceHeaderSource).toContain('buildPatrolScheduleOptions');
- expect(patrolIntelligenceHeaderSource).toContain('getAIQuickstartCreditsPresentation');
- expect(patrolIntelligenceSummarySource).toContain('getPatrolAssessmentPresentation');
- expect(patrolIntelligenceSummarySource).toContain('getPatrolSummaryMetricState');
- expect(patrolIntelligenceSummarySource).toContain('getPatrolSummaryPresentation');
- expect(patrolIntelligenceWorkspaceSource).toContain('ApprovalBanner');
- expect(patrolIntelligenceWorkspaceSource).toContain('FindingsPanel');
- expect(patrolIntelligenceBannersSource).toContain('trackUpgradeClicked');
- expect(aiIntelligenceSource).not.toContain('No issues found');
- expect(patrolIntelligenceSurfaceSource).not.toContain('No issues found');
- expect(aiIntelligenceSource).not.toContain('const SCHEDULE_PRESETS =');
- expect(patrolIntelligenceSurfaceSource).not.toContain('const SCHEDULE_PRESETS =');
- expect(aiPatrolSchedulePresentationSource).toContain('export const PATROL_SCHEDULE_PRESETS');
- expect(aiPatrolSchedulePresentationSource).toContain(
- 'export function buildPatrolScheduleOptions',
- );
- expect(patrolSummaryPresentationSource).toContain('export const PATROL_NO_ISSUES_LABEL');
- expect(aiCostDashboardSource).toContain('getAICostRangeButtonClass');
- expect(aiCostDashboardSource).toContain('getAICostLoadingState');
- expect(aiCostDashboardSource).toContain('AI_COST_PANEL_TITLE');
- expect(aiCostDashboardSource).toContain('AI_COST_PANEL_DESCRIPTION');
- expect(aiCostDashboardSource).toContain('AI_COST_EMPTY_STATE');
- expect(aiCostDashboardSource).toContain('AI_COST_DAILY_USD_EMPTY_STATE');
- expect(aiCostDashboardSource).toContain('AI_COST_DAILY_TOKEN_EMPTY_STATE');
- expect(aiCostDashboardSource).toContain('getAICostRefreshErrorMessage');
- expect(aiCostDashboardSource).toContain('getAICostResetHistoryConfirmationMessage');
- expect(aiCostDashboardSource).toContain('getAICostResetHistorySuccessMessage');
- expect(aiCostDashboardSource).toContain('getAICostResetHistoryErrorMessage');
- expect(aiCostDashboardSource).toContain('getAICostExportHistoryErrorMessage');
- expect(aiCostDashboardSource).not.toContain('No usage data yet.');
- expect(aiCostDashboardSource).not.toContain('No daily USD trend yet.');
- expect(aiCostDashboardSource).not.toContain('No daily token trend yet.');
- expect(aiCostDashboardSource).not.toContain('Loading usage…');
- expect(aiCostDashboardSource).not.toContain('const rangeButtonClass =');
- expect(aiCostPresentationSource).toContain('export function getAICostRangeButtonClass');
- expect(aiCostPresentationSource).toContain('export function getAICostLoadingState');
- expect(aiCostPresentationSource).toContain('export const AI_COST_EMPTY_STATE');
- expect(aiCostPresentationSource).toContain('export const AI_COST_DAILY_USD_EMPTY_STATE');
- expect(aiCostPresentationSource).toContain('export const AI_COST_DAILY_TOKEN_EMPTY_STATE');
- expect(aiCostPresentationSource).toContain('export const AI_COST_PANEL_TITLE');
- expect(aiCostPresentationSource).toContain('export const AI_COST_PANEL_DESCRIPTION');
- expect(aiCostPresentationSource).toContain('export function getAICostRefreshErrorMessage');
- expect(aiCostPresentationSource).toContain('export function getAICostResetHistoryConfirmationMessage');
- expect(aiCostPresentationSource).toContain('export function getAICostResetHistorySuccessMessage');
- expect(aiCostPresentationSource).toContain('export function getAICostResetHistoryErrorMessage');
- expect(aiCostPresentationSource).toContain('export function getAICostExportHistoryErrorMessage');
- expect(rbacFeatureGateSectionSource).toContain('@/utils/upgradePresentation');
- expect(agentProfilesPanelStateSource).toContain('@/utils/upgradePresentation');
- expect(auditLogPanelSource).toContain('@/utils/upgradePresentation');
- expect(ssoProvidersPanelSource).toContain('@/utils/upgradePresentation');
- expect(auditWebhookPanelSource).toContain('@/utils/upgradePresentation');
- expect(upgradePresentationSource).toContain('export const UPGRADE_ACTION_LABEL');
- expect(upgradePresentationSource).toContain('export const UPGRADE_TRIAL_LABEL');
- expect(upgradePresentationSource).toContain('export const UPGRADE_TRIAL_LINK_CLASS');
- expect(upgradePresentationSource).toContain('export function getTrialTryAgainLaterMessage');
- expect(upgradePresentationSource).toContain('export function getTrialStartErrorMessage');
- expect(upgradePresentationSource).toContain('export function getUpgradeActionButtonClass');
- });
-
- it('keeps the infrastructure workspace on router-derived view state', () => {
- expect(infrastructureWorkspaceSource).toContain('./infrastructureWorkspaceModel');
- expect(infrastructureWorkspaceSource).not.toContain(
- 'createSignal<InfrastructureWorkspaceView>',
- );
- expect(infrastructureWorkspaceSource).not.toContain('setActiveView(');
- expect(infrastructureWorkspaceSource).not.toContain(
- "navigate('/settings/infrastructure/proxmox')",
- );
- expect(infrastructureWorkspaceModelSource).toContain(
- 'export function deriveAddStepFromLegacyPath',
- );
- expect(infrastructureWorkspaceModelSource).toContain(
- "pathname.startsWith('/settings/infrastructure/proxmox')",
- );
- expect(infrastructureWorkspaceModelSource).not.toContain(
- "operations: '/settings/infrastructure/operations'",
- );
- });
-
- it('keeps websocket State contract resource-first without legacy per-type arrays', () => {
- expect(apiTypesSource).toContain('export interface State {');
- expect(apiTypesSource).toContain('resources: Resource[]');
- expect(apiTypesSource).not.toContain('nodes: Node[]');
- expect(apiTypesSource).not.toContain('vms: VM[]');
- expect(apiTypesSource).not.toContain('containers: Container[]');
- expect(apiTypesSource).not.toContain('dockerHosts: DockerHost[]');
- expect(apiTypesSource).not.toContain('hosts: Host[]');
- expect(apiTypesSource).not.toContain('storage: Storage[]');
- expect(apiTypesSource).not.toContain('pbs: PBSInstance[]');
- expect(apiTypesSource).not.toContain('pmg: PMGInstance[]');
- expect(apiTypesSource).not.toContain('replicationJobs: ReplicationJob[]');
- expect(apiTypesSource).toContain('export interface DockerRuntime');
- expect(apiTypesSource).not.toContain('export interface DockerHost');
- });
-
- it('keeps discovery resource types on canonical v6 names', () => {
- expect(discoveryTypesSource).not.toContain("| 'lxc'");
- expect(discoveryTypesSource).not.toContain("| 'docker_lxc'");
- expect(discoveryTargetUtilsSource).toContain('discoveryTarget.agentId');
- expect(unifiedResourcesHookSource).toContain(
- 'const discoveryAgentId = v2.discoveryTarget?.agentId;',
- );
- expect(apiTypesSource).toContain("export type GuestType = 'vm' | 'system-container';");
- expect(apiTypesSource).not.toContain("'qemu'");
- expect(apiTypesSource).not.toContain("'lxc'");
- expect(commandPaletteSource).not.toContain("'lxc'");
- expect(organizationSharingCreateSectionSource).toContain('@/utils/canonicalResourceTypes');
- expect(canonicalResourceTypesSource).toContain('export const CANONICAL_RESOURCE_TYPES =');
- expect(canonicalResourceTypesSource).toContain("'system-container'");
- expect(canonicalResourceTypesSource).toContain("'app-container'");
- expect(canonicalResourceTypesSource).not.toContain("'container',");
- });
-
- it('keeps organization role vocabulary on shared utilities', () => {
- expect(organizationAccessPanelSource).toContain('./useOrganizationAccessPanelState');
- expect(organizationAccessPanelSource).toContain('./OrganizationAccessLoadingState');
- expect(organizationAccessPanelSource).toContain('./OrganizationAccessManagementSection');
- expect(organizationAccessPanelSource).toContain('./OrganizationAccessMembersSection');
- expect(organizationAccessManagementSectionSource).toContain(
- '@/utils/organizationRolePresentation',
- );
- expect(organizationAccessMembersSectionSource).toContain(
- '@/utils/organizationRolePresentation',
- );
- expect(organizationAccessManagementSectionSource).toContain(
- '@/utils/organizationSettingsPresentation',
- );
- expect(organizationAccessMembersSectionSource).toContain(
- '@/utils/organizationSettingsPresentation',
- );
- expect(organizationAccessManagementSectionSource).toContain('ORGANIZATION_MEMBER_ROLE_OPTIONS');
- expect(organizationAccessMembersSectionSource).toContain('ORGANIZATION_MEMBER_ROLE_OPTIONS');
- expect(organizationAccessMembersSectionSource).toContain('roleBadgeClass');
- expect(organizationAccessMembersSectionSource).toContain('formatOrgDate');
- expect(organizationAccessMembersSectionSource).toContain('getOrganizationAccessEmptyState');
- expect(organizationAccessLoadingStateSource).toContain('animate-pulse');
- expect(organizationAccessStateSource).toContain('normalizeOrgScope(getOrgID())');
- expect(organizationAccessStateSource).toContain('OrgsAPI.updateMemberRole');
- expect(organizationAccessStateSource).toContain('OrgsAPI.inviteMember');
- expect(organizationAccessStateSource).toContain('OrgsAPI.removeMember');
- expect(organizationAccessStateSource).toContain('getOrganizationAccessRoleUpdatedMessage');
- expect(organizationAccessStateSource).toContain('getOrganizationAccessMemberAddedMessage');
- expect(organizationAccessStateSource).toContain('getOrganizationAccessMemberRemovedMessage');
- expect(organizationAccessPanelSource).not.toContain("{ value: 'viewer', label: 'Viewer' }");
- expect(organizationAccessStateSource).not.toContain(
- "notificationStore.error('User ID is required')",
- );
- expect(organizationAccessStateSource).not.toContain(
- "notificationStore.error(error instanceof Error ? error.message : 'Failed to add member')",
- );
- expect(organizationAccessStateSource).not.toContain(
- "notificationStore.error(error instanceof Error ? error.message : 'Failed to remove member')",
- );
- expect(organizationAccessStateSource).not.toContain('notificationStore.success(`Updated ');
- expect(organizationAccessStateSource).not.toContain('notificationStore.success(`Added ');
- expect(organizationAccessStateSource).not.toContain('notificationStore.success(`Removed ');
- expect(organizationOverviewPanelSource).toContain('./useOrganizationOverviewPanelState');
- expect(organizationOverviewPanelSource).toContain('./OrganizationOverviewLoadingState');
- expect(organizationOverviewPanelSource).toContain('./OrganizationOverviewDetailsSection');
- expect(organizationOverviewPanelSource).toContain('./OrganizationOverviewMembersSection');
- expect(organizationOverviewDetailsSectionSource).toContain(
- '@/utils/organizationSettingsPresentation',
- );
- expect(organizationOverviewMembersSectionSource).toContain(
- '@/utils/organizationSettingsPresentation',
- );
- expect(organizationOverviewDetailsSectionSource).toContain('formatOrgDate');
- expect(organizationOverviewMembersSectionSource).toContain('roleBadgeClass');
- expect(organizationOverviewMembersSectionSource).toContain('formatOrgDate');
- expect(organizationOverviewMembersSectionSource).toContain(
- 'getOrganizationOverviewMembersEmptyState',
- );
- expect(organizationOverviewLoadingStateSource).toContain('animate-pulse');
- expect(organizationOverviewStateSource).toContain('normalizeOrgScope(getOrgID())');
- expect(organizationOverviewStateSource).toContain('OrgsAPI.get');
- expect(organizationOverviewStateSource).toContain('OrgsAPI.listMembers');
- expect(organizationOverviewStateSource).toContain('OrgsAPI.update');
- expect(organizationOverviewStateSource).toContain('getOrganizationDisplayNameUpdatedMessage');
- expect(organizationOverviewStateSource).not.toContain(
- "notificationStore.error('Display name is required')",
- );
- expect(organizationOverviewStateSource).not.toContain(
- "error instanceof Error ? error.message : 'Failed to update organization name'",
- );
- expect(organizationOverviewStateSource).not.toContain(
- "notificationStore.success('Organization name updated')",
- );
- expect(organizationSharingCreateSectionSource).toContain(
- '@/utils/organizationRolePresentation',
- );
- expect(organizationSharingStateSource).toContain('@/utils/organizationSettingsPresentation');
- expect(organizationSharingCreateSectionSource).toContain('ORGANIZATION_SHARE_ROLE_OPTIONS');
- expect(organizationOutgoingSharesSectionSource).toContain('normalizeOrganizationShareRole');
- expect(organizationIncomingSharesSectionSource).toContain('normalizeOrganizationShareRole');
- expect(organizationSharingCreateSectionSource).not.toContain(
- 'const accessRoleOptions: Array<{ value: ShareAccessRole; label: string }> = [',
- );
- expect(organizationOutgoingSharesSectionSource).not.toContain('const normalizeShareRole =');
- expect(organizationSharingStateSource).not.toContain(
- "notificationStore.error('Target organization is required')",
- );
- expect(organizationSharingStateSource).not.toContain(
- "notificationStore.error('Target organization must differ from the current organization')",
- );
- expect(organizationSharingStateSource).not.toContain(
- "notificationStore.error('Valid resource type and resource ID are required')",
- );
- expect(organizationSharingStateSource).not.toContain(
- "notificationStore.success('Resource shared successfully')",
- );
- expect(organizationSharingStateSource).not.toContain(
- "notificationStore.success('Share removed')",
- );
- expect(organizationSharingPanelSource).toContain('./OrganizationSharingLoadingState');
- expect(organizationSharingPanelSource).toContain('./OrganizationSharingCreateSection');
- expect(organizationSharingPanelSource).toContain('./OrganizationOutgoingSharesSection');
- expect(organizationSharingPanelSource).toContain('./OrganizationIncomingSharesSection');
- expect(organizationSharingLoadingStateSource).toContain('animate-pulse');
- expect(organizationRolePresentationSource).toContain(
- 'export const ORGANIZATION_MEMBER_ROLE_OPTIONS',
- );
- expect(organizationRolePresentationSource).toContain(
- 'export const ORGANIZATION_SHARE_ROLE_OPTIONS',
- );
- expect(organizationRolePresentationSource).toContain(
- 'export function normalizeOrganizationShareRole',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationAccessManageRequiredMessage',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationAccessRoleUpdatedMessage',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationAccessMemberAddedMessage',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationAccessMemberRemovedMessage',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationMemberUserIdRequiredMessage',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationMemberRoleUpdateErrorMessage',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationDisplayNameRequiredMessage',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationDisplayNameUpdatedMessage',
- );
- expect(organizationSettingsPresentationSource).toContain(
- 'export function getOrganizationOverviewManageRequiredMessage',
- );
- });
-
- it('keeps alerts agent thresholds sourced from unified agent resources', () => {
- expect(alertsPageSource).toContain(
- "import { AlertsConfigurationSurface } from '@/features/alerts/AlertsConfigurationSurface';",
- );
- expect(alertsPageSource).not.toContain('const agentResources = createMemo(');
- expect(alertsPageSource).not.toContain("resourceType: 'Agent Disk'");
- expect(alertsConfigurationSurfaceSource).toContain('<ThresholdsTab');
- expect(thresholdsTableStateSource).toContain(
- "import { useThresholdsData } from './useThresholdsData';",
- );
- expect(thresholdsDataHookSource).toContain('useThresholdsHostData');
- expect(thresholdsHostDataHookSource).toContain("resourceType: 'System Disk'");
- expect(thresholdsHostDataHookSource).not.toContain("resourceType: 'Host Disk'");
- expect(thresholdsHostDataHookSource).toContain('props.agentDefaults');
- expect(thresholdsTableAgentsResourcesSectionSource).toContain('disableAllAgents');
- expect(thresholdsTableSource).not.toContain('hostDefaults');
- expect(thresholdsTableSource).not.toContain('disableAllHosts');
- });
-
- it('keeps setup and node summary fallbacks aware of v6 agent facets', () => {
- expect(setupCompletionPanelSource).toContain('buildSetupCompletionConnectedSystems');
- expect(setupCompletionPanelSource).toContain('buildSetupCompletionViewModel');
- expect(setupCompletionPanelSource).toContain('Open Infrastructure Install');
- expect(setupCompletionPanelSource).toContain('Open Platform connections');
- expect(setupCompletionPanelSource).toContain(
- 'The canonical install flow now lives in Infrastructure.',
- );
- expect(setupCompletionPanelSource).not.toContain('const hasAgentFacet = (resource: Resource)');
- expect(setupCompletionPanelSource).not.toContain(
- 'const agentFacetResources = resources.filter(',
- );
- expect(setupCompletionPanelSource).not.toContain('state.nodes || []');
- expect(setupCompletionPanelSource).not.toContain('state.hosts || []');
- expect(infrastructureSelectorSource).toContain('useInfrastructureSelectorState');
- expect(infrastructureSelectorSource).not.toContain(
- 'const hasAgentFacet = (resource: Resource): boolean =>',
- );
- expect(infrastructureSelectorSource).not.toContain("resource.type === 'truenas'");
- expect(infrastructureSelectorStateSource).toContain('useUnifiedResources');
- expect(infrastructureSelectorModelSource).toContain('hasInfrastructureSelectorAgentFacet');
- expect(infrastructureSelectorModelSource).toContain('isAgentFacetInfrastructureResource');
- expect(infrastructureSelectorModelSource).not.toContain('if (hostLikeResources.length === 0');
- expect(guestRowCellsSource).toContain('getDashboardGuestBackupStatusPresentation');
- expect(guestRowCellsSource).toContain('getDashboardGuestBackupTooltip');
- expect(guestRowCellsSource).toContain('getDashboardGuestNetworkEmptyState');
- expect(guestRowSource).toContain('getDashboardGuestDiskStatusMessage');
- expect(guestRowSource).not.toContain('const BACKUP_STATUS_CONFIG: Record<');
- expect(guestRowSource).not.toContain('No backup found');
- expect(guestRowSource).not.toContain('No IP assigned');
- expect(guestRowSource).not.toContain(
- 'No filesystems found. VM may be booting or using a Live ISO.',
- );
- expect(dashboardDiskListSource).toContain('./useDiskListState');
- expect(dashboardDiskListStateSource).toContain('getDashboardGuestDiskStatusMessage');
- expect(dashboardDiskListSource).not.toContain(
- 'No filesystems found. VM may be booting or using a Live ISO.',
- );
- expect(dashboardGuestPresentationSource).toContain(
- 'export function getDashboardGuestBackupStatusPresentation',
- );
- expect(dashboardGuestPresentationSource).toContain(
- 'export function getDashboardGuestBackupTooltip',
- );
- expect(dashboardGuestPresentationSource).toContain(
- 'export function getDashboardGuestNetworkEmptyState',
- );
- expect(dashboardGuestPresentationSource).toContain(
- 'export function getDashboardGuestDiskStatusMessage',
- );
- });
-
- it('keeps discovery mapping on canonical agentId only', () => {
- expect(resourceDetailDiscoveryModelSource).toContain('const explicitDiscoveryAgentId =');
- expect(resourceDetailDiscoveryModelSource).toContain('agentId: explicitDiscoveryAgentId');
- expect(resourceDetailDiscoveryModelSource).not.toContain('hostId: explicitDiscoveryAgentId');
- expect(resourceDetailDiscoveryModelSource).not.toContain("case 'truenas'");
- expect(resourceDetailMappersSource).toContain('getActionableAgentIdFromResource(resource)');
- expect(unifiedResourcesHookSource).toContain(
- 'const discoveryAgentId = v2.discoveryTarget?.agentId;',
- );
- expect(unifiedResourcesHookSource).not.toContain("case 'truenas'");
- });
-
- it('keeps AI chat mention resources aware of agent facets beyond host type', () => {
- expect(aiChatSource).toContain('isAgentFacetInfrastructureResource');
- expect(aiChatSource).toContain('getGlobalWebSocketStore');
- expect(aiChatSource).toContain('getCachedUnifiedResources');
- expect(aiChatSource).not.toContain('useResources()');
- expect(aiChatSource).toContain('const agentResources = allResources().filter((resource) =>');
- expect(aiChatSource).toContain('getActionableAgentIdFromResource(resource) || resource.id;');
- expect(aiChatSource).not.toContain("resource.type === 'truenas'");
- expect(aiChatSource).not.toContain("resource.type === 'host'");
- expect(aiChatSource).toContain("type: 'agent'");
- expect(aiChatSource).not.toContain("mention.type === 'agent'");
- expect(aiChatSource).toContain('@/utils/aiControlLevelPresentation');
- expect(aiChatSource).toContain('AI_CHAT_SESSION_EMPTY_STATE');
- expect(aiChatSource).toContain('AI_CHAT_SESSION_MENU_TITLE');
- expect(aiChatSource).toContain('AI_CHAT_DRAWER_SUBTITLE');
- expect(aiChatSource).toContain('AI_CHAT_DISCOVERY_HINT_TITLE');
- expect(aiChatSource).toContain('getAIChatEmptyStateSuggestions');
- expect(aiChatSource).not.toContain('No previous assistant sessions');
- expect(aiChatSource).not.toContain('Chat sessions');
- expect(aiChatSource).not.toContain('Infrastructure intelligence');
- expect(aiChatSource).not.toContain('Pulse Assistant ready');
- expect(aiChatSource).not.toContain('Discovery is off.');
- expect(aiChatSource).toContain('getAIChatControlLevelPresentation');
- expect(aiChatSource).toContain('normalizeAIControlLevel');
- expect(aiChatSource).not.toContain('const normalizeControlLevel =');
- expect(aiChatSource).not.toContain('const labelForControlLevel =');
- expect(aiChatSource).not.toContain('const controlTone =');
- expect(aiChatSource).toContain('const mentionsForAPI =');
- expect(aiChatSource).toContain('? mentions.map((mention) => ({');
- expect(aiChatSource).toContain('name: mention.label,');
- expect(aiChatSource).toContain('type: mention.type,');
- expect(aiChatSource).not.toContain(
- 'const mentionsForAPI = mentions.length > 0 ? mentions : undefined;',
- );
- expect(aiChatPresentationSource).toContain('export const AI_CHAT_SESSION_EMPTY_STATE');
- expect(aiChatPresentationSource).toContain('export const AI_CHAT_SESSION_MENU_TITLE');
- expect(aiChatPresentationSource).toContain('export const AI_CHAT_DRAWER_SUBTITLE');
- expect(aiChatPresentationSource).toContain('export const AI_CHAT_DISCOVERY_HINT_TITLE');
- expect(aiChatPresentationSource).toContain('export const AI_CHAT_QUESTION_CARD_TITLE');
- expect(aiChatPresentationSource).toContain('export function getAIChatLauncherTitle');
- expect(aiChatPresentationSource).toContain('export function getAIChatEmptyStateSuggestions');
- expect(mentionAutocompleteSource).toContain("| 'agent'");
- expect(mentionAutocompleteSource).toContain('getSimpleStatusIndicator');
- expect(mentionAutocompleteSource).toContain('<StatusDot');
- expect(mentionAutocompleteSource).not.toContain('const getStatusColor =');
- expect(mentionAutocompleteSource).toContain("| 'system-container'");
- expect(mentionAutocompleteSource).not.toContain("| 'container'");
- expect(mentionAutocompleteSource).toContain("| 'storage'");
- expect(mentionAutocompleteSource).not.toContain("| 'host'");
- });
-
- it('keeps infrastructure selectors on v6 agent-family resources', () => {
- expect(infrastructureSummarySource).not.toContain("resource.type === 'host'");
- expect(infrastructureSelectorComponentSource).not.toContain("resource.type === 'host'");
- expect(workloadsLinkSource).not.toContain("resource.type === 'host'");
- expect(unifiedResourceTableSource).not.toContain('buildMetricKeyForUnifiedResource');
- expect(unifiedResourceTableSource).not.toContain("buildMetricKey('host', resource.id)");
- expect(unifiedResourceHostTableCardSource).toContain('buildMetricKeyForUnifiedResource');
- expect(unifiedResourceHostTableCardSource).not.toContain("buildMetricKey('host', resource.id)");
- expect(resourceBadgesSource).not.toContain("host: 'Agent'");
- expect(problemResourcesTableSource).not.toContain("host: 'Agent'");
- });
-
- it('keeps dashboard and recovery type presentation on shared canonical helpers', () => {
- expect(problemResourcesTableSource).toContain('getResourceTypeLabel(pr.resource.type)');
- expect(problemResourcesTableSource).not.toContain('function formatType(');
- expect(recoveryTablePresentationSource).toContain('getRecoveryItemTypeBadgeClass');
- expect(recoveryTablePresentationSource).toContain('getRecoveryItemTypeLabel');
- expect(recoverySource).not.toContain('SUBJECT_TYPE_LABELS');
- expect(resourceBadgesSource).toContain('@/utils/resourceBadgePresentation');
- expect(resourceBadgePresentationSource).toContain('getResourceTypePresentation');
- expect(workloadTypeBadgesSource).toContain('getWorkloadTypePresentation');
- expect(workloadTypeBadgesSource).not.toContain('canonicalizeFrontendResourceType');
- expect(workloadTypePresentationSource).toContain('canonicalizeFrontendResourceType');
- expect(recoverySource).toContain('normalizeSourcePlatformQueryValue');
- expect(recoverySource).not.toContain('const normalizeProviderFromQuery');
- expect(sourcePlatformsSource).toContain('export const normalizeSourcePlatformQueryValue');
- expect(aiSettingsSource).toContain('getAISessionDiffStatusPresentation');
- expect(aiSettingsSource).not.toContain('const formatDiffStatus =');
- expect(aiSettingsSource).not.toContain('const diffStatusClasses =');
- expect(aiSessionDiffPresentationSource).toContain(
- 'export function getAISessionDiffStatusPresentation',
- );
- });
-
- it('keeps resource picker reportable type policy on shared utilities', () => {
- expect(resourcePickerSource).toContain('@/utils/reportableResourceTypes');
- expect(resourcePickerSource).toContain('RESOURCE_PICKER_TYPE_FILTERS');
- expect(resourcePickerSource).toContain('getResourcePickerTypeFilterLabel');
- expect(resourcePickerSource).toContain('getResourcePickerEmptyState');
- expect(resourcePickerSource).toContain('getSimpleStatusIndicator');
- expect(resourcePickerSource).toContain('<StatusDot');
- expect(resourcePickerSource).not.toContain('const REPORTABLE_RESOURCE_TYPES =');
- expect(resourcePickerSource).not.toContain('const typeFilterLabels =');
- expect(resourcePickerSource).not.toContain('function getStatusColor(');
- expect(resourcePickerSource).not.toContain('function normalizeType(');
- expect(resourcePickerSource).not.toContain('No resources available');
- expect(resourcePickerSource).not.toContain(
- 'Resources appear as Pulse collects infrastructure and workload metrics',
- );
- expect(resourcePickerSource).not.toContain('No resources match your filters');
- expect(reportableResourceTypesSource).toContain('export const REPORTABLE_RESOURCE_TYPES =');
- expect(reportableResourceTypesSource).toContain('export const RESOURCE_PICKER_TYPE_FILTERS');
- expect(reportableResourceTypesSource).toContain(
- 'export const getResourcePickerTypeFilterLabel',
- );
- expect(reportableResourceTypesSource).toContain('export const getResourcePickerEmptyState');
- expect(reportableResourceTypesSource).toContain(
- 'export const matchesReportableResourceTypeFilter =',
- );
- });
-
- it('keeps diagnostics alerts contract free of removed legacy threshold flags', () => {
- expect(diagnosticsPanelSource).not.toContain('legacyThresholdsDetected');
- expect(diagnosticsPanelSource).not.toContain('legacyThresholdSources');
- expect(diagnosticsPanelSource).not.toContain('legacyScheduleSettings');
- expect(systemSettingsStateSource).toContain('export function useSystemSettingsState(');
- expect(systemSettingsStateSource).not.toContain('legacyThresholdsDetected');
- expect(systemSettingsStateSource).not.toContain('legacyThresholdSources');
- expect(systemSettingsStateSource).not.toContain('legacyScheduleSettings');
- });
-
- it('keeps system settings polling presets and backup interval contracts on shared utilities', () => {
- expect(systemSettingsStateSource).toContain('@/utils/systemSettingsPresentation');
- expect(systemSettingsStateSource).toContain('getBackupIntervalSelectValue');
- expect(systemSettingsStateSource).toContain('getBackupIntervalSummary');
- expect(systemSettingsStateSource).toContain('getSystemSettingsSaveErrorMessage');
- expect(systemSettingsStateSource).toContain('getCheckForUpdatesErrorMessage');
- expect(systemSettingsStateSource).toContain('getStartUpdateErrorMessage');
- expect(systemSettingsStateSource).toContain('PVE_POLLING_PRESETS');
- expect(systemSettingsStateSource).not.toContain('const BACKUP_INTERVAL_OPTIONS =');
- expect(systemSettingsStateSource).not.toContain('const PVE_POLLING_PRESETS =');
- expect(systemSettingsStateSource).not.toContain(
- "notificationStore.error(error instanceof Error ? error.message : 'Failed to save settings')",
- );
- expect(systemSettingsStateSource).not.toContain(
- "notificationStore.error('Failed to check for updates')",
- );
- expect(systemSettingsStateSource).not.toContain(
- "notificationStore.error('Failed to start update. Please try again.')",
- );
- expect(generalSettingsPanelSource).toContain('@/utils/systemSettingsPresentation');
- expect(generalSettingsPanelSource).toContain('FilterButtonGroup');
- expect(generalSettingsPanelSource).toContain('variant="prominent"');
- expect(generalSettingsPanelSource).not.toContain('const PVE_POLLING_PRESETS =');
- expect(recoverySettingsPanelSource).toContain('@/utils/systemSettingsPresentation');
- expect(recoverySettingsPanelSource).not.toContain('const BACKUP_INTERVAL_OPTIONS =');
- expect(networkSettingsPanelSource).toContain('./NetworkDiscoverySection');
- expect(networkSettingsPanelSource).toContain('./NetworkBoundarySettingsSection');
- expect(networkDiscoverySectionSource).toContain('@/utils/systemSettingsPresentation');
- expect(networkDiscoverySectionSource).not.toContain('const COMMON_DISCOVERY_SUBNETS =');
- expect(networkBoundarySettingsSectionSource).not.toContain('const COMMON_DISCOVERY_SUBNETS =');
- expect(systemSettingsPresentationSource).toContain('export const PVE_POLLING_PRESETS');
- expect(systemSettingsPresentationSource).toContain('export const BACKUP_INTERVAL_OPTIONS');
- expect(systemSettingsPresentationSource).toContain('export const COMMON_DISCOVERY_SUBNETS');
- expect(systemSettingsPresentationSource).toContain(
- 'export function getBackupIntervalSelectValue',
- );
- expect(systemSettingsPresentationSource).toContain('export function getBackupIntervalSummary');
- expect(systemSettingsPresentationSource).toContain(
- 'export function getSystemSettingsSaveErrorMessage',
- );
- expect(systemSettingsPresentationSource).toContain(
- 'export function getCheckForUpdatesErrorMessage',
- );
- expect(systemSettingsPresentationSource).toContain(
- 'export function getStartUpdateErrorMessage',
- );
- });
-
- it('keeps SSO provider presentation on shared utilities', () => {
- expect(ssoProvidersPanelSource).toContain('@/utils/ssoProviderPresentation');
- expect(ssoProvidersPanelSource).toContain('@/components/Settings/useSSOProvidersState');
- expect(ssoProvidersPanelSource).toContain('getSSOProviderTypeLabel');
- expect(ssoProvidersPanelSource).toContain('getSSOProviderSummary');
- expect(ssoProvidersPanelSource).toContain('getSSOProviderCardClass');
- expect(ssoProvidersPanelSource).toContain('getSSOCertificatePresentation');
- expect(ssoProvidersPanelSource).toContain('getSSOProviderAddButtonLabel');
- expect(ssoProvidersPanelSource).toContain('getSSOProviderModalTitle');
- expect(ssoProvidersPanelSource).toContain('getSSOProviderEmptyStateTitle');
- expect(ssoProvidersPanelSource).toContain('getSSOProviderEmptyStateDescription');
- expect(ssoProvidersPanelSource).toContain('getSSOProvidersLoadingState');
- expect(ssoProvidersPanelSource).toContain('SSOProviderTypeIcon');
- expect(ssoProvidersPanelSource).not.toContain('No SSO providers configured');
- expect(ssoProvidersPanelSource).not.toContain('Loading SSO providers...');
- expect(ssoProvidersPanelSource).not.toContain(
- "notificationStore.error('Failed to load SSO providers')",
- );
- expect(ssoProvidersPanelSource).not.toContain(
- "notificationStore.error('Failed to load provider details')",
- );
- expect(ssoProvidersPanelSource).not.toContain("notificationStore.success('Provider deleted')");
- expect(ssoProvidersPanelSource).not.toContain(
- "notificationStore.error('Failed to delete provider')",
- );
- expect(ssoProvidersPanelSource).not.toContain(
- "notificationStore.success('Connection test successful')",
- );
- expect(ssoProvidersPanelSource).not.toContain(
- "notificationStore.error('Failed to test connection')",
- );
- expect(ssoProvidersPanelSource).not.toContain(
- "notificationStore.error('Please enter an IdP Metadata URL')",
- );
- expect(ssoProvidersPanelSource).not.toContain('const loadProviders = async () =>');
- expect(ssoProvidersPanelSource).not.toContain('const handleSave = async (');
- expect(ssoProvidersPanelSource).not.toContain('const testConnection = async () =>');
- expect(ssoProvidersPanelSource).not.toContain('provider.type.toUpperCase()');
- expect(ssoProvidersPanelSource).not.toContain("provider.type === 'oidc' ? (");
- expect(ssoProvidersPanelSource).not.toContain(
- "testResult()?.success\n ? 'bg-green-50 dark:bg-green-900 border-green-200 dark:border-green-800'",
- );
- expect(ssoProvidersPanelSource).not.toContain(
- "cert.isExpired ? 'bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300' : 'bg-surface-hover text-base-content'",
- );
- expect(ssoProviderPresentationSource).toContain('export function getSSOProviderTypeLabel');
- expect(ssoProviderPresentationSource).toContain('export function getSSOProviderSummary');
- expect(ssoProviderPresentationSource).toContain('export function getSSOProviderCardClass');
- expect(ssoProviderPresentationSource).toContain('export function getSSOProviderAddButtonLabel');
- expect(ssoProviderPresentationSource).toContain('export function getSSOProviderModalTitle');
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOProviderEmptyStateTitle',
- );
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOProviderEmptyStateDescription',
- );
- expect(ssoProviderPresentationSource).toContain('export function getSSOProvidersLoadingState');
- expect(ssoProviderPresentationSource).toContain('export function getSSOTestResultPresentation');
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOCertificatePresentation',
- );
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOProvidersLoadErrorMessage',
- );
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOProviderDetailsLoadErrorMessage',
- );
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOProviderSaveSuccessMessage',
- );
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOProviderDeleteSuccessMessage',
- );
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOConnectionTestSuccessMessage',
- );
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOMetadataUrlRequiredMessage',
- );
- expect(ssoProvidersStateSource).toContain('@/components/Settings/ssoProvidersModel');
- expect(ssoProvidersStateSource).toContain('getSSOTestResultPresentation');
- expect(ssoProvidersStateSource).toContain('getSSOProvidersLoadErrorMessage');
- expect(ssoProvidersStateSource).toContain('getSSOProviderDetailsLoadErrorMessage');
- expect(ssoProvidersStateSource).toContain('getSSOProviderSaveSuccessMessage');
- expect(ssoProvidersStateSource).toContain('getSSOProviderDeleteSuccessMessage');
- expect(ssoProvidersStateSource).toContain('getSSOConnectionTestSuccessMessage');
- expect(ssoProvidersModelSource).toContain('export const createEmptyProviderForm =');
- expect(ssoProvidersModelSource).toContain('export const mapProviderDetailsToForm =');
- expect(ssoProvidersModelSource).toContain('export const buildProviderPayload =');
- expect(ssoProvidersModelSource).toContain('export const buildProviderTestPayload =');
- });
-
- it('keeps RBAC permission vocabulary on shared utilities', () => {
- expect(rolesPanelSource).toContain('@/utils/rbacPresentation');
- expect(rolesPanelSource).toContain('./RBACFeatureGateSection');
- expect(rolesPanelSource).toContain('./RolesEditorDialog');
- expect(rolesPanelSource).toContain('./useRolesPanelState');
- expect(rbacFeatureGateStateSource).toContain('getRBACFeatureGateCopy');
- expect(rolesPanelSource).toContain('getRolesEmptyState');
- expect(rolesPanelSource).not.toContain(
- "const ACTIONS = ['read', 'write', 'delete', 'admin', '*']",
- );
- expect(rolesPanelSource).not.toContain(
- "const RESOURCES = ['settings', 'audit_logs', 'nodes', 'users', 'license', '*']",
- );
- expect(rolesPanelSource).not.toContain('Custom Roles (Pro)');
- expect(rolesPanelSource).not.toContain('No roles available.');
- expect(rbacPermissionsSource).toContain('export const RBAC_PERMISSION_ACTIONS');
- expect(rbacPermissionsSource).toContain('export const RBAC_PERMISSION_RESOURCES');
- expect(rbacPermissionsSource).toContain('export function createDefaultRBACPermission');
- expect(rolesPanelStateSource).toContain('@/utils/rbacPermissions');
- expect(rbacPresentationSource).toContain('export function getRBACFeatureGateCopy');
- expect(rbacPresentationSource).toContain('export function getRolesEmptyState');
- expect(rbacPresentationSource).toContain('export function getRolesLoadErrorMessage');
- expect(rbacPresentationSource).toContain('export function getRolesSaveErrorMessage');
- expect(rbacPresentationSource).toContain('export function getUserAssignmentsLoadErrorMessage');
- expect(rbacPresentationSource).toContain('export function getUserAssignmentsEmptyStateCopy');
- expect(userAssignmentsPanelSource).toContain('@/utils/rbacPresentation');
- expect(userAssignmentsPanelSource).toContain('./RBACFeatureGateSection');
- expect(userAssignmentsPanelSource).toContain('./UserAssignmentsDialog');
- expect(userAssignmentsPanelSource).toContain('./useUserAssignmentsPanelState');
- expect(rbacFeatureGateStateSource).toContain('getRBACFeatureGateCopy');
- expect(userAssignmentsPanelSource).toContain('getUserAssignmentsEmptyStateCopy');
- expect(userAssignmentsPanelStateSource).toContain('getUserAssignmentsLoadErrorMessage');
- expect(userAssignmentsPanelStateSource).toContain('getUserAssignmentsUpdateErrorMessage');
- expect(rolesPanelStateSource).toContain('getRolesLoadErrorMessage');
- expect(rolesPanelStateSource).toContain('getRolesRequiredFieldsMessage');
- expect(rolesEditorDialogSource).toContain('RBAC_PERMISSION_ACTIONS');
- expect(rolesEditorDialogSource).toContain('RBAC_PERMISSION_RESOURCES');
- expect(rbacFeatureGateSectionSource).toContain('trackUpgradeClicked');
- expect(rbacFeatureGateStateSource).toContain('trackPaywallViewed');
- expect(rbacFeatureGateStateSource).toContain('runStartProTrialAction({');
- expect(rbacFeatureGateStateSource).not.toContain('startProTrial()');
- expect(userAssignmentsDialogSource).toContain('Effective Permissions Preview');
- expect(userAssignmentsPanelStateSource).toContain('RBACAPI.getUsers');
- expect(userAssignmentsPanelStateSource).toContain('RBACAPI.updateUserRoles');
- expect(rolesPanelSource).not.toContain("notificationStore.error('Failed to load roles')");
- expect(rolesPanelSource).not.toContain("notificationStore.error('Failed to save role')");
- expect(userAssignmentsPanelSource).not.toContain(
- "notificationStore.error('Failed to load user assignments')",
- );
- expect(userAssignmentsPanelSource).not.toContain(
- "notificationStore.error('Failed to update user roles')",
- );
- expect(userAssignmentsPanelSource).not.toContain('Centralized Access Control (Pro)');
- expect(userAssignmentsPanelSource).not.toContain('No users yet');
- expect(userAssignmentsPanelSource).not.toContain('Configure SSO in Security settings');
- expect(userAssignmentsPanelSource).not.toContain('Users sync on first login');
- });
-
- it('keeps alert thresholds routes on v6 container path only', () => {
- expect(thresholdsTableStateSource).toContain(
- "if (path.includes('/thresholds/containers')) return 'docker';",
- );
- expect(thresholdsTableStateSource).toContain('/thresholds/agents');
- expect(thresholdsHostDataHookSource).toContain("resourceType: 'System Disk'");
- expect(thresholdsTableStateSource).toContain('getAlertThresholdsSectionTitles');
- expect(thresholdsTableAgentDisksSectionSource).toContain(
- 'title={state.sectionTitles.agentDisks}',
- );
- expect(thresholdsHostDataHookSource).not.toContain("resourceType: 'Host Disk'");
- expect(thresholdsHostDataHookSource).toContain('props.agentDefaults');
- expect(thresholdsTableStateSource).not.toContain('props.hostDefaults');
- expect(thresholdsTableStateSource).not.toContain('timeThresholds().host');
- expect(thresholdsTableStateSource).not.toContain('/thresholds/docker');
- expect(thresholdsTableStateSource).toContain('PBS_THRESHOLDS_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('GUEST_THRESHOLDS_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('NODE_THRESHOLDS_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('PBS_THRESHOLDS_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('GUEST_THRESHOLDS_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('GUEST_FILTERING_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('BACKUP_THRESHOLDS_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('SNAPSHOT_THRESHOLDS_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('STORAGE_THRESHOLDS_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('STORAGE_THRESHOLDS_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('PMG_THRESHOLDS_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('PMG_THRESHOLDS_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('AGENT_THRESHOLDS_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('AGENT_DISKS_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('AGENT_DISKS_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('CONTAINER_RUNTIMES_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('CONTAINERS_FILTER_EMPTY_STATE');
- expect(thresholdsTableStateSource).toContain('getAlertThresholdsGuestFilterPresentation');
- expect(thresholdsTableStateSource).toContain('getAlertThresholdsBackupOrphanedPresentation');
- expect(thresholdsTableStateSource).toContain(
- 'getAlertThresholdsDockerIgnoredPrefixesPresentation',
- );
- expect(thresholdsTableSource).not.toContain('No PBS servers configured.');
- expect(thresholdsTableSource).not.toContain('No VMs or containers found.');
- expect(thresholdsTableSource).not.toContain('No nodes match the current filters.');
- expect(thresholdsTableSource).not.toContain('No PBS servers match the current filters.');
- expect(thresholdsTableSource).not.toContain('No VMs or containers match the current filters.');
- expect(thresholdsTableSource).not.toContain('Configure guest filtering rules.');
- expect(thresholdsTableSource).not.toContain('Configure recovery alert thresholds.');
- expect(thresholdsTableSource).not.toContain('Configure snapshot age thresholds.');
- expect(thresholdsTableSource).not.toContain('No storage devices found.');
- expect(thresholdsTableSource).not.toContain('No storage devices match the current filters.');
- expect(thresholdsTableSource).not.toContain('No mail gateways match the current filters.');
- expect(thresholdsTableSource).not.toContain('No agents match the current filters.');
- expect(thresholdsTableSource).not.toContain(
- 'No agent disks found. Agents with mounted filesystems will appear here.',
- );
- expect(thresholdsTableSource).not.toContain('No agent disks match the current filters.');
- expect(thresholdsTableSource).not.toContain('No container runtimes match the current filters.');
- expect(thresholdsTableSource).not.toContain('No containers match the current filters.');
- expect(thresholdsTableSource).not.toContain('Skip metrics for guests starting with:');
- expect(thresholdsTableSource).not.toContain(
- 'Only monitor guests with at least one of these tags (leave empty to disable whitelist):',
- );
- expect(thresholdsTableSource).not.toContain('Ignore guests with any of these tags:');
- expect(thresholdsTableSource).not.toContain(
- 'Alert when backups exist for VMIDs that are no longer in inventory.',
- );
- expect(thresholdsTableSource).not.toContain('Toggle orphaned VM/Container backup alerts');
- expect(thresholdsTableSource).not.toContain(
- 'Containers whose name or ID starts with any prefix below are skipped for container alerts. Enter one prefix per line; matching is case-insensitive.',
- );
- expect(thresholdsTableSource).not.toContain('runner-');
- expect(thresholdsTableSource).not.toContain('100, 200, 10*');
- expect(thresholdsTableSource).not.toContain('Search resources...');
- expect(thresholdsTableSource).not.toContain('Dismiss tips');
- expect(thresholdsTableSource).not.toContain('Quick tips:');
- expect(thresholdsTableSource).not.toContain('Swarm service alerts');
- expect(thresholdsTableSource).not.toContain('Toggle Swarm service replica monitoring');
- expect(thresholdsTableSource).not.toContain('Warning gap %');
- expect(thresholdsTableSource).not.toContain(
- 'Convert to warning when at least this percentage of replicas are missing.',
- );
- expect(thresholdsTableSource).not.toContain('Critical gap %');
- expect(thresholdsTableSource).not.toContain(
- 'Raise a critical alert when the missing replica gap meets or exceeds this value.',
- );
- expect(thresholdsTableSource).not.toContain(
- 'Critical gap must be greater than or equal to the warning gap when enabled.',
- );
- expect(thresholdsTableSource).not.toContain('title="Proxmox Nodes"');
- expect(thresholdsTableSource).not.toContain('title="PBS Servers"');
- expect(thresholdsTableSource).not.toContain('title="VMs & Containers"');
- expect(thresholdsTableSource).not.toContain('title="Guest Filtering"');
- expect(thresholdsTableSource).not.toContain('title="Recovery"');
- expect(thresholdsTableSource).not.toContain('title="Snapshot Age"');
- expect(thresholdsTableSource).not.toContain('title="Storage Devices"');
- expect(thresholdsTableSource).not.toContain('title="Mail Gateway Thresholds"');
- expect(thresholdsTableSource).not.toContain('title="Agents"');
- expect(thresholdsTableSource).not.toContain('title="Agent Disks"');
- expect(thresholdsTableSource).not.toContain('title="Container Runtimes"');
- expect(thresholdsTableSource).not.toContain('title="Containers"');
- expect(alertThresholdsPresentationSource).toContain('export const PBS_THRESHOLDS_EMPTY_STATE');
- expect(alertThresholdsPresentationSource).toContain(
- 'export const GUEST_THRESHOLDS_EMPTY_STATE',
- );
- expect(alertThresholdsPresentationSource).toContain(
- 'export const NODE_THRESHOLDS_FILTER_EMPTY_STATE',
- );
- expect(alertThresholdsPresentationSource).toContain('export const PMG_THRESHOLDS_EMPTY_STATE');
- expect(alertThresholdsPresentationSource).toContain(
- 'export const ALERT_THRESHOLDS_SEARCH_PLACEHOLDER',
- );
- expect(alertThresholdsPresentationSource).toContain(
- 'export function getAlertThresholdsHelpBanner',
- );
- expect(alertThresholdsPresentationSource).toContain(
- 'export function getAlertThresholdsGuestFilterPresentation',
- );
- expect(alertThresholdsPresentationSource).toContain(
- 'export function getAlertThresholdsBackupOrphanedPresentation',
- );
- expect(alertThresholdsPresentationSource).toContain(
- 'export function getAlertThresholdsDockerIgnoredPrefixesPresentation',
- );
- expect(alertThresholdsPresentationSource).toContain(
- 'export function getAlertThresholdsDockerServicePresentation',
- );
- expect(alertThresholdsPresentationSource).toContain(
- 'export function getAlertThresholdsSectionTitles',
- );
- expect(collapsibleSectionSource).toContain('getAlertThresholdsSectionDisabledLabel');
- expect(collapsibleSectionSource).toContain('getAlertThresholdsSectionUnsavedChangesTitle');
- expect(collapsibleSectionSource).not.toContain('>Disabled<');
- expect(collapsibleSectionSource).not.toContain('title="Unsaved changes"');
- expect(alertThresholdsSectionPresentationSource).toContain(
- 'export function getAlertThresholdsSectionDisabledLabel',
- );
- expect(alertThresholdsSectionPresentationSource).toContain(
- 'export function getAlertThresholdsSectionUnsavedChangesTitle',
- );
- });
-
- it('keeps workloads routing on canonical v6 agent query param only', () => {
- expect(resourceLinksSource).toContain("agent: 'agent'");
- expect(resourceLinksSource).not.toContain('LEGACY_WORKLOADS_HOST_QUERY_PARAM');
- expect(resourceLinksSource).not.toContain('canonicalHost || legacyHost');
- });
-
- it('keeps alerts API adapter fully canonical v6', () => {
- expect(alertsApiSource).not.toContain('normalizeAlertConfigFromAPI');
- expect(alertsApiSource).not.toContain('serializeAlertConfigForAPI');
- expect(alertsApiSource).not.toContain('hostDefaults');
- expect(alertsApiSource).not.toContain('disableAllHosts');
- expect(alertsApiSource).not.toContain('timeThresholds.host');
- expect(alertsApiSource).toContain('body: JSON.stringify(config)');
- });
-
- it('keeps license API free of removed legacy exchange surface', () => {
- expect(licenseApiSource).not.toContain('exchangeLicense(');
- expect(licenseApiSource).not.toContain('/exchange');
- expect(licenseApiSource).not.toContain('existing_jwt');
- });
-
- it('keeps monitoring API container-runtime errors on v6 naming', () => {
- expect(monitoringApiSource).toContain('Container runtime not found');
- expect(monitoringApiSource).not.toContain('Docker host not found');
- expect(apiTypesSource).toContain('export interface DockerRuntimeCommand');
- expect(apiTypesSource).not.toContain('export interface DockerHostCommand');
- expect(monitoringApiSource).toContain('deleteDockerRuntime');
- expect(monitoringApiSource).toContain('allowDockerRuntimeReenroll');
- expect(monitoringApiSource).not.toContain('deleteDockerHost');
- expect(monitoringApiSource).not.toContain('allowDockerHostReenroll');
- expect(monitoringApiSource).toContain(
- 'body: JSON.stringify({ agentId, containerId, containerName })',
- );
- expect(monitoringApiSource).not.toContain(
- 'body: JSON.stringify({ hostId, containerId, containerName })',
- );
- expect(monitoringApiSource).toContain('agentId?: string;');
- expect(monitoringApiSource).not.toContain('hostId?: string;');
- expect(monitoringApiSource).toContain('/agents/docker/runtimes/');
- expect(monitoringApiSource).not.toContain('/agents/docker/hosts/');
- });
-
- it('keeps container update actions wired to agentId naming only', () => {
- expect(containerUpdatesSource).toContain('export function syncWithAgentCommand');
- expect(containerUpdatesSource).not.toContain('export const syncWithHostCommand');
- expect(websocketStoreSource).toContain('syncWithAgentCommand(agentId, command as any)');
- expect(websocketStoreSource).not.toContain('syncWithHostCommand(hostId, command as any)');
- expect(websocketStoreSource).toContain('markDockerRuntimesTokenRevoked');
- expect(websocketStoreSource).toContain("markTokenRevoked('dockerRuntimes', tokenId, agentIds)");
- expect(guestRowSource).toContain('agentId={dockerHostId()}');
- expect(guestRowStateSource).toContain('getWorkloadDockerHostId(props.guest)');
- expect(guestRowSource).not.toContain('hostId={dockerHostId()}');
- expect(guestRowStateSource).not.toContain('getWorkloadDockerServerId');
- expect(guestDrawerSource).toContain('agentId={discoveryAgentId()}');
- expect(guestDrawerSource).not.toContain('hostId={discoveryHostId()}');
- });
-
- it('keeps chart API contract on canonical agentData naming', () => {
- expect(chartsApiSource).toContain('agentData?: Record<string, ChartData>');
- expect(chartsApiSource).not.toContain('hostData?: Record<string, ChartData>');
- expect(chartsApiSource).toContain('agents?: number;');
- expect(chartsApiSource).not.toContain('hosts?: number;');
- expect(chartsApiSource).toContain("| 'system-container'");
- expect(chartsApiSource).toContain("| 'app-container'");
- expect(chartsApiSource).not.toContain("| 'container'");
- expect(chartsApiSource).toContain("| 'docker-host'");
- expect(chartsApiSource).not.toContain("| 'dockerHost'");
- expect(chartsApiSource).not.toContain("| 'guest'");
- expect(chartsApiSource).not.toContain("| 'docker'");
- expect(chartsApiSource).not.toContain("case 'truenas'");
- expect(resourcePickerSource).toContain('@/utils/reportableResourceTypes');
- expect(reportableResourceTypesSource).toContain("return 'docker-host';");
- expect(reportableResourceTypesSource).toContain("return 'app-container';");
- expect(reportableResourceTypesSource).not.toContain("return 'dockerHost';");
- expect(reportableResourceTypesSource).not.toContain("return 'dockerContainer';");
- expect(reportableResourceTypesSource).not.toContain("return 'container';");
- });
-
- it('keeps login and SSO settings on provider-based flows only', () => {
- expect(loginSource).not.toContain('Legacy OIDC fallback');
- expect(loginSource).not.toContain('startOidcLogin');
- expect(settingsSource).not.toContain('<OIDCPanel');
- expect(settingsSource).toContain('getSettingsLoadingState');
- expect(settingsSource).not.toContain('Loading settings...');
- expect(settingsSystemPanelsSource).toContain('getSettingsConfigurationLoadingState');
- expect(settingsSystemPanelsSource).not.toContain('Loading configuration...');
- expect(settingsPanelRegistrySource).toContain('createSettingsPanelRegistry');
- expect(settingsPanelRegistrySource).toContain('buildSettingsPanelRegistryContext(params)');
- expect(settingsPanelRegistrySource).not.toContain('getSettingsConfigurationLoadingState');
- expect(settingsShellPresentationSource).toContain('export function getSettingsLoadingState');
- expect(settingsShellPresentationSource).toContain(
- 'export function getSettingsConfigurationLoadingState',
- );
- expect(settingsSource).not.toContain(
- "stateHosts={(state.resources ?? []).filter((r) => r.type === 'host')}",
- );
- expect(infrastructureDiscoveryRuntimeStateSource).toContain(
- '@/utils/infrastructureSettingsPresentation',
- );
- expect(infrastructureDiscoveryRuntimeStateSource).toContain(
- 'getDiscoveryScanStartErrorMessage',
- );
- expect(infrastructureDiscoveryRuntimeStateSource).toContain(
- 'getDiscoverySettingUpdateErrorMessage',
- );
- expect(infrastructureDiscoveryRuntimeStateSource).toContain(
- 'getDiscoverySubnetUpdateErrorMessage',
- );
- expect(infrastructureConfiguredNodesStateSource).toContain(
- 'getNodeTemperatureMonitoringUpdateErrorMessage',
- );
- expect(infrastructureDiscoveryRuntimeStateSource).not.toContain(
- "notificationStore.error('Failed to start discovery scan')",
- );
- expect(infrastructureDiscoveryRuntimeStateSource).not.toContain(
- "notificationStore.error('Failed to update discovery setting')",
- );
- expect(infrastructureDiscoveryRuntimeStateSource).not.toContain(
- "notificationStore.error('Failed to update discovery subnet')",
- );
- expect(infrastructureConfiguredNodesStateSource).not.toContain(
- "notificationStore.error(error instanceof Error ? error.message : 'Failed to update temperature monitoring setting')",
- );
- expect(infrastructureConfiguredNodesStateSource).not.toContain(
- "notificationStore.error(error instanceof Error ? error.message : 'Failed to delete node')",
- );
- expect(infrastructureSettingsStateSource).not.toContain("byType('host')");
- expect(appSource).not.toContain('oidcEnabled');
- expect(appSource).not.toContain('oidcUsername');
- });
-
- it('keeps AI settings/types free of removed legacy autonomous and schedule fields', () => {
- expect(aiTypesSource).not.toContain('autonomous_mode');
- expect(aiTypesSource).not.toContain('patrol_schedule_preset');
- expect(aiSettingsSource).not.toContain('settings_ai_autonomous_mode');
- });
-
- it('keeps unified resource typing normalized to agent (no legacy host type)', () => {
- expect(resourceTypesSource).not.toContain("| 'host' // Standalone host (via agent)");
- expect(unifiedResourcesHookSource).not.toContain("case 'host':");
- expect(unifiedResourcesHookSource).toContain("case 'agent':");
- expect(unifiedResourcesHookSource).toContain("return 'agent';");
- expect(unifiedResourcesHookSource).not.toContain("return 'host';");
- });
-
- it('keeps node link IDs on canonical linkedAgentId only', () => {
- expect(apiTypesSource).toContain('linkedAgentId?: string');
- expect(apiTypesSource).not.toContain('linkedHostAgentId');
- expect(resourceStateAdaptersSource).toContain('const linkedAgentId =');
- expect(resourceStateAdaptersSource).toContain(
- 'asString(platform?.linkedAgentId) || getActionableAgentIdFromResource(resource)',
- );
- expect(resourceStateAdaptersSource).not.toContain('linkedHostAgentId');
- });
-});
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 96209a3186..469f5def43 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -1,1580 +1,87 @@
import { describe, expect, it } from 'vitest';
-import { SELF_HOSTED_PRO_BILLING_PRESENTATION } from '../selfHostedBillingPresentation';
-import { RELAY_SETTINGS_DESCRIPTION } from '@/utils/relayPresentation';
import settingsSource from '../Settings.tsx?raw';
import settingsDialogsSource from '../SettingsDialogs.tsx?raw';
-import settingsShellSource from '../SettingsPageShell.tsx?raw';
+import settingsPageShellSource from '../SettingsPageShell.tsx?raw';
import settingsHeaderMetaSource from '../settingsHeaderMeta.ts?raw';
-import connectionsTableSource from '../ConnectionsTable.tsx?raw';
-import connectionsTableModelSource from '../connectionsTableModel.ts?raw';
+import settingsNavigationHookSource from '../useSettingsNavigation.ts?raw';
import infrastructureWorkspaceSource from '../InfrastructureWorkspace.tsx?raw';
import infrastructureWorkspaceModelSource from '../infrastructureWorkspaceModel.ts?raw';
-import platformConnectionsWorkspaceSource from '../PlatformConnectionsWorkspace.tsx?raw';
-import platformConnectionsModelSource from '../platformConnectionsModel.ts?raw';
-import infrastructureInstallerSectionSource from '../InfrastructureInstallerSection.tsx?raw';
-import infrastructureOperationsControllerSource from '../InfrastructureOperationsController.tsx?raw';
-import infrastructureOperationsModelSource from '../infrastructureOperationsModel.tsx?raw';
-import trueNASSettingsPanelSource from '../TrueNASSettingsPanel.tsx?raw';
-import vmwareSettingsPanelSource from '../VMwareSettingsPanel.tsx?raw';
-import infrastructureInventorySectionSource from '../InfrastructureInventorySection.tsx?raw';
-import infrastructureActiveRowDetailsSource from '../InfrastructureActiveRowDetails.tsx?raw';
-import infrastructureIgnoredRowDetailsSource from '../InfrastructureIgnoredRowDetails.tsx?raw';
-import infrastructureStopMonitoringDialogSource from '../InfrastructureStopMonitoringDialog.tsx?raw';
-import nodeModalAuthenticationSectionSource from '../NodeModalAuthenticationSection.tsx?raw';
-import nodeModalBasicInfoSectionSource from '../NodeModalBasicInfoSection.tsx?raw';
-import nodeModalModelSource from '../nodeModalModel.ts?raw';
-import nodeModalMonitoringSectionSource from '../NodeModalMonitoringSection.tsx?raw';
-import nodeModalSetupGuideSectionSource from '../NodeModalSetupGuideSection.tsx?raw';
-import nodeModalStatusFooterSource from '../NodeModalStatusFooter.tsx?raw';
-import nodeModalSource from '../NodeModal.tsx?raw';
-import infrastructureInstallStateSource from '../useInfrastructureInstallState.tsx?raw';
-import infrastructureOperationsStateSource from '../useInfrastructureOperationsState.tsx?raw';
-import infrastructureReportingStateSource from '../useInfrastructureReportingState.tsx?raw';
-import trueNASSettingsStateSource from '../useTrueNASSettingsPanelState.ts?raw';
-import vmwareSettingsStateSource from '../useVMwareSettingsPanelState.ts?raw';
-import infrastructureSettingsStateSource from '../useInfrastructureSettingsState.ts?raw';
-import infrastructureSettingsModelSource from '../infrastructureSettingsModel.ts?raw';
-import infrastructureConfiguredNodesStateSource from '../useInfrastructureConfiguredNodesState.ts?raw';
-import infrastructureDiscoveryRuntimeStateSource from '../useInfrastructureDiscoveryRuntimeState.ts?raw';
-import settingsNavigationModelSource from '../settingsNavigationModel.ts?raw';
-import settingsRoutingSource from '../settingsRouting.ts?raw';
-import settingsTypesSource from '../settingsTypes.ts?raw';
-import settingsNavCatalogSource from '../settingsNavCatalog.ts?raw';
-import selfHostedBillingPresentationSource from '../selfHostedBillingPresentation.ts?raw';
-import settingsNavVisibilitySource from '../settingsNavVisibility.ts?raw';
-import settingsInfrastructurePanelPropsSource from '../useSettingsInfrastructurePanelProps.ts?raw';
-import settingsNavigationHookSource from '../useSettingsNavigation.ts?raw';
-import settingsShellStateSource from '../useSettingsShellState.ts?raw';
-import nodeModalStateSource from '../useNodeModalState.ts?raw';
-import settingsPanelRegistryContextSource from '../settingsPanelRegistryContext.tsx?raw';
-import settingsPanelRegistryLoadersSource from '../settingsPanelRegistryLoaders.ts?raw';
-import settingsTabSaveBehaviorSource from '../settingsTabSaveBehavior.ts?raw';
-import settingsPanelRegistryHookSource from '../useSettingsPanelRegistry.tsx?raw';
-import settingsSystemPanelsSource from '../useSettingsSystemPanels.tsx?raw';
-import { getSettingsNavItem } from '../settingsNavCatalog';
-import apiAccessPanelSource from '../APIAccessPanel.tsx?raw';
-import apiTokenManagerSource from '../APITokenManager.tsx?raw';
-import apiTokenManagerModelSource from '../apiTokenManagerModel.ts?raw';
-import apiTokenManagerStateSource from '../useAPITokenManagerState.ts?raw';
-import auditLogPanelSource from '../AuditLogPanel.tsx?raw';
-import auditLogStateSource from '../useAuditLogPanelState.ts?raw';
-import auditWebhookPanelSource from '../AuditWebhookPanel.tsx?raw';
-import auditWebhookStateSource from '../useAuditWebhookPanelState.ts?raw';
-import billingAdminOrganizationsTableSource from '../BillingAdminOrganizationsTable.tsx?raw';
-import billingAdminPanelSource from '../BillingAdminPanel.tsx?raw';
-import billingAdminPanelStateSource from '../useBillingAdminPanelState.ts?raw';
-import generalSettingsPanelSource from '../GeneralSettingsPanel.tsx?raw';
-import docsLinksSource from '@/utils/docsLinks.ts?raw';
-import aiSettingsPanelSource from '../AISettings.tsx?raw';
-import aiChatMaintenanceSectionSource from '../AIChatMaintenanceSection.tsx?raw';
-import aiProviderConfigurationSectionSource from '../AIProviderConfigurationSection.tsx?raw';
-import aiSettingsDialogsSource from '../AISettingsDialogs.tsx?raw';
-import aiModelSelectionSectionSource from '../AIModelSelectionSection.tsx?raw';
-import aiSettingsModelSource from '../aiSettingsModel.ts?raw';
-import aiRuntimeControlsSectionSource from '../AIRuntimeControlsSection.tsx?raw';
-import aiSettingsStatusAndActionsSource from '../AISettingsStatusAndActions.tsx?raw';
-import aiSettingsStateSource from '../useAISettingsState.ts?raw';
-import aiRuntimeStateSource from '@/stores/aiRuntimeState.ts?raw';
-import diagnosticsModelSource from '../diagnosticsModel.ts?raw';
-import diagnosticsPanelSource from '../DiagnosticsPanel.tsx?raw';
-import diagnosticsResultsPanelSource from '../DiagnosticsResultsPanel.tsx?raw';
-import operationsPanelSource from '../OperationsPanel.tsx?raw';
-import networkBoundarySettingsSectionSource from '../NetworkBoundarySettingsSection.tsx?raw';
-import networkDiscoverySectionSource from '../NetworkDiscoverySection.tsx?raw';
-import networkSettingsPanelSource from '../NetworkSettingsPanel.tsx?raw';
-import networkSettingsModelSource from '../networkSettingsModel.ts?raw';
-import copyCommandBlockSource from '../CopyCommandBlock.tsx?raw';
-import updateInstallGuideSource from '../UpdateInstallGuide.tsx?raw';
-import updatesSettingsModelSource from '../updatesSettingsModel.ts?raw';
-import updatesSettingsPanelSource from '../UpdatesSettingsPanel.tsx?raw';
-import recoverySettingsPanelSource from '../RecoverySettingsPanel.tsx?raw';
-import systemSettingsStateSource from '../useSystemSettingsState.ts?raw';
-import relaySettingsPanelSource from '../RelaySettingsPanel.tsx?raw';
-import relayPairingSectionSource from '../RelayPairingSection.tsx?raw';
-import monitoredSystemLedgerPanelSource from '../MonitoredSystemLedgerPanel.tsx?raw';
-import proLicensePanelSource from '../ProLicensePanel.tsx?raw';
-import monitoredSystemDefinitionDisclosureSource from '@/components/Commercial/MonitoredSystemDefinitionDisclosure.tsx?raw';
-import proLicensePlanSectionSource from '../ProLicensePlanSection.tsx?raw';
-import commercialBillingSectionsSource from '../CommercialBillingSections.tsx?raw';
-import selfHostedCommercialRecoverySectionSource from '../SelfHostedCommercialRecoverySection.tsx?raw';
-import commercialBillingModelSource from '@/utils/commercialBillingModel.ts?raw';
-import monitoredSystemPresentationSource from '@/utils/monitoredSystemPresentation.ts?raw';
-import relaySettingsPanelStateSource from '../useRelaySettingsPanelState.ts?raw';
-import proLicensePanelStateSource from '../useProLicensePanelState.ts?raw';
-import organizationOverviewPanelSource from '../OrganizationOverviewPanel.tsx?raw';
-import organizationOverviewLoadingStateSource from '../OrganizationOverviewLoadingState.tsx?raw';
-import organizationOverviewDetailsSectionSource from '../OrganizationOverviewDetailsSection.tsx?raw';
-import organizationOverviewMembersSectionSource from '../OrganizationOverviewMembersSection.tsx?raw';
-import organizationAccessPanelSource from '../OrganizationAccessPanel.tsx?raw';
-import organizationAccessLoadingStateSource from '../OrganizationAccessLoadingState.tsx?raw';
-import organizationAccessManagementSectionSource from '../OrganizationAccessManagementSection.tsx?raw';
-import organizationAccessMembersSectionSource from '../OrganizationAccessMembersSection.tsx?raw';
-import organizationSharingPanelSource from '../OrganizationSharingPanel.tsx?raw';
-import organizationSharingCreateSectionSource from '../OrganizationSharingCreateSection.tsx?raw';
-import organizationSharingLoadingStateSource from '../OrganizationSharingLoadingState.tsx?raw';
-import organizationOutgoingSharesSectionSource from '../OrganizationOutgoingSharesSection.tsx?raw';
-import organizationIncomingSharesSectionSource from '../OrganizationIncomingSharesSection.tsx?raw';
-import organizationAccessStateSource from '../useOrganizationAccessPanelState.ts?raw';
-import organizationOverviewStateSource from '../useOrganizationOverviewPanelState.ts?raw';
-import organizationSharingStateSource from '../useOrganizationSharingPanelState.ts?raw';
-import organizationBillingLoadingStateSource from '../OrganizationBillingLoadingState.tsx?raw';
-import organizationBillingPanelSource from '../OrganizationBillingPanel.tsx?raw';
-import organizationBillingStateSource from '../useOrganizationBillingPanelState.ts?raw';
-import proxmoxDeleteNodeDialogSource from '../ProxmoxDeleteNodeDialog.tsx?raw';
-import proxmoxConfiguredNodesTableSource from '../ProxmoxConfiguredNodesTable.tsx?raw';
-import proxmoxDirectWorkspaceSource from '../ProxmoxDirectWorkspace.tsx?raw';
-import proxmoxDirectConnectionsCardSource from '../ProxmoxDirectConnectionsCard.tsx?raw';
-import proxmoxDiscoveryResultsCardSource from '../ProxmoxDiscoveryResultsCard.tsx?raw';
-import proxmoxNodeModalStackSource from '../ProxmoxNodeModalStack.tsx?raw';
-import proxmoxSettingsModelSource from '../proxmoxSettingsModel.ts?raw';
-import proxmoxSettingsPanelSource from '../ProxmoxSettingsPanel.tsx?raw';
-import proxmoxDirectWorkspaceStateSource from '../useProxmoxDirectWorkspaceState.ts?raw';
-import securityOverviewPanelSource from '../SecurityOverviewPanel.tsx?raw';
-import securityAuthPanelSource from '../SecurityAuthPanel.tsx?raw';
-import ssoProvidersPanelSource from '../SSOProvidersPanel.tsx?raw';
-import ssoProvidersStateSource from '../useSSOProvidersState.ts?raw';
-import ssoProvidersModelSource from '../ssoProvidersModel.ts?raw';
-import ssoProviderPresentationSource from '@/utils/ssoProviderPresentation.ts?raw';
-import systemSettingsPresentationSource from '@/utils/systemSettingsPresentation.ts?raw';
-import updatesPresentationSource from '@/utils/updatesPresentation.ts?raw';
-import diagnosticsStateSource from '../useDiagnosticsPanelState.ts?raw';
-import reportingCatalogModelSource from '../reportingCatalogModel.ts?raw';
-import reportingPanelModelSource from '../reportingPanelModel.ts?raw';
-import reportingInventoryExportModelSource from '../reportingInventoryExportModel.ts?raw';
-import reportingPanelSource from '../ReportingPanel.tsx?raw';
-import reportingPanelStateSource from '../useReportingPanelState.ts?raw';
-import systemLogsPanelSource from '../SystemLogsPanel.tsx?raw';
-import systemLogsPanelStateSource from '../useSystemLogsPanelState.ts?raw';
-import rbacFeatureGateSectionSource from '../RBACFeatureGateSection.tsx?raw';
-import rbacFeatureGateStateSource from '../useRBACFeatureGateState.ts?raw';
-import rolesPanelSource from '../RolesPanel.tsx?raw';
-import rolesEditorDialogSource from '../RolesEditorDialog.tsx?raw';
-import rolesPanelStateSource from '../useRolesPanelState.ts?raw';
-import userAssignmentsPanelSource from '../UserAssignmentsPanel.tsx?raw';
-import userAssignmentsDialogSource from '../UserAssignmentsDialog.tsx?raw';
-import userAssignmentsPanelStateSource from '../useUserAssignmentsPanelState.ts?raw';
-import { SETTINGS_HEADER_META } from '../settingsHeaderMeta';
-
-const normalizedGeneralSettingsPanelSource = generalSettingsPanelSource.replace(/\s+/g, ' ');
-
-const extractedModules = [
- '../settingsNavigationModel.ts',
- '../settingsRouting.ts',
- '../settingsNavCatalog.ts',
- '../settingsNavVisibility.ts',
- '../settingsTabSaveBehavior.ts',
- '../settingsTypes.ts',
- '../DockerRuntimeSettingsCard.tsx',
- '../settingsHeaderMeta.ts',
- '../settingsFeatureGates.ts',
- '../BackupTransferDialogs.tsx',
- '../InfrastructureOperationsController.tsx',
- '../infrastructureOperationsModel.tsx',
- '../PlatformConnectionsWorkspace.tsx',
- '../platformConnectionsModel.ts',
- '../TrueNASSettingsPanel.tsx',
- '../VMwareSettingsPanel.tsx',
- '../useInfrastructureInstallState.tsx',
- '../useInfrastructureOperationsState.tsx',
- '../useInfrastructureReportingState.tsx',
- '../useTrueNASSettingsPanelState.ts',
- '../useVMwareSettingsPanelState.ts',
- '../infrastructureSettingsModel.ts',
- '../useInfrastructureConfiguredNodesState.ts',
- '../useInfrastructureDiscoveryRuntimeState.ts',
- '../useSettingsInfrastructurePanelProps.ts',
- '../settingsPanelRegistryContext.tsx',
- '../settingsPanelRegistryLoaders.ts',
- '../apiTokenManagerModel.ts',
- '../useAPITokenManagerState.ts',
- '../useAuditLogPanelState.ts',
- '../useAuditWebhookPanelState.ts',
- '../BillingAdminOrganizationsTable.tsx',
- '../useBillingAdminPanelState.ts',
- '../NodeModalAuthenticationSection.tsx',
- '../NodeModalBasicInfoSection.tsx',
- '../NodeModalMonitoringSection.tsx',
- '../NodeModalSetupGuideSection.tsx',
- '../NodeModalStatusFooter.tsx',
- '../NodeModal.tsx',
- '../nodeModalModel.ts',
- '../useNodeModalState.ts',
- '../InfrastructureWorkspace.tsx',
- '../ConnectionsTable.tsx',
- '../connectionsTableModel.ts',
- '../infrastructureWorkspaceModel.ts',
- '../InfrastructureInstallerSection.tsx',
- '../InfrastructureInventorySection.tsx',
- '../InfrastructureActiveRowDetails.tsx',
- '../InfrastructureIgnoredRowDetails.tsx',
- '../InfrastructureStopMonitoringDialog.tsx',
- '../AIProviderConfigurationSection.tsx',
- '../AISettingsDialogs.tsx',
- '../AIChatMaintenanceSection.tsx',
- '../AIModelSelectionSection.tsx',
- '../AIRuntimeControlsSection.tsx',
- '../AISettingsStatusAndActions.tsx',
- '../aiSettingsModel.ts',
- '../useAISettingsState.ts',
- '../diagnosticsModel.ts',
- '../DiagnosticsPanel.tsx',
- '../DiagnosticsResultsPanel.tsx',
- '../OperationsPanel.tsx',
- '../NetworkBoundarySettingsSection.tsx',
- '../NetworkDiscoverySection.tsx',
- '../networkSettingsModel.ts',
- '../CopyCommandBlock.tsx',
- '../UpdateInstallGuide.tsx',
- '../ReportingPanel.tsx',
- '../reportingPanelModel.ts',
- '../reportingInventoryExportModel.ts',
- '../ProLicensePlanSection.tsx',
- '../RelayPairingSection.tsx',
- '../OrganizationOverviewLoadingState.tsx',
- '../OrganizationOverviewDetailsSection.tsx',
- '../OrganizationOverviewMembersSection.tsx',
- '../OrganizationAccessLoadingState.tsx',
- '../OrganizationAccessManagementSection.tsx',
- '../OrganizationAccessMembersSection.tsx',
- '../OrganizationSharingCreateSection.tsx',
- '../OrganizationSharingLoadingState.tsx',
- '../OrganizationOutgoingSharesSection.tsx',
- '../OrganizationIncomingSharesSection.tsx',
- '../OrganizationBillingLoadingState.tsx',
- '../useOrganizationAccessPanelState.ts',
- '../useOrganizationBillingPanelState.ts',
- '../useOrganizationOverviewPanelState.ts',
- '../useOrganizationSharingPanelState.ts',
- '../RBACFeatureGateSection.tsx',
- '../RolesEditorDialog.tsx',
- '../useRBACFeatureGateState.ts',
- '../useRolesPanelState.ts',
- '../UserAssignmentsDialog.tsx',
- '../useUserAssignmentsPanelState.ts',
- '../updatesSettingsModel.ts',
- '../useProLicensePanelState.ts',
- '../useRelaySettingsPanelState.ts',
- '../useDiagnosticsPanelState.ts',
- '../useReportingPanelState.ts',
- '../useSystemLogsPanelState.ts',
- '../useSSOProvidersState.ts',
- '../ssoProvidersModel.ts',
- '../ProxmoxSettingsPanel.tsx',
- '../ProxmoxDirectWorkspace.tsx',
- '../ProxmoxConfiguredNodesTable.tsx',
- '../ProxmoxDeleteNodeDialog.tsx',
- '../ProxmoxDirectConnectionsCard.tsx',
- '../ProxmoxDiscoveryResultsCard.tsx',
- '../ProxmoxNodeModalStack.tsx',
- '../proxmoxSettingsModel.ts',
- '../useProxmoxDirectWorkspaceState.ts',
- '../SettingsDialogs.tsx',
- '../SettingsPageShell.tsx',
- '../useDiscoverySettingsState.ts',
- '../useSettingsAccess.ts',
- '../useSettingsShellState.ts',
- '../useSettingsNavigation.ts',
- '../useSettingsPanelRegistry.tsx',
- '../useSettingsSystemPanels.tsx',
- '../useSystemSettingsState.ts',
- '../useInfrastructureSettingsState.ts',
- '../useBackupTransferFlow.ts',
- '../settingsPanelRegistry.ts',
-] as const;
-
-const requiredImportSources = [
- './settingsTabSaveBehavior',
- './SettingsDialogs',
- './SettingsPageShell',
- './useBackupTransferFlow',
- './useDiscoverySettingsState',
- './useInfrastructureSettingsState',
- './useSettingsInfrastructurePanelProps',
- './useSettingsAccess',
- './useSettingsPanelRegistry',
- './useSettingsShellState',
- './useSettingsSystemPanels',
- './useSystemSettingsState',
- './useSettingsNavigation',
-] as const;
-
-const topLevelSettingsPanelSources = {
- APIAccessPanel: apiAccessPanelSource,
- AuditLogPanel: auditLogPanelSource,
- AuditWebhookPanel: auditWebhookPanelSource,
- BillingAdminPanel: billingAdminPanelSource,
- GeneralSettingsPanel: generalSettingsPanelSource,
- AISettings: aiSettingsPanelSource,
- InfrastructureWorkspace: infrastructureWorkspaceSource,
- NetworkSettingsPanel: networkSettingsPanelSource,
- UpdatesSettingsPanel: updatesSettingsPanelSource,
- RecoverySettingsPanel: recoverySettingsPanelSource,
- RelaySettingsPanel: relaySettingsPanelSource,
- ProLicensePanel: proLicensePanelSource,
- OrganizationOverviewPanel: organizationOverviewPanelSource,
- OrganizationAccessPanel: organizationAccessPanelSource,
- OrganizationSharingPanel: organizationSharingPanelSource,
- OrganizationBillingPanel: organizationBillingPanelSource,
- SecurityOverviewPanel: securityOverviewPanelSource,
- SecurityAuthPanel: securityAuthPanelSource,
- SSOProvidersPanel: ssoProvidersPanelSource,
- RolesPanel: rolesPanelSource,
- UserAssignmentsPanel: userAssignmentsPanelSource,
-} as const;
+import connectionEditorSource from '../ConnectionEditor/ConnectionEditor.tsx?raw';
+import addressProbeStepSource from '../ConnectionEditor/AddressProbeStep.tsx?raw';
+import connectionEditorStateSource from '../ConnectionEditor/useConnectionEditor.ts?raw';
+import nodeCredentialSlotSource from '../ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx?raw';
-const canonicalShellTitleExpectations = [
- {
- tab: 'api',
- title: 'API Access',
- source: apiAccessPanelSource,
- },
- {
- tab: 'system-general',
- title: 'General',
- source: generalSettingsPanelSource,
- },
- {
- tab: 'system-network',
- title: 'Network',
- source: networkSettingsPanelSource,
- },
- {
- tab: 'system-updates',
- title: 'Updates',
- source: updatesSettingsPanelSource,
- },
- {
- tab: 'system-recovery',
- title: 'Recovery',
- source: recoverySettingsPanelSource,
- },
- {
- tab: 'system-ai',
- title: 'Assistant & Patrol',
- source: aiSettingsPanelSource,
- },
- {
- tab: 'system-billing',
- title: SELF_HOSTED_PRO_BILLING_PRESENTATION.shellTitle,
- source: proLicensePanelSource,
- },
- {
- tab: 'organization-billing',
- title: 'Billing & Usage',
- source: organizationBillingPanelSource,
- },
- {
- tab: 'security-overview',
- title: 'Security Overview',
- source: securityOverviewPanelSource,
- },
- {
- tab: 'security-auth',
- title: 'Authentication',
- source: securityAuthPanelSource,
- },
- {
- tab: 'security-sso',
- title: 'Single Sign-On Providers',
- source: ssoProvidersPanelSource,
- },
- {
- tab: 'security-audit',
- title: 'Audit Log',
- source: auditLogPanelSource,
- },
- {
- tab: 'security-webhooks',
- title: 'Audit Webhooks',
- source: auditWebhookPanelSource,
- },
-] as const;
+describe('settings architecture guardrails', () => {
+ it('keeps Settings on the canonical page shell boundary', () => {
+ expect(settingsSource).toContain("import { SettingsDialogs } from './SettingsDialogs';");
+ expect(settingsSource).toContain("import { SettingsPageShell } from './SettingsPageShell';");
+ expect(settingsSource).toContain('const {');
+ expect(settingsSource).toContain('useSettingsNavigation({');
+ expect(settingsSource).toContain('<SettingsPageShell');
+ expect(settingsSource).toContain('<SettingsDialogs');
+ expect(settingsSource).not.toContain('<PageHeader');
-describe('Settings architecture guardrails', () => {
- it('keeps the primary AI settings toggle explicitly addressable and runtime-backed', () => {
- expect(aiSettingsPanelSource).toContain('ariaLabel="Enable Assistant and Patrol"');
- expect(aiSettingsPanelSource).toContain('await state.handleEnableRequest(newValue)');
- });
-
- it('keeps shell-level runtime hooks on the shared app runtime context', () => {
- expect(settingsSource).toContain("from '@/contexts/appRuntime'");
- expect(settingsSource).not.toContain("from '@/App'");
- expect(apiTokenManagerStateSource).toContain("from '@/contexts/appRuntime'");
- expect(apiTokenManagerStateSource).not.toContain("from '@/App'");
- expect(infrastructureReportingStateSource).toContain("from '@/contexts/appRuntime'");
- expect(infrastructureReportingStateSource).not.toContain("from '@/App'");
- });
-
- it('keeps extracted settings modules present on disk', () => {
- const settingsModuleFiles = {
- ...import.meta.glob('../*.ts'),
- ...import.meta.glob('../*.tsx'),
- };
-
- for (const modulePath of extractedModules) {
- expect(
- Object.prototype.hasOwnProperty.call(settingsModuleFiles, modulePath),
- `${modulePath} should exist and remain externalized`,
- ).toBe(true);
- }
- });
-
- it('imports extracted architecture modules from Settings.tsx', () => {
- const importSources = Array.from(
- settingsSource.matchAll(/import[\s\S]*?from\s+['"]([^'"]+)['"];?/g),
- (match) => match[1],
+ expect(settingsPageShellSource).toContain('import { PageHeader } from');
+ expect(settingsPageShellSource).toContain(
+ '<PageHeader title={props.headerMeta().title} description={props.headerMeta().description} />',
);
-
- for (const source of requiredImportSources) {
- expect(importSources, `Settings.tsx should import ${source}`).toContain(source);
- }
+ expect(settingsDialogsSource).toContain('export const SettingsDialogs');
});
- it('routes dispatchable settings tabs through the extracted panel registry', async () => {
- const registrySource = (await import('../settingsPanelRegistry.ts?raw')).default;
- const accessHookSource = (await import('../useSettingsAccess.ts?raw')).default;
- const panelRegistryHookSource = (await import('../useSettingsPanelRegistry.tsx?raw')).default;
- const shellHookSource = (await import('../useSettingsShellState.ts?raw')).default;
-
- expect(registrySource).toContain('createSettingsPanelRegistry');
- expect(registrySource).toContain('SETTINGS_PANEL_REGISTRY_LOADERS');
- expect(registrySource).toContain("'security-webhooks'");
- expect(accessHookSource).toContain('shouldHideSettingsNavItem');
- expect(accessHookSource).toContain('SETTINGS_NAV_GROUPS');
- expect(accessHookSource).toContain('./settingsNavCatalog');
- expect(accessHookSource).toContain('./settingsNavVisibility');
- expect(accessHookSource).toContain('tabFeatureRequirements');
- expect(panelRegistryHookSource).toContain('createSettingsPanelRegistry');
- expect(panelRegistryHookSource).toContain('buildSettingsPanelRegistryContext');
- expect(settingsPanelRegistryLoadersSource).toContain(
- 'export const SETTINGS_PANEL_REGISTRY_LOADERS',
- );
- expect(settingsPanelRegistryLoadersSource).toContain("import('./InfrastructureWorkspace')");
- expect(shellHookSource).toContain('SETTINGS_HEADER_META');
- expect(settingsSource).toContain('useSettingsPanelRegistry');
- expect(settingsSource).toContain('useSettingsAccess');
- expect(settingsSource).toContain('useSettingsShellState');
- expect(settingsSource).toContain('getSettingsTabSaveBehavior');
- expect(settingsSource).toContain('activeSettingsPanelEntry');
- expect(settingsSource).toContain('<Dynamic component={entry().component}');
- expect(settingsSource).not.toContain('<ProxmoxSettingsPanel');
- expect(settingsSource).not.toContain("<Show when={activeTab() === 'system-general'}>");
- expect(settingsSource).not.toContain("<Show when={activeTab() === 'security-webhooks'}>");
- });
+ it('keeps infrastructure onboarding route-backed under the shared settings shell', () => {
+ expect(settingsHeaderMetaSource).toContain("'infrastructure-systems': {");
+ expect(settingsHeaderMetaSource).toContain('Review monitored systems in one ledger');
- it('keeps settings shell panel assembly split between dedicated system and registry owners', () => {
- expect(settingsSource).toContain('useSettingsSystemPanels');
- expect(settingsSource).toContain('useSettingsInfrastructurePanelProps');
- expect(settingsSource).toContain('./settingsTabSaveBehavior');
- expect(settingsSource).toContain('const systemPanels = useSettingsSystemPanels({');
- expect(settingsSource).toContain(
- 'const infrastructurePanelProps = useSettingsInfrastructurePanelProps({',
- );
- expect(settingsSource).toContain('const settingsPanelRegistry = useSettingsPanelRegistry({');
- expect(settingsSource).toContain('systemPanels,');
- expect(settingsSource).toContain('const discoverySettings = useDiscoverySettingsState()');
- expect(settingsSource).not.toContain('getInfrastructurePanelProps: () => ({');
- expect(settingsSystemPanelsSource).toContain('GeneralSettingsPanel');
- expect(settingsSystemPanelsSource).toContain('getSettingsConfigurationLoadingState');
- expect(settingsSystemPanelsSource).toContain('getNetworkPanelProps');
- expect(settingsSystemPanelsSource).toContain('getUpdatesPanelProps');
- expect(settingsSystemPanelsSource).toContain('getRecoveryPanelProps');
- expect(settingsSystemPanelsSource).toContain('pvePollingInterval:');
- expect(settingsSystemPanelsSource).toContain('allowedOrigins:');
- expect(settingsSystemPanelsSource).toContain('backupPollingEnabled:');
- expect(settingsSystemPanelsSource).toContain('handleDiscoveryEnabledChange:');
- expect(settingsPanelRegistryHookSource).toContain('buildSettingsPanelRegistryContext');
- expect(settingsPanelRegistryContextSource).toContain('systemPanels: SettingsSystemPanels');
- expect(settingsPanelRegistryContextSource).toContain(
- 'systemGeneralPanel: params.systemPanels.systemGeneralPanel',
+ expect(settingsNavigationHookSource).toContain('deriveAddStepFromLegacyPath(path)');
+ expect(settingsNavigationHookSource).toContain(
+ 'navigate(buildInfrastructureOnboardingPath(infrastructureOnboardingStep), {',
);
- expect(settingsPanelRegistryContextSource).toContain(
- 'getNetworkPanelProps: params.systemPanels.getNetworkPanelProps',
- );
- expect(settingsPanelRegistryContextSource).toContain(
- 'getUpdatesPanelProps: params.systemPanels.getUpdatesPanelProps',
- );
- expect(settingsPanelRegistryContextSource).toContain(
- 'getRecoveryPanelProps: params.systemPanels.getRecoveryPanelProps',
- );
- expect(settingsPanelRegistryContextSource).toContain('const systemAiPanel: Component');
- expect(settingsPanelRegistryContextSource).toContain('const securitySsoPanel: Component');
- expect(settingsPanelRegistryHookSource).not.toContain('pvePollingInterval: params.');
- expect(settingsPanelRegistryHookSource).not.toContain('allowedOrigins: params.');
- expect(settingsPanelRegistryHookSource).not.toContain('backupPollingEnabled: params.');
- expect(settingsInfrastructurePanelPropsSource).toContain('pbsInstanceFromResource');
- expect(settingsInfrastructurePanelPropsSource).toContain('pmgInstanceFromResource');
- expect(settingsInfrastructurePanelPropsSource).toContain(
- 'const agentStateResources = createMemo',
- );
- expect(settingsInfrastructurePanelPropsSource).toContain('getInfrastructurePanelProps');
- expect(settingsNavigationModelSource).toContain('export type SettingsTab =');
- expect(settingsNavigationModelSource).toContain('export const DEFAULT_SETTINGS_TAB');
- expect(settingsNavigationModelSource).toContain('export function resolveCanonicalSettingsPath');
- expect(settingsNavigationModelSource).toContain('export function isProxmoxSettingsPath');
- expect(settingsNavigationModelSource).toContain('export function settingsTabPath');
- expect(settingsNavigationModelSource).toContain("case 'infrastructure-systems':");
- expect(settingsNavigationModelSource).toContain('return INFRASTRUCTURE_SYSTEMS_PREFIX;');
- expect(settingsNavigationModelSource).toContain('SELF_HOSTED_PRO_BILLING_PLAN_ROUTE');
- expect(settingsNavigationHookSource).toContain('deriveTabFromPath');
- expect(settingsNavigationHookSource).toContain('isProxmoxSettingsPath');
- expect(settingsNavigationHookSource).toContain('resolveCanonicalSettingsPath');
- expect(settingsNavigationHookSource).toContain('resolveCanonicalSelfHostedBillingHref');
- expect(settingsNavigationHookSource).toContain('settingsTabPath');
- expect(settingsNavigationHookSource).toContain('presentationPolicyIsReadOnly');
- expect(settingsNavigationHookSource).toContain('buildInfrastructureWorkspacePath');
- expect(settingsNavigationModelSource).toContain('hideFromSidebar?: boolean;');
- expect(settingsRoutingSource).toContain("from './settingsNavigationModel'");
- expect(settingsTypesSource).toContain("from './settingsNavigationModel'");
- expect(settingsDialogsSource).toContain('UpdateConfirmationModal');
- expect(settingsDialogsSource).toContain('BackupTransferDialogs');
- expect(settingsDialogsSource).toContain('ChangePasswordModal');
- expect(settingsShellStateSource).toContain('SETTINGS_HEADER_META');
- expect(settingsShellStateSource).toContain('sidebarCollapsed');
- expect(settingsShellStateSource).toContain('showPasswordModal');
- expect(settingsNavCatalogSource).toContain('export const SETTINGS_NAV_GROUPS');
- expect(settingsNavCatalogSource).toContain('export function getSettingsNavItem');
- expect(settingsNavCatalogSource).toContain('./selfHostedBillingPresentation');
- expect(settingsNavCatalogSource).toContain('SELF_HOSTED_PRO_BILLING_PRESENTATION.shellTitle');
- expect(settingsNavCatalogSource).not.toContain("label: 'Pulse Pro'");
- expect(settingsNavVisibilitySource).toContain('export function shouldHideSettingsNavItem');
- expect(settingsNavVisibilitySource).toContain('export function isSettingsNavItemLocked');
- expect(settingsTabSaveBehaviorSource).toContain('getSettingsNavItem(tab)?.saveBehavior');
- });
-
- it('keeps commercial plan and usage sections on a shared billing owner', () => {
- expect(commercialBillingSectionsSource).toContain('export const CommercialSection');
- expect(commercialBillingSectionsSource).toContain('export const CommercialStatGrid');
- expect(commercialBillingSectionsSource).toContain('export const CommercialUsageMeters');
- expect(commercialBillingSectionsSource).toContain('export const CommercialBillingShell');
- expect(commercialBillingModelSource).toContain('buildSelfHostedCommercialPlanModel');
- expect(commercialBillingModelSource).toContain('buildHostedCommercialPlanModel');
- expect(commercialBillingModelSource).toContain('buildHostedCommercialUsageModel');
- expect(proLicensePanelSource).toContain('./CommercialBillingSections');
- expect(proLicensePanelSource).toContain('./useProLicensePanelState');
- expect(proLicensePanelSource).toContain('./ProLicensePlanSection');
- expect(proLicensePanelSource).toContain('SelfHostedCommercialRecoverySection');
- expect(proLicensePanelSource).toContain('MonitoredSystemLedgerPanel');
- expect(proLicensePanelSource).toContain('CommercialBillingShell');
- expect(proLicensePanelSource).toContain('CommercialSection');
- expect(proLicensePanelSource).not.toContain('createSignal(');
- expect(proLicensePanelSource).not.toContain('useLocation()');
- expect(monitoredSystemLedgerPanelSource).toContain('@/utils/monitoredSystemPresentation');
- expect(monitoredSystemLedgerPanelSource).toContain('getMonitoredSystemLedgerPresentation');
- expect(monitoredSystemLedgerPanelSource).toContain(
- 'getMonitoredSystemCountingDetailsToggleLabel',
- );
- expect(monitoredSystemLedgerPanelSource).not.toContain('No monitored systems counted.');
- expect(monitoredSystemLedgerPanelSource).not.toContain('Current status');
- expect(monitoredSystemLedgerPanelSource).toContain('getMonitoredSystemLedgerDescription');
- expect(proLicensePanelSource).toContain('@/utils/monitoredSystemPresentation');
- expect(proLicensePanelSource).toContain('getMonitoredSystemBriefSummary');
- expect(monitoredSystemDefinitionDisclosureSource).toContain(
- '@/utils/monitoredSystemPresentation',
- );
- expect(monitoredSystemDefinitionDisclosureSource).toContain('getMonitoredSystemBriefSummary');
- expect(monitoredSystemDefinitionDisclosureSource).toContain(
- 'getMonitoredSystemDisclosureToggleLabel',
- );
- expect(monitoredSystemDefinitionDisclosureSource).not.toContain('summary?: string');
- expect(monitoredSystemDefinitionDisclosureSource).not.toContain('{props.summary}');
- expect(proLicensePanelSource).toContain('./selfHostedBillingPresentation');
- expect(proLicensePanelSource).toContain('SELF_HOSTED_PRO_BILLING_PRESENTATION');
- expect(proLicensePanelStateSource).toContain('buildSelfHostedCommercialPlanModel');
- expect(proLicensePanelStateSource).toContain('loadLicenseEntitlements(true)');
- expect(proLicensePanelStateSource).toContain('loadCommercialPosture(true)');
- expect(proLicensePanelStateSource).toContain('loadRuntimeCapabilities(true)');
- expect(proLicensePanelStateSource).toContain('runStartProTrialAction({');
- expect(proLicensePanelStateSource).not.toContain('startProTrial()');
- expect(proLicensePanelSource).not.toContain('title="Pulse Pro"');
- expect(proLicensePanelSource).not.toContain('description="Manage self-hosted billing');
- expect(proLicensePanelSource).not.toContain('title="Plan"');
- expect(proLicensePanelSource).not.toContain('title="Usage"');
- expect(infrastructureWorkspaceSource).not.toContain('./selfHostedBillingPresentation');
- expect(infrastructureWorkspaceSource).not.toContain(
- 'SELF_HOSTED_PRO_BILLING_PRESENTATION.infrastructureWorkspaceReferral',
- );
- expect(proLicensePlanSectionSource).toContain('CommercialStatGrid');
- expect(proLicensePlanSectionSource).toContain('getLicenseStatusLoadingState');
- expect(monitoredSystemPresentationSource).toContain(
- 'export function getMonitoredSystemLedgerPresentation',
- );
- expect(monitoredSystemPresentationSource).toContain(
- 'export function getMonitoredSystemCountingDetailsToggleLabel',
- );
- expect(monitoredSystemPresentationSource).toContain(
- 'export function getMonitoredSystemBriefSummary',
- );
- expect(monitoredSystemPresentationSource).toContain(
- 'export function getMonitoredSystemDisclosureToggleLabel',
- );
- expect(selfHostedCommercialRecoverySectionSource).toContain('@/utils/licensePresentation');
- expect(selfHostedCommercialRecoverySectionSource).toContain(
- 'SELF_HOSTED_RECOVERY_PRESENTATION',
- );
- expect(selfHostedCommercialRecoverySectionSource).not.toContain('License / Activation Key');
- expect(selfHostedCommercialRecoverySectionSource).not.toContain('Start 14-day Pro Trial');
- expect(organizationBillingPanelSource).toContain('./CommercialBillingSections');
- expect(organizationBillingPanelSource).toContain('./OrganizationBillingLoadingState');
- expect(organizationBillingPanelSource).toContain('./useOrganizationBillingPanelState');
- expect(organizationBillingPanelSource).toContain('CommercialBillingShell');
- expect(organizationBillingPanelSource).toContain('CommercialSection');
- expect(organizationBillingPanelSource).toContain('CommercialUsageMeters');
- expect(organizationBillingPanelSource).not.toContain('createSignal(');
- expect(organizationBillingPanelSource).not.toContain('onMount(() =>');
- expect(organizationBillingStateSource).toContain('buildHostedCommercialPlanModel');
- expect(organizationBillingStateSource).toContain('buildHostedCommercialUsageModel');
- expect(organizationBillingStateSource).toContain("eventBus.on('org_switched'");
- expect(organizationBillingLoadingStateSource).toContain('animate-pulse');
- expect(settingsSource).toContain('organizationMonitoredSystemUsage');
- expect(settingsSource).toContain("getRuntimeLimit('max_monitored_systems')?.current ?? 0");
- expect(settingsSource).not.toContain('organizationAgentUsage');
- });
-
- it('keeps relay settings split into shell, runtime, and pairing owners', () => {
- expect(relaySettingsPanelSource).toContain('./useRelaySettingsPanelState');
- expect(relaySettingsPanelSource).toContain('./RelayPairingSection');
- expect(relaySettingsPanelSource).toContain('@/components/shared/UpgradeLink');
- expect(relaySettingsPanelSource).toContain('@/utils/upgradePresentation');
- expect(relaySettingsPanelSource).toContain('UPGRADE_TRIAL_LABEL');
- expect(relaySettingsPanelSource).not.toContain('createSignal(');
- expect(relaySettingsPanelSource).not.toContain('QRCode.toDataURL(');
- expect(relaySettingsPanelSource).not.toContain('target="_blank"');
- expect(relaySettingsPanelSource).not.toContain('>Start free trial<');
- expect(relaySettingsPanelStateSource).toContain(
- "trackPaywallViewed('relay', 'settings_relay_panel')",
- );
- expect(relaySettingsPanelStateSource).toContain("getUpgradeActionDestination('relay')");
- expect(relaySettingsPanelStateSource).toContain('setInterval(() => void loadStatus(), 5000)');
- expect(relaySettingsPanelStateSource).toContain('QRCode.toDataURL(payload.deep_link');
- expect(relaySettingsPanelStateSource).toContain('runStartProTrialAction({');
- expect(relaySettingsPanelStateSource).not.toContain('startProTrial()');
- expect(relayPairingSectionSource).toContain('getRelayDiagnosticClass');
- expect(relayPairingSectionSource).toContain('Pair New Device');
- });
-
- it('keeps hosted billing admin split into shell, runtime, and table owners', () => {
- expect(billingAdminPanelSource).toContain('./useBillingAdminPanelState');
- expect(billingAdminPanelSource).toContain('./BillingAdminOrganizationsTable');
- expect(billingAdminPanelSource).not.toContain('createSignal(');
- expect(billingAdminPanelSource).not.toContain('BillingAdminAPI.listOrganizations');
- expect(billingAdminPanelStateSource).toContain('BillingAdminAPI.listOrganizations');
- expect(billingAdminPanelStateSource).toContain('BillingAdminAPI.putBillingState');
- expect(billingAdminPanelStateSource).toContain('promisePool');
- expect(billingAdminOrganizationsTableSource).toContain('PulseDataGrid');
- expect(billingAdminOrganizationsTableSource).toContain('Billing state JSON');
- });
-
- it('keeps system logs split into shell and runtime owners', () => {
- expect(systemLogsPanelSource).toContain('@/components/Settings/OperationsPanel');
- expect(systemLogsPanelSource).toContain('./useSystemLogsPanelState');
- expect(systemLogsPanelSource).not.toContain('createSignal(');
- expect(systemLogsPanelSource).not.toContain('new EventSource(');
- expect(systemLogsPanelSource).not.toContain("apiFetchJSON('/api/logs/level'");
- expect(systemLogsPanelStateSource).toContain('new EventSource');
- expect(systemLogsPanelStateSource).toContain("apiFetchJSON('/api/logs/level'");
- expect(systemLogsPanelStateSource).toContain('notificationStore.success');
- });
-
- it('keeps network settings split into shell, section, and model owners', () => {
- expect(networkSettingsPanelSource).toContain('./NetworkDiscoverySection');
- expect(networkSettingsPanelSource).toContain('./NetworkBoundarySettingsSection');
- expect(networkSettingsPanelSource).toContain('./networkSettingsModel');
- expect(networkSettingsPanelSource).not.toContain('COMMON_DISCOVERY_SUBNETS');
- expect(networkSettingsPanelSource).not.toContain('Dashboard URL for Notifications');
- expect(networkSettingsPanelSource).not.toContain('Allowed Private IP Ranges for Webhooks');
- expect(networkDiscoverySectionSource).toContain('COMMON_DISCOVERY_SUBNETS');
- expect(networkDiscoverySectionSource).toContain('@/utils/discoveryPresentation');
- expect(networkDiscoverySectionSource).toContain('getNetworkDiscoveryPriorityNotice');
- expect(networkDiscoverySectionSource).toContain('getNetworkDiscoverySectionPresentation');
- expect(networkDiscoverySectionSource).toContain('getNetworkDiscoveryModePresentation');
- expect(networkDiscoverySectionSource).toContain('getNetworkDiscoverySubnetPresentation');
- expect(networkDiscoverySectionSource).not.toContain('Configuration priority');
- expect(networkDiscoverySectionSource).not.toContain('Automatic scanning');
- expect(networkDiscoverySectionSource).not.toContain(
- 'Discovery settings are locked by environment variables.',
- );
- expect(networkBoundarySettingsSectionSource).toContain('Dashboard URL for Notifications');
- expect(networkBoundarySettingsSectionSource).toContain(
- 'Allowed Private IP Ranges for Webhooks',
- );
- expect(networkBoundarySettingsSectionSource).toContain('EnvironmentOverrideAlert');
- expect(networkSettingsModelSource).toContain('export interface NetworkSettingsPanelProps');
- expect(networkSettingsModelSource).toContain('export type NetworkDiscoverySectionProps');
- expect(networkSettingsModelSource).toContain('export type NetworkBoundarySettingsSectionProps');
- });
+ expect(settingsNavigationHookSource).toContain('navigate(buildInfrastructureWorkspacePath(), {');
+ expect(settingsNavigationHookSource).toContain('resolveCanonicalSettingsPath(path)');
- it('does not re-inline extracted tab and header metadata definitions', () => {
- expect(settingsSource).not.toMatch(/\b(?:const|let|var)\s+baseTabGroups\s*=/);
- expect(settingsSource).not.toMatch(/\b(?:const|let|var)\s+SETTINGS_HEADER_META\s*=/);
- expect(settingsSource).not.toMatch(/\b(?:const|let|var)\s+tabFeatureRequirements\s*=/);
- });
-
- it('keeps Settings.tsx below the monolith guardrail ceiling', () => {
- // If this test fails, the change should be decomposed into the appropriate
- // extracted module rather than increasing the limit. Exceptions require
- // explicit discussion.
- const maxSettingsLines = 4500;
- const settingsLineCount = settingsSource.trimEnd().split(/\r?\n/).length;
-
- expect(settingsLineCount).toBeLessThanOrEqual(maxSettingsLines);
- });
-
- it('keeps the direct Proxmox settings workspace split into section owners', () => {
- expect(proxmoxSettingsPanelSource).toContain('./ProxmoxDirectWorkspace');
- expect(proxmoxSettingsPanelSource).toContain('./proxmoxSettingsModel');
- expect(proxmoxSettingsPanelSource).toContain('SettingsSectionNav');
- expect(proxmoxSettingsPanelSource).not.toContain('./useProxmoxSettingsPanelState');
- expect(proxmoxSettingsPanelSource).not.toContain('./useProxmoxDirectWorkspaceState');
- expect(proxmoxDirectWorkspaceSource).toContain('./useProxmoxDirectWorkspaceState');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxConfiguredNodesTable');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxDirectConnectionsCard');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxDiscoveryResultsCard');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxDeleteNodeDialog');
- expect(proxmoxDirectWorkspaceSource).toContain('./ProxmoxNodeModalStack');
- expect(proxmoxSettingsPanelSource).not.toContain('const renderConfiguredTable = () =>');
- expect(proxmoxSettingsPanelSource).not.toContain('const renderNodeModal = (type: NodeType)');
- expect(proxmoxSettingsPanelSource).not.toContain(
- 'No discovery matches for this Proxmox type yet.',
- );
- expect(proxmoxSettingsPanelSource).not.toContain('What happens next');
- expect(proxmoxConfiguredNodesTableSource).toContain('PveNodesTable');
- expect(proxmoxConfiguredNodesTableSource).toContain('PbsNodesTable');
- expect(proxmoxConfiguredNodesTableSource).toContain('PmgNodesTable');
- expect(proxmoxDirectConnectionsCardSource).toContain('getSettingsConfigurationLoadingState');
- expect(proxmoxDiscoveryResultsCardSource).toContain('Discovery issues:');
- expect(proxmoxDiscoveryResultsCardSource).toContain(
- 'No discovery matches for this Proxmox type yet. You can still add a direct',
- );
- expect(proxmoxDeleteNodeDialogSource).toContain('What happens next');
- expect(proxmoxNodeModalStackSource).toContain('PROXMOX_NODE_TYPES');
- expect(proxmoxNodeModalStackSource).toContain('<NodeModal');
- expect(proxmoxSettingsModelSource).toContain(
- 'export interface InfrastructurePlatformSettingsProps',
- );
- expect(proxmoxSettingsModelSource).toContain('trueNASSettings');
- expect(proxmoxSettingsModelSource).toContain('./infrastructureSettingsModel');
- expect(proxmoxDirectWorkspaceStateSource).toContain(
- 'export function useProxmoxDirectWorkspaceState',
- );
- expect(proxmoxDirectWorkspaceStateSource).toContain(
- "notificationStore.info('Refreshing discovery...'",
- );
- });
-
- it('keeps organization sharing split into shell, state, and section owners', () => {
- expect(organizationSharingPanelSource).toContain('./useOrganizationSharingPanelState');
- expect(organizationSharingPanelSource).toContain('./OrganizationSharingLoadingState');
- expect(organizationSharingPanelSource).toContain('./OrganizationSharingCreateSection');
- expect(organizationSharingPanelSource).toContain('./OrganizationOutgoingSharesSection');
- expect(organizationSharingPanelSource).toContain('./OrganizationIncomingSharesSection');
- expect(organizationSharingPanelSource).not.toContain('const loadSharingData = async');
- expect(organizationSharingPanelSource).not.toContain('const createShare = async');
- expect(organizationSharingStateSource).toContain('OrgsAPI.createShare');
- expect(organizationSharingStateSource).toContain('OrgsAPI.deleteShare');
- expect(organizationSharingStateSource).toContain('normalizeOrgScope(getOrgID())');
- expect(organizationSharingCreateSectionSource).toContain('CANONICAL_RESOURCE_TYPES');
- expect(organizationSharingCreateSectionSource).toContain('ORGANIZATION_SHARE_ROLE_OPTIONS');
- expect(organizationOutgoingSharesSectionSource).toContain(
- 'getOrganizationOutgoingSharesEmptyState',
- );
- expect(organizationIncomingSharesSectionSource).toContain(
- 'getOrganizationIncomingSharesEmptyState',
- );
- expect(organizationSharingLoadingStateSource).toContain('animate-pulse');
- });
-
- it('keeps organization access split into shell, state, and section owners', () => {
- expect(organizationAccessPanelSource).toContain('./useOrganizationAccessPanelState');
- expect(organizationAccessPanelSource).toContain('./OrganizationAccessLoadingState');
- expect(organizationAccessPanelSource).toContain('./OrganizationAccessManagementSection');
- expect(organizationAccessPanelSource).toContain('./OrganizationAccessMembersSection');
- expect(organizationAccessPanelSource).not.toContain('const loadOrganizationAccess = async');
- expect(organizationAccessPanelSource).not.toContain('const inviteMember = async');
- expect(organizationAccessStateSource).toContain('OrgsAPI.updateMemberRole');
- expect(organizationAccessStateSource).toContain('OrgsAPI.inviteMember');
- expect(organizationAccessStateSource).toContain('OrgsAPI.removeMember');
- expect(organizationAccessStateSource).toContain('normalizeOrgScope(getOrgID())');
- expect(organizationAccessManagementSectionSource).toContain(
- 'getOrganizationAccessManageRequiredMessage',
- );
- expect(organizationAccessManagementSectionSource).toContain('ORGANIZATION_MEMBER_ROLE_OPTIONS');
- expect(organizationAccessMembersSectionSource).toContain('getOrganizationAccessEmptyState');
- expect(organizationAccessMembersSectionSource).toContain('formatOrgDate');
- expect(organizationAccessLoadingStateSource).toContain('animate-pulse');
- });
-
- it('keeps organization overview split into shell, state, and section owners', () => {
- expect(organizationOverviewPanelSource).toContain('./useOrganizationOverviewPanelState');
- expect(organizationOverviewPanelSource).toContain('./OrganizationOverviewLoadingState');
- expect(organizationOverviewPanelSource).toContain('./OrganizationOverviewDetailsSection');
- expect(organizationOverviewPanelSource).toContain('./OrganizationOverviewMembersSection');
- expect(organizationOverviewPanelSource).not.toContain('const loadOrganization = async');
- expect(organizationOverviewPanelSource).not.toContain('const saveDisplayName = async');
- expect(organizationOverviewStateSource).toContain('OrgsAPI.get');
- expect(organizationOverviewStateSource).toContain('OrgsAPI.listMembers');
- expect(organizationOverviewStateSource).toContain('OrgsAPI.update');
- expect(organizationOverviewStateSource).toContain('normalizeOrgScope(getOrgID())');
- expect(organizationOverviewDetailsSectionSource).toContain(
- 'getOrganizationOverviewManageRequiredMessage',
- );
- expect(organizationOverviewDetailsSectionSource).toContain('formatOrgDate');
- expect(organizationOverviewMembersSectionSource).toContain(
- 'getOrganizationOverviewMembersEmptyState',
- );
- expect(organizationOverviewLoadingStateSource).toContain('animate-pulse');
- });
-
- it('keeps RBAC settings panels split into gate, state, and dialog owners', () => {
- expect(rolesPanelSource).toContain('./RBACFeatureGateSection');
- expect(rolesPanelSource).toContain('./RolesEditorDialog');
- expect(rolesPanelSource).toContain('./useRolesPanelState');
- expect(rolesPanelSource).not.toContain('const handleStartTrial = async');
- expect(rolesPanelSource).not.toContain('const loadRoles = async');
- expect(userAssignmentsPanelSource).toContain('./RBACFeatureGateSection');
- expect(userAssignmentsPanelSource).toContain('./UserAssignmentsDialog');
- expect(userAssignmentsPanelSource).toContain('./useUserAssignmentsPanelState');
- expect(userAssignmentsPanelSource).not.toContain('const handleStartTrial = async');
- expect(userAssignmentsPanelSource).not.toContain('const loadData = async');
- expect(rbacFeatureGateSectionSource).toContain('@/components/shared/UpgradeLink');
- expect(rbacFeatureGateSectionSource).toContain('trackUpgradeClicked');
- expect(rbacFeatureGateSectionSource).not.toContain('target="_blank"');
- expect(rbacFeatureGateStateSource).toContain('trackPaywallViewed');
- expect(rbacFeatureGateStateSource).toContain('runStartProTrialAction({');
- expect(rbacFeatureGateStateSource).not.toContain('startProTrial()');
- expect(rolesEditorDialogSource).toContain('RBAC_PERMISSION_ACTIONS');
- expect(rolesPanelStateSource).toContain('RBACAPI.getRoles');
- expect(rolesPanelStateSource).toContain('RBACAPI.saveRole');
- expect(userAssignmentsDialogSource).toContain('Effective Permissions Preview');
- expect(userAssignmentsPanelStateSource).toContain('RBACAPI.getUsers');
- expect(userAssignmentsPanelStateSource).toContain('RBACAPI.updateUserRoles');
- });
-
- it('uses lazy() imports for panel components in settingsPanelRegistry', async () => {
- const source = (await import('../settingsPanelRegistry.ts?raw')).default;
- const loadersSource = (await import('../settingsPanelRegistryLoaders.ts?raw')).default;
-
- expect(source).toContain('SETTINGS_PANEL_REGISTRY_LOADERS');
- expect(loadersSource).toContain('lazy(');
-
- const staticImports = Array.from(
- loadersSource.matchAll(
- /^import\s+(?!type\b)(?!{[^}]*}\s+from\s+'solid-js').*from\s+'\.\/\w+Panel'/gm,
- ),
- );
- expect(staticImports.length).toBe(0);
- });
-
- it('keeps page-level settings header chrome inside SettingsPageShell', () => {
- expect(settingsShellSource).toContain('<PageHeader');
- expect(settingsShellSource).toContain('getSettingsSearchEmptyState');
- expect(settingsShellSource).toContain('getSettingsUnsavedChangesBanner');
- expect(settingsShellSource).toContain('SETTINGS_SHELL_COPY');
- expect(settingsShellSource).not.toContain('No settings found for "');
- expect(settingsShellSource).not.toContain('Unsaved changes');
- expect(settingsShellSource).not.toContain('Search settings...');
- expect(settingsShellSource).not.toContain('Collapse sidebar');
- expect(settingsShellSource).not.toContain('Expand sidebar');
- expect(infrastructureWorkspaceSource).not.toContain('<PageHeader');
- expect(infrastructureWorkspaceSource).not.toMatch(/<h[12][^>]*>/);
- expect(infrastructureWorkspaceSource).not.toContain('Add and manage infrastructure');
- expect(infrastructureWorkspaceSource).not.toContain('tracking-[0.22em]');
- expect(infrastructureWorkspaceSource).toContain('./infrastructureWorkspaceModel');
- expect(infrastructureWorkspaceSource).not.toContain(
- 'createSignal<InfrastructureWorkspaceView>',
- );
- expect(infrastructureWorkspaceSource).toContain('createEffect(() =>');
- expect(infrastructureWorkspaceSource).toContain('readOnly()');
- expect(infrastructureWorkspaceSource).toContain('./ConnectionsTable');
- expect(infrastructureWorkspaceSource).toContain('./InfrastructureActiveRowDetails');
- expect(infrastructureWorkspaceSource).toContain('./InfrastructureIgnoredRowDetails');
- expect(infrastructureWorkspaceSource).toContain('InfrastructureOperationsStateProvider');
- expect(infrastructureWorkspaceSource).toContain('InfrastructureInstallerSection');
- expect(infrastructureWorkspaceSource).toContain('InfrastructureStopMonitoringDialog');
- expect(infrastructureWorkspaceSource).toContain('AgentProfilesPanel');
- expect(infrastructureWorkspaceSource).not.toContain(
- "import { Subtabs } from '@/components/shared/Subtabs'",
- );
- expect(infrastructureWorkspaceSource).not.toContain('<Subtabs');
- expect(infrastructureWorkspaceSource).toContain('./ConnectionEditor/ConnectionEditor');
- expect(infrastructureWorkspaceSource).toContain('renderCredentialSlot');
- expect(infrastructureWorkspaceSource).not.toContain("activeView() === 'operations'");
- expect(connectionsTableSource).toContain('headerActions');
- expect(connectionsTableModelSource).toContain('export function buildInfrastructureSystemRows');
- expect(platformConnectionsWorkspaceSource).toContain('./platformConnectionsModel');
- expect(platformConnectionsWorkspaceSource).toContain('./ProxmoxSettingsPanel');
- expect(platformConnectionsWorkspaceSource).toContain('./TrueNASSettingsPanel');
- expect(platformConnectionsWorkspaceSource).toContain('./VMwareSettingsPanel');
- expect(platformConnectionsModelSource).toContain('export const PLATFORM_CONNECTIONS_TABS');
- expect(platformConnectionsModelSource).toContain(
- 'export function getPlatformConnectionsViewFromPath',
- );
- expect(infrastructureOperationsControllerSource).toContain(
- 'InfrastructureOperationsStateProvider',
- );
- expect(infrastructureOperationsControllerSource).toContain('InfrastructureInstallerSection');
- expect(infrastructureOperationsControllerSource).toContain('InfrastructureInventorySection');
- expect(infrastructureOperationsControllerSource).toContain(
- 'InfrastructureStopMonitoringDialog',
- );
- expect(infrastructureOperationsStateSource).toContain(
- 'export const useInfrastructureOperationsState',
- );
- expect(infrastructureOperationsStateSource).toContain('./useInfrastructureInstallState');
- expect(infrastructureOperationsStateSource).toContain('./useInfrastructureReportingState');
- expect(infrastructureOperationsStateSource).toContain(
- 'export const InfrastructureOperationsStateProvider',
- );
- expect(infrastructureOperationsStateSource).toContain(
- 'export const useInfrastructureOperationsContext',
- );
- expect(trueNASSettingsPanelSource).toContain('state: TrueNASSettingsPanelState');
- expect(vmwareSettingsPanelSource).toContain('state: VMwareSettingsPanelState');
- expect(trueNASSettingsStateSource).toContain('@/api/truenas');
- expect(trueNASSettingsStateSource).toContain('export function useTrueNASSettingsPanelState');
- expect(vmwareSettingsStateSource).toContain('@/api/vmware');
- expect(vmwareSettingsStateSource).toContain('export function useVMwareSettingsPanelState');
- expect(infrastructureSettingsStateSource).toContain('./useTrueNASSettingsPanelState');
- expect(infrastructureSettingsStateSource).toContain('./useVMwareSettingsPanelState');
- expect(infrastructureOperationsStateSource).not.toContain('const renderInstallerSection =');
- expect(infrastructureOperationsStateSource).not.toContain('const renderInventorySection =');
- expect(infrastructureOperationsStateSource).not.toContain('const renderStopMonitoringDialog =');
- expect(infrastructureInstallStateSource).toContain(
- 'export const useInfrastructureInstallState',
- );
- expect(infrastructureReportingStateSource).toContain(
- 'export const useInfrastructureReportingState',
- );
- expect(infrastructureInstallerSectionSource).toContain('useInfrastructureOperationsContext');
- expect(infrastructureInventorySectionSource).toContain('useInfrastructureOperationsContext');
- expect(infrastructureStopMonitoringDialogSource).toContain(
- 'useInfrastructureOperationsContext',
- );
- expect(infrastructureActiveRowDetailsSource).toContain('useInfrastructureOperationsContext');
- expect(infrastructureIgnoredRowDetailsSource).toContain('useInfrastructureOperationsContext');
- expect(infrastructureWorkspaceModelSource).not.toContain(
- 'export const INFRASTRUCTURE_WORKSPACE_TABS',
- );
expect(infrastructureWorkspaceModelSource).toContain(
- 'export function deriveAddStepFromLegacyPath',
+ "const INFRASTRUCTURE_BASE_PATH = '/settings/infrastructure';",
);
expect(infrastructureWorkspaceModelSource).toContain(
- 'export function buildInfrastructureWorkspacePath',
- );
- });
-
- it('keeps the infrastructure operations model extracted from the reactive hook owner', () => {
- expect(infrastructureOperationsStateSource).toContain('./infrastructureOperationsModel');
- expect(infrastructureOperationsStateSource).not.toContain('const INSTALL_PROFILE_OPTIONS');
- expect(infrastructureOperationsStateSource).not.toContain('const buildCommandsByPlatform =');
- expect(infrastructureOperationsStateSource).not.toContain(
- 'const rowFromConnectedInfrastructureItem =',
- );
- expect(infrastructureOperationsModelSource).toContain('export const INSTALL_PROFILE_OPTIONS');
- expect(infrastructureOperationsModelSource).toContain(
- 'export const rowFromConnectedInfrastructureItem',
- );
- expect(infrastructureOperationsModelSource).toContain('export const buildCommandsByPlatform');
- });
-
- it('keeps infrastructure settings split into composition, node, discovery, and model owners', () => {
- expect(infrastructureSettingsStateSource).toContain('./useInfrastructureConfiguredNodesState');
- expect(infrastructureSettingsStateSource).toContain('./useInfrastructureDiscoveryRuntimeState');
- expect(infrastructureSettingsStateSource).toContain("from './infrastructureSettingsModel'");
- expect(infrastructureSettingsStateSource).not.toContain('NodesAPI.getNodes');
- expect(infrastructureSettingsStateSource).not.toContain('SettingsAPI.updateSystemSettings');
- expect(infrastructureSettingsStateSource).not.toContain(
- 'const [nodes, setNodes] = createSignal',
- );
- expect(infrastructureSettingsStateSource).not.toContain(
- 'const [discoveredNodes, setDiscoveredNodes] = createSignal',
+ 'export function buildInfrastructureOnboardingPath(',
);
- expect(infrastructureConfiguredNodesStateSource).toContain(
- 'export const useInfrastructureConfiguredNodesState',
- );
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.getNodes');
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.updateNode');
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.deleteNode');
- expect(infrastructureConfiguredNodesStateSource).toContain('NodesAPI.refreshClusterNodes');
- expect(infrastructureConfiguredNodesStateSource).not.toContain("apiFetch('/api/discover'");
- expect(infrastructureConfiguredNodesStateSource).not.toContain(
- 'SettingsAPI.updateSystemSettings',
- );
- expect(infrastructureDiscoveryRuntimeStateSource).toContain(
- 'export const useInfrastructureDiscoveryRuntimeState',
- );
- expect(infrastructureDiscoveryRuntimeStateSource).toContain("apiFetch('/api/discover'");
- expect(infrastructureDiscoveryRuntimeStateSource).toContain('SettingsAPI.updateSystemSettings');
- expect(infrastructureDiscoveryRuntimeStateSource).toContain("eventBus.on('discovery_updated'");
- expect(infrastructureDiscoveryRuntimeStateSource).not.toContain('NodesAPI.getNodes');
- expect(infrastructureSettingsModelSource).toContain('export interface DiscoveredServer');
- expect(infrastructureSettingsModelSource).toContain('export type NodeType =');
- expect(infrastructureSettingsModelSource).toContain(
- 'export const matchConfiguredNodeToResource =',
- );
- });
-
- it('keeps the API token manager shell behind extracted state and model owners', () => {
- expect(apiTokenManagerSource).toContain('./useAPITokenManagerState');
- expect(apiTokenManagerSource).not.toContain(
- 'const [tokens, setTokens] = createSignal<APITokenRecord[]>([])',
- );
- expect(apiTokenManagerSource).not.toContain('const loadTokens = async () =>');
- expect(apiTokenManagerSource).not.toContain(
- 'const hasAgentScopeResource = (resource: Resource)',
- );
- expect(apiTokenManagerStateSource).toContain('export const useAPITokenManagerState =');
- expect(apiTokenManagerStateSource).toContain(
- 'const [tokens, setTokens] = createSignal<APITokenRecord[]>([])',
- );
- expect(apiTokenManagerStateSource).toContain('const loadTokens = async () =>');
- expect(apiTokenManagerStateSource).toContain('SecurityAPI.listTokens()');
- expect(apiTokenManagerStateSource).toContain('const scopePresets = getAPITokenScopePresets();');
- expect(apiTokenManagerStateSource).not.toContain(
- 'const scopePresets = API_TOKEN_SCOPE_PRESETS;',
- );
- expect(apiTokenManagerModelSource).toContain('export const hasAgentScopeResource =');
- expect(apiTokenManagerModelSource).toContain('export const buildDockerTokenUsage =');
- expect(apiTokenManagerModelSource).toContain('export const buildAgentTokenUsage =');
- expect(apiTokenManagerModelSource).toContain('resourceHasAgentFacet(resource)');
- expect(apiTokenManagerModelSource).not.toContain("resource.type === 'truenas'");
- expect(apiTokenManagerModelSource).toContain(
- 'export const getAPITokenScopePresets = (): APITokenPreset[] => [',
- );
- expect(apiTokenManagerModelSource).not.toContain('export const API_TOKEN_SCOPE_PRESETS = [');
- });
-
- it('keeps the node setup modal shell behind extracted state and model owners', () => {
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalBasicInfoSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalAuthenticationSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalMonitoringSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalStatusFooter');
- expect(nodeModalSource).toContain('@/components/Settings/nodeModalModel');
- expect(nodeModalSource).toContain('@/components/Settings/useNodeModalState');
- expect(nodeModalSource).not.toContain('title="Basic information"');
- expect(nodeModalSource).not.toContain('title="Authentication"');
- expect(nodeModalSource).not.toContain('title="Monitoring coverage"');
- expect(nodeModalSource).not.toContain('const deriveNameFromHost =');
- expect(nodeModalSource).not.toContain('const PVE_MANUAL_PERMISSION_COMMAND = `');
- expect(nodeModalSource).not.toContain('const [quickSetupBootstrap, setQuickSetupBootstrap] =');
- expect(nodeModalSource).not.toContain('const handleTestConnection = async () =>');
- expect(nodeModalBasicInfoSectionSource).toContain('title="Basic information"');
- expect(nodeModalAuthenticationSectionSource).toContain(
- '@/components/Settings/NodeModalSetupGuideSection',
- );
- expect(nodeModalSetupGuideSectionSource).toContain('Connection Setup');
- expect(nodeModalMonitoringSectionSource).toContain('title="Monitoring coverage"');
- expect(nodeModalStatusFooterSource).toContain('Start your free 14-day trial');
- expect(nodeModalModelSource).toContain('export interface NodeModalProps');
- expect(nodeModalModelSource).toContain('export const deriveNameFromHost =');
- expect(nodeModalModelSource).toContain('export const PVE_MANUAL_PERMISSION_COMMAND = `');
- expect(nodeModalStateSource).toContain('export const useNodeModalState =');
- expect(nodeModalStateSource).toContain(
- 'export type NodeModalState = ReturnType<typeof useNodeModalState>;',
- );
- expect(nodeModalStateSource).toContain('const [quickSetupBootstrap, setQuickSetupBootstrap] =');
- expect(nodeModalStateSource).toContain('const handleTestConnection = async () =>');
- expect(nodeModalStateSource).toContain(
- "const PROXMOX_SETUP_HOST_REQUIRED_MESSAGE = 'Proxmox setup host is required';",
- );
- expect(nodeModalStateSource).toContain('runStartProTrialAction({');
- expect(nodeModalStateSource).not.toContain('startProTrial()');
- });
-
- it('keeps AI settings sub-surfaces behind extracted runtime owners', () => {
- expect(aiSettingsPanelSource).toContain('@/components/Settings/AIModelSelectionSection');
- expect(aiSettingsPanelSource).toContain('@/components/Settings/AIRuntimeControlsSection');
- expect(aiSettingsPanelSource).toContain('@/components/Settings/AIChatMaintenanceSection');
- expect(aiSettingsPanelSource).toContain('@/components/Settings/AISettingsStatusAndActions');
- expect(aiSettingsPanelSource).toContain('@/components/Settings/AISettingsDialogs');
- expect(aiSettingsPanelSource).toContain('@/components/Settings/useAISettingsState');
- expect(aiSettingsPanelSource).toContain("@/routing/resourceLinks");
- expect(aiSettingsPanelSource).toContain("navigate(PATROL_PATH)");
- expect(aiSettingsPanelSource).not.toContain(
- 'const [loading, setLoading] = createSignal(false);',
- );
- expect(aiSettingsPanelSource).not.toContain('const handleSave = async (event?: Event) =>');
- expect(aiSettingsPanelSource).not.toContain('AIAPI.getSettings()');
- expect(aiSettingsPanelSource).not.toContain('Chat Session Maintenance');
- expect(aiSettingsPanelSource).not.toContain('Discovery Settings');
- expect(aiSettingsPanelSource).not.toContain('Pulse Permission Level');
- expect(aiModelSelectionSectionSource).toContain(
- '@/components/Settings/AIProviderConfigurationSection',
- );
- expect(aiModelSelectionSectionSource).toContain('@/components/Settings/aiSettingsModel');
- expect(aiModelSelectionSectionSource).toContain('@/utils/aiSettingsPresentation');
- expect(aiModelSelectionSectionSource).toContain('AI_SETTINGS_MODEL_OVERRIDES_TITLE');
- expect(aiRuntimeControlsSectionSource).toContain('@/components/shared/UpgradeLink');
- expect(aiRuntimeControlsSectionSource).toContain('@/utils/upgradePresentation');
- expect(aiRuntimeControlsSectionSource).toContain('UPGRADE_ACTION_LABEL');
- expect(aiRuntimeControlsSectionSource).toContain('UPGRADE_TRIAL_LABEL');
- expect(aiRuntimeControlsSectionSource).toContain('Workload Discovery');
- expect(aiRuntimeControlsSectionSource).toContain('getAISettingsWorkloadDiscoveryHelpContent');
- expect(aiRuntimeControlsSectionSource).toContain('getAISettingsWorkloadDiscoverySummary');
- expect(aiRuntimeControlsSectionSource).toContain('@/utils/aiSettingsPresentation');
- expect(aiRuntimeControlsSectionSource).toContain('AI_SETTINGS_ASSISTANT_PERMISSIONS_TITLE');
- expect(aiRuntimeControlsSectionSource).toContain('destination={state.upgradeAutofixDestination()}');
- expect(aiRuntimeControlsSectionSource).not.toContain('href={state.upgradeAutofixDestination().href}');
- expect(aiRuntimeControlsSectionSource).not.toContain('window.open(state.upgradeAutofixDestination().href');
- expect(aiRuntimeControlsSectionSource).not.toContain('>Upgrade to Pro<');
- expect(aiRuntimeControlsSectionSource).not.toContain('>Start free trial<');
- expect(aiChatMaintenanceSectionSource).toContain('@/utils/aiSettingsPresentation');
- expect(aiChatMaintenanceSectionSource).toContain('AI_SETTINGS_ASSISTANT_SESSIONS_TITLE');
- expect(aiSettingsStatusAndActionsSource).toContain('Save changes');
- expect(aiSettingsStatusAndActionsSource).toContain('Test Connection');
- expect(aiProviderConfigurationSectionSource).toContain('@/components/Settings/aiSettingsModel');
- expect(aiSettingsDialogsSource).toContain('@/components/Settings/aiSettingsModel');
- expect(aiSettingsDialogsSource).toContain('getAISettingsSetupDialogPresentation');
- expect(aiSettingsModelSource).toContain('export const AI_PROVIDER_CONFIGS');
- expect(aiSettingsModelSource).toContain('export const AI_SETUP_PROVIDER_OPTIONS');
- expect(aiSettingsStateSource).toContain('export const useAISettingsState =');
- expect(aiSettingsStateSource).toContain('const [loading, setLoading] = createSignal(false);');
- expect(aiSettingsStateSource).toContain('const handleSave = async (event?: Event) =>');
- expect(aiSettingsStateSource).toContain(
- 'const handleEnabledToggle = async (newValue: boolean) =>',
- );
- expect(aiSettingsStateSource).toContain("} from '@/stores/aiRuntimeState';");
- expect(aiSettingsStateSource).toContain("getUpgradeActionDestination('ai_autofix')");
- expect(aiSettingsStateSource).toContain('AIAPI.getSettings()');
- expect(aiSettingsStateSource).toContain('syncAIRuntimeSettings(data ?? null);');
- expect(aiSettingsStateSource).toContain('await loadAIRuntimeModels(true);');
- expect(aiSettingsStateSource).not.toContain('AIAPI.getModels()');
- expect(aiSettingsStateSource).toContain(
- 'const payload: Record<string, unknown> = { enabled: true };',
- );
- expect(aiSettingsStateSource).not.toContain('anthropic:claude-sonnet');
- expect(aiSettingsStateSource).not.toContain('openai:gpt-4o');
- expect(aiSettingsStateSource).not.toContain('openrouter:openai/gpt-4o-mini');
- expect(aiSettingsStateSource).not.toContain('gemini:gemini-2.5-flash');
- expect(aiSettingsStateSource).not.toContain('deepseek:deepseek-chat');
- expect(aiSettingsStateSource).not.toContain('ollama:llama3.2:latest');
- expect(aiSettingsStateSource).toContain('runStartProTrialAction({');
- expect(aiSettingsStateSource).not.toContain('startProTrial()');
- expect(aiSettingsStateSource).not.toContain('getTrialAlreadyUsedMessage()');
- expect(aiRuntimeStateSource).toContain('export async function loadAIRuntimeSettings');
- expect(aiRuntimeStateSource).toContain('export async function loadAIRuntimeModels');
- expect(aiRuntimeStateSource).toContain('const next = await AIAPI.getSettings()');
- expect(aiRuntimeStateSource).toContain('const result = await AIAPI.getModels()');
- expect(aiRuntimeStateSource).toContain("eventBus.on('org_switched'");
- });
-
- it('keeps the updates settings shell behind extracted install-guide owners', () => {
- expect(updatesSettingsPanelSource).toContain('@/components/Settings/UpdateInstallGuide');
- expect(updatesSettingsPanelSource).toContain('@/components/Settings/updatesSettingsModel');
- expect(updatesSettingsPanelSource).toContain('UPDATES_PANEL_COPY');
- expect(updatesSettingsPanelSource).toContain('getUpdateCheckActionLabel');
- expect(updatesSettingsPanelSource).not.toContain("navigator.clipboard.writeText('update')");
- expect(updatesSettingsPanelSource).not.toContain("value: 'stable'");
- expect(updatesSettingsPanelSource).not.toContain("value: 'rc'");
- expect(updatesSettingsPanelSource).not.toContain('Check Now');
- expect(updatesSettingsPanelSource).not.toContain('Checking...');
- expect(updatesSettingsPanelSource).not.toContain('Update Preferences');
- expect(updateInstallGuideSource).toContain('@/components/Settings/CopyCommandBlock');
- expect(updateInstallGuideSource).toContain('buildUpdateInstallGuide');
- expect(copyCommandBlockSource).toContain('export function CopyCommandBlock');
- expect(copyCommandBlockSource).toContain('aria-label="Copy to clipboard"');
- expect(updatesSettingsModelSource).toContain('export function getUpdateChannelCardOptions');
- expect(updatesSettingsModelSource).toContain('export function buildUpdateInstallGuide');
- expect(updatesSettingsModelSource).toContain("title: 'Pre-release'");
- expect(updatesSettingsModelSource).not.toContain('Release Candidate');
- expect(updatesPresentationSource).toContain(
- 'Pre-release builds stay on a manual preview channel.',
- );
- expect(updatesPresentationSource).not.toContain('RC is a manual preview channel.');
- });
-
- it('keeps the diagnostics shell behind extracted runtime and results owners', () => {
- expect(diagnosticsPanelSource).toContain('@/components/Settings/OperationsPanel');
- expect(diagnosticsPanelSource).toContain('@/components/Settings/DiagnosticsResultsPanel');
- expect(diagnosticsPanelSource).toContain('@/components/Settings/useDiagnosticsPanelState');
- expect(diagnosticsPanelSource).toContain('DIAGNOSTICS_PANEL_COPY');
- expect(diagnosticsPanelSource).toContain('formatUptime');
- expect(diagnosticsPanelSource).not.toContain("apiFetchJSON('/api/diagnostics')");
- expect(diagnosticsPanelSource).not.toContain('URL.createObjectURL');
- expect(diagnosticsPanelSource).not.toContain('sanitizeDiagnosticsData');
- expect(diagnosticsPanelSource).not.toContain('System Diagnostics');
- expect(diagnosticsResultsPanelSource).toContain('DIAGNOSTICS_EMPTY_PBS_MESSAGE');
- expect(diagnosticsResultsPanelSource).toContain('DIAGNOSTICS_EMPTY_STATE_COPY');
- expect(diagnosticsResultsPanelSource).toContain('getStatusIndicatorBadgeToneClasses(');
- expect(diagnosticsStateSource).toContain('export const useDiagnosticsPanelState =');
- expect(diagnosticsStateSource).toContain("apiFetchJSON('/api/diagnostics')");
- expect(diagnosticsStateSource).toContain('URL.createObjectURL');
- expect(diagnosticsModelSource).toContain('export function sanitizeDiagnosticsData');
- expect(diagnosticsModelSource).toContain('export function buildDiagnosticsExportFilename');
- expect(diagnosticsModelSource).toContain('export function formatUptime');
- });
-
- it('keeps the reporting shell behind extracted runtime and model owners', () => {
- expect(reportingPanelSource).toContain('@/components/Settings/OperationsPanel');
- expect(reportingPanelSource).toContain('@/components/Settings/useReportingPanelState');
- expect(reportingPanelSource).toContain('@/components/shared/UpgradeLink');
- expect(reportingPanelSource).toContain('@/components/Settings/reportingCatalogModel');
- expect(reportingPanelSource).toContain('@/components/Settings/reportingPanelModel');
- expect(reportingPanelSource).toContain('reportingCatalog');
- expect(reportingPanelSource).toContain('title="Reporting"');
- expect(reportingPanelSource).not.toContain('loadRuntimeCapabilities()');
- expect(reportingPanelSource).not.toContain('startProTrial()');
- expect(reportingPanelSource).not.toContain("apiFetch('/api/admin/reports/generate");
- expect(reportingPanelSource).not.toContain('window.URL.createObjectURL');
- expect(reportingPanelStateSource).toContain('export const useReportingPanelState =');
- expect(reportingPanelStateSource).toContain('loadRuntimeCapabilities');
- expect(reportingPanelStateSource).toContain('runStartProTrialAction({');
- expect(reportingPanelStateSource).toContain('getUpgradeActionDestination(');
- expect(reportingPanelStateSource).not.toContain('startProTrial()');
- expect(reportingPanelStateSource).toContain('buildReportingRequest');
- expect(reportingPanelStateSource).toContain('buildReportingCatalogRequest');
- expect(reportingPanelStateSource).toContain('buildLegacyReportingCatalogFallback');
- expect(reportingPanelStateSource).toContain('parseReportingCatalog');
- expect(reportingPanelStateSource).toContain('reportingFeatureId');
- expect(reportingPanelStateSource).toContain('loadReportingCatalog = async');
- expect(reportingPanelSource).toContain('Retry');
- expect(reportingPanelStateSource).not.toContain('!runtimeCapabilitiesLoaded()');
- expect(reportingPanelStateSource).not.toContain('!isReportingEnabled()');
- expect(reportingPanelStateSource).toContain('buildVMInventoryExportRequest');
- expect(reportingPanelStateSource).toContain('apiErrorFromResponse');
- expect(reportingPanelStateSource).toContain('getReportingGenerateSuccessMessage');
- expect(reportingPanelStateSource).toContain('resolveReportingDownloadFilename');
- expect(reportingPanelStateSource).not.toContain("'advanced_reporting'");
- expect(reportingPanelStateSource).not.toContain('getTrialAlreadyUsedMessage()');
- expect(reportingCatalogModelSource).toContain('export function buildReportingCatalogRequest');
- expect(reportingCatalogModelSource).toContain(
- 'export function buildLegacyReportingCatalogFallback',
- );
- expect(reportingCatalogModelSource).toContain('export function parseReportingCatalog');
- expect(reportingCatalogModelSource).toContain('interface ReportingLockedStateDefinition');
- expect(reportingCatalogModelSource).toContain('interface ReportingGuidanceDefinition');
- expect(reportingPanelSource).not.toContain('Advanced Reporting (Pro)');
- expect(reportingPanelSource).not.toContain('Advanced Insights');
- expect(reportingPanelSource).not.toContain('Detailed Reporting');
- expect(reportingPanelSource).toContain('<Show when={performanceReport()}>');
- expect(reportingPanelSource).not.toContain(
- '<Show when={performanceReport() && inventoryDefinition()}>',
- );
- expect(reportingPanelSource).not.toContain(
- 'Performance reports come from the historical metrics store',
- );
- expect(reportingPanelModelSource).toContain('export function getReportingRangeStart');
- expect(reportingPanelModelSource).toContain('export function buildReportingRequest');
- expect(reportingPanelModelSource).toContain('export function buildReportingFilename');
- expect(reportingInventoryExportModelSource).toContain(
- 'export function buildVMInventoryExportFilename',
- );
- expect(reportingInventoryExportModelSource).toContain(
- 'export function parseVMInventoryExportDefinition',
- );
- });
-
- it('keeps the shared operations wrapper rooted at SettingsPanel', () => {
- expect(operationsPanelSource).toContain('@/components/shared/SettingsPanel');
- expect(operationsPanelSource).toContain('noPadding');
- expect(operationsPanelSource).toContain('bodyClass="divide-y divide-border"');
- expect(operationsPanelSource).not.toContain('createSignal(');
- expect(operationsPanelSource).not.toContain('apiFetch');
- });
-
- it('keeps the audit log shell behind an extracted runtime owner', () => {
- expect(auditLogPanelSource).toContain('@/components/Settings/useAuditLogPanelState');
- expect(auditLogPanelSource).toContain('@/components/shared/UpgradeLink');
- expect(auditLogPanelSource).not.toContain('createLocalStorageStringSignal');
- expect(auditLogPanelSource).not.toContain('const fetchAuditEvents = async (');
- expect(auditLogPanelSource).not.toContain('const verifyAllEvents = async (');
- expect(auditLogPanelSource).not.toContain('trackPaywallViewed');
- expect(auditLogPanelSource).not.toContain('target="_blank"');
- expect(auditLogStateSource).toContain('export const useAuditLogPanelState =');
- expect(auditLogStateSource).toContain('createLocalStorageStringSignal');
- expect(auditLogStateSource).toContain('const fetchAuditEvents = async (');
- expect(auditLogStateSource).toContain('const verifyAllEvents = async (');
- expect(auditLogStateSource).toContain('trackPaywallViewed');
- expect(auditLogStateSource).toContain("getUpgradeActionDestination('audit_logging')");
- expect(auditLogStateSource).toContain('runStartProTrialAction({');
- expect(auditLogStateSource).not.toContain('startProTrial()');
- expect(auditLogStateSource).not.toContain('getTrialAlreadyUsedMessage()');
- });
-
- it('keeps the audit webhook shell behind an extracted runtime owner', () => {
- expect(auditWebhookPanelSource).toContain('@/components/Settings/useAuditWebhookPanelState');
- expect(auditWebhookPanelSource).toContain('@/components/shared/UpgradeLink');
- expect(auditWebhookPanelSource).not.toContain('loadRuntimeCapabilities();');
- expect(auditWebhookPanelSource).not.toContain('const fetchWebhooks = async () =>');
- expect(auditWebhookPanelSource).not.toContain('const saveWebhooks = async (urls: string[]) =>');
- expect(auditWebhookPanelSource).not.toContain('trackPaywallViewed');
- expect(auditWebhookPanelSource).not.toContain('target="_blank"');
- expect(auditWebhookStateSource).toContain('export const useAuditWebhookPanelState =');
- expect(auditWebhookStateSource).toContain('loadRuntimeCapabilities();');
- expect(auditWebhookStateSource).toContain('const fetchWebhooks = async () =>');
- expect(auditWebhookStateSource).toContain('const saveWebhooks = async (urls: string[]) =>');
- expect(auditWebhookStateSource).toContain('trackPaywallViewed');
- expect(auditWebhookStateSource).toContain("getUpgradeActionDestination('audit_logging')");
- expect(auditWebhookStateSource).toContain('runStartProTrialAction({');
- expect(auditWebhookStateSource).not.toContain('startProTrial()');
- expect(auditWebhookStateSource).not.toContain('getTrialAlreadyUsedMessage()');
- });
-
- it('keeps the SSO providers shell behind extracted runtime owners', () => {
- expect(ssoProvidersPanelSource).toContain('@/components/Settings/useSSOProvidersState');
- expect(ssoProvidersPanelSource).toContain('@/components/shared/UpgradeLink');
- expect(ssoProvidersPanelSource).toContain('@/utils/ssoProviderPresentation');
- expect(ssoProvidersPanelSource).not.toContain('const loadProviders = async () =>');
- expect(ssoProvidersPanelSource).not.toContain('const handleSave = async (');
- expect(ssoProvidersPanelSource).not.toContain('const testConnection = async () =>');
- expect(ssoProvidersPanelSource).not.toContain('target="_blank"');
- expect(ssoProvidersStateSource).toContain('@/components/Settings/ssoProvidersModel');
- expect(ssoProvidersStateSource).toContain('@/utils/ssoProviderPresentation');
- expect(ssoProvidersStateSource).toContain('export const useSSOProvidersState =');
- expect(ssoProvidersStateSource).toContain('const loadProviders = async () =>');
- expect(ssoProvidersStateSource).toContain('const handleSave = async (event?: Event) =>');
- expect(ssoProvidersStateSource).toContain('const testConnection = async () =>');
- expect(ssoProvidersStateSource).toContain('getUpgradeActionDestination');
- expect(ssoProvidersStateSource).toContain('runStartProTrialAction({');
- expect(ssoProvidersStateSource).not.toContain('startProTrial()');
- expect(ssoProvidersStateSource).not.toContain('getTrialAlreadyUsedMessage()');
- expect(ssoProvidersModelSource).toContain('export const createEmptyProviderForm =');
- expect(ssoProvidersModelSource).toContain('export const mapProviderDetailsToForm =');
- expect(ssoProvidersModelSource).toContain('export const buildProviderPayload =');
- expect(ssoProvidersModelSource).toContain('export const buildProviderTestPayload =');
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOProviderEmptyStateTitle',
- );
- expect(ssoProviderPresentationSource).toContain(
- 'export function getSSOProvidersLoadErrorMessage',
- );
- });
-
- it('keeps shared system settings presentation extracted from panel and state owners', () => {
- expect(generalSettingsPanelSource).toContain('@/utils/systemSettingsPresentation');
- expect(generalSettingsPanelSource).toContain('@/utils/docsLinks');
- expect(generalSettingsPanelSource).toContain('PRIVACY_DOC_URL');
- expect(generalSettingsPanelSource).toContain('Usage data and privacy');
- expect(generalSettingsPanelSource).toContain('Disable local-only upgrade events');
- expect(generalSettingsPanelSource).toContain('Preview payload');
- expect(generalSettingsPanelSource).toContain('Reset ID');
- expect(generalSettingsPanelSource).toContain('Telemetry payload preview');
- expect(normalizedGeneralSettingsPanelSource).toContain('retained for up to 90 days');
- expect(normalizedGeneralSettingsPanelSource).toContain(
- 'IP addresses are not stored in telemetry rows',
- );
- expect(apiAccessPanelSource).toContain('@/utils/docsLinks');
- expect(apiAccessPanelSource).toContain('API_TOKEN_SCOPES_DOC_URL');
- expect(aiRuntimeControlsSectionSource).toContain('@/utils/docsLinks');
- expect(aiRuntimeControlsSectionSource).toContain('TERMS_DOC_URL');
- expect(securityOverviewPanelSource).toContain('@/utils/docsLinks');
- expect(securityOverviewPanelSource).toContain('PROXY_AUTH_DOC_URL');
- expect(securityOverviewPanelSource).toContain('SECURITY_DOC_URL');
- expect(securityOverviewPanelSource).toContain('getSecurityHardeningActions');
- expect(securityOverviewPanelSource).toContain("label: 'Open API Access'");
- expect(securityOverviewPanelSource).toContain("label: 'Open security guide'");
- expect(securityOverviewPanelSource).toContain("tone={hardeningTone()}");
- expect(securityOverviewPanelSource).toContain("criticalHardeningActions() > 0 ? 'danger' : 'info'");
- expect(selfHostedCommercialRecoverySectionSource).toContain('@/utils/docsLinks');
- expect(selfHostedCommercialRecoverySectionSource).toContain('TERMS_DOC_URL');
- expect(apiTokenManagerModelSource).toContain('@/utils/docsLinks');
- expect(apiTokenManagerModelSource).toContain('API_TOKEN_SCOPES_DOC_URL');
- expect(recoverySettingsPanelSource).toContain('@/utils/systemSettingsPresentation');
- expect(networkDiscoverySectionSource).toContain('@/utils/systemSettingsPresentation');
- expect(systemSettingsStateSource).toContain('@/utils/systemSettingsPresentation');
- expect(systemSettingsStateSource).toContain('handleLoadTelemetryPreview');
- expect(systemSettingsStateSource).toContain('handleResetTelemetryInstallID');
- expect(systemSettingsPresentationSource).toContain('export const PVE_POLLING_PRESETS');
- expect(systemSettingsPresentationSource).toContain(
- 'export function getSystemSettingsSaveErrorMessage',
- );
- expect(systemSettingsPresentationSource).toContain(
- 'export function getStartUpdateErrorMessage',
- );
- expect(docsLinksSource).toContain("export const SHIPPED_DOCS_ROOT = '/docs'");
- expect(docsLinksSource).toContain(
- "export const PRIVACY_DOC_URL = getShippedDocUrl('PRIVACY.md')",
- );
- expect(docsLinksSource).toContain(
- "export const CONFIGURATION_DOC_URL = getShippedDocUrl('CONFIGURATION.md')",
- );
- expect(docsLinksSource).toContain(
- "export const PROXY_AUTH_DOC_URL = getShippedDocUrl('PROXY_AUTH.md')",
- );
- expect(docsLinksSource).toContain(
- "export const SECURITY_DOC_URL = getShippedDocUrl('SECURITY.md')",
- );
- expect(docsLinksSource).toContain("export const TERMS_DOC_URL = getShippedDocUrl('TERMS.md')");
- });
-
- it('routes every top-level settings surface through the canonical panel shell framing', () => {
- for (const [panelName, source] of Object.entries(topLevelSettingsPanelSources)) {
- const usesCanonicalShell =
- source.includes('SettingsPanel') ||
- source.includes('CommercialBillingShell') ||
- (panelName === 'InfrastructureWorkspace' &&
- source.includes('./InfrastructureInstallerSection') &&
- source.includes('./PlatformConnectionsWorkspace') &&
- source.includes('./ConnectionsTable'));
- expect(usesCanonicalShell, `${panelName} should use a canonical settings panel shell`).toBe(
- true,
- );
- expect(source, `${panelName} should not introduce page-level header chrome`).not.toContain(
- '<PageHeader',
- );
- }
- });
-
- it('keeps infrastructure shell framing focused on connected systems, not billing', () => {
- expect(settingsHeaderMetaSource).toContain('./selfHostedBillingPresentation');
- expect(settingsHeaderMetaSource).toContain(
- 'SELF_HOSTED_PRO_BILLING_PRESENTATION.infrastructureRouteReferral',
- );
- expect(settingsHeaderMetaSource).not.toContain(
- 'Billing and self-hosted plan features live in Pulse Pro.',
- );
- expect(SETTINGS_HEADER_META['infrastructure-systems'].title).toBe('Infrastructure');
- expect(SETTINGS_HEADER_META['infrastructure-systems'].description).toContain(
- 'use Add infrastructure',
- );
- expect(SETTINGS_HEADER_META['infrastructure-systems'].description).toBe(
- `Review monitored systems in one ledger, then use Add infrastructure when you need platform setup or agent install commands. ${SELF_HOSTED_PRO_BILLING_PRESENTATION.infrastructureRouteReferral}`,
- );
- });
-
- it('keeps billing-related shell framing on self-hosted commercial terms', () => {
- expect(SETTINGS_HEADER_META['infrastructure-systems'].description).toContain(
- 'self-hosted plan features',
- );
- expect(SETTINGS_HEADER_META['infrastructure-systems'].description).not.toContain(
- 'installed-agent',
- );
- expect(SETTINGS_HEADER_META['system-billing'].title).toBe(
- SELF_HOSTED_PRO_BILLING_PRESENTATION.shellTitle,
- );
- expect(SETTINGS_HEADER_META['system-billing'].description).toBe(
- SELF_HOSTED_PRO_BILLING_PRESENTATION.shellDescription,
- );
- expect(getSettingsNavItem('system-billing')?.label).toBe(
- SELF_HOSTED_PRO_BILLING_PRESENTATION.shellTitle,
- );
- expect(SETTINGS_HEADER_META['organization-billing'].description).toContain(
- 'subscription status',
- );
- expect(SETTINGS_HEADER_META['organization-billing'].description).toContain('plan limits');
- });
-
- it('keeps demo-mode billing visibility on the shared settings shell owner', () => {
- expect(settingsNavigationModelSource).toContain('hideWhenCommercialHidden?: boolean;');
- expect(settingsNavVisibilitySource).toContain('if (item.hideWhenCommercialHidden)');
- expect(settingsNavVisibilitySource).toContain('context.presentationPolicyResolved === false');
- expect(settingsNavVisibilitySource).toContain('if (context.presentationPolicyHidesCommercial)');
- expect(getSettingsNavItem('system-billing')?.hideWhenCommercialHidden).toBe(true);
- expect(getSettingsNavItem('organization-billing')?.hideWhenCommercialHidden).toBe(true);
- expect(getSettingsNavItem('organization-billing-admin')?.hideWhenCommercialHidden).toBe(true);
- });
-
- it('keeps demo-mode organization visibility on the shared settings shell owner', () => {
- expect(settingsNavigationModelSource).toContain('hideWhenOrganizationHidden?: boolean;');
- expect(settingsNavVisibilitySource).toContain('if (item.hideWhenOrganizationHidden)');
- expect(settingsNavVisibilitySource).toContain('context.presentationPolicyHidesOrganizations');
- expect(getSettingsNavItem('organization-overview')?.hideWhenOrganizationHidden).toBe(true);
- expect(getSettingsNavItem('organization-access')?.hideWhenOrganizationHidden).toBe(true);
- expect(getSettingsNavItem('organization-sharing')?.hideWhenOrganizationHidden).toBe(true);
- expect(getSettingsNavItem('organization-billing')?.hideWhenOrganizationHidden).toBe(true);
- expect(getSettingsNavItem('organization-billing-admin')?.hideWhenOrganizationHidden).toBe(
- true,
+ expect(infrastructureWorkspaceModelSource).toContain(
+ 'export function deriveAddStepFromLegacyPath(',
);
});
- it('keeps read-only infrastructure landing and shell copy on the shared settings owner', () => {
- expect(settingsNavigationHookSource).toContain('presentationPolicyIsReadOnly');
- expect(settingsNavigationHookSource).toContain('buildInfrastructureWorkspacePath');
- expect(settingsShellStateSource).toContain('presentationPolicyIsReadOnly');
- expect(settingsShellStateSource).toContain(
- 'Setup changes stay unavailable in this read-only session.',
+ it('keeps the infrastructure add flow inline on ConnectionEditor instead of retired overlays', () => {
+ expect(infrastructureWorkspaceSource).toContain(
+ "import { ConnectionEditor } from './ConnectionEditor/ConnectionEditor';",
);
- expect(infrastructureWorkspaceSource).toContain('presentationPolicyIsReadOnly');
- expect(infrastructureWorkspaceSource).toContain('readOnly()');
- });
-
- it('keeps relay shell copy on the shared relay presentation owner', () => {
- expect(settingsHeaderMetaSource).toContain('RELAY_SETTINGS_DESCRIPTION');
- expect(relaySettingsPanelSource).toContain('description={RELAY_SETTINGS_DESCRIPTION}');
- expect(SETTINGS_HEADER_META['system-relay'].description).toBe(RELAY_SETTINGS_DESCRIPTION);
- expect(SETTINGS_HEADER_META['system-relay'].description).toContain('Pulse Mobile pairing');
- });
-
- it('keeps self-hosted billing shell copy in a settings-owned presentation module', () => {
- expect(selfHostedBillingPresentationSource).toContain(
- 'export const SELF_HOSTED_PRO_BILLING_PRESENTATION',
- );
- expect(selfHostedBillingPresentationSource).not.toContain('@/utils/licensePresentation');
- });
-
- it('keeps shell titles aligned with the leading settings panel on key top-level surfaces', () => {
- for (const { tab, title, source } of canonicalShellTitleExpectations) {
- expect(SETTINGS_HEADER_META[tab].title, `${tab} should keep its shell title canonical`).toBe(
- title,
- );
- const allowedTitleExpression =
- tab === 'system-updates'
- ? `title={UPDATES_PANEL_COPY.title}`
- : tab === 'system-ai'
- ? 'title={AI_SETTINGS_PANEL_TITLE}'
- : tab === 'system-billing'
- ? 'title={SELF_HOSTED_PRO_BILLING_PRESENTATION.shellTitle}'
- : `title="${title}"`;
- expect(
- source,
- `${tab} should keep its leading SettingsPanel title aligned with the shell title`,
- ).toContain(allowedTitleExpression);
- }
- });
-
- it('keeps single-surface settings pages rooted directly at SettingsPanel', () => {
- expect(
- auditLogPanelSource,
- 'AuditLogPanel should not wrap its single shell in an extra page spacer',
- ).not.toContain('<div class="space-y-6">');
- expect(
- updatesSettingsPanelSource,
- 'UpdatesSettingsPanel should not wrap its single shell in an extra page spacer',
- ).not.toContain('<div class="space-y-6">');
- expect(
- recoverySettingsPanelSource,
- 'RecoverySettingsPanel should not wrap its single shell in an extra page spacer',
- ).not.toContain('<div class="space-y-6">');
+ expect(infrastructureWorkspaceSource).toContain('NodeCredentialSlot');
+ expect(infrastructureWorkspaceSource).toContain('TrueNASCredentialSlot');
+ expect(infrastructureWorkspaceSource).toContain('VMwareCredentialSlot');
+ expect(infrastructureWorkspaceSource).toContain('navigate(buildInfrastructureWorkspacePath(), { replace: true });');
+ expect(infrastructureWorkspaceSource).not.toContain('InfrastructureOperationsController');
+ expect(infrastructureWorkspaceSource).not.toContain('PlatformConnectionsWorkspace');
+ expect(infrastructureWorkspaceSource).not.toContain('NodeModal');
+ expect(infrastructureWorkspaceSource).not.toContain('layout="drawer-right"');
});
- it('splits runtime capability reads from commercial entitlement reads across settings state owners', () => {
- expect(settingsSource).toContain("from '@/stores/licenseCommercial';");
- expect(settingsSource).not.toContain("getRuntimeLimit, isPro, loadRuntimeCapabilities } from '@/stores/license';");
+ it('keeps probe-first connection setup and inline node credentials on the shared editor model', () => {
+ expect(connectionEditorSource).toContain("import { AddressProbeStep } from './AddressProbeStep';");
+ expect(connectionEditorSource).toContain('const DEFAULT_MANUAL_TYPES: ConnectionType[] =');
+ expect(connectionEditorSource).toContain('Paste an address and Pulse detects the product.');
+ expect(connectionEditorSource).toContain('<AddressProbeStep');
+ expect(connectionEditorSource).not.toContain('NodeModal');
- expect(aiSettingsStateSource).toContain("} from '@/stores/license';");
- expect(aiSettingsStateSource).toContain("} from '@/stores/licenseCommercial';");
- expect(aiSettingsStateSource).not.toContain('loadCommercialPosture();');
- expect(aiSettingsStateSource).toContain('canOfferCommercialTrial');
- expect(aiSettingsStateSource).not.toContain('commercialPosture()?.trial_eligible');
+ expect(addressProbeStepSource).toContain('Probe address');
+ expect(addressProbeStepSource).toContain('Enter credentials manually');
- expect(reportingPanelStateSource).toContain("} from '@/stores/license';");
- expect(reportingPanelStateSource).toContain("} from '@/stores/licenseCommercial';");
- expect(reportingPanelStateSource).not.toContain('loadCommercialPosture();');
- expect(reportingPanelStateSource).toContain('canOfferCommercialTrial');
- expect(reportingPanelStateSource).not.toContain('commercialPosture()?.trial_eligible');
+ expect(connectionEditorStateSource).toContain('ConnectionsAPI.probe(value)');
+ expect(connectionEditorStateSource).toContain('export const CONNECTION_TYPE_LABELS');
- expect(auditLogStateSource).toContain("} from '@/stores/license';");
- expect(auditLogStateSource).toContain("} from '@/stores/licenseCommercial';");
- expect(auditLogStateSource).not.toContain('loadCommercialPosture();');
- expect(auditLogStateSource).toContain('canOfferCommercialTrial');
- expect(auditLogStateSource).not.toContain('commercialPosture()?.trial_eligible');
- expect(auditWebhookStateSource).toContain("} from '@/stores/licenseCommercial';");
- expect(auditWebhookStateSource).not.toContain('loadCommercialPosture();');
- expect(auditWebhookStateSource).toContain('canOfferCommercialTrial');
- expect(auditWebhookStateSource).not.toContain('commercialPosture()?.trial_eligible');
- expect(ssoProvidersStateSource).toContain("} from '@/stores/licenseCommercial';");
- expect(ssoProvidersStateSource).not.toContain('loadCommercialPosture();');
- expect(ssoProvidersStateSource).toContain('canOfferCommercialTrial');
- expect(ssoProvidersStateSource).not.toContain('commercialPosture()?.trial_eligible');
- expect(rbacFeatureGateStateSource).toContain("} from '@/stores/licenseCommercial';");
- expect(rbacFeatureGateStateSource).not.toContain('loadCommercialPosture();');
- expect(rbacFeatureGateStateSource).toContain('canOfferCommercialTrial');
- expect(rbacFeatureGateStateSource).not.toContain('commercialPosture()?.trial_eligible');
- expect(nodeModalStateSource).toContain("from '@/stores/licenseCommercial';");
- expect(nodeModalStateSource).not.toContain('loadCommercialPosture();');
- expect(nodeModalStateSource).toContain('canStartCommercialTrial');
- expect(nodeModalStateSource).not.toContain('commercialPosture()');
- expect(relaySettingsPanelStateSource).toContain('canOfferCommercialTrial');
- expect(relaySettingsPanelStateSource).not.toContain('commercialPosture()?.trial_eligible');
+ expect(nodeCredentialSlotSource).toContain('useNodeModalState(modalProps)');
+ expect(nodeCredentialSlotSource).toContain('<NodeModalBasicInfoSection');
+ expect(nodeCredentialSlotSource).toContain('<NodeModalAuthenticationSection');
+ expect(nodeCredentialSlotSource).toContain('<NodeModalMonitoringSection');
+ expect(nodeCredentialSlotSource).toContain('<NodeModalStatusFooter');
+ expect(nodeCredentialSlotSource).not.toContain('<Dialog');
});
});
diff --git a/frontend-modern/src/components/Settings/connectionsTableModel.ts b/frontend-modern/src/components/Settings/connectionsTableModel.ts
index b9e621f939..681383975f 100644
--- a/frontend-modern/src/components/Settings/connectionsTableModel.ts
+++ b/frontend-modern/src/components/Settings/connectionsTableModel.ts
@@ -1,14 +1,4 @@
-import { getUnifiedAgentLastSeenLabel } from '@/utils/unifiedAgentInventoryPresentation';
-import {
- getUnifiedAgentStatusPresentation,
- MONITORING_STOPPED_STATUS_LABEL,
-} from '@/utils/unifiedAgentStatusPresentation';
-import type { UnifiedAgentRow } from './infrastructureOperationsModel';
-
-export type SystemManageAction =
- | { kind: 'connection'; connectionId: string }
- | { kind: 'inventory-active'; rowKey: string }
- | { kind: 'inventory-ignored'; rowKey: string };
+export type SystemManageAction = { kind: 'connection'; connectionId: string };
export interface InfrastructureSystemRow {
id: string;
@@ -23,77 +13,3 @@ export interface InfrastructureSystemRow {
manageLabel: string;
manage: SystemManageAction;
}
-
-const PROXMOX_CAPABILITY_KEYS = ['proxmox', 'pbs', 'pmg'] as const;
-const AGENT_CAPABILITY_KEYS = ['agent', 'docker', 'kubernetes'] as const;
-
-const collectionLabelFromCapabilities = (capabilities: UnifiedAgentRow['capabilities']) => {
- const hasAgent = capabilities.some((capability) =>
- AGENT_CAPABILITY_KEYS.includes(capability as (typeof AGENT_CAPABILITY_KEYS)[number]),
- );
- const hasApi = capabilities.some((capability) =>
- PROXMOX_CAPABILITY_KEYS.includes(capability as (typeof PROXMOX_CAPABILITY_KEYS)[number]) ||
- capability === 'truenas',
- );
-
- if (hasAgent && hasApi) {
- return 'Agent + API';
- }
- if (hasApi) {
- return 'API';
- }
- if (hasAgent) {
- return 'Agent';
- }
- return 'Runtime';
-};
-
-const isTopLevelInfrastructureRow = (row: UnifiedAgentRow) =>
- !row.linkedVmId?.trim() && !row.linkedContainerId?.trim();
-
-const compareRows = (left: InfrastructureSystemRow, right: InfrastructureSystemRow) => {
- const leftName = left.name.trim().toLowerCase();
- const rightName = right.name.trim().toLowerCase();
- if (leftName === rightName) {
- return left.id.localeCompare(right.id);
- }
- return leftName.localeCompare(rightName);
-};
-
-const reportingRow = (row: UnifiedAgentRow): InfrastructureSystemRow => {
- const statusPresentation = getUnifiedAgentStatusPresentation(row.status, row.healthStatus);
-
- return {
- id: row.rowKey,
- name: row.name,
- subtitle: row.status === 'removed' ? 'Ignored by Pulse' : undefined,
- host:
- row.hostname && row.hostname !== row.name && row.hostname !== row.displayName
- ? row.hostname
- : undefined,
- coverageLabels: row.surfaces.map((surface) => surface.label),
- collectionLabel: collectionLabelFromCapabilities(row.capabilities),
- statusLabel: statusPresentation.label,
- statusClassName: statusPresentation.badgeClass,
- lastActivityText: getUnifiedAgentLastSeenLabel(row, MONITORING_STOPPED_STATUS_LABEL),
- manageLabel: row.status === 'removed' ? 'Review ignored' : 'View details',
- manage:
- row.status === 'removed'
- ? { kind: 'inventory-ignored', rowKey: row.rowKey }
- : { kind: 'inventory-active', rowKey: row.rowKey },
- };
-};
-
-export interface InfrastructureSystemsTableSources {
- activeRows: readonly UnifiedAgentRow[];
- monitoringStoppedRows: readonly UnifiedAgentRow[];
-}
-
-export function buildInfrastructureSystemRows(
- sources: InfrastructureSystemsTableSources,
-): InfrastructureSystemRow[] {
- return [
- ...sources.activeRows.filter(isTopLevelInfrastructureRow).map(reportingRow),
- ...sources.monitoringStoppedRows.filter(isTopLevelInfrastructureRow).map(reportingRow),
- ].sort(compareRows);
-}
diff --git a/frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx b/frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx
index 477ed465a9..07b89724f9 100644
--- a/frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx
+++ b/frontend-modern/src/components/Settings/useInfrastructureOperationsState.tsx
@@ -14,7 +14,6 @@ import {
useInfrastructureInstallState,
type InfrastructureInstallStateOptions,
} from './useInfrastructureInstallState';
-import { useInfrastructureReportingState } from './useInfrastructureReportingState';
export type InfrastructureOperationsStateOptions = InfrastructureInstallStateOptions;
@@ -22,7 +21,6 @@ export const useInfrastructureOperationsState = (
options: InfrastructureOperationsStateOptions = {},
) => {
const installState = useInfrastructureInstallState(options);
- const reportingState = useInfrastructureReportingState();
const withPrivilegeEscalation = (command: string) => {
if (!command.includes('| bash -s --')) return command;
@@ -157,7 +155,6 @@ export const useInfrastructureOperationsState = (
return {
...installState,
- ...reportingState,
getPlatformUninstallCommand,
getUninstallCommand,
getUpgradeCommand,
diff --git a/frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx b/frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx
deleted file mode 100644
index 039eb8172c..0000000000
--- a/frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx
+++ /dev/null
@@ -1,1021 +0,0 @@
-import { createEffect, createMemo, createSignal, For, onMount, Show } from 'solid-js';
-import { useWebSocket } from '@/contexts/appRuntime';
-import {
- MonitoringAPI,
- type RemovedDockerHost,
- type RemovedHostAgent,
- type RemovedKubernetesCluster,
-} from '@/api/monitoring';
-import {
- AgentProfilesAPI,
- MISSING_AGENT_PROFILE_ASSIGNMENT_MESSAGE,
- type AgentProfile,
- type AgentProfileAssignment,
-} from '@/api/agentProfiles';
-import { notificationStore } from '@/stores/notifications';
-import { useResources } from '@/hooks/useResources';
-import { logger } from '@/utils/logger';
-import { getPreferredNamedEntityLabel } from '@/utils/resourceIdentity';
-import {
- getActionableAgentIdFromResource,
- getActionableDockerRuntimeIdFromResource,
- getActionableKubernetesClusterIdFromResource,
- getExplicitAgentIdFromResource,
-} from '@/utils/agentResources';
-import {
- getAgentCapabilityBadgeClass,
- type AgentCapability,
-} from '@/utils/agentCapabilityPresentation';
-import {
- ALLOW_RECONNECT_LABEL,
- MONITORING_STOPPED_STATUS_LABEL,
- getUnifiedAgentStatusPresentation,
-} from '@/utils/unifiedAgentStatusPresentation';
-import {
- getInventorySubjectLabel,
- getUnifiedAgentAllowReconnectErrorMessage,
- getUnifiedAgentAllowReconnectSuccessMessage,
- getUnifiedAgentLastSeenLabel,
- getUnifiedAgentStopMonitoringErrorMessage,
- getUnifiedAgentStopMonitoringSuccessMessage,
- getUnifiedAgentStopMonitoringUnavailableMessage,
-} from '@/utils/unifiedAgentInventoryPresentation';
-import type { ConnectedInfrastructureItem } from '@/types/api';
-import type { Resource } from '@/types/resource';
-import {
- getCapabilitySurfaceLabel,
- getRowReportingSummary,
- getStopMonitoringScopeLabel,
- joinHumanList,
- rowFromConnectedInfrastructureItem,
- type AgentPlatform,
- type InventoryActionNotice,
- type InventoryActionType,
- type ScopeCategory,
- type StopMonitoringDialogState,
- type UnifiedAgentRow,
-} from './infrastructureOperationsModel';
-
-export const useInfrastructureReportingState = () => {
- const { state } = useWebSocket();
- const { mutate: mutateResources, refetch: refetchResources } = useResources();
-
- const [profiles, setProfiles] = createSignal<AgentProfile[]>([]);
- const [assignments, setAssignments] = createSignal<AgentProfileAssignment[]>([]);
- const [pendingScopeUpdates, setPendingScopeUpdates] = createSignal<Record<string, boolean>>({});
- const [pendingInventoryActions, setPendingInventoryActions] = createSignal<
- Record<string, InventoryActionType>
- >({});
- const [inventoryActionNotice, setInventoryActionNotice] =
- createSignal<InventoryActionNotice | null>(null);
- const [optimisticRemovedHostAgents, setOptimisticRemovedHostAgents] = createSignal<
- RemovedHostAgent[]
- >([]);
- const [optimisticRemovedDockerHosts, setOptimisticRemovedDockerHosts] = createSignal<
- RemovedDockerHost[]
- >([]);
- const [optimisticRemovedKubernetesClusters, setOptimisticRemovedKubernetesClusters] =
- createSignal<RemovedKubernetesCluster[]>([]);
- const [stopMonitoringDialog, setStopMonitoringDialog] =
- createSignal<StopMonitoringDialogState | null>(null);
- const [expandedRowKey, setExpandedRowKey] = createSignal<string | null>(null);
- const [selectedIgnoredRowKey, setSelectedIgnoredRowKey] = createSignal<string | null>(null);
- const [filterCapability, setFilterCapability] = createSignal<'all' | AgentCapability>('all');
- const [filterScope, setFilterScope] = createSignal<'all' | Exclude<ScopeCategory, 'na'>>('all');
- const [filterSearch, setFilterSearch] = createSignal('');
- let recoveryQueueSectionRef: HTMLDivElement | undefined;
-
- const loadAgentProfiles = async () => {
- try {
- const [profilesData, assignmentsData] = await Promise.all([
- AgentProfilesAPI.listProfiles(),
- AgentProfilesAPI.listAssignments(),
- ]);
- setProfiles(profilesData);
- setAssignments(assignmentsData);
- } catch (err) {
- logger.debug('Failed to load agent profiles', err);
- notificationStore.error(err instanceof Error ? err.message : 'Failed to load agent profiles');
- }
- };
-
- onMount(() => {
- void loadAgentProfiles();
- });
-
- const profileById = createMemo(() => {
- const map = new Map<string, AgentProfile>();
- for (const profile of profiles()) {
- map.set(profile.id, profile);
- }
- return map;
- });
-
- const assignmentByAgent = createMemo(() => {
- const map = new Map<string, AgentProfileAssignment>();
- for (const assignment of assignments()) {
- map.set(assignment.agent_id, assignment);
- }
- return map;
- });
-
- const getAgentId = (resource: Resource) => getExplicitAgentIdFromResource(resource);
- const getAgentActionId = (resource: Resource) => getActionableAgentIdFromResource(resource);
- const getDockerActionId = (resource: Resource) =>
- getActionableDockerRuntimeIdFromResource(resource);
- const getKubernetesActionId = (resource: Resource) =>
- getActionableKubernetesClusterIdFromResource(resource);
-
- const getScopeInfo = (agentId: string | undefined) => {
- if (!agentId) {
- return { label: 'N/A', detail: '', category: 'na' as const };
- }
- const assignment = assignmentByAgent().get(agentId);
- if (!assignment) {
- return { label: 'Default', detail: 'Auto-detect', category: 'default' as const };
- }
- const profile = profileById().get(assignment.profile_id);
- if (!profile) {
- return {
- label: 'Profile assigned',
- detail: assignment.profile_id,
- category: 'profile' as const,
- };
- }
- const name = profile.name || assignment.profile_id;
- const isAIManaged =
- profile.description?.toLowerCase().includes('pulse ai') ||
- name.toLowerCase().startsWith('ai scope');
- return isAIManaged
- ? { label: 'Patrol-managed', detail: name, category: 'ai-managed' as const }
- : { label: name, detail: 'Assigned profile', category: 'profile' as const };
- };
-
- const getProfileOptionLabel = (profileId: string) => {
- const profile = profileById().get(profileId);
- if (profile) {
- return profile.name || profile.id;
- }
- return `Missing profile (${profileId})`;
- };
-
- const updateScopeAssignment = async (
- agentId: string,
- profileId: string | null,
- agentName: string,
- ) => {
- if (!agentId || pendingScopeUpdates()[agentId]) {
- return;
- }
-
- setPendingScopeUpdates((prev) => ({ ...prev, [agentId]: true }));
- try {
- if (profileId) {
- await AgentProfilesAPI.assignProfile(agentId, profileId);
- setAssignments((prev) => {
- const updatedAt = new Date().toISOString();
- const next = prev.filter((assignment) => assignment.agent_id !== agentId);
- next.push({ agent_id: agentId, profile_id: profileId, updated_at: updatedAt });
- return next;
- });
- notificationStore.success(
- `Scope updated for ${agentName}. Restart the agent to apply changes.`,
- );
- } else {
- await AgentProfilesAPI.unassignProfile(agentId);
- setAssignments((prev) => prev.filter((assignment) => assignment.agent_id !== agentId));
- notificationStore.success(
- `Scope reset for ${agentName}. Restart the agent to apply changes.`,
- );
- }
- } catch (err) {
- logger.error('Failed to update agent scope', err);
- if (err instanceof Error && err.message === MISSING_AGENT_PROFILE_ASSIGNMENT_MESSAGE) {
- await loadAgentProfiles();
- }
- notificationStore.error(
- err instanceof Error && err.message ? err.message : 'Failed to update agent scope',
- );
- } finally {
- setPendingScopeUpdates((prev) => {
- const next = { ...prev };
- delete next[agentId];
- return next;
- });
- }
- };
-
- const handleResetScope = async (agentId: string, agentName: string) => {
- if (
- !confirm(
- `Reset scope for ${agentName}? This removes any assigned profile and reverts to auto-detect.`,
- )
- ) {
- return;
- }
- await updateScopeAssignment(agentId, null, agentName);
- };
-
- const toggleAgentDetails = (rowKey: string) => {
- setExpandedRowKey(rowKey);
- };
-
- const connectedInfrastructureItems = createMemo<ConnectedInfrastructureItem[]>(
- () => state.connectedInfrastructure,
- );
-
- const matchesRemovedAgent = (
- resource: Resource,
- ids: { agentId?: string; dockerId?: string },
- capabilities: AgentCapability[],
- ) => {
- if (capabilities.includes('agent') && ids.agentId) {
- const agentId = ids.agentId;
- if (
- resource.id === agentId ||
- getAgentId(resource) === agentId ||
- getAgentActionId(resource) === agentId
- ) {
- return true;
- }
- }
-
- if (capabilities.includes('docker') && ids.dockerId) {
- const dockerId = ids.dockerId;
- if (resource.id === dockerId || getDockerActionId(resource) === dockerId) {
- return true;
- }
- }
-
- return false;
- };
-
- const reconcileRemovedAgent = (
- ids: { agentId?: string; dockerId?: string },
- capabilities: AgentCapability[],
- row: UnifiedAgentRow,
- ) => {
- const removedAt = Date.now();
- const displayName = row.displayName || row.name;
- const hostname = row.hostname || row.name;
- const agentId = ids.agentId;
- if (capabilities.includes('agent') && agentId) {
- setOptimisticRemovedHostAgents((prev) => [
- {
- id: agentId,
- hostname,
- displayName,
- linkedVmId: row.linkedVmId,
- linkedContainerId: row.linkedContainerId,
- removedAt,
- },
- ...prev.filter((item) => item.id !== agentId),
- ]);
- }
- const dockerId = ids.dockerId;
- if (capabilities.includes('docker') && dockerId) {
- setOptimisticRemovedDockerHosts((prev) => [
- {
- id: dockerId,
- hostname,
- displayName,
- removedAt,
- },
- ...prev.filter((item) => item.id !== dockerId),
- ]);
- }
- mutateResources((prev) =>
- prev.filter((resource) => !matchesRemovedAgent(resource, ids, capabilities)),
- );
- void refetchResources().catch((err) => {
- logger.debug('Failed to refresh resources after agent removal', err);
- });
- };
-
- const reconcileRemovedKubernetesCluster = (clusterId: string, clusterName?: string) => {
- setOptimisticRemovedKubernetesClusters((prev) => [
- {
- id: clusterId,
- name: clusterName || clusterId,
- displayName: clusterName,
- removedAt: Date.now(),
- },
- ...prev.filter((item) => item.id !== clusterId),
- ]);
- mutateResources((prev) =>
- prev.filter(
- (resource) =>
- !(
- resource.type === 'k8s-cluster' &&
- (getKubernetesActionId(resource) === clusterId || resource.id === clusterId)
- ),
- ),
- );
- void refetchResources().catch((err) => {
- logger.debug('Failed to refresh resources after kubernetes removal', err);
- });
- };
-
- const unifiedRows = createMemo<UnifiedAgentRow[]>(() => {
- const rows: UnifiedAgentRow[] = [];
- const optimisticHostIDs = new Set(
- optimisticRemovedHostAgents()
- .map((item) => item.id?.trim())
- .filter((id): id is string => Boolean(id)),
- );
- const optimisticDockerIDs = new Set(
- optimisticRemovedDockerHosts()
- .map((item) => item.id?.trim())
- .filter((id): id is string => Boolean(id)),
- );
- const optimisticKubernetesIDs = new Set(
- optimisticRemovedKubernetesClusters()
- .map((item) => item.id?.trim())
- .filter((id): id is string => Boolean(id)),
- );
-
- connectedInfrastructureItems().forEach((item) => {
- const optimisticFilteredItem: ConnectedInfrastructureItem =
- item.status === 'active'
- ? {
- ...item,
- surfaces: item.surfaces.filter((surface) => {
- const controlId = surface.controlId?.trim();
- if (!controlId) return true;
- if (surface.kind === 'agent') return !optimisticHostIDs.has(controlId);
- if (surface.kind === 'docker') return !optimisticDockerIDs.has(controlId);
- if (surface.kind === 'kubernetes') return !optimisticKubernetesIDs.has(controlId);
- return true;
- }),
- }
- : item;
-
- if (
- optimisticFilteredItem.status === 'active' &&
- optimisticFilteredItem.surfaces.length === 0
- ) {
- return;
- }
-
- rows.push(
- rowFromConnectedInfrastructureItem(
- optimisticFilteredItem,
- getScopeInfo(optimisticFilteredItem.scopeAgentId),
- ),
- );
- });
-
- const backendIgnoredSurfaceKeys = new Set(
- rows
- .filter((row) => row.status === 'removed')
- .flatMap((row) =>
- row.surfaces.map(
- (surface) => `${surface.kind}:${surface.controlId || surface.idValue || row.id}`,
- ),
- ),
- );
-
- optimisticRemovedDockerHosts().forEach((runtime) => {
- const key = `docker:${runtime.id}`;
- if (backendIgnoredSurfaceKeys.has(key)) return;
- const name = getPreferredNamedEntityLabel(runtime);
- rows.push({
- rowKey: `removed-docker-${runtime.id}`,
- id: runtime.id,
- dockerActionId: runtime.id,
- name,
- hostname: runtime.hostname,
- displayName: runtime.displayName,
- capabilities: ['docker'],
- status: 'removed',
- removedAt: runtime.removedAt,
- upgradePlatform: 'linux' as AgentPlatform,
- scope: getScopeInfo(undefined),
- installFlags: ['--enable-docker', '--disable-host'],
- searchText: [name, runtime.hostname, runtime.id].filter(Boolean).join(' ').toLowerCase(),
- surfaces: [
- {
- key: 'docker',
- kind: 'docker',
- label: 'Docker runtime data',
- detail: 'Pulse is blocking Docker runtime reports from this machine.',
- idLabel: 'Docker runtime ID',
- idValue: runtime.id,
- action: 'allow-reconnect',
- controlId: runtime.id,
- },
- ],
- });
- });
-
- optimisticRemovedHostAgents().forEach((host) => {
- const key = `agent:${host.id}`;
- if (backendIgnoredSurfaceKeys.has(key)) return;
- const name = getPreferredNamedEntityLabel(host);
- rows.push({
- rowKey: `removed-host-${host.id}`,
- id: host.id,
- agentActionId: host.id,
- name,
- hostname: host.hostname,
- displayName: host.displayName,
- capabilities: ['agent'],
- status: 'removed',
- removedAt: host.removedAt,
- linkedVmId: host.linkedVmId,
- linkedContainerId: host.linkedContainerId,
- upgradePlatform: 'linux' as AgentPlatform,
- scope: getScopeInfo(undefined),
- installFlags: [],
- searchText: [name, host.hostname, host.id].filter(Boolean).join(' ').toLowerCase(),
- surfaces: [
- {
- key: 'agent',
- kind: 'agent',
- label: 'Host telemetry',
- detail: 'Pulse is blocking host telemetry from this machine.',
- idLabel: 'Agent ID',
- idValue: host.id,
- action: 'allow-reconnect',
- controlId: host.id,
- },
- ],
- });
- });
-
- optimisticRemovedKubernetesClusters().forEach((cluster) => {
- const key = `kubernetes:${cluster.id}`;
- if (backendIgnoredSurfaceKeys.has(key)) return;
- const name = getPreferredNamedEntityLabel(cluster);
- rows.push({
- rowKey: `removed-k8s-${cluster.id}`,
- id: cluster.id,
- kubernetesActionId: cluster.id,
- name,
- capabilities: ['kubernetes'],
- status: 'removed',
- removedAt: cluster.removedAt,
- upgradePlatform: 'linux' as AgentPlatform,
- scope: getScopeInfo(undefined),
- installFlags: ['--enable-kubernetes'],
- searchText: [name, cluster.name, cluster.id].filter(Boolean).join(' ').toLowerCase(),
- surfaces: [
- {
- key: 'kubernetes',
- kind: 'kubernetes',
- label: 'Kubernetes cluster data',
- detail: 'Pulse is blocking Kubernetes telemetry for this cluster.',
- idLabel: 'Cluster ID',
- idValue: cluster.id,
- action: 'allow-reconnect',
- controlId: cluster.id,
- },
- ],
- });
- });
-
- rows.sort((a, b) => {
- if (a.status !== b.status) {
- return a.status === 'active' ? -1 : 1;
- }
- return a.name.localeCompare(b.name);
- });
-
- return rows;
- });
-
- const matchesInventoryFilters = (row: UnifiedAgentRow) => {
- const query = filterSearch().trim().toLowerCase();
- if (
- filterCapability() !== 'all' &&
- !row.capabilities.includes(filterCapability() as AgentCapability)
- ) {
- return false;
- }
- if (filterScope() !== 'all' && row.scope.category !== filterScope()) {
- return false;
- }
- if (query && !row.searchText.includes(query)) {
- return false;
- }
- return true;
- };
-
- const activeRows = createMemo(() => unifiedRows().filter((row) => row.status === 'active'));
- const monitoringStoppedRows = createMemo(() =>
- unifiedRows().filter((row) => row.status === 'removed'),
- );
- const linkedAgents = createMemo(() =>
- activeRows()
- .filter((row) => Boolean(row.linkedNodeId))
- .map((row) => ({
- id: row.id,
- hostname: row.hostname || row.name,
- displayName: row.displayName,
- linkedNodeId: row.linkedNodeId!,
- status: row.healthStatus || 'online',
- version: row.version,
- lastSeen: row.lastSeen,
- })),
- );
- const hasLinkedAgents = createMemo(() => linkedAgents().length > 0);
- const outdatedAgents = createMemo(() => activeRows().filter((row) => row.isOutdatedBinary));
- const hasOutdatedAgents = createMemo(() => outdatedAgents().length > 0);
-
- const filteredActiveRows = createMemo(() => activeRows().filter(matchesInventoryFilters));
- const filteredMonitoringStoppedRows = createMemo(() =>
- monitoringStoppedRows().filter(matchesInventoryFilters),
- );
- const selectedActiveRow = createMemo(() => {
- const selectedKey = expandedRowKey();
- return filteredActiveRows().find((row) => row.rowKey === selectedKey) || null;
- });
- const selectedIgnoredRow = createMemo(() => {
- const selectedKey = selectedIgnoredRowKey();
- return filteredMonitoringStoppedRows().find((row) => row.rowKey === selectedKey) || null;
- });
-
- const hasFilters = createMemo(() => {
- return (
- filterCapability() !== 'all' || filterScope() !== 'all' || filterSearch().trim().length > 0
- );
- });
-
- const hasMonitoringStoppedRows = createMemo(() => monitoringStoppedRows().length > 0);
- const showMonitoringStoppedSection = createMemo(() => {
- return hasMonitoringStoppedRows() || hasFilters();
- });
- const coverageSummary = createMemo(() => {
- const active = activeRows();
- return {
- agent: active.filter((row) => row.capabilities.includes('agent')).length,
- docker: active.filter((row) => row.capabilities.includes('docker')).length,
- kubernetes: active.filter((row) => row.capabilities.includes('kubernetes')).length,
- proxmox: active.filter((row) => row.capabilities.includes('proxmox')).length,
- pbs: active.filter((row) => row.capabilities.includes('pbs')).length,
- pmg: active.filter((row) => row.capabilities.includes('pmg')).length,
- truenas: active.filter((row) => row.capabilities.includes('truenas')).length,
- };
- });
-
- const reportingCoverageSummaryText = createMemo(() => {
- const summary = coverageSummary();
- const activeClauses = [
- summary.agent > 0 ? `${summary.agent} host${summary.agent === 1 ? '' : 's'}` : null,
- summary.docker > 0
- ? `${summary.docker} Docker runtime${summary.docker === 1 ? '' : 's'}`
- : null,
- summary.kubernetes > 0
- ? `${summary.kubernetes} Kubernetes cluster${summary.kubernetes === 1 ? '' : 's'}`
- : null,
- summary.proxmox > 0
- ? `${summary.proxmox} Proxmox node${summary.proxmox === 1 ? '' : 's'}`
- : null,
- summary.pbs > 0 ? `${summary.pbs} PBS server${summary.pbs === 1 ? '' : 's'}` : null,
- summary.pmg > 0 ? `${summary.pmg} PMG server${summary.pmg === 1 ? '' : 's'}` : null,
- summary.truenas > 0
- ? `${summary.truenas} TrueNAS system${summary.truenas === 1 ? '' : 's'}`
- : null,
- ].filter((value): value is string => Boolean(value));
-
- if (activeClauses.length === 0) {
- return 'Pulse is not currently receiving live infrastructure reports.';
- }
-
- return `Pulse is currently receiving live reports from ${joinHumanList(activeClauses)}.`;
- });
-
- const inventoryStatusSummaryText = createMemo(() => {
- const activeCount = filteredActiveRows().length;
- const recoveryCount = filteredMonitoringStoppedRows().length;
- const recoveryClause =
- recoveryCount > 0
- ? `${recoveryCount} item${recoveryCount === 1 ? ' is' : 's are'} currently ignored by Pulse`
- : 'nothing is currently ignored by Pulse';
- return `${activeCount} item${activeCount === 1 ? ' is' : 's are'} actively reporting right now, and ${recoveryClause}. Stopping monitoring in Pulse does not uninstall software on the remote system.`;
- });
-
- const resetFilters = () => {
- setFilterCapability('all');
- setFilterScope('all');
- setFilterSearch('');
- };
-
- const setInventoryActionPending = (
- rowKey: string,
- action: InventoryActionType,
- pending: boolean,
- ) => {
- setPendingInventoryActions((prev) => {
- const next = { ...prev };
- if (pending) {
- next[rowKey] = action;
- } else {
- delete next[rowKey];
- }
- return next;
- });
- };
-
- const getPendingInventoryAction = (rowKey: string) => pendingInventoryActions()[rowKey];
-
- const scrollToRecoveryQueue = () => {
- recoveryQueueSectionRef?.scrollIntoView({ behavior: 'smooth', block: 'start' });
- };
-
- const setRecoveryQueueSectionRef = (value: HTMLDivElement | undefined) => {
- recoveryQueueSectionRef = value;
- };
-
- const openStopMonitoringDialog = (row: UnifiedAgentRow) => {
- setStopMonitoringDialog({
- row,
- subject: getInventorySubjectLabel(row.name, 'this item'),
- scopeLabel: getStopMonitoringScopeLabel(row),
- });
- };
-
- const handleRemoveAgent = async (row: UnifiedAgentRow) => {
- const subject = getInventorySubjectLabel(row.name, 'this host');
-
- setInventoryActionNotice(null);
- setInventoryActionPending(row.rowKey, 'stop-monitoring', true);
- try {
- let removed = false;
- if (row.capabilities.includes('agent') && row.agentActionId) {
- await MonitoringAPI.deleteAgent(row.agentActionId);
- removed = true;
- }
- if (row.capabilities.includes('docker') && row.dockerActionId) {
- await MonitoringAPI.deleteDockerRuntime(row.dockerActionId, { force: true });
- removed = true;
- }
- if (removed) {
- reconcileRemovedAgent(
- { agentId: row.agentActionId, dockerId: row.dockerActionId },
- row.capabilities,
- row,
- );
- setInventoryActionNotice({
- tone: 'success',
- title: `Monitoring stopped for ${subject}`,
- detail:
- 'Pulse removed it from active reporting and will ignore new reports until you allow reconnect. You can review it in Ignored by Pulse below.',
- showRecoveryQueueLink: true,
- });
- notificationStore.success(getUnifiedAgentStopMonitoringSuccessMessage(subject));
- } else {
- notificationStore.error(getUnifiedAgentStopMonitoringUnavailableMessage());
- }
- } catch (err) {
- logger.error('Failed to stop monitoring host', err);
- notificationStore.error(getUnifiedAgentStopMonitoringErrorMessage(subject));
- } finally {
- setInventoryActionPending(row.rowKey, 'stop-monitoring', false);
- setStopMonitoringDialog(null);
- }
- };
-
- const handleAllowHostReconnect = async (row: UnifiedAgentRow) => {
- const agentId = row.agentActionId || row.id;
- const subject = getInventorySubjectLabel(row.displayName || row.hostname || row.name, agentId);
- setInventoryActionNotice(null);
- setInventoryActionPending(row.rowKey, 'allow-reconnect', true);
- try {
- await MonitoringAPI.allowHostAgentReenroll(agentId);
- setOptimisticRemovedHostAgents((prev) => prev.filter((item) => item.id !== agentId));
- setInventoryActionNotice({
- tone: 'info',
- title: `Reconnect allowed for ${subject}`,
- detail: 'Pulse will accept reports from it again the next time it checks in.',
- });
- notificationStore.success(getUnifiedAgentAllowReconnectSuccessMessage(subject));
- } catch (err) {
- logger.error('Failed to allow reconnect for host agent', err);
- notificationStore.error(getUnifiedAgentAllowReconnectErrorMessage(subject));
- } finally {
- setInventoryActionPending(row.rowKey, 'allow-reconnect', false);
- }
- };
-
- const handleAllowDockerReconnect = async (row: UnifiedAgentRow) => {
- const agentId = row.dockerActionId || row.id;
- const subject = getInventorySubjectLabel(row.displayName || row.hostname || row.name, agentId);
- setInventoryActionNotice(null);
- setInventoryActionPending(row.rowKey, 'allow-reconnect', true);
- try {
- await MonitoringAPI.allowDockerRuntimeReenroll(agentId);
- setOptimisticRemovedDockerHosts((prev) => prev.filter((item) => item.id !== agentId));
- setInventoryActionNotice({
- tone: 'info',
- title: `Reconnect allowed for ${subject}`,
- detail: 'Pulse will accept reports from it again the next time it checks in.',
- });
- notificationStore.success(getUnifiedAgentAllowReconnectSuccessMessage(subject));
- } catch (err) {
- logger.error('Failed to allow reconnect for docker runtime', err);
- notificationStore.error(getUnifiedAgentAllowReconnectErrorMessage(subject));
- } finally {
- setInventoryActionPending(row.rowKey, 'allow-reconnect', false);
- }
- };
-
- const handleRemoveKubernetesCluster = async (row: UnifiedAgentRow) => {
- const clusterId = row.kubernetesActionId || row.id;
- const subject = getInventorySubjectLabel(row.name, 'this cluster');
-
- setInventoryActionNotice(null);
- setInventoryActionPending(row.rowKey, 'stop-monitoring', true);
- try {
- await MonitoringAPI.deleteKubernetesCluster(clusterId);
- reconcileRemovedKubernetesCluster(clusterId, row.name);
- setInventoryActionNotice({
- tone: 'success',
- title: `Monitoring stopped for ${subject}`,
- detail:
- 'Pulse removed it from active reporting and will ignore new reports until you allow reconnect. You can review it in Ignored by Pulse below.',
- showRecoveryQueueLink: true,
- });
- notificationStore.success(getUnifiedAgentStopMonitoringSuccessMessage(subject));
- } catch (err) {
- logger.error('Failed to stop monitoring kubernetes cluster', err);
- notificationStore.error(getUnifiedAgentStopMonitoringErrorMessage(subject));
- } finally {
- setInventoryActionPending(row.rowKey, 'stop-monitoring', false);
- setStopMonitoringDialog(null);
- }
- };
-
- const handleAllowKubernetesReconnect = async (row: UnifiedAgentRow) => {
- const clusterId = row.kubernetesActionId || row.id;
- const subject = getInventorySubjectLabel(row.name, clusterId);
- setInventoryActionNotice(null);
- setInventoryActionPending(row.rowKey, 'allow-reconnect', true);
- try {
- await MonitoringAPI.allowKubernetesClusterReenroll(clusterId);
- setOptimisticRemovedKubernetesClusters((prev) =>
- prev.filter((item) => item.id !== clusterId),
- );
- setInventoryActionNotice({
- tone: 'info',
- title: `Reconnect allowed for ${subject}`,
- detail: 'Pulse will accept reports from it again the next time it checks in.',
- });
- notificationStore.success(getUnifiedAgentAllowReconnectSuccessMessage(subject));
- } catch (err) {
- logger.error('Failed to allow reconnect for kubernetes cluster', err);
- notificationStore.error(getUnifiedAgentAllowReconnectErrorMessage(subject));
- } finally {
- setInventoryActionPending(row.rowKey, 'allow-reconnect', false);
- }
- };
-
- createEffect(() => {
- const rows = filteredActiveRows();
- const selectedKey = expandedRowKey();
-
- if (rows.length === 0) {
- if (selectedKey !== null) {
- setExpandedRowKey(null);
- }
- return;
- }
-
- if (selectedKey && !rows.some((row) => row.rowKey === selectedKey)) {
- setExpandedRowKey(null);
- }
- });
-
- createEffect(() => {
- const rows = filteredMonitoringStoppedRows();
- const selectedKey = selectedIgnoredRowKey();
-
- if (rows.length === 0) {
- if (selectedKey !== null) {
- setSelectedIgnoredRowKey(null);
- }
- return;
- }
-
- if (selectedKey && !rows.some((row) => row.rowKey === selectedKey)) {
- setSelectedIgnoredRowKey(null);
- }
- });
-
- const reportingColumns = [
- {
- key: 'name',
- label: 'Name',
- render: (row: UnifiedAgentRow) => {
- const selected = () => expandedRowKey() === row.rowKey;
- const agentName = row.displayName || row.hostname || row.name;
- const reportingSummary = getRowReportingSummary(row);
- return (
- <div class="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2">
- <div class="min-w-0 text-left">
- <div class="truncate text-sm font-medium text-base-content">{row.name}</div>
- <Show when={row.displayName && row.hostname && row.displayName !== row.hostname}>
- <div class="truncate text-xs text-muted">{row.hostname}</div>
- </Show>
- <Show when={reportingSummary}>
- <div class="mt-1 line-clamp-2 text-xs text-muted">{reportingSummary}</div>
- </Show>
- </div>
- <button
- type="button"
- onClick={(event) => {
- event.stopPropagation();
- toggleAgentDetails(row.rowKey);
- }}
- class={`inline-flex min-h-10 items-center justify-center rounded-md px-2.5 py-1.5 text-xs font-medium sm:min-h-9 ${
- selected()
- ? 'bg-blue-600 text-white shadow-sm hover:bg-blue-700'
- : 'text-muted hover:bg-surface hover:text-base-content'
- }`}
- aria-label={`View details for ${agentName}`}
- aria-pressed={selected()}
- aria-controls={`agent-details-${row.rowKey}`}
- >
- {selected() ? 'Open details' : 'View details'}
- </button>
- </div>
- );
- },
- },
- {
- key: 'capabilities',
- label: 'Reporting surfaces',
- render: (row: UnifiedAgentRow) => (
- <div class="space-y-1 text-xs">
- <For each={row.capabilities}>
- {(capability) => (
- <div class="flex items-center gap-2">
- <span
- class={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${getAgentCapabilityBadgeClass(capability)}`}
- >
- {getCapabilitySurfaceLabel(capability)}
- </span>
- </div>
- )}
- </For>
- </div>
- ),
- },
- {
- key: 'status',
- label: 'Status',
- render: (row: UnifiedAgentRow) => {
- const statusPresentation = () =>
- getUnifiedAgentStatusPresentation(row.status, row.healthStatus);
- return (
- <span
- class={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${statusPresentation().badgeClass}`}
- >
- {statusPresentation().label}
- </span>
- );
- },
- },
- {
- key: 'lastSeen',
- label: 'Last Seen',
- render: (row: UnifiedAgentRow) => (
- <span class="text-xs text-muted">
- {getUnifiedAgentLastSeenLabel(row, MONITORING_STOPPED_STATUS_LABEL)}
- </span>
- ),
- },
- {
- key: 'actions',
- label: 'Actions',
- align: 'right' as const,
- render: (row: UnifiedAgentRow) => {
- const isRemoved = () => row.status === 'removed';
- const isKubernetes = () =>
- row.capabilities.includes('kubernetes') && !row.capabilities.includes('agent');
- const pendingAction = () => getPendingInventoryAction(row.rowKey);
- const isStopping = () => pendingAction() === 'stop-monitoring';
- const isAllowingReconnect = () => pendingAction() === 'allow-reconnect';
- const canRemove = () => {
- const needsAgent = row.capabilities.includes('agent') && !row.agentActionId;
- const needsDocker =
- row.capabilities.includes('docker') && !row.dockerActionId && !row.agentActionId;
- return !needsAgent && !needsDocker;
- };
- return (
- <Show
- when={isRemoved()}
- fallback={
- <Show
- when={isKubernetes()}
- fallback={
- <button
- onClick={() => openStopMonitoringDialog(row)}
- disabled={!canRemove() || Boolean(pendingAction())}
- title={!canRemove() ? 'Agent ID unavailable for removal' : undefined}
- class="inline-flex min-h-10 sm:min-h-9 items-center rounded-md px-2.5 py-1.5 text-sm font-medium text-red-600 hover:bg-red-50 hover:text-red-900 disabled:cursor-not-allowed disabled:opacity-50 dark:text-red-400 dark:hover:bg-red-900 dark:hover:text-red-300"
- >
- {isStopping() ? 'Stopping…' : 'Stop monitoring'}
- </button>
- }
- >
- <button
- onClick={() => openStopMonitoringDialog(row)}
- disabled={Boolean(pendingAction())}
- class="inline-flex min-h-10 sm:min-h-9 items-center rounded-md px-2.5 py-1.5 text-sm font-medium text-red-600 hover:bg-red-50 hover:text-red-900 dark:text-red-400 dark:hover:bg-red-900 dark:hover:text-red-300"
- >
- {isStopping() ? 'Stopping…' : 'Stop monitoring'}
- </button>
- </Show>
- }
- >
- <Show
- when={row.capabilities.includes('docker')}
- fallback={
- <Show
- when={row.capabilities.includes('kubernetes')}
- fallback={
- <button
- onClick={() => void handleAllowHostReconnect(row)}
- disabled={Boolean(pendingAction())}
- class="inline-flex min-h-10 sm:min-h-9 items-center rounded-md px-2.5 py-1.5 text-sm font-medium text-blue-600 hover:bg-blue-50 hover:text-blue-900 dark:text-blue-400 dark:hover:bg-blue-900 dark:hover:text-blue-300"
- >
- {isAllowingReconnect() ? 'Allowing reconnect…' : ALLOW_RECONNECT_LABEL}
- </button>
- }
- >
- <button
- onClick={() => void handleAllowKubernetesReconnect(row)}
- disabled={Boolean(pendingAction())}
- class="inline-flex min-h-10 sm:min-h-9 items-center rounded-md px-2.5 py-1.5 text-sm font-medium text-blue-600 hover:bg-blue-50 hover:text-blue-900 dark:text-blue-400 dark:hover:bg-blue-900 dark:hover:text-blue-300"
- >
- {isAllowingReconnect() ? 'Allowing reconnect…' : ALLOW_RECONNECT_LABEL}
- </button>
- </Show>
- }
- >
- <button
- onClick={() => void handleAllowDockerReconnect(row)}
- disabled={Boolean(pendingAction())}
- class="inline-flex min-h-10 sm:min-h-9 items-center rounded-md px-2.5 py-1.5 text-sm font-medium text-blue-600 hover:bg-blue-50 hover:text-blue-900 dark:text-blue-400 dark:hover:bg-blue-900 dark:hover:text-blue-300"
- >
- {isAllowingReconnect() ? 'Allowing reconnect…' : ALLOW_RECONNECT_LABEL}
- </button>
- </Show>
- </Show>
- );
- },
- },
- ];
-
- return {
- activeRows,
- assignmentByAgent,
- filterCapability,
- filterScope,
- filterSearch,
- filteredActiveRows,
- filteredMonitoringStoppedRows,
- getPendingInventoryAction,
- getProfileOptionLabel,
- handleAllowDockerReconnect,
- handleAllowHostReconnect,
- handleAllowKubernetesReconnect,
- handleRemoveAgent,
- handleRemoveKubernetesCluster,
- handleResetScope,
- hasFilters,
- hasLinkedAgents,
- hasOutdatedAgents,
- inventoryActionNotice,
- inventoryStatusSummaryText,
- linkedAgents,
- monitoringStoppedRows,
- openStopMonitoringDialog,
- outdatedAgents,
- pendingScopeUpdates,
- profileById,
- profiles,
- reportingColumns,
- reportingCoverageSummaryText,
- resetFilters,
- scrollToRecoveryQueue,
- selectedActiveRow,
- selectedIgnoredRow,
- selectedIgnoredRowKey,
- setExpandedRowKey,
- setFilterCapability,
- setFilterScope,
- setFilterSearch,
- setInventoryActionNotice,
- setRecoveryQueueSectionRef,
- setSelectedIgnoredRowKey,
- setStopMonitoringDialog,
- showMonitoringStoppedSection,
- stopMonitoringDialog,
- toggleAgentDetails,
- updateScopeAssignment,
- };
-};
-
-export type InfrastructureReportingState = ReturnType<typeof useInfrastructureReportingState>;
diff --git a/frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts b/frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts
deleted file mode 100644
index 21c7b34141..0000000000
--- a/frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-import { createMemo, createSignal } from 'solid-js';
-import { notificationStore } from '@/stores/notifications';
-import {
- buildProxmoxDiscoveryPrefillNode,
- getProxmoxVariantPresentation,
-} from '@/utils/proxmoxSettingsPresentation';
-import type { NodeConfig, NodeConfigWithStatus } from '@/types/nodes';
-import type { DiscoveredServer, NodeType } from './infrastructureSettingsModel';
-import type { InfrastructurePlatformSettingsProps } from './proxmoxSettingsModel';
-
-export function useProxmoxDirectWorkspaceState(props: InfrastructurePlatformSettingsProps) {
- const [prefillNode, setPrefillNode] = createSignal<Partial<NodeConfig> | null>(null);
-
- const activeAgent = () => props.selectedAgent();
- const activeConfig = createMemo(() => getProxmoxVariantPresentation(activeAgent()));
- const activeDiscoveredNodes = createMemo(() =>
- props.discoveredNodes().filter((node) => node.type === activeAgent()),
- );
- const activeConfiguredNodes = createMemo(() => {
- switch (activeAgent()) {
- case 'pve':
- return props.pveNodes();
- case 'pbs':
- return props.pbsNodes();
- case 'pmg':
- return props.pmgNodes();
- }
- });
- const hasDiscoveryTimeouts = () =>
- props.discoveryMode() === 'auto' &&
- (props.discoveryScanStatus().errors || []).some((error) => /timed out|timeout/i.test(error));
-
- const openCreateNode = (type: NodeType) => {
- setPrefillNode(null);
- props.setEditingNode(null);
- props.setCurrentNodeType(type);
- props.setModalResetKey((previous) => previous + 1);
- props.setShowNodeModal(true);
- };
-
- const openEditNode = (type: NodeType, node: NodeConfigWithStatus) => {
- setPrefillNode(null);
- props.setEditingNode(node);
- props.setCurrentNodeType(type);
- props.setShowNodeModal(true);
- };
-
- const openDiscoveredNode = (server: DiscoveredServer) => {
- setPrefillNode(buildProxmoxDiscoveryPrefillNode(server));
- props.setEditingNode(null);
- props.setCurrentNodeType(server.type);
- props.setModalResetKey((previous) => previous + 1);
- props.setShowNodeModal(true);
- };
-
- const closeNodeModal = () => {
- setPrefillNode(null);
- props.setShowNodeModal(false);
- props.setEditingNode(null);
- props.setModalResetKey((previous) => previous + 1);
- };
-
- const handleRefreshDiscovery = async () => {
- notificationStore.info('Refreshing discovery...', 2000);
- try {
- await props.triggerDiscoveryScan({ quiet: true });
- } finally {
- await props.loadDiscoveredNodes();
- }
- };
-
- const handleDiscoveryToggle = async (enabled: boolean) => {
- if (props.envOverrides().discoveryEnabled || props.savingDiscoverySettings()) {
- return props.discoveryEnabled();
- }
-
- const success = await props.handleDiscoveryEnabledChange(enabled);
- return success ? enabled : props.discoveryEnabled();
- };
-
- return {
- activeAgent,
- activeConfig,
- activeConfiguredNodes,
- activeDiscoveredNodes,
- closeNodeModal,
- handleDiscoveryToggle,
- handleRefreshDiscovery,
- hasDiscoveryTimeouts,
- openCreateNode,
- openDiscoveredNode,
- openEditNode,
- prefillNode,
- };
-}
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 8ec398d751..dec73b7d1f 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -129,7 +129,6 @@ import workloadsSummarySource from '@/components/Workloads/WorkloadsSummary.tsx?
import resourceDetailDrawerOverviewSource from '@/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx?raw';
import aiSettingsDialogsSource from '@/components/Settings/AISettingsDialogs.tsx?raw';
import generalSettingsPanelSource from '@/components/Settings/GeneralSettingsPanel.tsx?raw';
-import proxmoxSettingsPanelSource from '@/components/Settings/ProxmoxSettingsPanel.tsx?raw';
import reportingPanelSource from '@/components/Settings/ReportingPanel.tsx?raw';
import updatesSettingsPanelSource from '@/components/Settings/UpdatesSettingsPanel.tsx?raw';
@@ -584,10 +583,6 @@ describe('shared primitive guardrails', () => {
expect(calloutCardSource).toContain(
"type CalloutTone = 'danger' | 'info' | 'success' | 'warning'",
);
- expect(proxmoxSettingsPanelSource).toContain('CalloutCard');
- expect(proxmoxSettingsPanelSource).not.toContain(
- 'rounded-md border border-blue-200 bg-blue-50 px-4 py-3',
- );
expect(reportingPanelSource).toContain('CalloutCard');
expect(reportingPanelSource).not.toContain('rounded-md border border-blue-200 bg-blue-50 p-6');
});
@@ -647,7 +642,7 @@ describe('shared primitive guardrails', () => {
'scopeSelfHostedBillingDestination',
);
expect(monitoredSystemLimitWarningBannerStateSource).toContain(
- 'SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT',
+ 'SELF_HOSTED_PRO_BILLING_PLAN_SELECTION_INTENT',
);
expect(monitoredSystemLimitWarningBannerStateSource).toContain('viewCapacityDestination');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('handleUpgradeClick');
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index a4d8288816..34b4b8e8c5 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -366,12 +366,7 @@ import pmgPresentationSource from '@/utils/pmgPresentation.ts?raw';
import pmgThreatPresentationSource from '@/utils/pmgThreatPresentation.ts?raw';
import pmgQueuePresentationSource from '@/utils/pmgQueuePresentation.ts?raw';
import pmgServiceHealthBadgeSource from '@/components/PMG/ServiceHealthBadge.tsx?raw';
-import proxmoxSettingsPanelSource from '@/components/Settings/ProxmoxSettingsPanel.tsx?raw';
-import proxmoxConfiguredNodesTableSource from '@/components/Settings/ProxmoxConfiguredNodesTable.tsx?raw';
-import proxmoxDirectWorkspaceSource from '@/components/Settings/ProxmoxDirectWorkspace.tsx?raw';
-import proxmoxNodeModalStackSource from '@/components/Settings/ProxmoxNodeModalStack.tsx?raw';
import proxmoxSettingsModelSource from '@/components/Settings/proxmoxSettingsModel.ts?raw';
-import proxmoxDirectWorkspaceStateSource from '@/components/Settings/useProxmoxDirectWorkspaceState.ts?raw';
import infrastructureWorkspaceSource from '@/components/Settings/InfrastructureWorkspace.tsx?raw';
import infrastructureWorkspaceModelSource from '@/components/Settings/infrastructureWorkspaceModel.ts?raw';
import proxmoxSettingsPresentationSource from '@/utils/proxmoxSettingsPresentation.ts?raw';
@@ -382,7 +377,6 @@ import nodeModalModelSource from '@/components/Settings/nodeModalModel.ts?raw';
import nodeModalMonitoringSectionSource from '@/components/Settings/NodeModalMonitoringSection.tsx?raw';
import nodeModalSetupGuideSectionSource from '@/components/Settings/NodeModalSetupGuideSection.tsx?raw';
import nodeModalStatusFooterSource from '@/components/Settings/NodeModalStatusFooter.tsx?raw';
-import nodeModalSource from '@/components/Settings/NodeModal.tsx?raw';
import nodeModalStateSource from '@/components/Settings/useNodeModalState.ts?raw';
import nodeModalPresentationSource from '@/utils/nodeModalPresentation.ts?raw';
import cephPageSource from '@/pages/Ceph.tsx?raw';
@@ -3393,24 +3387,9 @@ describe('frontend resource type boundaries', () => {
expect(pmgThreatPresentationSource).toContain('export function getPMGThreatPresentation');
expect(pmgQueuePresentationSource).toContain('export function getPMGQueueTextClass');
expect(pmgServiceHealthBadgeSource).toContain('getServiceHealthPresentation');
- expect(proxmoxSettingsPanelSource).toContain('./ProxmoxDirectWorkspace');
- expect(proxmoxSettingsPanelSource).not.toContain('const VARIANT_CONFIG: Record<NodeType');
- expect(proxmoxSettingsPanelSource).not.toContain('const buildDiscoveryPrefillNode =');
- expect(proxmoxDirectWorkspaceSource).toContain('./useProxmoxDirectWorkspaceState');
- expect(proxmoxSettingsPanelSource).not.toContain('const openCreateNode = (type: NodeType) =>');
- expect(proxmoxSettingsPanelSource).not.toContain('const openDiscoveredNode = (server: DiscoveredServer) =>');
- expect(proxmoxConfiguredNodesTableSource).toContain('PveNodesTable');
- expect(proxmoxConfiguredNodesTableSource).toContain('PbsNodesTable');
- expect(proxmoxConfiguredNodesTableSource).toContain('PmgNodesTable');
- expect(proxmoxNodeModalStackSource).toContain('PROXMOX_NODE_TYPES');
expect(proxmoxSettingsModelSource).toContain(
'export interface InfrastructurePlatformSettingsProps',
);
- expect(proxmoxDirectWorkspaceStateSource).toContain(
- 'export function useProxmoxDirectWorkspaceState',
- );
- expect(proxmoxDirectWorkspaceStateSource).toContain('getProxmoxVariantPresentation');
- expect(proxmoxDirectWorkspaceStateSource).toContain('buildProxmoxDiscoveryPrefillNode');
expect(proxmoxSettingsPresentationSource).toContain(
'export const PROXMOX_VARIANT_PRESENTATION',
);
@@ -3430,24 +3409,6 @@ describe('frontend resource type boundaries', () => {
expect(infrastructureWorkspaceModelSource).toContain(
'export function buildInfrastructureWorkspacePath',
);
- expect(nodeModalSource).toContain('getNodeProductName');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalBasicInfoSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalAuthenticationSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalMonitoringSection');
- expect(nodeModalSource).toContain('@/components/Settings/NodeModalStatusFooter');
- expect(nodeModalSource).toContain('@/components/Settings/nodeModalModel');
- expect(nodeModalSource).toContain('@/components/Settings/useNodeModalState');
- expect(nodeModalSource).not.toContain('title="Basic information"');
- expect(nodeModalSource).not.toContain('title="Authentication"');
- expect(nodeModalSource).not.toContain('title="Monitoring coverage"');
- expect(nodeModalSource).not.toContain('const getCleanFormData =');
- expect(nodeModalSource).not.toContain('const nodeProductName =');
- expect(nodeModalSource).not.toContain('const deriveNameFromHost =');
- expect(nodeModalSource).not.toContain('const PVE_MANUAL_PERMISSION_COMMAND = `');
- expect(nodeModalSource).not.toContain('const [quickSetupBootstrap, setQuickSetupBootstrap] =');
- expect(nodeModalSource).not.toContain('const handleTestConnection = async () =>');
- expect(nodeModalSource).not.toContain("testResult()?.status === 'success'");
- expect(nodeModalSource).not.toContain("testResult()?.status === 'warning'");
expect(nodeModalModelSource).toContain('export const deriveNameFromHost =');
expect(nodeModalModelSource).toContain('export const PVE_MANUAL_PERMISSION_COMMAND = `');
expect(nodeModalStateSource).toContain('export const useNodeModalState =');
diff --git a/scripts/release_control/canonical_completion_guard_test.py b/scripts/release_control/canonical_completion_guard_test.py
index e50fa1c55c..2f3b6ebbef 100644
--- a/scripts/release_control/canonical_completion_guard_test.py
+++ b/scripts/release_control/canonical_completion_guard_test.py
@@ -27,12 +27,8 @@ from canonical_completion_guard import (
WORKSPACE_REPOS_ROOT = REPO_ROOT.parent
PLATFORM_CONNECTIONS_WORKSPACE_EXACT_FILES = [
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/__tests__/ConnectionEditor.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/PlatformConnectionsWorkspace.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/VMwareSettingsPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts",
"frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx",
"frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx",
@@ -46,7 +42,6 @@ PLATFORM_CONNECTIONS_WORKSPACE_EXACT_FILES = [
CONNECTIONS_LEDGER_WORKSPACE_EXACT_FILES = [
"frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts",
"frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts",
]
@@ -975,7 +970,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"exact_files": [
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/agentProfilesPresentation.test.ts",
],
}
@@ -1910,69 +1904,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
],
)
- def test_node_modal_change_uses_node_setup_settings_policy(self):
- required = infer_impacted_subsystems(
- ["frontend-modern/src/components/Settings/NodeModal.tsx"]
- )
- self.assertEqual(set(required), {"agent-lifecycle", "api-contracts"})
-
- lifecycle = required["agent-lifecycle"]
- self.assertEqual(
- lifecycle["contract"],
- "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",
- )
- self.assertEqual(
- lifecycle["touched_runtime_files"],
- ["frontend-modern/src/components/Settings/NodeModal.tsx"],
- )
- self.assertEqual(
- lifecycle["verification_requirements"],
- [
- {
- "id": "node-setup-settings-surface",
- "label": "node setup/install command proof",
- "touched_runtime_files": [
- "frontend-modern/src/components/Settings/NodeModal.tsx"
- ],
- "allow_same_subsystem_tests": False,
- "test_prefixes": [],
- "exact_files": [
- "frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts",
- "frontend-modern/src/utils/__tests__/nodeModalPresentation.test.ts",
- ],
- }
- ],
- )
-
- api_contracts = required["api-contracts"]
- self.assertEqual(
- api_contracts["contract"],
- "docs/release-control/v6/internal/subsystems/api-contracts.md",
- )
- self.assertEqual(
- api_contracts["touched_runtime_files"],
- ["frontend-modern/src/components/Settings/NodeModal.tsx"],
- )
- self.assertEqual(
- api_contracts["verification_requirements"],
- [
- {
- "id": "node-setup-settings-client-surface",
- "label": "node setup client consumer proof",
- "touched_runtime_files": [
- "frontend-modern/src/components/Settings/NodeModal.tsx"
- ],
- "allow_same_subsystem_tests": False,
- "test_prefixes": [],
- "exact_files": [
- "frontend-modern/src/api/__tests__/nodes.test.ts",
- "frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts",
- "frontend-modern/src/types/api.ts",
- ],
- }
- ],
- )
-
def test_setup_completion_panel_change_uses_setup_completion_install_policy(self):
required = infer_impacted_subsystems(
["frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx"]
@@ -2068,7 +1999,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"exact_files": [
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/agentProfilesPresentation.test.ts",
],
}
@@ -2104,80 +2034,12 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"exact_files": [
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/agentProfilesPresentation.test.ts",
],
}
],
)
- def test_infrastructure_operations_controller_change_requires_lifecycle_and_api_contracts(self):
- required = infer_impacted_subsystems(
- ["frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx"]
- )
- self.assertEqual(set(required), {"agent-lifecycle", "api-contracts"})
-
- lifecycle = required["agent-lifecycle"]
- self.assertEqual(
- lifecycle["contract"],
- "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",
- )
- self.assertEqual(
- lifecycle["touched_runtime_files"],
- ["frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx"],
- )
- self.assertEqual(
- lifecycle["verification_requirements"],
- [
- {
- "id": "unified-agent-settings-surface",
- "label": "unified agent settings lifecycle proof",
- "touched_runtime_files": [
- "frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx"
- ],
- "allow_same_subsystem_tests": False,
- "test_prefixes": [],
- "exact_files": [
- "frontend-modern/src/api/__tests__/agentProfiles.test.ts",
- "frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
- ],
- }
- ],
- )
-
- api_contracts = required["api-contracts"]
- self.assertEqual(
- api_contracts["contract"],
- "docs/release-control/v6/internal/subsystems/api-contracts.md",
- )
- self.assertEqual(
- api_contracts["touched_runtime_files"],
- ["frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx"],
- )
- self.assertEqual(
- api_contracts["verification_requirements"],
- [
- {
- "id": "unified-agent-settings-surface",
- "label": "infrastructure operations API proof",
- "touched_runtime_files": [
- "frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx"
- ],
- "allow_same_subsystem_tests": False,
- "test_prefixes": [],
- "exact_files": [
- "frontend-modern/src/api/__tests__/agentProfiles.test.ts",
- "frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
- ],
- }
- ],
- )
-
def test_infrastructure_install_state_change_requires_lifecycle_and_api_contracts(self):
required = infer_impacted_subsystems(
["frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx"]
@@ -2203,7 +2065,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"exact_files": [
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
],
}
@@ -2230,66 +2091,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
"frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
- ],
- }
- ],
- )
-
- def test_infrastructure_reporting_state_change_requires_lifecycle_and_api_contracts(self):
- required = infer_impacted_subsystems(
- ["frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx"]
- )
- self.assertEqual(set(required), {"agent-lifecycle", "api-contracts"})
-
- lifecycle = required["agent-lifecycle"]
- self.assertEqual(
- lifecycle["touched_runtime_files"],
- ["frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx"],
- )
- self.assertEqual(
- lifecycle["verification_requirements"],
- [
- {
- "id": "unified-agent-settings-surface",
- "label": "unified agent settings lifecycle proof",
- "touched_runtime_files": [
- "frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx"
- ],
- "allow_same_subsystem_tests": False,
- "test_prefixes": [],
- "exact_files": [
- "frontend-modern/src/api/__tests__/agentProfiles.test.ts",
- "frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
- ],
- }
- ],
- )
-
- api_contracts = required["api-contracts"]
- self.assertEqual(
- api_contracts["touched_runtime_files"],
- ["frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx"],
- )
- self.assertEqual(
- api_contracts["verification_requirements"],
- [
- {
- "id": "unified-agent-settings-surface",
- "label": "infrastructure operations API proof",
- "touched_runtime_files": [
- "frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx"
- ],
- "allow_same_subsystem_tests": False,
- "test_prefixes": [],
- "exact_files": [
- "frontend-modern/src/api/__tests__/agentProfiles.test.ts",
- "frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
],
}
@@ -2356,11 +2157,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"frontend-modern/src/components/Settings/connectionsTableModel.ts"
)
- def test_proxmox_settings_panel_change_requires_agent_lifecycle(self):
- self._assert_platform_connections_workspace_change_requires_agent_lifecycle(
- "frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx"
- )
-
def test_infrastructure_settings_state_change_requires_agent_lifecycle(self):
self._assert_platform_connections_workspace_change_requires_agent_lifecycle(
"frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts"
@@ -2420,7 +2216,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
"frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
],
}
@@ -2476,7 +2271,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
"frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
],
}
@@ -2493,11 +2287,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx"
)
- def test_proxmox_direct_workspace_state_change_requires_agent_lifecycle(self):
- self._assert_platform_connections_workspace_change_requires_agent_lifecycle(
- "frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts"
- )
-
def test_infrastructure_installer_section_change_requires_agent_lifecycle(self):
required = infer_impacted_subsystems(
["frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx"]
@@ -2527,7 +2316,6 @@ class CanonicalCompletionGuardTest(unittest.TestCase):
"exact_files": [
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
],
}
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 99d1ff4363..ee8f239706 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -16,7 +16,6 @@ RECOVERY_PRODUCT_SURFACE_EXACT_FILES = [
PATROL_PAGE_AND_STATE_EXACT_FILES = [
"frontend-modern/src/components/Brand/__tests__/PulsePatrolLogo.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx",
"frontend-modern/src/stores/__tests__/aiIntelligence.test.ts",
"frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts",
@@ -25,12 +24,8 @@ PATROL_PAGE_AND_STATE_EXACT_FILES = [
]
PLATFORM_CONNECTIONS_WORKSPACE_EXACT_FILES = [
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
+ "frontend-modern/src/components/Settings/ConnectionEditor/__tests__/ConnectionEditor.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/PlatformConnectionsWorkspace.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/VMwareSettingsPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts",
"frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx",
"frontend-modern/src/components/Settings/__tests__/useVMwareSettingsPanelState.test.tsx",
@@ -44,7 +39,6 @@ PLATFORM_CONNECTIONS_WORKSPACE_EXACT_FILES = [
CONNECTIONS_LEDGER_WORKSPACE_EXACT_FILES = [
"frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts",
"frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts",
]
@@ -1647,72 +1641,6 @@ class SubsystemLookupTest(unittest.TestCase):
self.assertEqual(match["lane_context"]["lane_id"], lane_id)
self.assertEqual(match["verification_requirement"]["id"], requirement_id)
- def test_lookup_paths_assigns_node_modal_to_agent_lifecycle_and_api_contracts(self) -> None:
- result = lookup_paths(
- [
- "frontend-modern/src/components/Settings/NodeModal.tsx",
- "frontend-modern/src/components/Settings/NodeModalAuthenticationSection.tsx",
- "frontend-modern/src/components/Settings/NodeModalBasicInfoSection.tsx",
- "frontend-modern/src/components/Settings/nodeModalModel.ts",
- "frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx",
- "frontend-modern/src/components/Settings/NodeModalSetupGuideSection.tsx",
- "frontend-modern/src/components/Settings/NodeModalStatusFooter.tsx",
- "frontend-modern/src/components/Settings/useNodeModalState.ts",
- ]
- )
- self.assertEqual(result["unowned_runtime_files"], [])
- self.assertEqual(
- {item["subsystem"] for item in result["impacted_subsystems"]},
- {"agent-lifecycle", "api-contracts"},
- )
- for file_entry in result["files"]:
- self.assertEqual(file_entry["classification"], "runtime")
- self.assertEqual(
- {match["subsystem"] for match in file_entry["matches"]},
- {"agent-lifecycle", "api-contracts"},
- )
-
- lifecycle_match = next(
- match for match in file_entry["matches"] if match["subsystem"] == "agent-lifecycle"
- )
- self.assertEqual(
- lifecycle_match["contract"],
- "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",
- )
- self.assertEqual(lifecycle_match["lane_context"]["lane_id"], "L16")
- self.assertEqual(
- lifecycle_match["verification_requirement"]["id"],
- "node-setup-settings-surface",
- )
- self.assertEqual(
- lifecycle_match["verification_requirement"]["exact_files"],
- [
- "frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts",
- "frontend-modern/src/utils/__tests__/nodeModalPresentation.test.ts",
- ],
- )
-
- api_contracts_match = next(
- match for match in file_entry["matches"] if match["subsystem"] == "api-contracts"
- )
- self.assertEqual(
- api_contracts_match["contract"],
- "docs/release-control/v6/internal/subsystems/api-contracts.md",
- )
- self.assertEqual(api_contracts_match["lane_context"]["lane_id"], "L6")
- self.assertEqual(
- api_contracts_match["verification_requirement"]["id"],
- "node-setup-settings-client-surface",
- )
- self.assertEqual(
- api_contracts_match["verification_requirement"]["exact_files"],
- [
- "frontend-modern/src/api/__tests__/nodes.test.ts",
- "frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts",
- "frontend-modern/src/types/api.ts",
- ],
- )
-
def test_lookup_paths_assigns_setup_completion_panel_to_agent_lifecycle(self) -> None:
result = lookup_paths(["frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx"])
self.assertEqual(result["unowned_runtime_files"], [])
@@ -1801,7 +1729,6 @@ class SubsystemLookupTest(unittest.TestCase):
[
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/agentProfilesPresentation.test.ts",
],
)
@@ -1834,39 +1761,10 @@ class SubsystemLookupTest(unittest.TestCase):
[
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/agentProfilesPresentation.test.ts",
],
)
- def test_lookup_paths_assigns_proxmox_settings_panel_to_agent_lifecycle(self) -> None:
- result = lookup_paths(["frontend-modern/src/components/Settings/ProxmoxSettingsPanel.tsx"])
- self.assertEqual(result["unowned_runtime_files"], [])
- self.assertEqual(
- {item["subsystem"] for item in result["impacted_subsystems"]},
- {"agent-lifecycle"},
- )
- file_entry = result["files"][0]
- self.assertEqual(file_entry["classification"], "runtime")
- self.assertEqual(
- {match["subsystem"] for match in file_entry["matches"]},
- {"agent-lifecycle"},
- )
- match = file_entry["matches"][0]
- self.assertEqual(
- match["contract"],
- "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",
- )
- self.assertEqual(match["lane_context"]["lane_id"], "L16")
- self.assertEqual(
- match["verification_requirement"]["id"],
- "platform-connections-workspace-surface",
- )
- self.assertEqual(
- match["verification_requirement"]["exact_files"],
- PLATFORM_CONNECTIONS_WORKSPACE_EXACT_FILES,
- )
-
def test_lookup_paths_assigns_infrastructure_workspace_model_to_agent_lifecycle(self) -> None:
result = lookup_paths(
["frontend-modern/src/components/Settings/infrastructureWorkspaceModel.ts"]
@@ -1989,36 +1887,6 @@ class SubsystemLookupTest(unittest.TestCase):
CONNECTIONS_LEDGER_WORKSPACE_EXACT_FILES,
)
- def test_lookup_paths_assigns_proxmox_direct_workspace_state_to_agent_lifecycle(self) -> None:
- result = lookup_paths(
- ["frontend-modern/src/components/Settings/useProxmoxDirectWorkspaceState.ts"]
- )
- self.assertEqual(result["unowned_runtime_files"], [])
- self.assertEqual(
- {item["subsystem"] for item in result["impacted_subsystems"]},
- {"agent-lifecycle"},
- )
- file_entry = result["files"][0]
- self.assertEqual(file_entry["classification"], "runtime")
- self.assertEqual(
- {match["subsystem"] for match in file_entry["matches"]},
- {"agent-lifecycle"},
- )
- match = file_entry["matches"][0]
- self.assertEqual(
- match["contract"],
- "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",
- )
- self.assertEqual(match["lane_context"]["lane_id"], "L16")
- self.assertEqual(
- match["verification_requirement"]["id"],
- "platform-connections-workspace-surface",
- )
- self.assertEqual(
- match["verification_requirement"]["exact_files"],
- PLATFORM_CONNECTIONS_WORKSPACE_EXACT_FILES,
- )
-
def test_lookup_paths_assigns_infrastructure_settings_model_to_agent_lifecycle(self) -> None:
result = lookup_paths(
["frontend-modern/src/components/Settings/infrastructureSettingsModel.ts"]
@@ -3351,7 +3219,6 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Settings/__tests__/OrganizationOverviewPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/OrganizationSharingPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts",
"frontend-modern/src/utils/__tests__/orgUtils.test.ts",
"frontend-modern/src/utils/__tests__/organizationRolePresentation.test.ts",
@@ -3552,7 +3419,6 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Settings/__tests__/OrganizationOverviewPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/OrganizationSharingPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts",
"frontend-modern/src/utils/__tests__/orgUtils.test.ts",
"frontend-modern/src/utils/__tests__/organizationRolePresentation.test.ts",
@@ -3591,7 +3457,6 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Settings/__tests__/OrganizationOverviewPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/OrganizationSharingPanel.test.tsx",
"frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts",
"frontend-modern/src/utils/__tests__/orgUtils.test.ts",
"frontend-modern/src/utils/__tests__/organizationRolePresentation.test.ts",
@@ -3780,8 +3645,8 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 121,
- "heading_line": 88,
+ "line": 117,
+ "heading_line": 86,
}
],
)
@@ -4020,67 +3885,6 @@ class SubsystemLookupTest(unittest.TestCase):
],
)
- def test_lookup_paths_assigns_infrastructure_operations_controller_to_shared_agent_lifecycle_and_api_contracts(self) -> None:
- result = lookup_paths(
- ["frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx"]
- )
- self.assertEqual(result["unowned_runtime_files"], [])
- self.assertEqual(
- {item["subsystem"] for item in result["impacted_subsystems"]},
- {"agent-lifecycle", "api-contracts"},
- )
- file_entry = result["files"][0]
- self.assertEqual(file_entry["classification"], "runtime")
- self.assertEqual(
- file_entry["shared_ownership"]["subsystems"],
- ["agent-lifecycle", "api-contracts"],
- )
- matches = {match["subsystem"] for match in file_entry["matches"]}
- self.assertEqual(matches, {"agent-lifecycle", "api-contracts"})
-
- by_subsystem = {match["subsystem"]: match for match in file_entry["matches"]}
- api_match = by_subsystem["api-contracts"]
- lifecycle_match = by_subsystem["agent-lifecycle"]
-
- self.assertEqual(
- api_match["contract"],
- "docs/release-control/v6/internal/subsystems/api-contracts.md",
- )
- self.assertEqual(api_match["lane_context"]["lane_id"], "L6")
- self.assertEqual(
- api_match["verification_requirement"]["id"],
- "unified-agent-settings-surface",
- )
- self.assertEqual(
- api_match["verification_requirement"]["exact_files"],
- [
- "frontend-modern/src/api/__tests__/agentProfiles.test.ts",
- "frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
- ],
- )
-
- self.assertEqual(
- lifecycle_match["contract"],
- "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",
- )
- self.assertEqual(lifecycle_match["lane_context"]["lane_id"], "L16")
- self.assertEqual(
- lifecycle_match["verification_requirement"]["id"],
- "unified-agent-settings-surface",
- )
- self.assertEqual(
- lifecycle_match["verification_requirement"]["exact_files"],
- [
- "frontend-modern/src/api/__tests__/agentProfiles.test.ts",
- "frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
- ],
- )
-
def test_lookup_paths_assigns_infrastructure_install_state_to_shared_agent_lifecycle_and_api_contracts(
self,
) -> None:
@@ -4115,7 +3919,6 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
"frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
],
)
@@ -4128,7 +3931,6 @@ class SubsystemLookupTest(unittest.TestCase):
[
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
],
)
@@ -4199,58 +4001,6 @@ class SubsystemLookupTest(unittest.TestCase):
"platform-connections-workspace-surface",
)
- def test_lookup_paths_assigns_infrastructure_reporting_state_to_shared_agent_lifecycle_and_api_contracts(
- self,
- ) -> None:
- result = lookup_paths(
- ["frontend-modern/src/components/Settings/useInfrastructureReportingState.tsx"]
- )
- self.assertEqual(result["unowned_runtime_files"], [])
- self.assertEqual(
- {item["subsystem"] for item in result["impacted_subsystems"]},
- {"agent-lifecycle", "api-contracts"},
- )
- file_entry = result["files"][0]
- self.assertEqual(file_entry["classification"], "runtime")
- self.assertEqual(
- file_entry["shared_ownership"]["subsystems"],
- ["agent-lifecycle", "api-contracts"],
- )
- matches = {match["subsystem"] for match in file_entry["matches"]}
- self.assertEqual(matches, {"agent-lifecycle", "api-contracts"})
-
- by_subsystem = {match["subsystem"]: match for match in file_entry["matches"]}
- api_match = by_subsystem["api-contracts"]
- lifecycle_match = by_subsystem["agent-lifecycle"]
-
- self.assertEqual(
- api_match["verification_requirement"]["id"],
- "unified-agent-settings-surface",
- )
- self.assertEqual(
- api_match["verification_requirement"]["exact_files"],
- [
- "frontend-modern/src/api/__tests__/agentProfiles.test.ts",
- "frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/api/__tests__/security.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
- ],
- )
- self.assertEqual(
- lifecycle_match["verification_requirement"]["id"],
- "unified-agent-settings-surface",
- )
- self.assertEqual(
- lifecycle_match["verification_requirement"]["exact_files"],
- [
- "frontend-modern/src/api/__tests__/agentProfiles.test.ts",
- "frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
- ],
- )
-
def test_lookup_paths_assigns_infrastructure_installer_section_to_agent_lifecycle(self) -> None:
result = lookup_paths(
["frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx"]
@@ -4282,7 +4032,6 @@ class SubsystemLookupTest(unittest.TestCase):
[
"frontend-modern/src/api/__tests__/agentProfiles.test.ts",
"frontend-modern/src/api/__tests__/monitoring.test.ts",
- "frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsController.test.tsx",
"frontend-modern/src/components/Settings/__tests__/InfrastructureOperationsModel.test.tsx",
],
)