mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
refactor(docker/containers): migrate networks table to react [EE-4665] (#10069)
This commit is contained in:
parent
776f6a62c3
commit
b15812a74d
28 changed files with 632 additions and 259 deletions
36
app/react/docker/queries/utils/container.ts
Normal file
36
app/react/docker/queries/utils/container.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue