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,
|
agentVersions,
|
||||||
updateInformation: isBE,
|
updateInformation: isBE,
|
||||||
edgeAsync: getEdgeAsyncValue(connectionTypes),
|
edgeAsync: getEdgeAsyncValue(connectionTypes),
|
||||||
|
platformTypes,
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryWithSort = {
|
const queryWithSort = {
|
||||||
|
|
|
@ -209,6 +209,7 @@ function getPlatformTypeOptions(connectionTypes: ConnectionType[]) {
|
||||||
{ value: PlatformType.Docker, label: 'Docker' },
|
{ value: PlatformType.Docker, label: 'Docker' },
|
||||||
{ value: PlatformType.Azure, label: 'Azure' },
|
{ value: PlatformType.Azure, label: 'Azure' },
|
||||||
{ value: PlatformType.Kubernetes, label: 'Kubernetes' },
|
{ value: PlatformType.Kubernetes, label: 'Kubernetes' },
|
||||||
|
{ value: PlatformType.Podman, label: 'Podman' },
|
||||||
];
|
];
|
||||||
|
|
||||||
if (connectionTypes.length === 0) {
|
if (connectionTypes.length === 0) {
|
||||||
|
@ -216,15 +217,25 @@ function getPlatformTypeOptions(connectionTypes: ConnectionType[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const connectionTypePlatformType = {
|
const connectionTypePlatformType = {
|
||||||
[ConnectionType.API]: [PlatformType.Docker, PlatformType.Azure],
|
[ConnectionType.API]: [
|
||||||
[ConnectionType.Agent]: [PlatformType.Docker, PlatformType.Kubernetes],
|
PlatformType.Docker,
|
||||||
|
PlatformType.Azure,
|
||||||
|
PlatformType.Podman,
|
||||||
|
],
|
||||||
|
[ConnectionType.Agent]: [
|
||||||
|
PlatformType.Docker,
|
||||||
|
PlatformType.Kubernetes,
|
||||||
|
PlatformType.Podman,
|
||||||
|
],
|
||||||
[ConnectionType.EdgeAgentStandard]: [
|
[ConnectionType.EdgeAgentStandard]: [
|
||||||
PlatformType.Kubernetes,
|
PlatformType.Kubernetes,
|
||||||
PlatformType.Docker,
|
PlatformType.Docker,
|
||||||
|
PlatformType.Podman,
|
||||||
],
|
],
|
||||||
[ConnectionType.EdgeAgentAsync]: [
|
[ConnectionType.EdgeAgentAsync]: [
|
||||||
PlatformType.Docker,
|
PlatformType.Docker,
|
||||||
PlatformType.Kubernetes,
|
PlatformType.Kubernetes,
|
||||||
|
PlatformType.Podman,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
EnvironmentSecuritySettings,
|
EnvironmentSecuritySettings,
|
||||||
EnvironmentStatus,
|
EnvironmentStatus,
|
||||||
EnvironmentGroupId,
|
EnvironmentGroupId,
|
||||||
|
PlatformType,
|
||||||
} from '@/react/portainer/environments/types';
|
} from '@/react/portainer/environments/types';
|
||||||
import { type TagId } from '@/portainer/tags/types';
|
import { type TagId } from '@/portainer/tags/types';
|
||||||
import { UserId } from '@/portainer/users/types';
|
import { UserId } from '@/portainer/users/types';
|
||||||
|
@ -45,6 +46,7 @@ export interface BaseEnvironmentsQueryParams {
|
||||||
agentVersions?: string[];
|
agentVersions?: string[];
|
||||||
updateInformation?: boolean;
|
updateInformation?: boolean;
|
||||||
edgeCheckInPassedSeconds?: number;
|
edgeCheckInPassedSeconds?: number;
|
||||||
|
platformTypes?: PlatformType[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EnvironmentsQueryParams = BaseEnvironmentsQueryParams &
|
export type EnvironmentsQueryParams = BaseEnvironmentsQueryParams &
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
|
||||||
import { withError } from '@/react-tools/react-query';
|
import { withError } from '@/react-tools/react-query';
|
||||||
|
import {
|
||||||
|
PlatformType,
|
||||||
|
EnvironmentStatus,
|
||||||
|
} from '@/react/portainer/environments/types';
|
||||||
|
|
||||||
import { EnvironmentStatus } from '../types';
|
|
||||||
import {
|
import {
|
||||||
EnvironmentsQueryParams,
|
EnvironmentsQueryParams,
|
||||||
getEnvironments,
|
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 {
|
return {
|
||||||
isLoading,
|
isLoading,
|
||||||
environments: data ? data.value : [],
|
environments: data ? data.value : [],
|
||||||
|
|
Loading…
Reference in New Issue