mirror of https://github.com/portainer/portainer
fix(podman): missing filter in homepage [BE-11502] (#404)
parent
4bb80d3e3a
commit
b25bf1e341
|
@ -109,6 +109,7 @@ export function EnvironmentList({ onClickBrowse, onRefresh }: Props) {
|
|||
agentVersions,
|
||||
updateInformation: isBE,
|
||||
edgeAsync: getEdgeAsyncValue(connectionTypes),
|
||||
platformTypes,
|
||||
};
|
||||
|
||||
const queryWithSort = {
|
||||
|
|
|
@ -209,6 +209,7 @@ function getPlatformTypeOptions(connectionTypes: ConnectionType[]) {
|
|||
{ value: PlatformType.Docker, label: 'Docker' },
|
||||
{ value: PlatformType.Azure, label: 'Azure' },
|
||||
{ value: PlatformType.Kubernetes, label: 'Kubernetes' },
|
||||
{ value: PlatformType.Podman, label: 'Podman' },
|
||||
];
|
||||
|
||||
if (connectionTypes.length === 0) {
|
||||
|
@ -216,15 +217,25 @@ function getPlatformTypeOptions(connectionTypes: ConnectionType[]) {
|
|||
}
|
||||
|
||||
const connectionTypePlatformType = {
|
||||
[ConnectionType.API]: [PlatformType.Docker, PlatformType.Azure],
|
||||
[ConnectionType.Agent]: [PlatformType.Docker, PlatformType.Kubernetes],
|
||||
[ConnectionType.API]: [
|
||||
PlatformType.Docker,
|
||||
PlatformType.Azure,
|
||||
PlatformType.Podman,
|
||||
],
|
||||
[ConnectionType.Agent]: [
|
||||
PlatformType.Docker,
|
||||
PlatformType.Kubernetes,
|
||||
PlatformType.Podman,
|
||||
],
|
||||
[ConnectionType.EdgeAgentStandard]: [
|
||||
PlatformType.Kubernetes,
|
||||
PlatformType.Docker,
|
||||
PlatformType.Podman,
|
||||
],
|
||||
[ConnectionType.EdgeAgentAsync]: [
|
||||
PlatformType.Docker,
|
||||
PlatformType.Kubernetes,
|
||||
PlatformType.Podman,
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
EnvironmentSecuritySettings,
|
||||
EnvironmentStatus,
|
||||
EnvironmentGroupId,
|
||||
PlatformType,
|
||||
} from '@/react/portainer/environments/types';
|
||||
import { type TagId } from '@/portainer/tags/types';
|
||||
import { UserId } from '@/portainer/users/types';
|
||||
|
@ -45,6 +46,7 @@ export interface BaseEnvironmentsQueryParams {
|
|||
agentVersions?: string[];
|
||||
updateInformation?: boolean;
|
||||
edgeCheckInPassedSeconds?: number;
|
||||
platformTypes?: PlatformType[];
|
||||
}
|
||||
|
||||
export type EnvironmentsQueryParams = BaseEnvironmentsQueryParams &
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
import {
|
||||
PlatformType,
|
||||
EnvironmentStatus,
|
||||
} from '@/react/portainer/environments/types';
|
||||
|
||||
import { EnvironmentStatus } from '../types';
|
||||
import {
|
||||
EnvironmentsQueryParams,
|
||||
getEnvironments,
|
||||
|
@ -98,6 +101,30 @@ export function useEnvironmentList(
|
|||
}
|
||||
);
|
||||
|
||||
if (data?.value && query && query.platformTypes) {
|
||||
const platforms = Array.from(query.platformTypes);
|
||||
|
||||
if (
|
||||
platforms.includes(PlatformType.Podman) !==
|
||||
platforms.includes(PlatformType.Docker)
|
||||
) {
|
||||
const isPodmanSelected = platforms.includes(PlatformType.Podman);
|
||||
const containerEngineToExclude = isPodmanSelected ? 'docker' : 'podman';
|
||||
|
||||
const filteredList = data?.value.filter(
|
||||
(env) => env.ContainerEngine !== containerEngineToExclude
|
||||
);
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
environments: filteredList,
|
||||
totalCount: data ? data.totalCount : 0,
|
||||
totalAvailable: data ? data.totalAvailable : 0,
|
||||
updateAvailable: data ? data.updateAvailable : false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
environments: data ? data.value : [],
|
||||
|
|
Loading…
Reference in New Issue