import { useMemo } from 'react';
import { useCurrentUser } from '@/react/hooks/useUser';
import { InsightsBox } from '@@/InsightsBox';
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;
};
export function StackName({
stackName,
setStackName,
stacks = [],
inputClassName,
}: Props) {
const { isAdmin } = useCurrentUser();
const stackResults = useMemo(
() => stacks.filter((stack) => stack.includes(stackName ?? '')),
[stacks, stackName]
);
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
.
>
)}
>
);
const insightsBoxContent = (
<>
The stack field below was previously labelled 'Name' but, in
fact, it's always been the stack name (hence the relabelling).
{isAdmin && (
<>
Kubernetes Stacks functionality can be turned off entirely via{' '}
Kubernetes Settings
.
>
)}
>
);
return (
<>