diff --git a/src/apps/console/components/menu-select.tsx b/src/apps/console/components/menu-select.tsx index 0804b8a3b..6b552756e 100644 --- a/src/apps/console/components/menu-select.tsx +++ b/src/apps/console/components/menu-select.tsx @@ -11,13 +11,10 @@ interface ISelectItem { active?: boolean; } -const SelectItem = React.forwardRef( +export const SelectItem = React.forwardRef( ({ children, className, ...props }, forwardedRef) => { return ( { - console.log(e); - }} className={cn( 'group relative flex flex-row gap-xl items-center bodyMd gap cursor-pointer select-none py-lg px-xl text-text-default outline-none transition-colors focus:bg-surface-basic-hovered hover:bg-surface-basic-hovered data-[disabled]:pointer-events-none data-[disabled]:text-text-disabled data-[state=checked]:bg-surface-basic-active', className @@ -37,6 +34,7 @@ interface IMenuSelect { items: { label: ReactNode; value: string; + render?: () => ReactNode; }[]; onChange?: (value: string) => void; onClick?: (value: string) => void; @@ -83,15 +81,13 @@ const MenuSelect = ({ > {items.map((item) => (
onClick?.(item.value)}> - -
{ - console.log('clicked'); - }} - > - {item.label} -
-
+ {item.render ? ( + item.render() + ) : ( + +
{item.label}
+
+ )}
))} diff --git a/src/apps/console/routes/_a+/onboarding+/$a+/new-cloud-provider.tsx b/src/apps/console/routes/_a+/onboarding+/$a+/new-cloud-provider.tsx index b840c5cd4..2ed12a137 100644 --- a/src/apps/console/routes/_a+/onboarding+/$a+/new-cloud-provider.tsx +++ b/src/apps/console/routes/_a+/onboarding+/$a+/new-cloud-provider.tsx @@ -10,8 +10,8 @@ import { handleError } from '~/root/lib/utils/common'; import { useState } from 'react'; import { useConsoleApi } from '~/console/server/gql/api-provider'; import { validateCloudProvider } from '~/console/server/r-utils/common'; -import { IdSelector } from '~/console/components/id-selector'; import ProgressWrapper from '~/console/components/progress-wrapper'; +import { NameIdView } from '~/console/components/name-id-view'; const NewCloudProvider = () => { const { a: accountName } = useParams(); @@ -27,6 +27,7 @@ const NewCloudProvider = () => { name: '', provider: providers[0], awsAccountId: '', + isNameError: false, }, validationSchema: Yup.object({ displayName: Yup.string().required(), @@ -35,6 +36,7 @@ const NewCloudProvider = () => { label: Yup.string().required(), value: Yup.string().required(), }).required(), + awsAccountId: Yup.string().required('AccountId is required.'), }), onSubmit: async (val) => { const addProvider = async () => { @@ -95,24 +97,16 @@ const NewCloudProvider = () => { the internet.
- - { - handleChange('name')({ target: { value: id } }); - }} - className="pt-xl" + displayName={values.displayName} + name={values.name} + label="Name" + placeholder="Enter provider name" + errors={errors.name} + handleChange={handleChange} /> -