You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/docker/queries/utils/container.ts

37 lines
1.1 KiB

import { DockerContainer } from '@/react/docker/containers/types';
import { EdgeStack } from '@/react/edge/edge-stacks/types';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { buildDockerSnapshotUrl, queryKeys as rootQueryKeys } from './root';
export interface ContainersQueryParams {
edgeStackId?: EdgeStack['Id'];
}
export const queryKeys = {
...rootQueryKeys,
containers: (environmentId: EnvironmentId) =>
[...queryKeys.snapshot(environmentId), 'containers'] as const,
containersQuery: (
environmentId: EnvironmentId,
params: ContainersQueryParams
) => [...queryKeys.containers(environmentId), params] as const,
container: (
environmentId: EnvironmentId,
containerId: DockerContainer['Id']
) => [...queryKeys.containers(environmentId), containerId] as const,
};
export function buildDockerSnapshotContainersUrl(
environmentId: EnvironmentId,
containerId?: DockerContainer['Id']
) {
let url = `${buildDockerSnapshotUrl(environmentId)}/containers`;
if (containerId) {
url += `/${containerId}`;
}
return url;
}