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.

proxmox(mail): bespoke Mail Gateway table; project uptime on PBS + PMG

rcourtman3ecc3fd0d135
diff --git a/frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx
new file mode 100644
index 0000000000..248ba8aed2
--- /dev/null
+++ b/frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx
@@ -0,0 +1,182 @@
+import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js';
+import { Card } from '@/components/shared/Card';
+import { EmptyState } from '@/components/shared/EmptyState';
+import { FilterButtonGroup, type FilterOption } from '@/components/shared/FilterButtonGroup';
+import { SearchInput } from '@/components/shared/SearchInput';
+import { StatusDot } from '@/components/shared/StatusDot';
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@/components/shared/Table';
+import { getSimpleStatusIndicator } from '@/utils/status';
+import { asTrimmedString } from '@/utils/stringUtils';
+import {
+ filterPlatformResources,
+ type PlatformResourceStatusFilter,
+} from '@/features/platformPage/sharedPlatformPage';
+import type { Resource } from '@/types/resource';
+
+// Proxmox Mail Gateway instances are mail-flow / quarantine appliances.
+// The generic infrastructure table renders dashes for Disk I/O / Uptime
+// / Temperature (PMG only exposes uptime, which we project now) and
+// omits the queue / spam / virus / quarantine counts that are the
+// operator columns. This bespoke table reuses canonical shared
+// primitives and surfaces those PMG-native columns.
+
+const STATUS_FILTER_OPTIONS: FilterOption<PlatformResourceStatusFilter>[] = [
+ { value: 'all', label: 'All' },
+ { value: 'online', label: 'Healthy' },
+ { value: 'degraded', label: 'Degraded' },
+ { value: 'offline', label: 'Offline' },
+];
+
+const formatUptime = (seconds: number | undefined): string => {
+ if (!seconds || seconds <= 0) return '—';
+ const days = Math.floor(seconds / 86_400);
+ if (days > 0) return `${days}d`;
+ const hours = Math.floor(seconds / 3_600);
+ if (hours > 0) return `${hours}h`;
+ const mins = Math.floor(seconds / 60);
+ return `${mins}m`;
+};
+
+const countCell = (value: number | undefined): JSX.Element => (
+ <span class="tabular-nums">{typeof value === 'number' ? value.toLocaleString() : '—'}</span>
+);
+
+export const ProxmoxMailGatewayTable: Component<{
+ resources: Resource[];
+ emptyTitle: string;
+ emptyDescription: string;
+}> = (props) => {
+ const [search, setSearch] = createSignal('');
+ const [status, setStatus] = createSignal<PlatformResourceStatusFilter>('all');
+
+ const filtered = createMemo(() => filterPlatformResources(props.resources, search(), status()));
+ const visible = createMemo(() => filtered().length);
+ const total = createMemo(() => props.resources.length);
+
+ return (
+ <Show
+ when={props.resources.length > 0}
+ fallback={
+ <Card padding="lg">
+ <EmptyState title={props.emptyTitle} description={props.emptyDescription} />
+ </Card>
+ }
+ >
+ <div class="space-y-3">
+ <div class="flex flex-wrap items-center gap-2">
+ <div class="min-w-[200px] flex-1 sm:max-w-xs">
+ <SearchInput
+ value={search}
+ onChange={setSearch}
+ placeholder="Search Mail Gateways"
+ />
+ </div>
+ <FilterButtonGroup
+ options={STATUS_FILTER_OPTIONS}
+ value={status()}
+ onChange={setStatus}
+ />
+ <span class="ml-auto whitespace-nowrap text-xs font-medium text-muted">
+ <Show when={visible() !== total()} fallback={<>{total()} instances</>}>
+ {visible()} of {total()} instances
+ </Show>
+ </span>
+ </div>
+
+ <Show
+ when={filtered().length > 0}
+ fallback={
+ <Card padding="lg">
+ <EmptyState
+ title="No instances match current filters"
+ description="Adjust the search or status filter to see more instances."
+ />
+ </Card>
+ }
+ >
+ <Card padding="none" tone="card" class="overflow-hidden">
+ <Table class="w-full min-w-[1080px] border-collapse text-xs">
+ <TableHeader class="bg-surface-alt text-muted border-b border-border">
+ <TableRow class="text-left text-[10px] uppercase tracking-wide">
+ <TableHead class="px-3 py-2 font-medium">Instance</TableHead>
+ <TableHead class="px-3 py-2 font-medium">Version</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Nodes</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Uptime</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Mail in</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Spam</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Virus</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Quarantine</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Queue</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Deferred</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody class="divide-y divide-border-subtle">
+ <For each={filtered()}>
+ {(instance) => {
+ const pmg = () => instance.pmg;
+ const name = () => asTrimmedString(instance.name) || instance.id;
+ const version = () => asTrimmedString(pmg()?.version) || '—';
+ const indicator = () => getSimpleStatusIndicator(instance.status);
+ return (
+ <TableRow class="hover:bg-surface-hover">
+ <TableCell class="px-3 py-2">
+ <div class="flex items-center gap-2 min-w-0">
+ <StatusDot
+ size="sm"
+ variant={indicator().variant}
+ title={instance.status || 'unknown'}
+ ariaHidden
+ />
+ <span class="font-semibold text-base-content truncate" title={name()}>
+ {name()}
+ </span>
+ </div>
+ </TableCell>
+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">
+ {version()}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content tabular-nums">
+ {countCell(pmg()?.nodeCount)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {formatUptime(instance.uptime ?? pmg()?.uptimeSeconds)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {countCell(pmg()?.mailCountTotal)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {countCell(pmg()?.spamIn)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {countCell(pmg()?.virusIn)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {countCell(pmg()?.quarantine)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {countCell(pmg()?.queueTotal ?? pmg()?.queueActive)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {countCell(pmg()?.queueDeferred)}
+ </TableCell>
+ </TableRow>
+ );
+ }}
+ </For>
+ </TableBody>
+ </Table>
+ </Card>
+ </Show>
+ </div>
+ </Show>
+ );
+};
+
+export default ProxmoxMailGatewayTable;
diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
index 20bd56380f..ca90d4c5bb 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
@@ -1,15 +1,14 @@
import { A, useLocation } from '@solidjs/router';
import TriangleAlertIcon from 'lucide-solid/icons/triangle-alert';
-import { For, Show, createMemo, createSignal } from 'solid-js';
+import { For, Show, createMemo } from 'solid-js';
import RecoverySurface from '@/components/Recovery/Recovery';
import StorageSurface from '@/components/Storage/Storage';
import { WorkloadsSurface } from '@/components/Workloads/WorkloadsSurface';
import { ProxmoxIcon } from '@/components/icons/ProxmoxIcon';
import { EmptyState } from '@/components/shared/EmptyState';
import { TableCard } from '@/components/shared/TableCard';
-import { UnifiedResourceTable } from '@/components/Infrastructure/UnifiedResourceTable';
+import { ProxmoxMailGatewayTable } from './ProxmoxMailGatewayTable';
import { useUnifiedResources } from '@/hooks/useUnifiedResources';
-import type { Resource } from '@/types/resource';
import {
PROXMOX_TAB_SPECS,
buildProxmoxPageModel,
@@ -61,30 +60,6 @@ function ProxmoxTableEmptyState(props: { title: string; description: string }) {
);
}
-function ProxmoxInfrastructureTable(props: {
- resources: Resource[];
- emptyTitle: string;
- emptyDescription: string;
-}) {
- const [expandedResourceId, setExpandedResourceId] = createSignal<string | null>(null);
-
- return (
- <Show
- when={props.resources.length > 0}
- fallback={
- <ProxmoxTableEmptyState title={props.emptyTitle} description={props.emptyDescription} />
- }
- >
- <UnifiedResourceTable
- resources={props.resources}
- expandedResourceId={expandedResourceId()}
- onExpandedResourceChange={setExpandedResourceId}
- groupingMode="grouped"
- />
- </Show>
- );
-}
-
export function ProxmoxPageSurface() {
const location = useLocation();
const { resources, loading, error, refetch } = useUnifiedResources({
@@ -181,10 +156,10 @@ export function ProxmoxPageSurface() {
/>
</Show>
<Show when={activeTab() === 'mail'}>
- <ProxmoxInfrastructureTable
+ <ProxmoxMailGatewayTable
resources={model().pmg}
- emptyTitle="No Proxmox Mail Gateway services"
- emptyDescription="PMG rows appear here using the existing service infrastructure table."
+ emptyTitle="No Proxmox Mail Gateway instances"
+ emptyDescription="PMG instances appear here once a Proxmox Mail Gateway connection reports them."
/>
</Show>
</Show>
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index a5977c3441..426869da63 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -582,6 +582,29 @@ export interface ResourceKubernetesMeta {
allocatablePods?: number;
}
+// Proxmox Mail Gateway projection emitted by the canonical adapter for
+// `pmg` resources. Surfaced on the Proxmox platform-page Mail Gateway
+// table where queue posture / spam / virus / quarantine counts are
+// the operator columns, not generic CPU/Memory bars.
+export interface ResourcePMGMeta {
+ instanceId?: string;
+ hostname?: string;
+ version?: string;
+ nodeCount?: number;
+ uptimeSeconds?: number;
+ connectionHealth?: string;
+ mailCountTotal?: number;
+ spamIn?: number;
+ virusIn?: number;
+ quarantine?: number;
+ queueIncoming?: number;
+ queueActive?: number;
+ queueDeferred?: number;
+ queueHold?: number;
+ queueTotal?: number;
+ lastUpdated?: string | number;
+}
+
export interface ResourceVMwareMeta {
connectionId?: string;
connectionName?: string;
@@ -716,6 +739,7 @@ export interface Resource {
agent?: ResourceAgentMeta;
kubernetes?: ResourceKubernetesMeta;
docker?: ResourceDockerMeta;
+ pmg?: ResourcePMGMeta;
vmware?: ResourceVMwareMeta;
proxmox?: ResourceProxmoxMeta;
pbs?: ResourcePBSMeta;
diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.go
index 7d03c3b758..6edd54b8d8 100644
--- a/internal/unifiedresources/adapters.go
+++ b/internal/unifiedresources/adapters.go
@@ -1211,6 +1211,7 @@ func resourceFromPBSInstance(instance models.PBSInstance) (Resource, ResourceIde
LastSeen: instance.LastSeen,
UpdatedAt: time.Now().UTC(),
Metrics: metricsFromPBSInstance(instance),
+ Uptime: instance.Uptime,
CustomURL: instance.GuestURL,
Incidents: incidents,
PBS: &PBSData{
@@ -1322,6 +1323,7 @@ func resourceFromPMGInstance(instance models.PMGInstance) (Resource, ResourceIde
LastSeen: instance.LastSeen,
UpdatedAt: time.Now().UTC(),
Metrics: metricsFromPMGInstance(instance),
+ Uptime: uptime,
CustomURL: instance.GuestURL,
PMG: &PMGData{
InstanceID: instance.ID,