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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Render resource context as detail tables
rcourtman29439fe14bde
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsxindex 9756213f47..38b4513262 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx@@ -18,17 +18,13 @@ import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';import { getAllFilterOptionLabel } from '@/components/shared/filterOptionPresentation';import { getServiceHealthPresentation } from '@/utils/serviceHealthPresentation';-import {- getResourceRoutingScopeLabel,- getResourceSensitivityLabel,-} from '@/utils/resourcePolicyPresentation';import { ResourceCorrelationSummary } from './ResourceCorrelationSummary';-import { ResourceChangeSummary } from './ResourceChangeSummary';import { ResourceFacetSummary } from './ResourceFacetSummary';import { ResourceActionHistory } from './ResourceActionHistory';import { ResourceOperatorStateSection } from './ResourceOperatorStateSection';import { MaintenanceVerificationSection } from './MaintenanceVerificationSection';import { InlineResourceSummaryTables, ResourceSummaryCards } from './ResourceDetailSummary';+import { ResourceInvestigationContextTables } from './ResourceInvestigationContextTables';import {RESOURCE_CHANGE_KIND_ORDER,RESOURCE_CHANGE_SOURCE_ADAPTER_ORDER,@@ -41,10 +37,6 @@ import { formatConfidenceLabel } from '@/utils/confidencePresentation';import { formatIdentifierLabel } from '@/utils/textPresentation';import { shouldShowResourcePlatformId } from '@/utils/resourceIdentity';import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';-import {- RESOURCE_ANALYSIS_LABEL,- RESOURCE_SAFE_SUMMARY_LABEL,-} from '@/utils/resourceAnalysisPresentation';import { formatInteger } from './resourceDetailMappers';import { buildPbsJobHealthEvidenceModel } from './resourceDetailDrawerServiceModel';import { ResourceDetailDrawerSupportDisclosure as SupportDisclosure } from './ResourceDetailDrawerSupportDisclosure';@@ -634,93 +626,7 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOvercontentClass="mt-3 space-y-3"dataTestId="resource-investigation-context">- <Show when={drawer.resourceIntelligence()}>- {(intel) => (- <div class="space-y-1.5 text-[11px]">- <div class="flex items-center justify-between gap-2">- <span class="text-muted uppercase tracking-wide">- {RESOURCE_ANALYSIS_LABEL}- </span>- </div>- <div class="flex items-center justify-between gap-2">- <span class="text-muted">Health</span>- <span class="font-semibold text-base-content">- {intel().health.grade} · {Math.round(intel().health.score)}/100- </span>- </div>- <div class="flex items-center justify-between gap-2">- <span class="text-muted">Trend</span>- <span class="font-semibold capitalize text-base-content">- {intel().health.trend}- </span>- </div>- <div class="flex items-center justify-between gap-2">- <span class="text-muted">Notes</span>- <span class="font-semibold text-base-content">{intel().note_count}</span>- </div>- <ResourceChangeSummary- class="space-y-0"- title="Latest canonical change"- changes={intel().recent_changes}- resolveResourceLabel={drawer.resolveResourceLabel}- maxChanges={1}- compact- />- </div>- )}- </Show>-- <Show when={drawer.hasGovernanceData()}>- <div class="space-y-1.5 text-[11px]">- <div class="flex items-center justify-between gap-2">- <span class="text-muted uppercase tracking-wide">Governance</span>- </div>- <Show when={resource.policy}>- <div class="flex items-center justify-between gap-2">- <span class="text-muted">Sensitivity</span>- <span class="font-semibold text-base-content">- {getResourceSensitivityLabel(resource.policy?.sensitivity)}- </span>- </div>- <div class="flex items-center justify-between gap-2">- <span class="text-muted">Routing</span>- <span class="font-semibold text-base-content">- {getResourceRoutingScopeLabel(resource.policy?.routing.scope)}- </span>- </div>- </Show>- <Show when={drawer.policyRedactions().length > 0 || drawer.governanceSummary()}>- <div class="flex items-center justify-between gap-2">- <span class="text-muted">Redactions</span>- <span class="font-semibold text-base-content">- {drawer.policyRedactions().length}- </span>- </div>- </Show>- <Show when={drawer.policyRedactions().length > 0}>- <div class="flex flex-col gap-1">- <span class="text-muted">Redaction labels</span>- <div class="flex flex-wrap gap-1">- <For each={drawer.policyRedactions()}>- {(label) => (- <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">- {label}- </span>- )}- </For>- </div>- </div>- </Show>- <Show when={drawer.governanceSummary()}>- <div class="flex flex-col gap-1">- <span class="text-muted">{RESOURCE_SAFE_SUMMARY_LABEL}</span>- <div class="rounded border border-border bg-surface-hover px-2 py-1.5 text-[10px] text-base-content">- {drawer.governanceSummary()}- </div>- </div>- </Show>- </div>- </Show>+ <ResourceInvestigationContextTables resource={resource} drawer={drawer} /></SupportDisclosure></Show>diff --git a/frontend-modern/src/components/Infrastructure/ResourceInvestigationContextTables.tsx b/frontend-modern/src/components/Infrastructure/ResourceInvestigationContextTables.tsxnew file mode 100644index 0000000000..d5e9ef7e75--- /dev/null+++ b/frontend-modern/src/components/Infrastructure/ResourceInvestigationContextTables.tsx@@ -0,0 +1,135 @@+import { For, Show } from 'solid-js';+import type { Component } from 'solid-js';+import type { Resource } from '@/types/resource';+import {+ getResourceRoutingScopeLabel,+ getResourceSensitivityLabel,+} from '@/utils/resourcePolicyPresentation';+import {+ RESOURCE_ANALYSIS_LABEL,+ RESOURCE_SAFE_SUMMARY_LABEL,+} from '@/utils/resourceAnalysisPresentation';+import { ResourceChangeSummary } from './ResourceChangeSummary';+import type { UseResourceDetailDrawerStateResult } from './useResourceDetailDrawerState';++interface ResourceInvestigationContextTablesProps {+ resource: Resource;+ drawer: UseResourceDetailDrawerStateResult;+}++export const ResourceInvestigationContextTables: Component<+ ResourceInvestigationContextTablesProps+> = (props) => (+ <div class="overflow-hidden rounded border border-border bg-surface">+ <table class="w-full table-fixed text-[11px]">+ <Show when={props.drawer.resourceIntelligence()}>+ {(intel) => (+ <tbody class="divide-y divide-border">+ <tr class="bg-surface-alt">+ <th+ colspan="2"+ class="px-2 py-1 text-left text-[10px] font-semibold uppercase tracking-wide text-muted"+ >+ {RESOURCE_ANALYSIS_LABEL}+ </th>+ </tr>+ <tr>+ <td class="w-[38%] px-2 py-1 text-muted">Health</td>+ <td class="px-2 py-1 text-right font-semibold text-base-content">+ {intel().health.grade} · {Math.round(intel().health.score)}/100+ </td>+ </tr>+ <tr>+ <td class="px-2 py-1 text-muted">Trend</td>+ <td class="px-2 py-1 text-right font-semibold capitalize text-base-content">+ {intel().health.trend}+ </td>+ </tr>+ <tr>+ <td class="px-2 py-1 text-muted">Notes</td>+ <td class="px-2 py-1 text-right font-semibold text-base-content">+ {intel().note_count}+ </td>+ </tr>+ <tr>+ <td colspan="2" class="px-2 py-2">+ <ResourceChangeSummary+ class="space-y-0"+ title="Latest canonical change"+ changes={intel().recent_changes}+ resolveResourceLabel={props.drawer.resolveResourceLabel}+ maxChanges={1}+ compact+ />+ </td>+ </tr>+ </tbody>+ )}+ </Show>++ <Show when={props.drawer.hasGovernanceData()}>+ <tbody class="divide-y divide-border border-t border-border">+ <tr class="bg-surface-alt">+ <th+ colspan="2"+ class="px-2 py-1 text-left text-[10px] font-semibold uppercase tracking-wide text-muted"+ >+ Governance+ </th>+ </tr>+ <Show when={props.resource.policy}>+ <tr>+ <td class="w-[38%] px-2 py-1 text-muted">Sensitivity</td>+ <td class="px-2 py-1 text-right font-semibold text-base-content">+ {getResourceSensitivityLabel(props.resource.policy?.sensitivity)}+ </td>+ </tr>+ <tr>+ <td class="px-2 py-1 text-muted">Routing</td>+ <td class="px-2 py-1 text-right font-semibold text-base-content">+ {getResourceRoutingScopeLabel(props.resource.policy?.routing.scope)}+ </td>+ </tr>+ </Show>+ <Show+ when={props.drawer.policyRedactions().length > 0 || props.drawer.governanceSummary()}+ >+ <tr>+ <td class="px-2 py-1 text-muted">Redactions</td>+ <td class="px-2 py-1 text-right font-semibold text-base-content">+ {props.drawer.policyRedactions().length}+ </td>+ </tr>+ </Show>+ <Show when={props.drawer.policyRedactions().length > 0}>+ <tr>+ <td class="px-2 py-1 align-top text-muted">Redaction labels</td>+ <td class="px-2 py-1">+ <div class="flex flex-wrap justify-end gap-1">+ <For each={props.drawer.policyRedactions()}>+ {(label) => (+ <span class="inline-flex items-center rounded bg-surface-alt px-1.5 py-0.5 text-[10px]">+ {label}+ </span>+ )}+ </For>+ </div>+ </td>+ </tr>+ </Show>+ <Show when={props.drawer.governanceSummary()}>+ <tr>+ <td class="px-2 py-1 align-top text-muted">{RESOURCE_SAFE_SUMMARY_LABEL}</td>+ <td+ class="px-2 py-1 text-left font-medium text-base-content"+ title={props.drawer.governanceSummary() ?? undefined}+ >+ <span class="block truncate">{props.drawer.governanceSummary()}</span>+ </td>+ </tr>+ </Show>+ </tbody>+ </Show>+ </table>+ </div>+);diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsxindex b2f2032c2c..f6a67f41db 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx@@ -7,6 +7,7 @@ import discoveryTabStateSource from '@/components/Discovery/useDiscoveryTabStateimport resourceDetailDrawerShellSource from '@/components/Infrastructure/ResourceDetailDrawer.tsx?raw';import resourceDetailDrawerOverviewSource from '@/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx?raw';import resourceDetailSummarySource from '@/components/Infrastructure/ResourceDetailSummary.tsx?raw';+import resourceInvestigationContextSource from '@/components/Infrastructure/ResourceInvestigationContextTables.tsx?raw';import resourceActionHistorySource from '@/components/Infrastructure/ResourceActionHistory.tsx?raw';import resourceDetailDrawerHistoryStateSource from '@/components/Infrastructure/useResourceDetailDrawerHistoryState.ts?raw';import createNonSuspendingQuerySource from '@/hooks/createNonSuspendingQuery.ts?raw';@@ -151,7 +152,12 @@ describe('ResourceDetailDrawer change history section', () => {expect(discoveryTabSource).not.toContain('triggerDiscovery(');expect(discoveryTabSource).not.toContain('updateDiscoveryNotes(');expect(resourceDetailDrawerOverviewSource).toContain("from './ResourceDetailSummary'");+ expect(resourceDetailDrawerOverviewSource).toContain(+ "from './ResourceInvestigationContextTables'",+ );expect(resourceDetailSummarySource).toContain("from '@/components/shared/TagBadges'");+ expect(resourceInvestigationContextSource).toContain('<table');+ expect(resourceInvestigationContextSource).toContain('RESOURCE_SAFE_SUMMARY_LABEL');expect(resourceDetailDrawerOverviewSource).toContain('getAllFilterOptionLabel');expect(resourceDetailDrawerOverviewSource).not.toContain("'All kinds'");expect(resourceDetailDrawerOverviewSource).not.toContain("'All sources'");@@ -588,11 +594,12 @@ describe('ResourceDetailDrawer change history section', () => {expect(screen.getByRole('button', { name: 'Open analysis' })).toBeInTheDocument();fireEvent.click(screen.getByRole('button', { name: 'Show context' }));- await within(screen.getByTestId('resource-investigation-context')).findByText('Analysis');+ const contextSection = screen.getByTestId('resource-investigation-context');+ await within(contextSection).findByText('Analysis');+ expect(contextSection.querySelector('table')).toBeTruthy();+ expect(contextSection.querySelector('tbody')).toBeTruthy();expect(- screen- .getByTestId('resource-investigation-context')- .querySelectorAll('.rounded.border.border-border.bg-surface.p-3').length,+ contextSection.querySelectorAll('.rounded.border.border-border.bg-surface.p-3').length,).toBe(0);expect(screen.getByText('Health')).toBeInTheDocument();expect(screen.getByText('A · 92/100')).toBeInTheDocument();diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsxindex 79d6277104..3ae179ca69 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx@@ -128,7 +128,9 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {expect(() => getByText('Mode')).toThrow();expect(() => getByText('Hybrid')).toThrow();expect(() => getByText('Platform ID')).toThrow();- expect(getByTestId('resource-current-state-section').querySelector('.border-dashed')).toBeNull();+ expect(+ getByTestId('resource-current-state-section').querySelector('.border-dashed'),+ ).toBeNull();expect(queryByRole('button', { name: 'Show details' })).toBeNull();expect(() => getByText('Runtime')).toThrow();expect(container.querySelector('.text-\\[11px\\].text-muted.truncate')).toBeNull();@@ -211,12 +213,8 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {it('uses terse availability notices for specialized tabs', () => {expect(getSpecializedTabAvailabilityMessage('mail')).toBe('PMG resources only.');expect(getSpecializedTabAvailabilityMessage('namespaces')).toBe('Kubernetes clusters only.');- expect(getSpecializedTabAvailabilityMessage('deployments')).toBe(- 'Kubernetes clusters only.',- );- expect(getSpecializedTabAvailabilityMessage('swarm')).toBe(- 'Docker runtimes with Swarm only.',- );+ expect(getSpecializedTabAvailabilityMessage('deployments')).toBe('Kubernetes clusters only.');+ expect(getSpecializedTabAvailabilityMessage('swarm')).toBe('Docker runtimes with Swarm only.');});it('keeps host detail cards behind a secondary overview disclosure', async () => {@@ -268,23 +266,20 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {expect(getByText('Hardware')).toBeInTheDocument();});expect(getByTestId('resource-secondary-sections').classList.contains('space-y-3')).toBe(true);- expect(- getByTestId('resource-support-sections').classList.contains('flex'),- ).toBe(true);- expect(- getByTestId('resource-support-sections').classList.contains('flex-wrap'),- ).toBe(true);+ expect(getByTestId('resource-support-sections').classList.contains('flex')).toBe(true);+ expect(getByTestId('resource-support-sections').classList.contains('flex-wrap')).toBe(true);expect(Array.from(getByTestId('resource-support-sections').children).map((node) =>node.getAttribute('data-testid'),),- ).toEqual([- 'resource-access-section',- 'resource-host-details-section',- ]);- expect(getByTestId('resource-host-details-section').querySelector('.mt-3.flex.flex-wrap')).toBeTruthy();+ ).toEqual(['resource-access-section', 'resource-host-details-section']);+ expect(+ getByTestId('resource-host-details-section').querySelector('.mt-3.flex.flex-wrap'),+ ).toBeTruthy();expect(- getByTestId('resource-host-details-section').querySelector('.mt-3.flex.flex-wrap')?.classList.contains('[&>*]:min-w-[220px]'),+ getByTestId('resource-host-details-section')+ .querySelector('.mt-3.flex.flex-wrap')+ ?.classList.contains('[&>*]:min-w-[220px]'),).toBe(true);expect(getByText('Network')).toBeInTheDocument();expect(getByText('Disks')).toBeInTheDocument();@@ -349,7 +344,9 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {));expect(getByTestId('resource-vmware-details-section')).toBeInTheDocument();- expect(getByText('Lab VC · Read-only vCenter context · 2 snapshots · 1 alarm · 1 task')).toBeInTheDocument();+ expect(+ getByText('Lab VC · Read-only vCenter context · 2 snapshots · 1 alarm · 1 task'),+ ).toBeInTheDocument();expect(queryByText('Compute Cluster')).toBeNull();expect(queryByText('Create snapshot (success)')).toBeNull();@@ -381,9 +378,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {},});- const { getByTestId, queryByText } = render(() => (- <ResourceDetailDrawer resource={resource} />- ));+ const { getByTestId, queryByText } = render(() => <ResourceDetailDrawer resource={resource} />);expect(queryByText('Sources')).toBeNull();expect(within(getByTestId('resource-header-badges')).getByText('PMG')).toBeInTheDocument();@@ -666,6 +661,9 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {within(getByTestId('resource-investigation-context')).getByText('Analysis'),).toBeInTheDocument();});+ const contextSection = getByTestId('resource-investigation-context');+ expect(contextSection.querySelector('table')).toBeTruthy();+ expect(contextSection.querySelector('tbody')).toBeTruthy();expect(getByText('Health')).toBeInTheDocument();expect(getByText('A · 92/100')).toBeInTheDocument();expect(getByText('Trend')).toBeInTheDocument();