From 877dc1e2368ef5e3048da43f064c15c297f6f8a8 Mon Sep 17 00:00:00 2001 From: Ali <83188384+testA113@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:57:29 +0100 Subject: [PATCH] fix(namespace): update no registries text [EE-2226] (#10501) Co-authored-by: testa113 --- app/kubernetes/react/components/index.ts | 7 ++- .../RegistriesSelector.tsx | 48 ++++++++++++++----- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/app/kubernetes/react/components/index.ts b/app/kubernetes/react/components/index.ts index 37934f126..2d8befbc7 100644 --- a/app/kubernetes/react/components/index.ts +++ b/app/kubernetes/react/components/index.ts @@ -76,7 +76,12 @@ export const ngModule = angular ) .component( 'createNamespaceRegistriesSelector', - r2a(RegistriesSelector, ['inputId', 'onChange', 'options', 'value']) + r2a(withUIRouter(withReactQuery(withCurrentUser(RegistriesSelector))), [ + 'inputId', + 'onChange', + 'options', + 'value', + ]) ) .component( 'kubeNodesDatatable', diff --git a/app/react/kubernetes/namespaces/components/RegistriesFormSection/RegistriesSelector.tsx b/app/react/kubernetes/namespaces/components/RegistriesFormSection/RegistriesSelector.tsx index 5e6c5697f..e06c26b83 100644 --- a/app/react/kubernetes/namespaces/components/RegistriesFormSection/RegistriesSelector.tsx +++ b/app/react/kubernetes/namespaces/components/RegistriesFormSection/RegistriesSelector.tsx @@ -1,8 +1,10 @@ import { MultiValue } from 'react-select'; import { Registry } from '@/react/portainer/registries/types'; +import { useCurrentUser } from '@/react/hooks/useUser'; import { Select } from '@@/form-components/ReactSelect'; +import { Link } from '@@/Link'; interface Props { value: MultiValue; @@ -17,18 +19,40 @@ export function RegistriesSelector({ options, inputId, }: Props) { + const { isAdmin } = useCurrentUser(); + return ( - 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" + /> + ); }