fix(namespace): update no registries text [EE-2226] (#10501)

Co-authored-by: testa113 <testa113>
pull/10445/head
Ali 2023-10-18 22:57:29 +01:00 committed by GitHub
parent 56f3bd8417
commit 877dc1e236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 13 deletions

View File

@ -76,7 +76,12 @@ export const ngModule = angular
) )
.component( .component(
'createNamespaceRegistriesSelector', 'createNamespaceRegistriesSelector',
r2a(RegistriesSelector, ['inputId', 'onChange', 'options', 'value']) r2a(withUIRouter(withReactQuery(withCurrentUser(RegistriesSelector))), [
'inputId',
'onChange',
'options',
'value',
])
) )
.component( .component(
'kubeNodesDatatable', 'kubeNodesDatatable',

View File

@ -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,7 +19,28 @@ export function RegistriesSelector({
options, options,
inputId, inputId,
}: Props) { }: Props) {
const { isAdmin } = useCurrentUser();
return ( return (
<>
{options.length === 0 && (
<p className="text-muted text-xs mb-1 mt-2">
{isAdmin ? (
<span>
No registries available. Head over to the{' '}
<Link to="portainer.registries" target="_blank">
registry view
</Link>{' '}
to define a container registry.
</span>
) : (
<span>
No registries available. Contact your administrator to create a
container registry.
</span>
)}
</p>
)}
<Select <Select
isMulti isMulti
getOptionLabel={(option) => option.Name} getOptionLabel={(option) => option.Name}
@ -30,5 +53,6 @@ export function RegistriesSelector({
data-cy="namespaceCreate-registrySelect" data-cy="namespaceCreate-registrySelect"
placeholder="Select one or more registries" placeholder="Select one or more registries"
/> />
</>
); );
} }