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.

Fix dead Investigate button and resolve all frontend TypeScript errors

rcourtman108dec4d7ab9
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index 463488e61b..a3f3da986d 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -34,7 +34,7 @@ import {
import { InvestigationSection, ApprovalSection } from '@/components/patrol';
import { AIAPI, type RemediationPlan } from '@/api/ai';
import { createSuppressionRuleFromFinding, reinvestigateFinding } from '@/api/patrol';
-import type { PatrolRunRecord, PatrolRuntimeState } from '@/api/patrol';
+import type { PatrolRunRecord, PatrolRuntimeState, PatrolAutonomyLevel } from '@/api/patrol';
import { formatRelativeTime } from '@/utils/format';
import { getFindingAlertIdentifier, hasTriggeringAlert } from '@/utils/findingAlertIdentity';
import { FilterSegmentedControl, type FilterSegmentOption } from '@/components/shared/FilterToolbar';
@@ -110,6 +110,7 @@ interface FindingsPanelProps {
scopeResourceTypes?: string[];
showScopeWarnings?: boolean;
runtimeState?: PatrolRuntimeState;
+ autonomyLevel?: PatrolAutonomyLevel;
blockedReason?: string;
overallHealth?: IntelligenceHealthScore;
historicalRegressionCount?: number;
@@ -1508,8 +1509,8 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
!finding.investigationStatus &&
!finding.investigationOutcome &&
!finding.lastInvestigatedAt &&
- !!props.runtimeState?.autonomy_level &&
- props.runtimeState.autonomy_level !== 'monitor'
+ !!props.autonomyLevel &&
+ props.autonomyLevel !== 'monitor'
}
>
<button
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
index 1f4118c605..953258cfa7 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.links.test.tsx
@@ -636,7 +636,7 @@ describe('FindingsPanel investigate action gating', () => {
render(() => (
<FindingsPanel
findingsSource="patrol"
- runtimeState={{ autonomy_level: 'approval' } as any}
+ autonomyLevel="approval"
/>
));
await waitFor(() => expect(mockState.loadPatrolFindings).toHaveBeenCalled());
@@ -648,7 +648,7 @@ describe('FindingsPanel investigate action gating', () => {
render(() => (
<FindingsPanel
findingsSource="patrol"
- runtimeState={{ autonomy_level: 'monitor' } as any}
+ autonomyLevel="monitor"
/>
));
await waitFor(() => expect(mockState.loadPatrolFindings).toHaveBeenCalled());
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
index 2f90677125..21480eddf5 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
@@ -240,6 +240,7 @@ export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceSt
scopeResourceTypes={state.selectedRun()?.scope_resource_types}
showScopeWarnings={Boolean(state.selectedRun())}
runtimeState={state.runtimeState()}
+ autonomyLevel={state.autonomyLevel()}
blockedReason={state.blockedReason()}
overallHealth={state.intelligenceSummary()?.overall_health}
historicalRegressionCount={state.historicalRegressionCount()}
diff --git a/frontend-modern/src/hooks/useWorkloads.ts b/frontend-modern/src/hooks/useWorkloads.ts
index 300c321c80..3a33e5180a 100644
--- a/frontend-modern/src/hooks/useWorkloads.ts
+++ b/frontend-modern/src/hooks/useWorkloads.ts
@@ -18,7 +18,11 @@ import {
getPreferredResourceKubernetesContext,
} from '@/utils/resourceIdentity';
import type { WorkloadGuest } from '@/types/workloads';
-import type { ResourceDiscoveryReadiness, ResourceDiscoveryTarget } from '@/types/resource';
+import type {
+ ResourceAvailabilityMeta,
+ ResourceDiscoveryReadiness,
+ ResourceDiscoveryTarget,
+} from '@/types/resource';
const WORKLOADS_URL = '/api/resources?type=vm,system-container,app-container,pod';
const WORKLOADS_PAGE_LIMIT = 200;
@@ -149,6 +153,7 @@ type APIResource = {
hostname?: string;
};
discoveryReadiness?: ResourceDiscoveryReadiness;
+ availability?: ResourceAvailabilityMeta;
};
type APIListResponse = {
@@ -561,6 +566,7 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {
clusterName: resource.vmware.clusterName,
}
: undefined,
+ availability: resource.availability as ResourceAvailabilityMeta | undefined,
};
};
diff --git a/frontend-modern/src/stores/websocket-global.ts b/frontend-modern/src/stores/websocket-global.ts
index d0ebc4ee0d..7aff0b478e 100644
--- a/frontend-modern/src/stores/websocket-global.ts
+++ b/frontend-modern/src/stores/websocket-global.ts
@@ -82,7 +82,7 @@ const bindGlobalShutdownHandler = () => {
window.__pulseWsShutdownBound = true;
};
-export function getGlobalWebSocketStore() {
+export function getGlobalWebSocketStore(): ReturnType<typeof createWebSocketStore> {
if (!window.__pulseWsStore) {
if (isJSDOMTestRuntime()) {
window.__pulseWsStore = createNoopWebSocketStore();
@@ -97,5 +97,5 @@ export function getGlobalWebSocketStore() {
bindGlobalShutdownHandler();
}
- return window.__pulseWsStore;
+ return window.__pulseWsStore!;
}