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.

Hide default source health in drawer

rcourtmanb304e5b316d3
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 162838229b..684807510c 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -177,6 +177,9 @@ and `useResourceDetailDrawerDerivedState.ts` now composes those operational
overview derivations through that canonical model owner instead of rebuilding
Kubernetes capability badges, source health, related links, and host-detail
coverage inline,
+and the current-state summary now leaves normal source provenance to the
+canonical header badges while only surfacing a `Sources` row when source
+health is degraded or unhealthy,
`resourceDetailDrawerServiceModel.ts` owns the pure Docker/PBS/PMG service
summary and breakdown derivations that feed the overview service-details
surface,
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.tsx
index 27d02c7a27..1560dde002 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
@@ -106,7 +106,7 @@ const baseResource = (overrides: Partial<Resource>): Resource => ({
});
describe('ResourceDetailDrawer runtime and identity cards', () => {
- it('renders a unified summary shell with current-state source and mode details', () => {
+ it('renders a unified summary shell without repeating healthy source status', () => {
const resource = baseResource({
platformData: {
sources: ['agent', 'proxmox'],
@@ -123,15 +123,14 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(getByText('Summary')).toBeInTheDocument();
expect(getByText('Current state')).toBeInTheDocument();
- expect(getByText('Sources')).toBeInTheDocument();
- expect(getByText('2/2 healthy')).toBeInTheDocument();
+ expect(() => getByText('Sources')).toThrow();
+ expect(queryByRole('link', { name: 'Open related workloads for host-1' })).toBeNull();
expect(getByText('Mode')).toBeInTheDocument();
expect(getByText('Hybrid')).toBeInTheDocument();
expect(() => getByText('Platform ID')).toThrow();
expect(getByTestId('resource-current-state-section').querySelector('.border-dashed')).toBeNull();
expect(queryByRole('button', { name: 'Show details' })).toBeNull();
expect(() => getByText('Runtime')).toThrow();
- expect(queryByRole('link', { name: 'Open related workloads for host-1' })).toBeNull();
const headerBadges = getByTestId('resource-header-badges');
expect(within(headerBadges).getAllByText('Agent')).toHaveLength(1);
expect(within(headerBadges).getByText('PVE')).toBeInTheDocument();
@@ -238,7 +237,7 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(getByText('eth0')).toBeInTheDocument();
});
- it('falls back to source list summary when per-source health is unavailable', () => {
+ it('keeps source provenance in the header when no source health issue is present', () => {
const resource = baseResource({
sourceType: 'api',
platformData: {
@@ -246,12 +245,12 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
},
});
- const { getByText, getAllByText, queryByText } = render(() => (
+ const { getByTestId, getByText, queryByText } = render(() => (
<ResourceDetailDrawer resource={resource} />
));
- expect(getByText('Sources')).toBeInTheDocument();
- expect(getAllByText('PMG').length).toBeGreaterThan(0);
+ expect(queryByText('Sources')).toBeNull();
+ expect(within(getByTestId('resource-header-badges')).getByText('PMG')).toBeInTheDocument();
expect(getByText('Mode')).toBeInTheDocument();
expect(getByText('API')).toBeInTheDocument();
expect(queryByText('Platform ID')).toBeNull();
@@ -259,6 +258,23 @@ describe('ResourceDetailDrawer runtime and identity cards', () => {
expect(queryByText('Show details')).toBeNull();
});
+ it('shows the sources row when canonical source health is degraded', () => {
+ const resource = baseResource({
+ platformData: {
+ sources: ['agent', 'proxmox'],
+ sourceStatus: {
+ agent: { status: 'online', lastSeen: new Date().toISOString() },
+ proxmox: { status: 'degraded', lastSeen: new Date().toISOString() },
+ },
+ },
+ });
+
+ const { getByText } = render(() => <ResourceDetailDrawer resource={resource} />);
+
+ expect(getByText('Sources')).toBeInTheDocument();
+ expect(getByText('1/2 degraded')).toBeInTheDocument();
+ });
+
it('hides the mode row when a resource has no canonical source mode', () => {
const resource = baseResource({
sourceType: null as unknown as Resource['sourceType'],
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
index 91791e0c76..9f0b7a7c1d 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
@@ -71,7 +71,7 @@ describe('resourceDetailDrawerOperationalModel', () => {
]);
});
- it('prefers source health summaries and falls back to merged source counts', () => {
+ it('surfaces only non-healthy source health summaries', () => {
expect(
buildSourceSummary(
['agent', 'docker'],
@@ -86,11 +86,13 @@ describe('resourceDetailDrawerOperationalModel', () => {
title: 'agent:healthy • docker:degraded',
});
- expect(buildSourceSummary(['agent', 'docker'], {})).toEqual({
- label: '2 sources',
- className: 'text-base-content',
- title: 'agent • docker',
- });
+ expect(
+ buildSourceSummary(['agent', 'docker'], {
+ agent: { status: 'healthy' },
+ docker: { status: 'online' },
+ }),
+ ).toBeNull();
+ expect(buildSourceSummary(['agent', 'docker'], {})).toBeNull();
});
it('keeps host detail coverage and runtime context on canonical operational inputs', () => {
diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts
index fe5e0b6139..9fbdd7b5df 100644
--- a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts
+++ b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts
@@ -84,7 +84,6 @@ export const buildSourceHealthSummary = (
const entries = Object.entries(sourceStatus);
if (entries.length === 0) return null;
- let healthy = 0;
let warning = 0;
let unhealthy = 0;
const parts: string[] = [];
@@ -93,7 +92,7 @@ export const buildSourceHealthSummary = (
const normalized = (status?.status || '').trim().toLowerCase();
parts.push(`${source}:${normalized || 'unknown'}`);
if (['online', 'running', 'healthy', 'connected', 'ok'].includes(normalized)) {
- healthy += 1;
+ continue;
} else if (['degraded', 'warning', 'stale'].includes(normalized)) {
warning += 1;
} else {
@@ -116,11 +115,7 @@ export const buildSourceHealthSummary = (
title: parts.join(' • '),
};
}
- return {
- label: `${healthy}/${total} healthy`,
- className: 'text-emerald-600 dark:text-emerald-400',
- title: parts.join(' • '),
- };
+ return null;
};
export const buildSourceSummary = (
@@ -129,12 +124,7 @@ export const buildSourceSummary = (
): ResourceDetailDrawerSummary | null => {
const health = buildSourceHealthSummary(sourceStatus);
if (health) return health;
- if (mergedSources.length === 0) return null;
- return {
- label: mergedSources.length === 1 ? mergedSources[0].toUpperCase() : `${mergedSources.length} sources`,
- className: 'text-base-content',
- title: mergedSources.join(' • '),
- };
+ return null;
};
export const buildHostDetailCards = (options: {