import clsx from 'clsx'; import { DockerContainerStatus } from '@/react/docker/containers/types'; import { Authorized } from '@/portainer/hooks/useUser'; import { Icon } from '@/react/components/Icon'; import { react2angular } from '@/react-tools/react2angular'; import { Link } from '@@/Link'; import styles from './ContainerQuickActions.module.css'; interface QuickActionsState { showQuickActionAttach: boolean; showQuickActionExec: boolean; showQuickActionInspect: boolean; showQuickActionLogs: boolean; showQuickActionStats: boolean; } interface Props { taskId?: string; containerId?: string; nodeName: string; state: QuickActionsState; status: DockerContainerStatus; } export function ContainerQuickActions({ taskId, containerId, nodeName, state, status, }: Props) { if (taskId) { return ; } const isActive = ['starting', 'running', 'healthy', 'unhealthy'].includes( status ); return (
{state.showQuickActionLogs && ( )} {state.showQuickActionInspect && ( )} {state.showQuickActionStats && isActive && ( )} {state.showQuickActionExec && isActive && ( )} {state.showQuickActionAttach && isActive && ( )}
); } interface TaskProps { taskId: string; state: QuickActionsState; } function TaskQuickActions({ taskId, state }: TaskProps) { return (
{state.showQuickActionLogs && ( )} {state.showQuickActionInspect && ( )}
); } export const ContainerQuickActionsAngular = react2angular( ContainerQuickActions, ['taskId', 'containerId', 'nodeName', 'state', 'status'] );