You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/components/TeamsSelector/TeamsSelector.tsx

42 lines
852 B

import { Team, TeamId } from '@/react/portainer/users/teams/types';
import { PortainerSelect } from '@@/form-components/PortainerSelect';
interface Props {
name?: string;
value: TeamId[] | readonly TeamId[];
onChange(value: readonly TeamId[]): void;
teams: Team[];
dataCy?: string;
inputId?: string;
placeholder?: string;
disabled?: boolean;
}
export function TeamsSelector({
name,
value,
onChange,
teams,
dataCy,
inputId,
placeholder,
disabled,
}: Props) {
const options = teams.map((team) => ({ label: team.Name, value: team.Id }));
return (
<PortainerSelect<number>
name={name}
isMulti
options={options}
value={value}
onChange={(value) => onChange(value)}
data-cy={dataCy}
inputId={inputId}
placeholder={placeholder}
disabled={disabled}
/>
);
}