mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
refactor(portainer): remove offline mode [EE-4348] (#7761)
Co-authored-by: deviantony <anthony.lapenna@portainer.io>
This commit is contained in:
parent
61e8e68c31
commit
75f40fe485
39 changed files with 28 additions and 311 deletions
|
@ -2,9 +2,6 @@ import { Column } from 'react-table';
|
|||
import { useSref } from '@uirouter/react';
|
||||
|
||||
import type { DockerContainer } from '@/react/docker/containers/types';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
|
||||
import { useRowContext } from '../RowContext';
|
||||
|
||||
export const image: Column<DockerContainer> = {
|
||||
Header: 'Image',
|
||||
|
@ -25,12 +22,6 @@ function ImageCell({ value: imageName }: Props) {
|
|||
const linkProps = useSref('docker.images.image', { id: imageName });
|
||||
const shortImageName = trimSHASum(imageName);
|
||||
|
||||
const { environment } = useRowContext();
|
||||
|
||||
if (isOfflineEndpoint(environment)) {
|
||||
return <span>{shortImageName}</span>;
|
||||
}
|
||||
|
||||
return (
|
||||
<a href={linkProps.href} onClick={linkProps.onClick}>
|
||||
{shortImageName}
|
||||
|
|
|
@ -3,12 +3,10 @@ import _ from 'lodash';
|
|||
import { useSref } from '@uirouter/react';
|
||||
|
||||
import type { DockerContainer } from '@/react/docker/containers/types';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
|
||||
import { useTableSettings } from '@@/datatables/useZustandTableSettings';
|
||||
|
||||
import { TableSettings } from '../types';
|
||||
import { useRowContext } from '../RowContext';
|
||||
|
||||
export const name: Column<DockerContainer> = {
|
||||
Header: 'Name',
|
||||
|
@ -36,17 +34,11 @@ export function NameCell({
|
|||
const { settings } = useTableSettings<TableSettings>();
|
||||
const truncate = settings.truncateContainerName;
|
||||
|
||||
const { environment } = useRowContext();
|
||||
|
||||
let shortName = name;
|
||||
if (truncate > 0) {
|
||||
shortName = _.truncate(name, { length: truncate });
|
||||
}
|
||||
|
||||
if (isOfflineEndpoint(environment)) {
|
||||
return <span>{shortName}</span>;
|
||||
}
|
||||
|
||||
return (
|
||||
<a href={linkProps.href} onClick={linkProps.onClick} title={name}>
|
||||
{shortName}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { CellProps, Column } from 'react-table';
|
||||
|
||||
import { useAuthorizations } from '@/react/hooks/useUser';
|
||||
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
|
||||
import { useCurrentEnvironment } from '@/react/hooks/useCurrentEnvironment';
|
||||
import { ContainerQuickActions } from '@/react/docker/containers/components/ContainerQuickActions';
|
||||
import { DockerContainer } from '@/react/docker/containers/types';
|
||||
|
||||
|
@ -24,11 +22,6 @@ export const quickActions: Column<DockerContainer> = {
|
|||
function QuickActionsCell({
|
||||
row: { original: container },
|
||||
}: CellProps<DockerContainer>) {
|
||||
const environmentQuery = useCurrentEnvironment();
|
||||
|
||||
const environment = environmentQuery.data;
|
||||
const offlineMode = !environment || isOfflineEndpoint(environment);
|
||||
|
||||
const { settings } = useTableSettings<TableSettings>();
|
||||
|
||||
const { hiddenQuickActions = [] } = settings;
|
||||
|
@ -57,7 +50,7 @@ function QuickActionsCell({
|
|||
'DockerTaskLogs',
|
||||
]);
|
||||
|
||||
if (offlineMode || !someOn || !isAuthorized) {
|
||||
if (!someOn || !isAuthorized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue