import { useMemo } from 'react';
import { useIsEdgeAdmin } from '@/react/hooks/useUser';
import { Link } from '@@/Link';
import { TextTip } from '@@/Tip/TextTip';
import { Tooltip } from '@@/Tip/Tooltip';
import { AutocompleteSelect } from '@@/form-components/AutocompleteSelect';
type Props = {
stackName: string;
setStackName: (name: string) => void;
stacks?: string[];
inputClassName?: string;
textTip?: string;
};
export function StackName({
stackName,
setStackName,
stacks = [],
inputClassName,
textTip = "Enter or select a 'stack' name to group multiple deployments together, or else leave empty to ignore.",
}: Props) {
const isAdminQuery = useIsEdgeAdmin();
const stackResults = useMemo(
() => stacks.filter((stack) => stack.includes(stackName ?? '')),
[stacks, stackName]
);
const { isAdmin } = isAdminQuery;
const tooltip = (
<>
You may specify a stack name to label resources that you want to group.
This includes Deployments, DaemonSets, StatefulSets and Pods.
{isAdmin && (
<>
You can leave the stack name empty, or even turn off Kubernetes Stacks
functionality entirely via{' '}
Kubernetes Settings
.
>
)}
>
);
return (
<>