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.

Fix Proxmox page workloads hidden by the proxmox-all platform filter

rcourtmana90d5c907a4a
diff --git a/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts b/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts
index 9fcc67c768..abe784cc6b 100644
--- a/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts
+++ b/frontend-modern/src/components/Workloads/__tests__/workloadSelectors.test.ts
@@ -56,6 +56,34 @@ describe('workloadSelectors', () => {
expect(result).toBe(guests);
});
+ it('keeps Proxmox guests visible under the proxmox-all aggregate platform filter', () => {
+ const pveGuest = makeGuest(1, {
+ type: 'vm',
+ workloadType: 'vm' as any,
+ platformType: 'proxmox-pve',
+ platformScopes: ['proxmox-pve'],
+ });
+ const dockerGuest = makeGuest(2, {
+ type: 'app-container',
+ workloadType: 'app-container' as any,
+ platformType: 'docker',
+ platformScopes: ['docker'],
+ });
+
+ const result = filterWorkloads({
+ guests: [pveGuest, dockerGuest],
+ viewMode: 'all',
+ statusMode: 'all',
+ searchTerm: '',
+ selectedNode: null,
+ selectedHostHint: null,
+ selectedKubernetesContext: null,
+ selectedPlatform: 'proxmox-all',
+ });
+
+ expect(result).toEqual([pveGuest]);
+ });
+
it('filters by view mode and status mode semantics', () => {
const guests = [
makeGuest(1, { status: 'running', type: 'vm', workloadType: 'vm' }),
diff --git a/frontend-modern/src/utils/__tests__/sourcePlatforms.test.ts b/frontend-modern/src/utils/__tests__/sourcePlatforms.test.ts
index d63e3d01d1..74ec7d8083 100644
--- a/frontend-modern/src/utils/__tests__/sourcePlatforms.test.ts
+++ b/frontend-modern/src/utils/__tests__/sourcePlatforms.test.ts
@@ -9,6 +9,7 @@ import {
resolvePlatformTypeFromSources,
resolveResourcePlatformType,
resolveSourceTypeFromSources,
+ sourcePlatformScopeMatchesFilter,
} from '@/utils/sourcePlatforms';
import {
ADMITTED_PLATFORM_IDS,
@@ -265,4 +266,24 @@ describe('sourcePlatforms', () => {
expect(resolveSourceTypeFromSources(['custom-source'])).toBe('api');
});
});
+
+ describe('sourcePlatformScopeMatchesFilter', () => {
+ it('matches concrete scopes exactly', () => {
+ expect(sourcePlatformScopeMatchesFilter('proxmox-pve', 'proxmox-pve')).toBe(true);
+ expect(sourcePlatformScopeMatchesFilter('docker', 'proxmox-pve')).toBe(false);
+ });
+
+ it('treats an empty or all filter as match-everything', () => {
+ expect(sourcePlatformScopeMatchesFilter('docker', null)).toBe(true);
+ expect(sourcePlatformScopeMatchesFilter('docker', 'all')).toBe(true);
+ });
+
+ it('resolves the proxmox-all aggregate across the Proxmox family only', () => {
+ expect(sourcePlatformScopeMatchesFilter('proxmox-pve', 'proxmox-all')).toBe(true);
+ expect(sourcePlatformScopeMatchesFilter('proxmox-pbs', 'proxmox-all')).toBe(true);
+ expect(sourcePlatformScopeMatchesFilter('proxmox-pmg', 'proxmox-all')).toBe(true);
+ expect(sourcePlatformScopeMatchesFilter('docker', 'proxmox-all')).toBe(false);
+ expect(sourcePlatformScopeMatchesFilter('', 'proxmox-all')).toBe(false);
+ });
+ });
});
diff --git a/frontend-modern/src/utils/sourcePlatforms.ts b/frontend-modern/src/utils/sourcePlatforms.ts
index 5f966ad9c2..52db27a306 100644
--- a/frontend-modern/src/utils/sourcePlatforms.ts
+++ b/frontend-modern/src/utils/sourcePlatforms.ts
@@ -97,6 +97,21 @@ export const normalizeSourcePlatformQueryValue = (value: string | null | undefin
return normalizeSourcePlatformKey(normalized) || normalized;
};
+// `proxmox-all` is a filter-only aggregate covering every Proxmox-family
+// scope (proxmox-pve, proxmox-pbs, proxmox-pmg). It never appears as a
+// resource scope itself, so any matcher comparing filter keys against scope
+// keys must resolve it here rather than by equality.
+export const sourcePlatformScopeMatchesFilter = (
+ scopeKey: string | null | undefined,
+ filterKey: string | null | undefined,
+): boolean => {
+ const scope = normalizeSourcePlatformQueryValue(scopeKey);
+ const filter = normalizeSourcePlatformQueryValue(filterKey);
+ if (!filter || filter === 'all') return true;
+ if (filter === 'proxmox-all') return scope.startsWith('proxmox-');
+ return scope === filter;
+};
+
export const normalizeSourcePlatformScopes = (
values?: readonly (string | null | undefined)[] | null,
fallbackPlatform?: string | null | undefined,
diff --git a/frontend-modern/src/utils/storageSources.ts b/frontend-modern/src/utils/storageSources.ts
index e4295eb562..43f109360b 100644
--- a/frontend-modern/src/utils/storageSources.ts
+++ b/frontend-modern/src/utils/storageSources.ts
@@ -1,6 +1,10 @@
import type { Storage } from '@/types/api';
import { getAllFilterOptionLabel } from '@/components/shared/filterOptionPresentation';
-import { getSourcePlatformLabel, normalizeSourcePlatformKey } from '@/utils/sourcePlatforms';
+import {
+ getSourcePlatformLabel,
+ normalizeSourcePlatformKey,
+ sourcePlatformScopeMatchesFilter,
+} from '@/utils/sourcePlatforms';
import { titleCaseDelimitedLabel } from '@/utils/textPresentation';
export type StorageSourceTone = 'slate' | 'orange' | 'indigo' | 'rose' | 'teal' | 'cyan' | 'blue';
@@ -80,9 +84,7 @@ export const storageSourceMatchesFilter = (
): boolean => {
const sourceKey = normalizeStorageSourceKey(source);
const filterKey = normalizeStorageSourceKey(filter);
- if (!filterKey || filterKey === 'all') return true;
- if (filterKey === 'proxmox-all') return sourceKey.startsWith('proxmox-');
- return sourceKey === filterKey;
+ return sourcePlatformScopeMatchesFilter(sourceKey, filterKey);
};
export const resolveStorageSourceKey = (storage: Storage): string => {
diff --git a/frontend-modern/src/utils/workloads.ts b/frontend-modern/src/utils/workloads.ts
index 806c8d0e0b..3a5ed63320 100644
--- a/frontend-modern/src/utils/workloads.ts
+++ b/frontend-modern/src/utils/workloads.ts
@@ -11,6 +11,7 @@ import { canonicalizeFrontendResourceType } from '@/utils/resourceTypeCompat';
import { canonicalDiscoveryResourceType } from '@/utils/discoveryTarget';
import {
normalizeSourcePlatformQueryValue,
+ sourcePlatformScopeMatchesFilter,
normalizeSourcePlatformScopes,
} from '@/utils/sourcePlatforms';
@@ -102,7 +103,9 @@ export const workloadMatchesPlatformScope = (
): boolean => {
const normalizedScope = normalizeSourcePlatformQueryValue(platformScope);
if (!normalizedScope || normalizedScope === 'all') return true;
- return getWorkloadPlatformScopes(guest).includes(normalizedScope);
+ return getWorkloadPlatformScopes(guest).some((scope) =>
+ sourcePlatformScopeMatchesFilter(scope, normalizedScope),
+ );
};
export const resolveWorkloadType = (