import { useMemo, useState } from 'react';
import YAML from 'yaml';
import { Minus, Plus } from 'lucide-react';
import { FeatureId } from '@/react/portainer/feature-flags/enums';
import { AutomationTestingProps } from '@/types';
import { WebEditorForm } from '@@/WebEditorForm';
import { Button } from '@@/buttons';
import { BETeaserButton } from '@@/BETeaserButton';
import { Alert } from '@@/Alert';
import { Loading } from '@@/Widget/Loading';
type Props = {
identifier: string;
data: string;
hideMessage?: boolean;
isLoading?: boolean;
isError?: boolean;
} & AutomationTestingProps;
export function YAMLInspector({
identifier,
data,
hideMessage,
'data-cy': dataCy,
isLoading,
isError,
}: Props) {
const [expanded, setExpanded] = useState(false);
const yaml = useMemo(() => cleanYamlUnwantedFields(data), [data]);
if (isLoading) {
return