From 62cff032103cdb32507a8bd7bdeefa9c109f7391 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Wed, 3 Jun 2026 12:37:38 +0100 Subject: [PATCH] Remove 103 unused frontend exports Dead-code sweep. Named exports flagged unused by ts-prune and confirmed unreferenced by adversarial cross-file verification, removed via a TypeScript compiler-API codemod (whole-declaration removal by name). tsc --noEmit over the full project including all test files, and npm run lint (eslint + theme + canonical-platform audits), both pass. 54 candidates deferred for safety: 1 false positive caught by the type-check (WizardState is imported by SetupCompletionPanel.tsx), ~20 files whose export removal orphans secondary imports/helpers (needs a follow-up cascading pass), and 2 multi-declarator statements. --- frontend-modern/src/api/ai.ts | 14 ---- frontend-modern/src/api/monitoring.ts | 23 ------ frontend-modern/src/api/responseUtils.ts | 8 -- .../Infrastructure/resourceDetailMappers.ts | 2 - .../useResourceDetailDrawerDerivedState.ts | 4 - ...eResourceDetailDrawerDockerActionsState.ts | 4 - .../useResourceDetailDrawerHistoryState.ts | 4 - .../useUnifiedResourceTableViewportSync.ts | 4 - .../components/Settings/aiSettingsModel.ts | 13 --- .../Settings/infrastructureSettingsModel.ts | 28 ------- .../Settings/proxmoxSettingsModel.ts | 2 - .../Settings/reportingResourceTypes.ts | 3 +- .../components/Settings/settingsRouting.ts | 13 --- .../src/components/Settings/settingsTypes.ts | 5 -- .../useInfrastructureInstallState.tsx | 2 - .../useInfrastructureSettingsState.ts | 6 -- .../src/components/SetupWizard/index.ts | 3 +- .../Workloads/workloadMetricHistoryModel.ts | 1 - .../Workloads/workloadsFilterModel.ts | 1 - .../src/components/patrol/index.ts | 1 - .../src/components/shared/FilterBar/index.ts | 5 +- .../components/shared/FilterButtonGroup.tsx | 1 - .../src/components/shared/PulseDataGrid.tsx | 2 +- .../src/components/shared/SearchField.tsx | 3 - .../src/components/shared/SearchInput.tsx | 2 +- .../components/shared/SearchTipsPopover.tsx | 2 +- .../components/shared/SelectionCardGroup.tsx | 2 - .../responsive/ResponsiveMetricCell.tsx | 82 ------------------- .../components/shared/summaryChartLayout.ts | 2 +- .../src/components/shared/summaryTimeRange.ts | 3 - .../shared/useCommandPaletteState.ts | 2 - .../shared/useContainerUpdateButtonState.ts | 2 - .../src/components/shared/useHelpIconState.ts | 2 - .../components/shared/useMobileNavBarState.ts | 2 - .../shared/useWebInterfaceUrlFieldState.ts | 2 - .../features/alerts/guestOverrideIdentity.ts | 10 --- .../thresholdsOverrideMutationModel.ts | 14 ---- .../storageBackups/storagePagePresentation.ts | 8 -- .../src/features/truenas/truenasPageModel.ts | 12 --- frontend-modern/src/routing/resourceLinks.ts | 1 - frontend-modern/src/types/ai.ts | 21 ----- frontend-modern/src/types/api.ts | 33 -------- frontend-modern/src/types/config.ts | 53 ------------ frontend-modern/src/types/discovery.ts | 4 - frontend-modern/src/types/nodes.ts | 15 ---- frontend-modern/src/types/recovery.ts | 8 -- frontend-modern/src/types/resource.ts | 2 - .../src/utils/aiFindingPresentation.ts | 36 -------- .../src/utils/alertConfigPresentation.ts | 4 - .../src/utils/alertWebhookPresentation.ts | 11 --- frontend-modern/src/utils/cloudPlans.ts | 4 - .../src/utils/commercialBillingModel.ts | 2 - .../src/utils/infrastructureSummaryCache.ts | 8 -- .../src/utils/licensePresentation.ts | 4 - .../src/utils/resourceBadgePresentation.ts | 10 --- frontend-modern/src/utils/storageSources.ts | 6 -- .../src/utils/storageSummaryCache.ts | 5 -- .../unifiedAgentInventoryPresentation.ts | 6 -- .../utils/unifiedAgentStatusPresentation.ts | 1 - .../src/utils/workloadsSummaryCache.ts | 1 - 60 files changed, 7 insertions(+), 527 deletions(-) diff --git a/frontend-modern/src/api/ai.ts b/frontend-modern/src/api/ai.ts index ad895727c..667beee8a 100644 --- a/frontend-modern/src/api/ai.ts +++ b/frontend-modern/src/api/ai.ts @@ -556,20 +556,6 @@ export interface StepResult { run_at: string; } -export interface RemediationExecution { - id: string; - plan_id: string; - status: 'pending' | 'approved' | 'running' | 'completed' | 'failed' | 'rolled_back'; - approved_by?: string; - approved_at?: string; - started_at?: string; - completed_at?: string; - current_step: number; - step_results?: StepResult[]; - error?: string; - rollback_error?: string; -} - // Compatibility response shape for older execution endpoints. export interface RemediationExecutionResult { execution_id: string; diff --git a/frontend-modern/src/api/monitoring.ts b/frontend-modern/src/api/monitoring.ts index 181b445b2..3c28219b8 100644 --- a/frontend-modern/src/api/monitoring.ts +++ b/frontend-modern/src/api/monitoring.ts @@ -16,29 +16,6 @@ import { parseOptionalAPIResponseOrNull, } from './responseUtils'; -export interface RemovedDockerHost { - id: string; - hostname?: string; - displayName?: string; - removedAt: number; -} - -export interface RemovedHostAgent { - id: string; - hostname?: string; - displayName?: string; - linkedVmId?: string; - linkedContainerId?: string; - removedAt: number; -} - -export interface RemovedKubernetesCluster { - id: string; - name?: string; - displayName?: string; - removedAt: number; -} - async function deleteResource( url: string, parseErrorMessage: string, diff --git a/frontend-modern/src/api/responseUtils.ts b/frontend-modern/src/api/responseUtils.ts index 211e4800a..80156930e 100644 --- a/frontend-modern/src/api/responseUtils.ts +++ b/frontend-modern/src/api/responseUtils.ts @@ -201,14 +201,6 @@ export function apiErrorCode(error: unknown): string | null { return trimmedOptionalString((error as APIErrorLike).code); } -export function apiErrorDetail(error: unknown): string | null { - if (!error || typeof error !== 'object') { - return null; - } - - return trimmedOptionalString((error as APIErrorLike).detail); -} - export function apiErrorDetails(error: unknown): Record | null { if (!error || typeof error !== 'object') { return null; diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts b/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts index 0c66963c6..e75cbc817 100644 --- a/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts +++ b/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts @@ -359,5 +359,3 @@ export const formatInteger = (value?: number): string => { if (value === undefined || value === null || Number.isNaN(value)) return '—'; return new Intl.NumberFormat().format(Math.round(value)); }; - -export const ALIAS_COLLAPSE_THRESHOLD = 4; diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts index aa277cdf3..8122a5400 100644 --- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts +++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts @@ -490,7 +490,3 @@ export const useResourceDetailDrawerDerivedState = ( tabs, }; }; - -export type ResourceDetailDrawerDerivedState = ReturnType< - typeof useResourceDetailDrawerDerivedState ->; diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDockerActionsState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDockerActionsState.ts index bfd7b388a..3f1e2f17d 100644 --- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDockerActionsState.ts +++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDockerActionsState.ts @@ -95,7 +95,3 @@ export const useResourceDetailDrawerDockerActionsState = ( queueDockerUpdateAll, }; }; - -export type UseResourceDetailDrawerDockerActionsStateResult = ReturnType< - typeof useResourceDetailDrawerDockerActionsState ->; diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerHistoryState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerHistoryState.ts index 9f7bddb36..7ae6dd26a 100644 --- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerHistoryState.ts +++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerHistoryState.ts @@ -234,7 +234,3 @@ export const useResourceDetailDrawerHistoryState = ( refetchHistoryFacets, }; }; - -export type ResourceDetailDrawerHistoryState = ReturnType< - typeof useResourceDetailDrawerHistoryState ->; diff --git a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts index 8c9cc2459..77e311f14 100644 --- a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts +++ b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts @@ -45,7 +45,3 @@ export function useUnifiedResourceTableViewportSync( setHostBodyRef, }; } - -export type UnifiedResourceTableViewportSync = ReturnType< - typeof useUnifiedResourceTableViewportSync ->; diff --git a/frontend-modern/src/components/Settings/aiSettingsModel.ts b/frontend-modern/src/components/Settings/aiSettingsModel.ts index f7833e756..7c94d7ca4 100644 --- a/frontend-modern/src/components/Settings/aiSettingsModel.ts +++ b/frontend-modern/src/components/Settings/aiSettingsModel.ts @@ -216,16 +216,3 @@ export function isModelProviderConfigured( const provider = getProviderFromModelId(modelId); return isAIProviderConfigured(provider, settings); } - -export function groupModelsByProvider(models: AIAvailableModel[]): Map { - const grouped = new Map(); - - for (const model of models) { - const provider = getProviderFromModelId(model.id); - const existing = grouped.get(provider) || []; - existing.push(model); - grouped.set(provider, existing); - } - - return grouped; -} diff --git a/frontend-modern/src/components/Settings/infrastructureSettingsModel.ts b/frontend-modern/src/components/Settings/infrastructureSettingsModel.ts index d9deb2021..a01a8952a 100644 --- a/frontend-modern/src/components/Settings/infrastructureSettingsModel.ts +++ b/frontend-modern/src/components/Settings/infrastructureSettingsModel.ts @@ -48,34 +48,6 @@ export const matchConfiguredNodeToResource = ( }); }; -export const collectConfiguredInfrastructureHosts = (nodes: NodeConfigWithStatus[]) => { - const configuredHosts = new Set(); - const clusterMemberIPs = new Set(); - - nodes.forEach((node) => { - const cleanedHost = node.host.replace(/^https?:\/\//, '').replace(/:\d+$/, ''); - configuredHosts.add(cleanedHost.toLowerCase()); - - if (!('isCluster' in node) || !node.isCluster || !('clusterEndpoints' in node)) { - return; - } - - node.clusterEndpoints?.forEach((endpoint: ClusterEndpoint) => { - if (endpoint.ip) { - clusterMemberIPs.add(endpoint.ip.toLowerCase()); - } - if (endpoint.host) { - clusterMemberIPs.add(endpoint.host.toLowerCase()); - } - }); - }); - - return { - clusterMemberIPs, - configuredHosts, - }; -}; - const createRepresentedDiscoveryHosts = (): RepresentedDiscoveryHosts => ({ pve: new Set(), pbs: new Set(), diff --git a/frontend-modern/src/components/Settings/proxmoxSettingsModel.ts b/frontend-modern/src/components/Settings/proxmoxSettingsModel.ts index 851039651..08b4281c7 100644 --- a/frontend-modern/src/components/Settings/proxmoxSettingsModel.ts +++ b/frontend-modern/src/components/Settings/proxmoxSettingsModel.ts @@ -12,8 +12,6 @@ import type { DiscoverySettingsFormProps } from './discoverySettingsModel'; import type { TrueNASSettingsPanelState } from './useTrueNASSettingsPanelState'; import type { VMwareSettingsPanelState } from './useVMwareSettingsPanelState'; -export type DiscoveryMode = 'auto' | 'custom'; - export interface InfrastructurePlatformSettingsProps { selectedAgent: Accessor; onSelectAgent: (agent: NodeType) => void; diff --git a/frontend-modern/src/components/Settings/reportingResourceTypes.ts b/frontend-modern/src/components/Settings/reportingResourceTypes.ts index 02783a1ab..8b1378917 100644 --- a/frontend-modern/src/components/Settings/reportingResourceTypes.ts +++ b/frontend-modern/src/components/Settings/reportingResourceTypes.ts @@ -1,2 +1 @@ -export type { ReportingResourceType } from '@/utils/reportingResourceTypes'; -export { toReportingResourceType } from '@/utils/reportingResourceTypes'; + diff --git a/frontend-modern/src/components/Settings/settingsRouting.ts b/frontend-modern/src/components/Settings/settingsRouting.ts index eff2edac5..8e19926cb 100644 --- a/frontend-modern/src/components/Settings/settingsRouting.ts +++ b/frontend-modern/src/components/Settings/settingsRouting.ts @@ -1,16 +1,3 @@ export { - DEFAULT_SETTINGS_TAB, - agentKeyFromPlatformType, - deriveTabFromPath, - deriveTabFromQuery, - isRetiredSettingsCompatibilityPath, - isRouteableSettingsPath, - resolveCanonicalSettingsPath, - settingsAgentLabel, settingsAgentNodeLabel, - settingsAgentPlatformType, - settingsTabPath, - type AgentKey, - type ProxmoxPlatformType, - type SettingsTab, } from './settingsNavigationModel'; diff --git a/frontend-modern/src/components/Settings/settingsTypes.ts b/frontend-modern/src/components/Settings/settingsTypes.ts index c192b3041..42eb1f6c5 100644 --- a/frontend-modern/src/components/Settings/settingsTypes.ts +++ b/frontend-modern/src/components/Settings/settingsTypes.ts @@ -1,8 +1,3 @@ export type { - SettingsHeaderMeta, - SettingsHeaderMetaMap, - SettingsNavGroup, - SettingsNavGroupId, - SettingsNavItem, SettingsTab, } from './settingsNavigationModel'; diff --git a/frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx b/frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx index 7f9ddf2d7..d74b55fad 100644 --- a/frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx +++ b/frontend-modern/src/components/Settings/useInfrastructureInstallState.tsx @@ -559,5 +559,3 @@ Pulse prepares the first-host install token from setup so you can move straight tokenName, }; }; - -export type InfrastructureInstallState = ReturnType; diff --git a/frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts b/frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts index 0e8768029..e638eb10c 100644 --- a/frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts +++ b/frontend-modern/src/components/Settings/useInfrastructureSettingsState.ts @@ -6,12 +6,6 @@ import { useInfrastructureDiscoveryRuntimeState } from './useInfrastructureDisco import { useTrueNASSettingsPanelState } from './useTrueNASSettingsPanelState'; import { useVMwareSettingsPanelState } from './useVMwareSettingsPanelState'; -export type { - DiscoveryScanStatus, - DiscoveredServer, - NodeType, -} from './infrastructureSettingsModel'; - type InfrastructureEventBus = { on(event: T, handler: (data?: EventDataMap[T]) => void): () => void; }; diff --git a/frontend-modern/src/components/SetupWizard/index.ts b/frontend-modern/src/components/SetupWizard/index.ts index 88370ca9b..74a516fc4 100644 --- a/frontend-modern/src/components/SetupWizard/index.ts +++ b/frontend-modern/src/components/SetupWizard/index.ts @@ -1,3 +1,2 @@ export { SetupWizard } from './SetupWizard'; -export { StepIndicator } from './StepIndicator'; -export type { WizardState, WizardStep } from './SetupWizard'; +export type { WizardState, } from './SetupWizard'; diff --git a/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts b/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts index fbb60efc4..ccc8a05e5 100644 --- a/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts +++ b/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts @@ -68,7 +68,6 @@ export const WORKLOAD_TABLE_HISTORY_RANGE_LABELS: Record = (props) => { const search = useSearchInputState(props); diff --git a/frontend-modern/src/components/shared/SearchTipsPopover.tsx b/frontend-modern/src/components/shared/SearchTipsPopover.tsx index e1f3906c8..f71256b96 100644 --- a/frontend-modern/src/components/shared/SearchTipsPopover.tsx +++ b/frontend-modern/src/components/shared/SearchTipsPopover.tsx @@ -11,7 +11,7 @@ import { } from './searchTipsPopoverModel'; import { useSearchTipsPopoverState } from './useSearchTipsPopoverState'; -export type { SearchTip, SearchTipsPopoverProps } from './searchTipsPopoverModel'; +export type { SearchTipsPopoverProps } from './searchTipsPopoverModel'; export const SearchTipsPopover: Component = (props) => { const triggerVariant = () => getSearchTipsPopoverTriggerVariant(props.triggerVariant); diff --git a/frontend-modern/src/components/shared/SelectionCardGroup.tsx b/frontend-modern/src/components/shared/SelectionCardGroup.tsx index 2ac7d79ce..0ad3dbdb7 100644 --- a/frontend-modern/src/components/shared/SelectionCardGroup.tsx +++ b/frontend-modern/src/components/shared/SelectionCardGroup.tsx @@ -11,9 +11,7 @@ import { useSelectionCardGroupState } from './useSelectionCardGroupState'; export type { SelectionCardGroupProps, - SelectionCardGroupVariant, SelectionCardOption, - SelectionCardTone, } from './selectionCardGroupModel'; export function SelectionCardGroup(props: SelectionCardGroupProps) { diff --git a/frontend-modern/src/components/shared/responsive/ResponsiveMetricCell.tsx b/frontend-modern/src/components/shared/responsive/ResponsiveMetricCell.tsx index b2217c942..49a9900e1 100644 --- a/frontend-modern/src/components/shared/responsive/ResponsiveMetricCell.tsx +++ b/frontend-modern/src/components/shared/responsive/ResponsiveMetricCell.tsx @@ -153,85 +153,3 @@ export const ResponsiveMetricCell: Component = (props ); }; - -/** - * Simpler metric text component for when you just want colored percentage - * without the MetricBar complexity - */ -export const MetricText: Component<{ - value: number; - type: 'cpu' | 'memory' | 'disk'; - label?: string; - class?: string; - thresholds?: MetricDisplayThresholds | null; -}> = (props) => { - const displayLabel = createMemo(() => props.label ?? formatPercent(props.value)); - const colorClass = createMemo(() => metricTextClass(props.value, props.type, props.thresholds)); - - return ( - - - - - - ); -}; - -/** - * Metric cell with explicit mobile/desktop rendering - * Use this when you need full control over what renders in each mode - */ -export const DualMetricCell: Component<{ - value: number; - type: 'cpu' | 'memory' | 'disk'; - label?: string; - sublabel?: string; - resourceId?: string; - isRunning?: boolean; - showMobile: boolean; - mobileContent?: JSX.Element; - desktopContent?: JSX.Element; - fallback?: JSX.Element; - class?: string; - thresholds?: MetricDisplayThresholds | null; -}> = (props) => { - const displayLabel = createMemo(() => props.label ?? formatPercent(props.value)); - const colorClass = createMemo(() => metricTextClass(props.value, props.type, props.thresholds)); - const isRunning = () => props.isRunning !== false; - - const defaultFallback = ( -
- -
- ); - - const defaultMobileContent = ( -
- - - -
- ); - - const defaultDesktopContent = ( - - ); - - return ( - -
- - {props.mobileContent ?? defaultMobileContent} - -
-
- ); -}; diff --git a/frontend-modern/src/components/shared/summaryChartLayout.ts b/frontend-modern/src/components/shared/summaryChartLayout.ts index 16c38fdbb..45fd9be16 100644 --- a/frontend-modern/src/components/shared/summaryChartLayout.ts +++ b/frontend-modern/src/components/shared/summaryChartLayout.ts @@ -1,3 +1,3 @@ -export const SUMMARY_CHART_SLOT_CLASS = 'h-[136px] sm:h-[150px]'; + export const SUMMARY_CHART_SLOT_COMPACT_CLASS = 'h-[108px] sm:h-[120px]'; export const SUMMARY_CHART_PLOT_AREA_CLASS = 'h-[120px] sm:h-[134px]'; diff --git a/frontend-modern/src/components/shared/summaryTimeRange.ts b/frontend-modern/src/components/shared/summaryTimeRange.ts index a9c20d8f6..70a47891c 100644 --- a/frontend-modern/src/components/shared/summaryTimeRange.ts +++ b/frontend-modern/src/components/shared/summaryTimeRange.ts @@ -8,6 +8,3 @@ export const SUMMARY_TIME_RANGE_LABEL: Record = { '24h': '24h', '7d': '7d', }; - -export const isSummaryTimeRange = (value: string): value is SummaryTimeRange => - (SUMMARY_TIME_RANGES as readonly string[]).includes(value); diff --git a/frontend-modern/src/components/shared/useCommandPaletteState.ts b/frontend-modern/src/components/shared/useCommandPaletteState.ts index ba4536693..2727cccb5 100644 --- a/frontend-modern/src/components/shared/useCommandPaletteState.ts +++ b/frontend-modern/src/components/shared/useCommandPaletteState.ts @@ -73,5 +73,3 @@ export function useCommandPaletteState(props: CommandPaletteModalProps) { setQuery, }; } - -export type CommandPaletteState = ReturnType; diff --git a/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts b/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts index 80d1f6050..017398e8c 100644 --- a/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts +++ b/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts @@ -126,5 +126,3 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) { shouldHideButton, }; } - -export type ContainerUpdateButtonState = ReturnType; diff --git a/frontend-modern/src/components/shared/useHelpIconState.ts b/frontend-modern/src/components/shared/useHelpIconState.ts index b2b430b0a..e635445fb 100644 --- a/frontend-modern/src/components/shared/useHelpIconState.ts +++ b/frontend-modern/src/components/shared/useHelpIconState.ts @@ -98,5 +98,3 @@ export function useHelpIconState(props: HelpIconProps) { toggleOpen, }; } - -export type HelpIconState = ReturnType; diff --git a/frontend-modern/src/components/shared/useMobileNavBarState.ts b/frontend-modern/src/components/shared/useMobileNavBarState.ts index 0e23cf7ab..c962d58cd 100644 --- a/frontend-modern/src/components/shared/useMobileNavBarState.ts +++ b/frontend-modern/src/components/shared/useMobileNavBarState.ts @@ -80,5 +80,3 @@ export function useMobileNavBarState(props: MobileNavBarProps) { showLeftFade, }; } - -export type MobileNavBarState = ReturnType; diff --git a/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts b/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts index 3d23ed7e4..963f6fa74 100644 --- a/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts +++ b/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts @@ -211,5 +211,3 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) { urlValue, }; } - -export type WebInterfaceUrlFieldState = ReturnType; diff --git a/frontend-modern/src/features/alerts/guestOverrideIdentity.ts b/frontend-modern/src/features/alerts/guestOverrideIdentity.ts index 5daa9d8df..043f95363 100644 --- a/frontend-modern/src/features/alerts/guestOverrideIdentity.ts +++ b/frontend-modern/src/features/alerts/guestOverrideIdentity.ts @@ -124,16 +124,6 @@ export const getGuestOverrideIdentity = ( }; }; -export const canonicalGuestOverrideResourceId = ( - resource: GuestOverrideResourceLike, -): string | undefined => { - const identity = getGuestOverrideIdentity(resource); - if (!identity) { - return undefined; - } - return `${identity.instance}:${identity.node}:${identity.vmid}`; -}; - export const guestOverrideStorageId = (resource: GuestOverrideResourceLike): string => { const identity = getGuestOverrideIdentity(resource); if (!identity) { diff --git a/frontend-modern/src/features/alerts/thresholds/thresholdsOverrideMutationModel.ts b/frontend-modern/src/features/alerts/thresholds/thresholdsOverrideMutationModel.ts index aa865a156..3bfd9fd8e 100644 --- a/frontend-modern/src/features/alerts/thresholds/thresholdsOverrideMutationModel.ts +++ b/frontend-modern/src/features/alerts/thresholds/thresholdsOverrideMutationModel.ts @@ -40,17 +40,3 @@ export const stripStateKeys = ( delete (next as Record).poweredOffSeverity; return next; }; - -export const removeOverrideState = ( - overrides: Override[], - rawOverridesConfig: Record, - resourceId: string, -) => { - const nextRawConfig = { ...rawOverridesConfig }; - delete nextRawConfig[resourceId]; - - return { - nextOverrides: overrides.filter((override) => override.id !== resourceId), - nextRawConfig, - }; -}; diff --git a/frontend-modern/src/features/storageBackups/storagePagePresentation.ts b/frontend-modern/src/features/storageBackups/storagePagePresentation.ts index ce2664834..730a65750 100644 --- a/frontend-modern/src/features/storageBackups/storagePagePresentation.ts +++ b/frontend-modern/src/features/storageBackups/storagePagePresentation.ts @@ -81,14 +81,6 @@ export const getStoragePoolTableColumns = ( colClassName: 'hidden xl:table-column xl:w-[11%]', }, ]; - -export const STORAGE_CONTROLS_NODE_SELECT_CLASS = - 'px-2 py-1 text-xs border border-border rounded-md bg-surface text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500'; - -export const STORAGE_CONTROLS_NODE_DIVIDER_CLASS = 'h-5 w-px bg-surface-hover hidden sm:block'; - -export const STORAGE_CONTENT_CARD_HEADER_CLASS = - 'border-b border-border bg-surface-hover px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted'; export const STORAGE_CONTENT_CARD_BODY_CLASS = 'p-2'; export const STORAGE_POOLS_EMPTY_STATE_CLASS = 'p-6 text-sm text-muted'; diff --git a/frontend-modern/src/features/truenas/truenasPageModel.ts b/frontend-modern/src/features/truenas/truenasPageModel.ts index 8bf803405..ab2c15b76 100644 --- a/frontend-modern/src/features/truenas/truenasPageModel.ts +++ b/frontend-modern/src/features/truenas/truenasPageModel.ts @@ -854,18 +854,6 @@ const matchesTrueNASStorageSearch = (resource: Resource, search: string): boolea return haystack.includes(needle); }; -export function filterTrueNASStorageResources( - resources: Resource[], - search: string, - status: TrueNASStorageStatusFilter, -): Resource[] { - return resources.filter((resource) => { - if (!matchesTrueNASStorageSearch(resource, search)) return false; - if (status === 'all') return true; - return mapTrueNASStorageStatus(resource) === status; - }); -} - const resourceIncidentLabel = (resource: Resource, incident: ResourceIncident): string => { const label = asTrimmedString(resource.incidentLabel); if (label) return label; diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts index 5bcede4fd..f708f8025 100644 --- a/frontend-modern/src/routing/resourceLinks.ts +++ b/frontend-modern/src/routing/resourceLinks.ts @@ -29,7 +29,6 @@ export const TRUENAS_DEFAULT_TAB = 'overview'; export const VMWARE_PATH = '/vmware'; export const VMWARE_DEFAULT_TAB = 'overview'; export const PMG_THRESHOLDS_PATH = '/alerts/thresholds/mail-gateway'; -export const ALERTS_OVERVIEW_PATH = '/alerts/overview'; export const PATROL_PATH = '/patrol'; export const STORAGE_QUERY_PARAMS = { diff --git a/frontend-modern/src/types/ai.ts b/frontend-modern/src/types/ai.ts index 1600a5dd2..71a7e8aff 100644 --- a/frontend-modern/src/types/ai.ts +++ b/frontend-modern/src/types/ai.ts @@ -191,18 +191,6 @@ export interface AIConversationMessage { content: string; } -// AI Execute request/response types -export interface AIExecuteRequest { - prompt: string; - target_type?: string; // "agent", "system-container", "vm", etc. - target_id?: string; - context?: Record; - history?: AIConversationMessage[]; // Previous conversation messages - finding_id?: string; // If fixing a patrol finding, the ID to resolve on success - model?: string; // Override model for this request (user selection in chat) - use_case?: 'chat' | 'patrol'; // Optional server-side routing/model selection -} - // Tool execution info export interface AIToolExecution { name: string; // "run_command", "read_file" @@ -387,15 +375,6 @@ export interface AIChatMessage { toolCalls?: AIChatToolCall[]; } -export interface AIChatSession { - id: string; - username: string; - title: string; - createdAt: Date; - updatedAt: Date; - messages: AIChatMessage[]; -} - // Summary returned by list endpoint (no messages) export interface AIChatSessionHandoffResource { id?: string; diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.ts index c47da7032..a79bf70a0 100644 --- a/frontend-modern/src/types/api.ts +++ b/frontend-modern/src/types/api.ts @@ -63,30 +63,6 @@ export interface ConnectedInfrastructureItem { surfaces: ConnectedInfrastructureSurface[]; } -export interface KubernetesCluster { - id: string; - agentId: string; - name?: string; - displayName?: string; - customDisplayName?: string; - server?: string; - context?: string; - version?: string; - status: string; - lastSeen: number; - intervalSeconds: number; - agentVersion?: string; - tokenId?: string; - tokenName?: string; - tokenHint?: string; - tokenLastUsedAt?: number; - hidden?: boolean; - pendingUninstall?: boolean; - nodes?: KubernetesNode[]; - pods?: KubernetesPod[]; - deployments?: KubernetesDeployment[]; -} - export interface KubernetesNode { uid: string; name: string; @@ -1068,11 +1044,6 @@ export interface PhysicalDisk { smartAttributes?: SMARTAttributes; } -/** Returns the best resource ID for disk metrics queries (serial preferred, WWN fallback). */ -export function diskResourceId(disk: PhysicalDisk): string | null { - return disk.serial || disk.wwn || null; -} - export interface CPUInfo { model: string; cores: number; @@ -1259,7 +1230,3 @@ export type WSMessage = scanning?: boolean; }; }; - -// Utility types -export type Status = 'running' | 'stopped' | 'paused' | 'unknown'; -export type GuestType = 'vm' | 'system-container'; diff --git a/frontend-modern/src/types/config.ts b/frontend-modern/src/types/config.ts index 8c0e6830d..f413c0917 100644 --- a/frontend-modern/src/types/config.ts +++ b/frontend-modern/src/types/config.ts @@ -87,15 +87,6 @@ export interface NodesConfig { pbsInstances: PBSNodeConfig[]; } -/** - * Complete configuration structure - */ -export interface PulseConfig { - auth: Partial; // From .env - system: SystemConfig; // From system.json - nodes: NodesConfig; // From nodes.enc -} - /** * API response for security status */ @@ -180,47 +171,3 @@ export interface SSOProviderInfo { iconUrl?: string; loginUrl: string; } - -/** - * First-run setup request - */ -export interface SetupRequest { - username: string; - password: string; - apiToken?: string; - enableNotifications?: boolean; - darkMode?: boolean; -} - -/** - * Type guards for configuration validation - */ -export const isValidUpdateChannel = (value: string): value is UpdateChannel => { - return value === 'stable' || value === 'rc'; -}; - -export const isValidTimeFormat = (value: string): boolean => { - return /^([01]\d|2[0-3]):([0-5]\d)$/.test(value); -}; - -/** - * Default values for configuration - */ -export const DEFAULT_CONFIG: { - system: SystemConfig; -} = { - system: { - connectionTimeout: 60, - autoUpdateEnabled: false, - updateChannel: 'stable', - autoUpdateCheckInterval: 24, - autoUpdateTime: '03:00', - backupPollingEnabled: true, - backupPollingInterval: 0, - temperatureMonitoringEnabled: true, - telemetryEnabled: true, - sshPort: 22, - allowedOrigins: '', - frontendPort: 7655, - }, -}; diff --git a/frontend-modern/src/types/discovery.ts b/frontend-modern/src/types/discovery.ts index 9baef26e2..c08cca38e 100644 --- a/frontend-modern/src/types/discovery.ts +++ b/frontend-modern/src/types/discovery.ts @@ -162,10 +162,6 @@ export interface UpdateNotesRequest { user_secrets?: Record; } -export interface UpdateSettingsRequest { - max_discovery_age_days?: number; // Days before rediscovery (default 30) -} - // AI provider information for discovery transparency export interface AIProviderInfo { provider: string; // e.g., "anthropic", "openai", "ollama" diff --git a/frontend-modern/src/types/nodes.ts b/frontend-modern/src/types/nodes.ts index ad98f7788..44ed00684 100644 --- a/frontend-modern/src/types/nodes.ts +++ b/frontend-modern/src/types/nodes.ts @@ -104,18 +104,3 @@ export type NodeConfigWithStatus = NodeConfig & { hasToken?: boolean; status: 'connected' | 'disconnected' | 'offline' | 'error' | 'pending'; }; - -export interface NodesResponse { - pve_instances: PVENodeConfig[]; - pbs_instances: PBSNodeConfig[]; - pmg_instances?: PMGNodeConfig[]; -} - -export interface NodeUpdateRequest { - node: NodeConfig; -} - -export interface NodeDeleteResponse { - success: boolean; - message: string; -} diff --git a/frontend-modern/src/types/recovery.ts b/frontend-modern/src/types/recovery.ts index c505657e7..e2e562b43 100644 --- a/frontend-modern/src/types/recovery.ts +++ b/frontend-modern/src/types/recovery.ts @@ -137,10 +137,6 @@ export interface RecoveryPointsSeriesBucket { remote: number; } -export interface RecoveryPointsSeriesResponse { - data: RecoveryPointsSeriesBucket[]; -} - export interface RecoveryPointsFacets { clusters?: string[]; nodesAgents?: string[]; @@ -150,7 +146,3 @@ export interface RecoveryPointsFacets { hasVerification?: boolean; hasEntityId?: boolean; } - -export interface RecoveryPointsFacetsResponse { - data: RecoveryPointsFacets; -} diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts index 842aeda22..df912a079 100644 --- a/frontend-modern/src/types/resource.ts +++ b/frontend-modern/src/types/resource.ts @@ -196,8 +196,6 @@ export const requiresGovernedResourceDisplay = (policy?: ResourcePolicy | null): if (!policy) return false; return policy.routing.scope === 'local-only' || (policy.routing.redact?.length ?? 0) > 0; }; - -export type ResourceApprovalLevel = 'none' | 'dry_run_only' | 'admin' | 'mfa'; export type ResourceChangeConfidence = 'high' | 'medium' | 'low'; export type ResourceChangeKind = | 'state_transition' diff --git a/frontend-modern/src/utils/aiFindingPresentation.ts b/frontend-modern/src/utils/aiFindingPresentation.ts index 5de3b56b1..12ed02495 100644 --- a/frontend-modern/src/utils/aiFindingPresentation.ts +++ b/frontend-modern/src/utils/aiFindingPresentation.ts @@ -342,23 +342,6 @@ export const getFindingSeverityCompactLabel = ( severity: UnifiedFinding['severity'] | string, ): string => FINDING_SEVERITY_COMPACT_LABELS[severity] || String(severity).toUpperCase(); -export const getFindingCompactBadgePresentation = ( - finding: Pick, -): FindingCompactBadgePresentation => { - if (isPatrolRuntimeFinding(finding)) { - const severityPresentation = getFindingSeverityPresentation(finding); - return { - label: severityPresentation.label, - badgeClasses: severityPresentation.badgeClasses, - }; - } - - return { - label: getFindingSeverityCompactLabel(finding.severity), - badgeClasses: getFindingSeverityBadgeClasses(finding.severity), - }; -}; - export const isPatrolRuntimeFinding = ( finding: Pick, ): boolean => { @@ -617,25 +600,6 @@ export const doesFindingNeedAttention = ( ); }; -// True when the finding has an investigation outcome indicating that some -// remediation step has run against it — anything past "fix queued." For these -// states, Verify fix is a meaningful action; for fix_queued (still awaiting -// approval) and earlier states there is nothing applied yet to verify, and -// for fix_failed the fix didn't complete so verification doesn't apply. -export const findingHasAppliedFix = ( - finding: Pick, -): boolean => { - switch (finding.investigationOutcome) { - case 'fix_executed': - case 'fix_verified': - case 'fix_verification_failed': - case 'fix_verification_unknown': - return true; - default: - return false; - } -}; - export const getFindingLoopStateBadgeClasses = (loopState: string): string => FINDING_LOOP_STATE_CLASSES[loopState] || DEFAULT_LOOP_STATE_CLASSES; diff --git a/frontend-modern/src/utils/alertConfigPresentation.ts b/frontend-modern/src/utils/alertConfigPresentation.ts index 3f9db9a4a..88d55d45a 100644 --- a/frontend-modern/src/utils/alertConfigPresentation.ts +++ b/frontend-modern/src/utils/alertConfigPresentation.ts @@ -190,10 +190,6 @@ export function getAlertConfigDiscardLabel(isReloading: boolean) { return isReloading ? ALERT_CONFIG_DISCARDING_LABEL : ALERT_CONFIG_DISCARD_LABEL; } -export function getAlertConfigSwarmGapValidationError() { - return ALERT_CONFIG_SWARM_GAP_VALIDATION; -} - export function getAlertConfigQuietHourSuppressOptions() { return ALERT_CONFIG_QUIET_HOUR_SUPPRESS_OPTIONS; } diff --git a/frontend-modern/src/utils/alertWebhookPresentation.ts b/frontend-modern/src/utils/alertWebhookPresentation.ts index 2a63983d8..168bf932c 100644 --- a/frontend-modern/src/utils/alertWebhookPresentation.ts +++ b/frontend-modern/src/utils/alertWebhookPresentation.ts @@ -275,17 +275,6 @@ export function getAlertWebhookUrlPlaceholder(urlPattern?: string) { return urlPattern || ALERT_WEBHOOK_URL_PLACEHOLDER; } -export function getAlertWebhookMentionPlaceholder(service: string) { - return ( - ALERT_WEBHOOK_SERVICE_PRESENTATION[service as AlertWebhookService]?.mentionPlaceholder || - ALERT_WEBHOOK_MENTION_FALLBACK_PLACEHOLDER - ); -} - -export function getAlertWebhookMentionHelp(service: string) { - return ALERT_WEBHOOK_SERVICE_PRESENTATION[service as AlertWebhookService]?.mentionHelp || ''; -} - export function getAlertWebhookSummaryLabel(enabledCount: number, totalCount: number) { return `${enabledCount} of ${totalCount} webhooks enabled`; } diff --git a/frontend-modern/src/utils/cloudPlans.ts b/frontend-modern/src/utils/cloudPlans.ts index 77b3b496d..0a0f80fb6 100644 --- a/frontend-modern/src/utils/cloudPlans.ts +++ b/frontend-modern/src/utils/cloudPlans.ts @@ -146,10 +146,6 @@ export function parseCloudTier(value?: string | null): CloudTierKey { } } -export function getCloudPlanForTier(value?: string | null): CloudPlanDefinition { - return CLOUD_PLAN_BY_TIER[parseCloudTier(value)]; -} - export function getCloudPlanPricePresentation( plan: CloudPlanDefinition, ): CloudPlanPricePresentation { diff --git a/frontend-modern/src/utils/commercialBillingModel.ts b/frontend-modern/src/utils/commercialBillingModel.ts index 2cfdf3c37..6fe4b42b8 100644 --- a/frontend-modern/src/utils/commercialBillingModel.ts +++ b/frontend-modern/src/utils/commercialBillingModel.ts @@ -48,8 +48,6 @@ export interface HostedCommercialModelInput { guestUsage: number; renewsOrExpires: string; } - -export const SELF_HOSTED_NOT_METERED_LABEL = 'Not metered'; export const LIFETIME_DAYS_REMAINING_LABEL = 'Permanent'; const asUnlimitedLimit = (value?: number) => diff --git a/frontend-modern/src/utils/infrastructureSummaryCache.ts b/frontend-modern/src/utils/infrastructureSummaryCache.ts index c5ef33d7a..dd33a5232 100644 --- a/frontend-modern/src/utils/infrastructureSummaryCache.ts +++ b/frontend-modern/src/utils/infrastructureSummaryCache.ts @@ -307,14 +307,6 @@ export function readInfrastructureSummaryCache( } } -export function hasFreshInfrastructureSummaryCache( - range: TimeRange, - maxAgeMs: number = INFRA_SUMMARY_CACHE_MAX_AGE_MS, - metrics?: readonly InfrastructureSummaryMetric[] | null, -): boolean { - return readInfrastructureSummaryCache(range, maxAgeMs, undefined, metrics) !== null; -} - const inFlightFetches = new Map>(); let infraSummaryFetchSeq = 0; diff --git a/frontend-modern/src/utils/licensePresentation.ts b/frontend-modern/src/utils/licensePresentation.ts index ce31f0052..53c67c56e 100644 --- a/frontend-modern/src/utils/licensePresentation.ts +++ b/frontend-modern/src/utils/licensePresentation.ts @@ -60,10 +60,6 @@ export interface LicenseInlineNotice { body: string; } -export interface LicenseActionNotice extends LicenseInlineNotice { - actionLabel: string; -} - export interface BillingAdminOrganizationBadge { label: string; badgeClass: string; diff --git a/frontend-modern/src/utils/resourceBadgePresentation.ts b/frontend-modern/src/utils/resourceBadgePresentation.ts index 77368cc37..4bd25e8cb 100644 --- a/frontend-modern/src/utils/resourceBadgePresentation.ts +++ b/frontend-modern/src/utils/resourceBadgePresentation.ts @@ -758,13 +758,3 @@ export function getContainerRuntimeBadgeForRuntime(runtime?: string | null): Res title: `Runtime: ${label}`, }; } - -export function getContainerRuntimeBadge( - platformType?: PlatformType, - platformData?: Record | null, -): ResourceBadge | null { - if (platformType !== 'docker' || !platformData) return null; - - const docker = (platformData as { docker?: { runtime?: string } } | undefined)?.docker; - return getContainerRuntimeBadgeForRuntime(docker?.runtime); -} diff --git a/frontend-modern/src/utils/storageSources.ts b/frontend-modern/src/utils/storageSources.ts index 1b6128f34..d4aa8f79b 100644 --- a/frontend-modern/src/utils/storageSources.ts +++ b/frontend-modern/src/utils/storageSources.ts @@ -163,9 +163,3 @@ export const buildStorageSourceOptionsFromKeys = ( const orderedKeys = orderStorageSourceKeys(keys).filter((key) => key !== 'all'); return [ALL_STORAGE_SOURCE_OPTION, ...orderedKeys.map((key) => getStorageSourceOption(key))]; }; - -export const DEFAULT_STORAGE_SOURCE_OPTIONS: StorageSourceOption[] = - buildStorageSourceOptionsFromKeys(['proxmox-pve', 'proxmox-pbs', 'ceph', 'truenas']); - -export const buildStorageSourceOptions = (storageList: Storage[]): StorageSourceOption[] => - buildStorageSourceOptionsFromKeys(storageList.map((storage) => resolveStorageSourceKey(storage))); diff --git a/frontend-modern/src/utils/storageSummaryCache.ts b/frontend-modern/src/utils/storageSummaryCache.ts index 305ddeca5..e8dd1ace8 100644 --- a/frontend-modern/src/utils/storageSummaryCache.ts +++ b/frontend-modern/src/utils/storageSummaryCache.ts @@ -48,11 +48,6 @@ export function fetchStorageSummaryAndCache( return request; } -export function __resetStorageSummaryCacheForTests(): void { - inMemoryCache.clear(); - inFlightFetches.clear(); -} - const unsubscribeStorageOrgSwitch = eventBus.on('org_switched', () => { inMemoryCache.clear(); inFlightFetches.clear(); diff --git a/frontend-modern/src/utils/unifiedAgentInventoryPresentation.ts b/frontend-modern/src/utils/unifiedAgentInventoryPresentation.ts index 984de0336..ceaa5e847 100644 --- a/frontend-modern/src/utils/unifiedAgentInventoryPresentation.ts +++ b/frontend-modern/src/utils/unifiedAgentInventoryPresentation.ts @@ -39,12 +39,6 @@ export function getUnifiedAgentLastSeenLabel( return row.lastSeen ? formatRelativeTime(row.lastSeen) : '—'; } -export function getMonitoringStoppedEmptyState(hasFilters: boolean): string { - return hasFilters - ? 'No monitoring-stopped items match the current filters.' - : 'No infrastructure currently has monitoring stopped.'; -} - export function getUnifiedAgentStopMonitoringUnavailableMessage(): string { return 'No host identifiers are available to stop monitoring.'; } diff --git a/frontend-modern/src/utils/unifiedAgentStatusPresentation.ts b/frontend-modern/src/utils/unifiedAgentStatusPresentation.ts index d2a81b656..998ff35e6 100644 --- a/frontend-modern/src/utils/unifiedAgentStatusPresentation.ts +++ b/frontend-modern/src/utils/unifiedAgentStatusPresentation.ts @@ -13,7 +13,6 @@ export interface UnifiedAgentLookupStatusPresentation { } export const MONITORING_STOPPED_STATUS_LABEL = 'Monitoring stopped'; -export const ALLOW_RECONNECT_LABEL = 'Allow reconnect'; export function getUnifiedAgentStatusPresentation( state: UnifiedAgentMonitoringState, diff --git a/frontend-modern/src/utils/workloadsSummaryCache.ts b/frontend-modern/src/utils/workloadsSummaryCache.ts index 6f8a725b3..b5d3475d5 100644 --- a/frontend-modern/src/utils/workloadsSummaryCache.ts +++ b/frontend-modern/src/utils/workloadsSummaryCache.ts @@ -9,7 +9,6 @@ import { normalizeOrgScope } from '@/utils/orgScope'; import { eventBus } from '@/stores/events'; export const WORKLOADS_SUMMARY_CACHE_VERSION = 6; -export const WORKLOAD_CHART_DEFAULT_POINT_LIMIT = 180; const WORKLOADS_SUMMARY_CACHE_PREFIX = 'pulse.workloadsSummaryCharts.'; const WORKLOADS_SUMMARY_CACHE_MAX_AGE_MS = 5 * 60_000;