mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
fix(edge/stacks): show correct status for env [EE-3374] (#7466)
This commit is contained in:
parent
a247db7e93
commit
29f0daa7ea
8 changed files with 39 additions and 21 deletions
|
@ -3,7 +3,8 @@ import { useSref } from '@uirouter/react';
|
|||
|
||||
import type { DockerContainer } from '@/react/docker/containers/types';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
import { useCurrentEnvironment } from '@/portainer/hooks/useCurrentEnvironment';
|
||||
|
||||
import { useRowContext } from '../RowContext';
|
||||
|
||||
export const image: Column<DockerContainer> = {
|
||||
Header: 'Image',
|
||||
|
@ -24,11 +25,9 @@ function ImageCell({ value: imageName }: Props) {
|
|||
const linkProps = useSref('docker.images.image', { id: imageName });
|
||||
const shortImageName = trimSHASum(imageName);
|
||||
|
||||
const environmentQuery = useCurrentEnvironment();
|
||||
const { environment } = useRowContext();
|
||||
|
||||
const environment = environmentQuery.data;
|
||||
|
||||
if (!environment || isOfflineEndpoint(environment)) {
|
||||
if (isOfflineEndpoint(environment)) {
|
||||
return <span>{shortImageName}</span>;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ import { useSref } from '@uirouter/react';
|
|||
|
||||
import type { DockerContainer } from '@/react/docker/containers/types';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
import { useCurrentEnvironment } from '@/portainer/hooks/useCurrentEnvironment';
|
||||
|
||||
import { useTableSettings } from '@@/datatables/useZustandTableSettings';
|
||||
|
||||
import { TableSettings } from '../types';
|
||||
import { useRowContext } from '../RowContext';
|
||||
|
||||
export const name: Column<DockerContainer> = {
|
||||
Header: 'Name',
|
||||
|
@ -35,16 +35,15 @@ export function NameCell({
|
|||
|
||||
const { settings } = useTableSettings<TableSettings>();
|
||||
const truncate = settings.truncateContainerName;
|
||||
const environmentQuery = useCurrentEnvironment();
|
||||
|
||||
const environment = environmentQuery.data;
|
||||
const { environment } = useRowContext();
|
||||
|
||||
let shortName = name;
|
||||
if (truncate > 0) {
|
||||
shortName = _.truncate(name, { length: truncate });
|
||||
}
|
||||
|
||||
if (!environment || isOfflineEndpoint(environment)) {
|
||||
if (isOfflineEndpoint(environment)) {
|
||||
return <span>{shortName}</span>;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ import { Column } from 'react-table';
|
|||
import _ from 'lodash';
|
||||
|
||||
import type { DockerContainer, Port } from '@/react/docker/containers/types';
|
||||
import { useCurrentEnvironment } from '@/portainer/hooks/useCurrentEnvironment';
|
||||
|
||||
import { useRowContext } from '../RowContext';
|
||||
|
||||
export const ports: Column<DockerContainer> = {
|
||||
Header: 'Published Ports',
|
||||
|
@ -20,10 +21,9 @@ interface Props {
|
|||
}
|
||||
|
||||
function PortsCell({ value: ports }: Props) {
|
||||
const environmentQuery = useCurrentEnvironment();
|
||||
const { environment } = useRowContext();
|
||||
|
||||
const environment = environmentQuery.data;
|
||||
if (!environment || ports.length === 0) {
|
||||
if (ports.length === 0) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue