import { AlertTriangle } from 'lucide-react'; import { EnvironmentId } from '@/react/portainer/environments/types'; import { Stack } from '@/react/common/stacks/types'; import { StackDuplicationForm } from '@/react/common/stacks/ItemView/StackDuplicationForm/StackDuplicationForm'; import { StackRedeployGitForm } from '@/react/portainer/gitops/StackRedeployGitForm/StackRedeployGitForm'; import { useApiVersion } from '@/react/docker/proxy/queries/useVersion'; import { Authorized } from '@/react/hooks/useUser'; import { Icon } from '@@/Icon'; import { FormSection } from '@@/form-components/FormSection'; import { StackActions } from './StackActions'; import { AssociateStackForm } from './AssociateStackForm'; interface StackInfoTabProps { stack?: Stack; // will be loaded only if regular or orphaned stackName: string; stackFileContent?: string; isRegular?: boolean; isExternal: boolean; isOrphaned: boolean; isOrphanedRunning: boolean; environmentId: number; yamlError?: string; } export function StackInfoTab({ stack, stackName, stackFileContent, isRegular, isExternal, isOrphaned, isOrphanedRunning, environmentId, yamlError, }: StackInfoTabProps) { return ( <> {stackName} {stack && ( )} {stack && ( <> {isOrphaned ? ( ) : ( <> {stack.GitConfig && !stack.FromAppTemplate && ( )} {isRegular && ( )} > )} > )} > ); } function ExternalOrphanedWarning({ isExternal, isOrphaned, }: { isExternal: boolean; isOrphaned: boolean; }) { if (!isExternal && !isOrphaned) return null; return ( {isExternal && ( This stack was created outside of Portainer. Control over this stack is limited. )} {isOrphaned && ( This stack is orphaned. You can re-associate it with the current environment using the "Associate to this environment" feature. )} ); } function StackRedeployGitFormWrapper({ stack, environmentId, }: { stack: Stack; environmentId: EnvironmentId; }) { const apiVersion = useApiVersion(environmentId); if (!stack.GitConfig) { return null; } return ( ); }
{isExternal && ( This stack was created outside of Portainer. Control over this stack is limited. )} {isOrphaned && ( This stack is orphaned. You can re-associate it with the current environment using the "Associate to this environment" feature. )}