|
|
@ -1,8 +1,10 @@
|
|
|
|
import { MultiValue } from 'react-select';
|
|
|
|
import { MultiValue } from 'react-select';
|
|
|
|
|
|
|
|
|
|
|
|
import { Registry } from '@/react/portainer/registries/types';
|
|
|
|
import { Registry } from '@/react/portainer/registries/types';
|
|
|
|
|
|
|
|
import { useCurrentUser } from '@/react/hooks/useUser';
|
|
|
|
|
|
|
|
|
|
|
|
import { Select } from '@@/form-components/ReactSelect';
|
|
|
|
import { Select } from '@@/form-components/ReactSelect';
|
|
|
|
|
|
|
|
import { Link } from '@@/Link';
|
|
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
interface Props {
|
|
|
|
value: MultiValue<Registry>;
|
|
|
|
value: MultiValue<Registry>;
|
|
|
@ -17,18 +19,40 @@ export function RegistriesSelector({
|
|
|
|
options,
|
|
|
|
options,
|
|
|
|
inputId,
|
|
|
|
inputId,
|
|
|
|
}: Props) {
|
|
|
|
}: Props) {
|
|
|
|
|
|
|
|
const { isAdmin } = useCurrentUser();
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Select
|
|
|
|
<>
|
|
|
|
isMulti
|
|
|
|
{options.length === 0 && (
|
|
|
|
getOptionLabel={(option) => option.Name}
|
|
|
|
<p className="text-muted text-xs mb-1 mt-2">
|
|
|
|
getOptionValue={(option) => String(option.Id)}
|
|
|
|
{isAdmin ? (
|
|
|
|
options={options}
|
|
|
|
<span>
|
|
|
|
value={value}
|
|
|
|
No registries available. Head over to the{' '}
|
|
|
|
closeMenuOnSelect={false}
|
|
|
|
<Link to="portainer.registries" target="_blank">
|
|
|
|
onChange={onChange}
|
|
|
|
registry view
|
|
|
|
inputId={inputId}
|
|
|
|
</Link>{' '}
|
|
|
|
data-cy="namespaceCreate-registrySelect"
|
|
|
|
to define a container registry.
|
|
|
|
placeholder="Select one or more registries"
|
|
|
|
</span>
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<span>
|
|
|
|
|
|
|
|
No registries available. Contact your administrator to create a
|
|
|
|
|
|
|
|
container registry.
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
<Select
|
|
|
|
|
|
|
|
isMulti
|
|
|
|
|
|
|
|
getOptionLabel={(option) => option.Name}
|
|
|
|
|
|
|
|
getOptionValue={(option) => String(option.Id)}
|
|
|
|
|
|
|
|
options={options}
|
|
|
|
|
|
|
|
value={value}
|
|
|
|
|
|
|
|
closeMenuOnSelect={false}
|
|
|
|
|
|
|
|
onChange={onChange}
|
|
|
|
|
|
|
|
inputId={inputId}
|
|
|
|
|
|
|
|
data-cy="namespaceCreate-registrySelect"
|
|
|
|
|
|
|
|
placeholder="Select one or more registries"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|