2022-08-11 04:33:29 +00:00
|
|
|
import { useInfo } from '@/docker/services/system.service';
|
2022-10-23 06:53:25 +00:00
|
|
|
import { Environment } from '@/react/portainer/environments/types';
|
|
|
|
import { isAgentEnvironment } from '@/react/portainer/environments/utils';
|
2022-08-11 04:33:29 +00:00
|
|
|
|
|
|
|
import { PageHeader } from '@@/PageHeader';
|
|
|
|
|
|
|
|
import { ContainersDatatable } from './ContainersDatatable';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
endpoint: Environment;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function ListView({ endpoint: environment }: Props) {
|
|
|
|
const isAgent = isAgentEnvironment(environment.Type);
|
|
|
|
|
|
|
|
const envInfoQuery = useInfo(environment.Id, (info) => !!info.Swarm?.NodeID);
|
|
|
|
|
|
|
|
const isSwarmManager = !!envInfoQuery.data;
|
|
|
|
const isHostColumnVisible = isAgent && isSwarmManager;
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<PageHeader
|
|
|
|
title="Container list"
|
|
|
|
breadcrumbs={[{ label: 'Containers' }]}
|
|
|
|
reload
|
|
|
|
/>
|
|
|
|
|
2022-08-17 09:49:29 +00:00
|
|
|
<ContainersDatatable
|
|
|
|
isHostColumnVisible={isHostColumnVisible}
|
|
|
|
environment={environment}
|
|
|
|
/>
|
2022-08-11 04:33:29 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|