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 workload type filtering

rcourtmanb92615e44a4f
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index fe3e3dd17d..bc6fa43f41 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -1644,7 +1644,10 @@ Workload type option labels are part of that filter-config model ownership:
instead of embedding its own `System containers` / `App containers` wording in
the shell, with platform-first presentation allowed to narrow or relabel that
catalog only when the owning platform scope makes the broader v6 options
-inapplicable (for example Proxmox rendering the container option as `LXCs`).
+inapplicable. Proxmox narrowing must resolve the forced platform through the
+canonical `sourcePlatformScopeMatchesFilter` helper against `proxmox-pve`, so
+both the PVE scope and the `proxmox-all` aggregate expose only `All`, `VMs`, and
+`LXCs`; the global `Pods` option must not leak into that platform-owned surface.
The Type and Status filters must remain one-click inline `FilterBar` controls
because they are the high-frequency workload narrowing path; dynamic scope
filters such as node, platform, namespace, and runtime stay menu-backed.
diff --git a/frontend-modern/src/components/Workloads/WorkloadsFilter.tsx b/frontend-modern/src/components/Workloads/WorkloadsFilter.tsx
index 3b9af6a23d..7a9b4980a8 100644
--- a/frontend-modern/src/components/Workloads/WorkloadsFilter.tsx
+++ b/frontend-modern/src/components/Workloads/WorkloadsFilter.tsx
@@ -18,6 +18,10 @@ import {
import { GroupedTableModeSegmentedControl } from '@/components/shared/GroupedTableModeSegmentedControl';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { STORAGE_KEYS } from '@/utils/localStorage';
+import {
+ normalizeSourcePlatformQueryValue,
+ sourcePlatformScopeMatchesFilter,
+} from '@/utils/sourcePlatforms';
import { isContainerWorkloadViewMode } from '@/utils/workloads';
import type { ViewMode } from '@/types/workloads';
import { MetricDisplayModeSegmentedControl } from './MetricDisplayModeSegmentedControl';
@@ -35,16 +39,20 @@ import {
} from './workloadsFilterModel';
import { WORKLOAD_STATUS_FILTER_OPTIONS, WORKLOAD_TYPE_OPTIONS } from './workloadFilterConfigModel';
-const PROXMOX_PLATFORM_FILTER = 'proxmox-pve';
-
export const WorkloadsFilter: Component<WorkloadsFilterProps> = (props) => {
const { isMobile } = useBreakpoint();
const typeValue = () =>
isContainerWorkloadViewMode(props.viewMode()) ? 'container' : props.viewMode();
- const isProxmoxScope = () =>
- (props.forcedPlatform ?? '').trim().toLowerCase() === PROXMOX_PLATFORM_FILTER;
+ const isProxmoxScope = () => {
+ const forcedPlatform = normalizeSourcePlatformQueryValue(props.forcedPlatform);
+ return (
+ forcedPlatform !== '' &&
+ forcedPlatform !== 'all' &&
+ sourcePlatformScopeMatchesFilter('proxmox-pve', forcedPlatform)
+ );
+ };
const workloadTypeOptions = (): FilterSelectOption[] =>
(isProxmoxScope()
diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsFilter.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsFilter.test.tsx
index c0efd92fd5..aeb3b41b0d 100644
--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsFilter.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsFilter.test.tsx
@@ -197,6 +197,32 @@ describe('WorkloadsFilter', () => {
pickInlineFilter('Type', 'VMs');
expect(setViewMode).toHaveBeenCalledWith('vm');
});
+
+ it.each(['proxmox-pve', 'proxmox-all', 'proxmox'])(
+ 'limits the %s platform scope to Proxmox workload types',
+ (forcedPlatform) => {
+ render(() => <WorkloadsFilter {...makeProps({ forcedPlatform })} />);
+
+ const typeFilter = within(inlineFilterGroup('Type'));
+ expect(typeFilter.getByRole('button', { name: 'All' })).toBeInTheDocument();
+ expect(typeFilter.getByRole('button', { name: 'VMs' })).toBeInTheDocument();
+ expect(typeFilter.getByRole('button', { name: 'LXCs' })).toBeInTheDocument();
+ expect(typeFilter.queryByRole('button', { name: 'Containers' })).not.toBeInTheDocument();
+ expect(typeFilter.queryByRole('button', { name: 'Pods' })).not.toBeInTheDocument();
+ },
+ );
+
+ it.each([undefined, '', 'all', 'kubernetes'])(
+ 'keeps global workload types for the %s platform scope',
+ (forcedPlatform) => {
+ render(() => <WorkloadsFilter {...makeProps({ forcedPlatform })} />);
+
+ const typeFilter = within(inlineFilterGroup('Type'));
+ expect(typeFilter.getByRole('button', { name: 'Containers' })).toBeInTheDocument();
+ expect(typeFilter.getByRole('button', { name: 'Pods' })).toBeInTheDocument();
+ expect(typeFilter.queryByRole('button', { name: 'LXCs' })).not.toBeInTheDocument();
+ },
+ );
});
describe('status filter', () => {