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.

Remove orphaned PMGInstanceDrawer and its dead presentation constants

rcourtman8c80bff84a08
diff --git a/frontend-modern/src/components/PMG/PMGInstanceDrawer.tsx b/frontend-modern/src/components/PMG/PMGInstanceDrawer.tsx
deleted file mode 100644
index e3a8ee0656..0000000000
--- a/frontend-modern/src/components/PMG/PMGInstanceDrawer.tsx
+++ /dev/null
@@ -1,583 +0,0 @@
-import type { Component } from 'solid-js';
-import { For, Show, createMemo, createResource, createSignal } from 'solid-js';
-import { apiFetchJSON } from '@/utils/apiClient';
-import { Card } from '@/components/shared/Card';
-import { SearchField } from '@/components/shared/SearchField';
-import {
- Table,
- TableHeader,
- TableBody,
- TableRow,
- TableHead,
- TableCell,
-} from '@/components/shared/Table';
-import { EmptyState } from '@/components/shared/EmptyState';
-import {
- PLATFORM_TABLE_BODY_CLASS,
- PLATFORM_TABLE_HEADER_ROW_CLASS,
- getPlatformTableCellClassForKind,
- getPlatformTableHeadClassForKind,
-} from '@/features/platformPage/sharedPlatformPage';
-import { formatBytes, formatRelativeTime } from '@/utils/format';
-import { getServiceHealthPresentation } from '@/utils/serviceHealthPresentation';
-import { asTrimmedString } from '@/utils/stringUtils';
-import {
- getPMGDetailsDrawerPresentation,
- PMG_DETAILS_FAILURE_STATE_TITLE,
- PMG_DETAILS_LOADING_STATE_DESCRIPTION,
- PMG_DETAILS_LOADING_STATE_TITLE,
- PMG_DETAILS_EMPTY_STATE_DESCRIPTION,
- PMG_DETAILS_EMPTY_STATE_TITLE,
-} from '@/utils/pmgPresentation';
-
-type PMGNodeStatus = {
- name: string;
- status: string;
- role?: string;
- uptime?: number;
- loadAvg?: string;
- queueStatus?: {
- active?: number;
- deferred?: number;
- hold?: number;
- incoming?: number;
- total?: number;
- };
-};
-
-type PMGMailStats = {
- timeframe?: string;
- countIn?: number;
- countOut?: number;
- spamIn?: number;
- spamOut?: number;
- virusIn?: number;
- virusOut?: number;
- bouncesIn?: number;
- bouncesOut?: number;
- bytesIn?: number;
- bytesOut?: number;
- greylistCount?: number;
- rblRejects?: number;
- averageProcessTimeMs?: number;
-};
-
-type PMGQuarantine = {
- spam?: number;
- virus?: number;
- attachment?: number;
- blacklisted?: number;
-};
-
-type PMGSpamBucket = {
- bucket: string;
- count: number;
-};
-
-type PMGRelayDomain = {
- domain: string;
- comment?: string;
-};
-
-type PMGDomainStat = {
- domain: string;
- mailCount: number;
- spamCount: number;
- virusCount: number;
- bytes?: number;
-};
-
-type PMGData = {
- instanceId?: string;
- hostname?: string;
- version?: string;
- nodeCount?: number;
- uptimeSeconds?: number;
- queueActive?: number;
- queueDeferred?: number;
- queueHold?: number;
- queueIncoming?: number;
- queueTotal?: number;
- mailCountTotal?: number;
- spamIn?: number;
- virusIn?: number;
- connectionHealth?: string;
- lastUpdated?: string;
-
- nodes?: PMGNodeStatus[];
- mailStats?: PMGMailStats;
- quarantine?: PMGQuarantine;
- spamDistribution?: PMGSpamBucket[];
- relayDomains?: PMGRelayDomain[];
- domainStats?: PMGDomainStat[];
- domainStatsAsOf?: string;
-};
-
-type UnifiedResourceResponse = {
- id: string;
- type: string;
- name?: string;
- status?: string;
- lastSeen?: string;
- customUrl?: string;
- pmg?: PMGData;
-};
-
-type PMGInstanceDrawerProps = {
- resourceId: string;
- resourceName?: string;
-};
-
-const formatCompact = (value?: number | null): string => {
- if (value === undefined || value === null || Number.isNaN(value)) return '—';
- if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`;
- if (value >= 1_000) return `${(value / 1_000).toFixed(1)}K`;
- return Math.round(value).toLocaleString();
-};
-
-export const PMGInstanceDrawer: Component<PMGInstanceDrawerProps> = (props) => {
- const [searchRelay, setSearchRelay] = createSignal('');
- const [searchDomain, setSearchDomain] = createSignal('');
- const drawerPresentation = getPMGDetailsDrawerPresentation();
-
- const resourceId = createMemo(() => asTrimmedString(props.resourceId) ?? '');
-
- const [resource] = createResource(
- resourceId,
- async (id) => {
- if (!id) return null;
- return apiFetchJSON<UnifiedResourceResponse>(`/api/resources/${encodeURIComponent(id)}`, {
- cache: 'no-store',
- });
- },
- { initialValue: null },
- );
-
- const loadError = createMemo(() => {
- const err = resource.error;
- if (!err) return '';
- return (err as Error)?.message || 'Failed to fetch PMG details';
- });
-
- const pmg = createMemo(() => resource()?.pmg ?? null);
-
- const lastUpdatedRelative = createMemo(() => {
- const raw = pmg()?.lastUpdated;
- if (!raw) return '';
- const parsed = Date.parse(raw);
- if (!Number.isFinite(parsed)) return '';
- return formatRelativeTime(parsed);
- });
-
- const domainStatsAsOfRelative = createMemo(() => {
- const raw = pmg()?.domainStatsAsOf;
- if (!raw) return '';
- const parsed = Date.parse(raw);
- if (!Number.isFinite(parsed)) return '';
- return formatRelativeTime(parsed);
- });
-
- const relayDomains = createMemo(() => {
- const rows = pmg()?.relayDomains ?? [];
- const term = (asTrimmedString(searchRelay()) ?? '').toLowerCase();
- if (!term) return rows;
- return rows.filter(
- (row) =>
- row.domain.toLowerCase().includes(term) || (row.comment || '').toLowerCase().includes(term),
- );
- });
-
- const domainStats = createMemo(() => {
- const rows = pmg()?.domainStats ?? [];
- const term = (asTrimmedString(searchDomain()) ?? '').toLowerCase();
- const filtered = term ? rows.filter((row) => row.domain.toLowerCase().includes(term)) : rows;
- return [...filtered].sort((a, b) => (b.mailCount || 0) - (a.mailCount || 0));
- });
-
- const spamBuckets = createMemo(() => {
- const rows = pmg()?.spamDistribution ?? [];
- const parsed = rows
- .map((row) => ({ bucket: asTrimmedString(row.bucket) ?? '', count: Number(row.count || 0) }))
- .filter((row) => row.bucket.length > 0);
- return parsed.sort((a, b) => a.bucket.localeCompare(b.bucket));
- });
-
- const maxSpamBucketCount = createMemo(() =>
- Math.max(0, ...spamBuckets().map((row) => row.count)),
- );
-
- const headingId = () => `pmg-drawer-heading-${resourceId() || 'instance'}`;
- const drawerLabel = () => asTrimmedString(props.resourceName) || resourceId() || 'PMG instance';
-
- return (
- <section class="space-y-3" aria-labelledby={headingId()}>
- <h2 id={headingId()} class="sr-only">
- {drawerLabel()} details
- </h2>
- <Show when={loadError()}>
- <div role="alert" aria-live="assertive">
- <Card padding="lg" tone="danger">
- <EmptyState
- title={PMG_DETAILS_FAILURE_STATE_TITLE}
- description={loadError()}
- tone="danger"
- />
- </Card>
- </div>
- </Show>
- <Show
- when={!resource.loading}
- fallback={
- <Card padding="lg">
- <EmptyState
- title={PMG_DETAILS_LOADING_STATE_TITLE}
- description={PMG_DETAILS_LOADING_STATE_DESCRIPTION}
- />
- </Card>
- }
- >
- <Show
- when={pmg()}
- fallback={
- <Card padding="lg">
- <EmptyState
- title={PMG_DETAILS_EMPTY_STATE_TITLE}
- description={PMG_DETAILS_EMPTY_STATE_DESCRIPTION}
- />
- </Card>
- }
- >
- {(pmgData) => (
- <>
- <Card padding="lg">
- <div class="flex items-start justify-between gap-4">
- <div class="min-w-0">
- <div
- class="text-sm font-semibold text-base-content truncate"
- title={
- asTrimmedString(props.resourceName) ||
- resource()?.name ||
- drawerPresentation.defaultResourceName
- }
- >
- {asTrimmedString(props.resourceName) ||
- resource()?.name ||
- drawerPresentation.defaultResourceName}
- </div>
- <div class="mt-1 text-xs text-muted">
- {pmgData().hostname || drawerPresentation.unknownHostLabel}
- <Show when={pmgData().version}>
- <span class="mx-2 text-muted">|</span>
- <span>v{pmgData().version}</span>
- </Show>
- </div>
- <Show when={lastUpdatedRelative()}>
- <div class="mt-1 text-[11px] text-muted">
- {drawerPresentation.updatedPrefix} {lastUpdatedRelative()}
- </div>
- </Show>
- </div>
-
- <div class="shrink-0 flex items-center gap-2">
- {(() => {
- const health = getServiceHealthPresentation(
- resource()?.status,
- pmgData().connectionHealth,
- );
- return (
- <>
- <span class={`inline-block h-2.5 w-2.5 rounded-full ${health.dot}`} />
- <span class={`text-xs font-medium ${health.text}`}>{health.label}</span>
- </>
- );
- })()}
- <Show when={resource()?.customUrl}>
- {(url) => (
- <a
- class="ml-2 text-xs font-medium text-blue-700 hover:text-blue-800 dark:text-blue-300 dark:hover:text-blue-200"
- href={url()}
- target="_blank"
- rel="noreferrer"
- >
- Open
- </a>
- )}
- </Show>
- </div>
- </div>
-
- <div class="mt-4 grid grid-cols-2 gap-3 text-xs sm:grid-cols-4">
- <div class="rounded border border-border bg-surface px-3 py-2">
- <div class="text-[10px] uppercase tracking-wide text-muted">Queue Total</div>
- <div class="mt-1 text-sm font-semibold text-base-content">
- {formatCompact(pmgData().queueTotal ?? 0)}
- </div>
- </div>
- <div class="rounded border border-border bg-surface px-3 py-2">
- <div class="text-[10px] uppercase tracking-wide text-muted">Deferred</div>
- <div class="mt-1 text-sm font-semibold text-base-content">
- {formatCompact(pmgData().queueDeferred ?? 0)}
- </div>
- </div>
- <div class="rounded border border-border bg-surface px-3 py-2">
- <div class="text-[10px] uppercase tracking-wide text-muted">Mail</div>
- <div class="mt-1 text-sm font-semibold text-base-content">
- {formatCompact(pmgData().mailCountTotal ?? 0)}
- </div>
- </div>
- <div class="rounded border border-border bg-surface px-3 py-2">
- <div class="text-[10px] uppercase tracking-wide text-muted">Spam/Virus</div>
- <div class="mt-1 text-sm font-semibold text-base-content">
- {formatCompact(pmgData().spamIn ?? 0)} /{' '}
- {formatCompact(pmgData().virusIn ?? 0)}
- </div>
- </div>
- </div>
- </Card>
-
- <Show when={(pmgData().nodes || []).length > 0}>
- <Card padding="lg">
- <div class="text-xs font-semibold text-base-content">
- {drawerPresentation.nodesSectionTitle}
- </div>
- <Table
- wrapperClass="mt-2"
- class="min-w-full table-fixed text-xs md:min-w-[560px]"
- >
- <TableHeader>
- <TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>
- <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[34%]`}>
- {drawerPresentation.nodeColumnLabel}
- </TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[22%]`}>
- {drawerPresentation.roleColumnLabel}
- </TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[22%]`}>
- {drawerPresentation.statusColumnLabel}
- </TableHead>
- <TableHead
- class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[22%]`}
- >
- {drawerPresentation.queueColumnLabel}
- </TableHead>
- </TableRow>
- </TableHeader>
- <TableBody class={PLATFORM_TABLE_BODY_CLASS}>
- <For each={pmgData().nodes || []}>
- {(node) => (
- <TableRow class="text-[11px] sm:text-xs">
- <TableCell
- class={`${getPlatformTableCellClassForKind('name')} text-base-content`}
- >
- <span class="block truncate" title={node.name}>
- {node.name}
- </span>
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('text')} text-muted`}
- >
- <span class="block truncate" title={node.role || '—'}>
- {node.role || '—'}
- </span>
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('text')} text-muted`}
- >
- <span class="block truncate" title={node.status || '—'}>
- {node.status || '—'}
- </span>
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted tabular-nums`}
- >
- {formatCompact(node.queueStatus?.total ?? 0)}
- </TableCell>
- </TableRow>
- )}
- </For>
- </TableBody>
- </Table>
- </Card>
- </Show>
-
- <Show when={(pmgData().relayDomains || []).length > 0}>
- <Card padding="lg">
- <div class="flex items-center justify-between gap-3">
- <div class="text-xs font-semibold text-base-content">
- {drawerPresentation.relayDomainsSectionTitle}
- </div>
- <SearchField
- value={searchRelay()}
- onChange={setSearchRelay}
- placeholder={drawerPresentation.domainSearchPlaceholder}
- class="w-56"
- inputClass="py-1 text-xs"
- />
- </div>
- <Table
- wrapperClass="mt-2"
- class="min-w-full table-fixed text-xs md:min-w-[520px]"
- >
- <TableHeader>
- <TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>
- <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[45%]`}>
- {drawerPresentation.domainColumnLabel}
- </TableHead>
- <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[55%]`}>
- {drawerPresentation.commentColumnLabel}
- </TableHead>
- </TableRow>
- </TableHeader>
- <TableBody class={PLATFORM_TABLE_BODY_CLASS}>
- <For each={relayDomains()}>
- {(row) => (
- <TableRow class="text-[11px] sm:text-xs">
- <TableCell
- class={`${getPlatformTableCellClassForKind('name')} text-base-content`}
- >
- <span class="block truncate" title={row.domain}>
- {row.domain}
- </span>
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('text')} text-muted`}
- >
- <span class="block truncate" title={row.comment || '—'}>
- {row.comment || '—'}
- </span>
- </TableCell>
- </TableRow>
- )}
- </For>
- </TableBody>
- </Table>
- </Card>
- </Show>
-
- <Show when={(pmgData().domainStats || []).length > 0}>
- <Card padding="lg">
- <div class="flex items-center justify-between gap-3">
- <div class="min-w-0">
- <div class="text-xs font-semibold text-base-content">
- {drawerPresentation.domainStatsSectionTitle}
- </div>
- <Show when={domainStatsAsOfRelative()}>
- <div class="mt-0.5 text-[11px] text-muted">
- {drawerPresentation.asOfPrefix} {domainStatsAsOfRelative()}
- </div>
- </Show>
- </div>
- <SearchField
- value={searchDomain()}
- onChange={setSearchDomain}
- placeholder={drawerPresentation.domainSearchPlaceholder}
- class="w-56"
- inputClass="py-1 text-xs"
- />
- </div>
- <Table
- wrapperClass="mt-2"
- class="min-w-full table-fixed text-xs md:min-w-[720px]"
- >
- <TableHeader>
- <TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>
- <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[36%]`}>
- {drawerPresentation.domainColumnLabel}
- </TableHead>
- <TableHead
- class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[16%]`}
- >
- {drawerPresentation.mailColumnLabel}
- </TableHead>
- <TableHead
- class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[16%]`}
- >
- {drawerPresentation.spamColumnLabel}
- </TableHead>
- <TableHead
- class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[16%]`}
- >
- {drawerPresentation.virusColumnLabel}
- </TableHead>
- <TableHead
- class={`${getPlatformTableHeadClassForKind('numeric-value')} md:w-[16%]`}
- >
- {drawerPresentation.bytesColumnLabel}
- </TableHead>
- </TableRow>
- </TableHeader>
- <TableBody class={PLATFORM_TABLE_BODY_CLASS}>
- <For each={domainStats()}>
- {(row) => (
- <TableRow class="text-[11px] sm:text-xs">
- <TableCell
- class={`${getPlatformTableCellClassForKind('name')} text-base-content`}
- >
- <span class="block truncate" title={row.domain}>
- {row.domain}
- </span>
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted tabular-nums`}
- >
- {formatCompact(row.mailCount)}
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted tabular-nums`}
- >
- {formatCompact(row.spamCount)}
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted tabular-nums`}
- >
- {formatCompact(row.virusCount)}
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted tabular-nums`}
- >
- {row.bytes ? formatBytes(row.bytes) : '—'}
- </TableCell>
- </TableRow>
- )}
- </For>
- </TableBody>
- </Table>
- </Card>
- </Show>
-
- <Show when={spamBuckets().length > 0}>
- <Card padding="lg">
- <div class="text-xs font-semibold text-base-content">
- {drawerPresentation.spamDistributionSectionTitle}
- </div>
- <div class="mt-3 space-y-2">
- <For each={spamBuckets()}>
- {(bucket) => (
- <div class="flex items-center gap-3">
- <div class="w-16 text-[11px] font-medium text-muted">{bucket.bucket}</div>
- <div class="flex-1 h-2 rounded bg-surface-alt overflow-hidden">
- <div
- class="h-full bg-amber-500"
- style={{
- width: `${maxSpamBucketCount() > 0 ? Math.round((bucket.count / maxSpamBucketCount()) * 100) : 0}%`,
- }}
- />
- </div>
- <div class="w-14 text-right text-[11px] text-muted">
- {formatCompact(bucket.count)}
- </div>
- </div>
- )}
- </For>
- </div>
- </Card>
- </Show>
- </>
- )}
- </Show>
- </Show>
- </section>
- );
-};
-
-export default PMGInstanceDrawer;
diff --git a/frontend-modern/src/components/PMG/__tests__/PMGInstanceDrawer.test.tsx b/frontend-modern/src/components/PMG/__tests__/PMGInstanceDrawer.test.tsx
deleted file mode 100644
index cdf5e616c5..0000000000
--- a/frontend-modern/src/components/PMG/__tests__/PMGInstanceDrawer.test.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { cleanup, render, screen, waitFor } from '@solidjs/testing-library';
-
-const apiFetchJSONMock = vi.fn();
-
-vi.mock('@/utils/apiClient', () => ({
- apiFetchJSON: (...args: unknown[]) => apiFetchJSONMock(...args),
-}));
-
-import { PMGInstanceDrawer } from '@/components/PMG/PMGInstanceDrawer';
-
-describe('PMGInstanceDrawer', () => {
- beforeEach(() => {
- apiFetchJSONMock.mockReset();
- });
-
- afterEach(() => {
- cleanup();
- });
-
- it('uses the shared platform table spacing and divider contract for detail tables', async () => {
- apiFetchJSONMock.mockResolvedValueOnce({
- id: 'pmg-1',
- type: 'pmg',
- name: 'mail-gateway',
- pmg: {
- hostname: 'mail-gateway.local',
- version: '8.1.0',
- nodes: [
- {
- name: 'mail-node-a',
- role: 'master',
- status: 'online',
- queueStatus: { total: 12 },
- },
- ],
- relayDomains: [{ domain: 'example.com', comment: 'primary' }],
- domainStats: [
- {
- domain: 'example.com',
- mailCount: 128,
- spamCount: 4,
- virusCount: 1,
- bytes: 4096,
- },
- ],
- },
- });
-
- const { container } = render(() => (
- <PMGInstanceDrawer resourceId="pmg-1" resourceName="Mail Gateway" />
- ));
-
- await waitFor(() => {
- expect(screen.getByText('mail-node-a')).toBeInTheDocument();
- expect(screen.getAllByText('example.com').length).toBeGreaterThan(0);
- });
-
- expect(apiFetchJSONMock).toHaveBeenCalledWith('/api/resources/pmg-1', {
- cache: 'no-store',
- });
-
- const tables = Array.from(container.querySelectorAll('table'));
- expect(tables).toHaveLength(3);
- for (const table of tables) {
- expect(table).toHaveClass('table-fixed');
- expect(table.querySelector('thead tr')).toHaveClass('bg-surface-alt');
- expect(table.querySelector('tbody')).toHaveClass('divide-y', 'divide-border');
- expect(table.querySelector('tbody')).not.toHaveClass('divide-border-subtle');
- expect(table.querySelector('th')).toHaveClass('px-1.5', 'py-0.5');
- }
- });
-});
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 1c12528c26..f16228eb34 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -130,7 +130,7 @@ import unifiedResourceHostTableCardSource from '@/components/Infrastructure/Unif
import unifiedResourceServiceInfrastructureCardSource from '@/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx?raw';
import unifiedResourcePBSTableSectionSource from '@/components/Infrastructure/UnifiedResourcePBSTableSection.tsx?raw';
import unifiedResourcePMGTableSectionSource from '@/components/Infrastructure/UnifiedResourcePMGTableSection.tsx?raw';
-import pmgInstanceDrawerSource from '@/components/PMG/PMGInstanceDrawer.tsx?raw';
+import proxmoxMailGatewayDrawerSource from '@/features/proxmox/ProxmoxMailGatewayDrawer.tsx?raw';
import swarmServicesDrawerSource from '@/components/Docker/SwarmServicesDrawer.tsx?raw';
import k8sDeploymentsDrawerSource from '@/components/Kubernetes/K8sDeploymentsDrawer.tsx?raw';
import k8sNamespacesDrawerSource from '@/components/Kubernetes/K8sNamespacesDrawer.tsx?raw';
@@ -581,7 +581,7 @@ describe('shared primitive guardrails', () => {
deployDeployingStepSource,
deployPreflightStepSource,
deployResultsStepSource,
- pmgInstanceDrawerSource,
+ proxmoxMailGatewayDrawerSource,
pmgInstancePanelSource,
pmgMailGatewaySource,
pulseDataGridSource,
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index c6e5088a78..7e22d8c71f 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -282,7 +282,7 @@ import useStorageModelSource from '@/components/Storage/useStorageModel.ts?raw';
import useStorageCephModelSource from '@/components/Storage/useStorageCephModel.ts?raw';
import useStorageAlertStateSource from '@/components/Storage/useStorageAlertState.ts?raw';
import temperatureUtilSource from '@/utils/temperature.ts?raw';
-import pmgInstanceDrawerSource from '@/components/PMG/PMGInstanceDrawer.tsx?raw';
+import proxmoxMailGatewayDrawerSource from '@/features/proxmox/ProxmoxMailGatewayDrawer.tsx?raw';
import serviceHealthPresentationSource from '@/utils/serviceHealthPresentation.ts?raw';
import alertIncidentEventFiltersSource from '@/components/Alerts/IncidentEventFilters.tsx?raw';
import alertIncidentTimelinePanelSource from '@/components/Alerts/IncidentTimelinePanel.tsx?raw';
@@ -2354,8 +2354,7 @@ describe('frontend resource type boundaries', () => {
expect(cephRecordPresentationSource).toContain('export const getCephPoolsText');
expect(cephRecordPresentationSource).toContain('export const collectCephClusterNodes');
expect(temperatureUtilSource).toContain('export const getTemperatureTextClass');
- expect(pmgInstanceDrawerSource).toContain('getServiceHealthPresentation');
- expect(pmgInstanceDrawerSource).not.toContain('const statusTone =');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('const statusTone =');
expect(serviceHealthPresentationSource).toContain(
'export function getServiceHealthPresentation',
);
@@ -2636,8 +2635,8 @@ describe('frontend resource type boundaries', () => {
expect(swarmServicesDrawerSource).not.toContain(
"const normalize = (value?: string | null) => (value || '').trim();",
);
- expect(pmgInstanceDrawerSource).toContain('asTrimmedString');
- expect(pmgInstanceDrawerSource).not.toContain(
+ expect(proxmoxMailGatewayDrawerSource).toContain('asTrimmedString');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain(
"const normalize = (value?: string | null) => (value || '').trim();",
);
expect(k8sNamespacesDrawerSource).toContain('asTrimmedString');
@@ -3245,19 +3244,13 @@ describe('frontend resource type boundaries', () => {
expect(mailGatewaySource).not.toContain('Reconnect now');
expect(mailGatewaySource).not.toContain('Clear search');
expect(mailGatewaySource).not.toContain('const StatusBadge: Component');
- expect(pmgInstanceDrawerSource).toContain('getPMGDetailsDrawerPresentation');
- expect(pmgInstanceDrawerSource).toContain('PMG_DETAILS_EMPTY_STATE_TITLE');
- expect(pmgInstanceDrawerSource).toContain('PMG_DETAILS_EMPTY_STATE_DESCRIPTION');
- expect(pmgInstanceDrawerSource).toContain('PMG_DETAILS_LOADING_STATE_TITLE');
- expect(pmgInstanceDrawerSource).toContain('PMG_DETAILS_LOADING_STATE_DESCRIPTION');
- expect(pmgInstanceDrawerSource).toContain('PMG_DETAILS_FAILURE_STATE_TITLE');
- expect(pmgInstanceDrawerSource).toMatch(/<Table(?:\s|>)/);
- expect(pmgInstanceDrawerSource).toContain('PLATFORM_TABLE_HEADER_ROW_CLASS');
- expect(pmgInstanceDrawerSource).toContain('PLATFORM_TABLE_BODY_CLASS');
- expect(pmgInstanceDrawerSource).toContain('getPlatformTableHeadClassForKind');
- expect(pmgInstanceDrawerSource).toContain('getPlatformTableCellClassForKind');
- expect(pmgInstanceDrawerSource).not.toContain('divide-y divide-border-subtle');
- expect(pmgInstanceDrawerSource).not.toContain('<div class="mt-2 overflow-x-auto">');
+ expect(proxmoxMailGatewayDrawerSource).toMatch(/<Table(?:\s|>)/);
+ expect(proxmoxMailGatewayDrawerSource).toContain('PLATFORM_TABLE_HEADER_ROW_CLASS');
+ expect(proxmoxMailGatewayDrawerSource).toContain('PLATFORM_TABLE_BODY_CLASS');
+ expect(proxmoxMailGatewayDrawerSource).toContain('getPlatformTableHeadClassForKind');
+ expect(proxmoxMailGatewayDrawerSource).toContain('getPlatformTableCellClassForKind');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('divide-y divide-border-subtle');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('<div class="mt-2 overflow-x-auto">');
expect(mailGatewaySource).not.toContain('<div class="overflow-x-auto -mx-4 px-4">');
expect(mailGatewaySource).not.toContain('wrapperClass="-mx-4 px-4"');
expect(pmgInstancePanelSource).not.toContain('<div class="overflow-x-auto -mx-4 px-4">');
@@ -3268,12 +3261,12 @@ describe('frontend resource type boundaries', () => {
expect(pmgInstancePanelSource).not.toContain(
'<div class="overflow-auto max-h-[260px] rounded-md border border-border">',
);
- expect(pmgInstanceDrawerSource).not.toContain('Search domains...');
- expect(pmgInstanceDrawerSource).not.toContain('Unknown host');
- expect(pmgInstanceDrawerSource).not.toContain('Spam Distribution');
- expect(pmgInstanceDrawerSource).not.toContain('No PMG details for this resource yet');
- expect(pmgInstanceDrawerSource).not.toContain('Loading mail gateway details...');
- expect(pmgInstanceDrawerSource).not.toContain('Failed to load PMG details');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('Search domains...');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('Unknown host');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('Spam Distribution');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('No PMG details for this resource yet');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('Loading mail gateway details...');
+ expect(proxmoxMailGatewayDrawerSource).not.toContain('Failed to load PMG details');
expect(pmgInstancePanelSource).toContain('getPMGThreatPresentation');
expect(pmgInstancePanelSource).not.toContain('const barColor =');
expect(pmgInstancePanelSource).not.toContain('const textColor =');
@@ -3288,12 +3281,6 @@ describe('frontend resource type boundaries', () => {
expect(pmgPresentationSource).toContain('export const PMG_LOADING_STATE_DESCRIPTION');
expect(pmgPresentationSource).toContain('export const PMG_DISCONNECTED_STATE_TITLE');
expect(pmgPresentationSource).toContain('export const PMG_SEARCH_PLACEHOLDER');
- expect(pmgPresentationSource).toContain('export const PMG_DETAILS_EMPTY_STATE_TITLE');
- expect(pmgPresentationSource).toContain('export const PMG_DETAILS_EMPTY_STATE_DESCRIPTION');
- expect(pmgPresentationSource).toContain('export const PMG_DETAILS_LOADING_STATE_TITLE');
- expect(pmgPresentationSource).toContain('export const PMG_DETAILS_LOADING_STATE_DESCRIPTION');
- expect(pmgPresentationSource).toContain('export const PMG_DETAILS_FAILURE_STATE_TITLE');
- expect(pmgPresentationSource).toContain('export function getPMGDetailsDrawerPresentation');
expect(pmgPresentationSource).toContain('export function getPMGDisconnectedState');
expect(pmgPresentationSource).toContain('export function getPMGSearchEmptyState');
expect(pmgThreatPresentationSource).toContain('export function getPMGThreatPresentation');
diff --git a/frontend-modern/src/utils/__tests__/pmgPresentation.test.ts b/frontend-modern/src/utils/__tests__/pmgPresentation.test.ts
index d68c36bb0a..65b4663009 100644
--- a/frontend-modern/src/utils/__tests__/pmgPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/pmgPresentation.test.ts
@@ -1,13 +1,7 @@
import { describe, expect, it } from 'vitest';
import {
- getPMGDetailsDrawerPresentation,
getPMGDisconnectedState,
getPMGSearchEmptyState,
- PMG_DETAILS_FAILURE_STATE_TITLE,
- PMG_DETAILS_LOADING_STATE_DESCRIPTION,
- PMG_DETAILS_LOADING_STATE_TITLE,
- PMG_DETAILS_EMPTY_STATE_DESCRIPTION,
- PMG_DETAILS_EMPTY_STATE_TITLE,
PMG_DISCONNECTED_STATE_TITLE,
PMG_EMPTY_STATE_DESCRIPTION,
PMG_EMPTY_STATE_TITLE,
@@ -17,30 +11,6 @@ import {
} from '../pmgPresentation';
describe('pmgPresentation', () => {
- it('exports canonical PMG details drawer presentation', () => {
- expect(getPMGDetailsDrawerPresentation()).toEqual({
- defaultResourceName: 'Mail Gateway',
- unknownHostLabel: 'Unknown host',
- updatedPrefix: 'Updated',
- nodesSectionTitle: 'Nodes',
- relayDomainsSectionTitle: 'Relay Domains',
- domainStatsSectionTitle: 'Domain Stats',
- spamDistributionSectionTitle: 'Spam Distribution',
- asOfPrefix: 'As of',
- domainSearchPlaceholder: 'Search domains...',
- nodeColumnLabel: 'Node',
- roleColumnLabel: 'Role',
- statusColumnLabel: 'Status',
- queueColumnLabel: 'Queue',
- domainColumnLabel: 'Domain',
- commentColumnLabel: 'Comment',
- mailColumnLabel: 'Mail',
- spamColumnLabel: 'Spam',
- virusColumnLabel: 'Virus',
- bytesColumnLabel: 'Bytes',
- });
- });
-
it('exports canonical PMG empty-state copy', () => {
expect(PMG_EMPTY_STATE_TITLE).toBe('No Mail Gateways configured');
expect(PMG_EMPTY_STATE_DESCRIPTION).toBe(
@@ -51,11 +21,6 @@ describe('pmgPresentation', () => {
expect(PMG_LOADING_STATE_DESCRIPTION).toBe('Connecting to the monitoring service.');
expect(PMG_DISCONNECTED_STATE_TITLE).toBe('Connection lost');
expect(PMG_SEARCH_PLACEHOLDER).toBe('Search gateways...');
- expect(PMG_DETAILS_EMPTY_STATE_TITLE).toBe('No PMG details for this resource yet');
- expect(PMG_DETAILS_EMPTY_STATE_DESCRIPTION).toContain("Pulse hasn't ingested PMG analytics");
- expect(PMG_DETAILS_LOADING_STATE_TITLE).toBe('Loading mail gateway details...');
- expect(PMG_DETAILS_LOADING_STATE_DESCRIPTION).toBe('Fetching PMG resource details.');
- expect(PMG_DETAILS_FAILURE_STATE_TITLE).toBe('Failed to load PMG details');
});
it('exports canonical PMG disconnected and search state helpers', () => {
diff --git a/frontend-modern/src/utils/pmgPresentation.ts b/frontend-modern/src/utils/pmgPresentation.ts
index a58b899c25..7743702a34 100644
--- a/frontend-modern/src/utils/pmgPresentation.ts
+++ b/frontend-modern/src/utils/pmgPresentation.ts
@@ -13,60 +13,6 @@ export const PMG_DISCONNECTED_STATE_TITLE = 'Connection lost';
export const PMG_SEARCH_PLACEHOLDER = 'Search gateways...';
-export const PMG_DETAILS_EMPTY_STATE_TITLE = 'No PMG details for this resource yet';
-
-export const PMG_DETAILS_EMPTY_STATE_DESCRIPTION =
- "Pulse hasn't ingested PMG analytics for this instance.";
-
-export const PMG_DETAILS_LOADING_STATE_TITLE = 'Loading mail gateway details...';
-
-export const PMG_DETAILS_LOADING_STATE_DESCRIPTION = 'Fetching PMG resource details.';
-
-export const PMG_DETAILS_FAILURE_STATE_TITLE = 'Failed to load PMG details';
-export const PMG_DETAILS_DEFAULT_RESOURCE_NAME = 'Mail Gateway';
-export const PMG_DETAILS_UNKNOWN_HOST_LABEL = 'Unknown host';
-export const PMG_DETAILS_UPDATED_PREFIX = 'Updated';
-export const PMG_DETAILS_NODES_SECTION_TITLE = 'Nodes';
-export const PMG_DETAILS_RELAY_DOMAINS_SECTION_TITLE = 'Relay Domains';
-export const PMG_DETAILS_DOMAIN_STATS_SECTION_TITLE = 'Domain Stats';
-export const PMG_DETAILS_SPAM_DISTRIBUTION_SECTION_TITLE = 'Spam Distribution';
-export const PMG_DETAILS_AS_OF_PREFIX = 'As of';
-export const PMG_DETAILS_DOMAIN_SEARCH_PLACEHOLDER = 'Search domains...';
-export const PMG_DETAILS_NODE_COLUMN_LABEL = 'Node';
-export const PMG_DETAILS_ROLE_COLUMN_LABEL = 'Role';
-export const PMG_DETAILS_STATUS_COLUMN_LABEL = 'Status';
-export const PMG_DETAILS_QUEUE_COLUMN_LABEL = 'Queue';
-export const PMG_DETAILS_DOMAIN_COLUMN_LABEL = 'Domain';
-export const PMG_DETAILS_COMMENT_COLUMN_LABEL = 'Comment';
-export const PMG_DETAILS_MAIL_COLUMN_LABEL = 'Mail';
-export const PMG_DETAILS_SPAM_COLUMN_LABEL = 'Spam';
-export const PMG_DETAILS_VIRUS_COLUMN_LABEL = 'Virus';
-export const PMG_DETAILS_BYTES_COLUMN_LABEL = 'Bytes';
-
-export function getPMGDetailsDrawerPresentation() {
- return {
- defaultResourceName: PMG_DETAILS_DEFAULT_RESOURCE_NAME,
- unknownHostLabel: PMG_DETAILS_UNKNOWN_HOST_LABEL,
- updatedPrefix: PMG_DETAILS_UPDATED_PREFIX,
- nodesSectionTitle: PMG_DETAILS_NODES_SECTION_TITLE,
- relayDomainsSectionTitle: PMG_DETAILS_RELAY_DOMAINS_SECTION_TITLE,
- domainStatsSectionTitle: PMG_DETAILS_DOMAIN_STATS_SECTION_TITLE,
- spamDistributionSectionTitle: PMG_DETAILS_SPAM_DISTRIBUTION_SECTION_TITLE,
- asOfPrefix: PMG_DETAILS_AS_OF_PREFIX,
- domainSearchPlaceholder: PMG_DETAILS_DOMAIN_SEARCH_PLACEHOLDER,
- nodeColumnLabel: PMG_DETAILS_NODE_COLUMN_LABEL,
- roleColumnLabel: PMG_DETAILS_ROLE_COLUMN_LABEL,
- statusColumnLabel: PMG_DETAILS_STATUS_COLUMN_LABEL,
- queueColumnLabel: PMG_DETAILS_QUEUE_COLUMN_LABEL,
- domainColumnLabel: PMG_DETAILS_DOMAIN_COLUMN_LABEL,
- commentColumnLabel: PMG_DETAILS_COMMENT_COLUMN_LABEL,
- mailColumnLabel: PMG_DETAILS_MAIL_COLUMN_LABEL,
- spamColumnLabel: PMG_DETAILS_SPAM_COLUMN_LABEL,
- virusColumnLabel: PMG_DETAILS_VIRUS_COLUMN_LABEL,
- bytesColumnLabel: PMG_DETAILS_BYTES_COLUMN_LABEL,
- } as const;
-}
-
export function getPMGDisconnectedState(reconnecting: boolean) {
return {
title: PMG_DISCONNECTED_STATE_TITLE,