SkyeYoung commented on code in PR #3008:
URL: https://github.com/apache/apisix-dashboard/pull/3008#discussion_r2068106481


##########
src/components/form-slice/FormPartBasic.tsx:
##########
@@ -5,25 +5,32 @@ import { FormItemTextInput } from '../form/TextInput';
 import { FormItemTextarea } from '../form/Textarea';
 import { useFormContext } from 'react-hook-form';
 import type { APISIXType } from '@/types/schema/apisix';
+import { useNamePrefix } from '@/utils/useNamePrefix';
+import type { PropsWithChildren } from 'react';
 
-export type FormPartBasicProps = Omit<FormSectionProps, 'form'>;
+export type FormPartBasicProps = Omit<FormSectionProps, 'form'> &
+  PropsWithChildren;
 
 export const FormPartBasic = (props: FormPartBasicProps) => {
+  const { children, ...restProps } = props;
   const { control } = useFormContext<APISIXType['Basic']>();
   const { t } = useTranslation();
+  const np = useNamePrefix();
+
   return (
-    <FormSection legend={t('form.basic.title')} {...props}>
+    <FormSection legend={t('form.basic.title')} {...restProps}>
       <FormItemTextInput
-        name="name"
+        name={np('name')}
         label={t('form.basic.name')}
         control={control}
       />
       <FormItemTextarea
-        name="desc"
+        name={np('desc')}
         label={t('form.basic.desc')}
         control={control}
       />
-      <FormItemLabels name="labels" control={control} />
+      <FormItemLabels name={np('labels')} control={control} />

Review Comment:
   enter should be able to work 🤔 



##########
src/components/form-slice/FormPartRoute/index.tsx:
##########
@@ -0,0 +1,161 @@
+import { useFormContext } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+import { FormItemNumberInput } from '@/components/form/NumberInput';
+import { FormItemSwitch } from '@/components/form/Switch';
+import { FormItemTagsInput } from '@/components/form/TagInput';
+import { FormItemTextarea } from '@/components/form/Textarea';
+import { FormItemTextInput } from '@/components/form/TextInput';
+import { NamePrefixProvider } from '@/utils/useNamePrefix';
+import { FormItemPlugins } from '../FormItemPlugins';
+import { FormPartBasic } from '../FormPartBasic';
+import { FormPartUpstream, FormSectionTimeout } from '../FormPartUpstream';
+import { FormSection } from '../FormSection';
+import { Divider, InputWrapper } from '@mantine/core';
+import type { RoutePostType } from './schema';
+import { FormItemSelect } from '@/components/form/Select';
+import { APISIX } from '@/types/schema/apisix';
+
+const FormPartBasicWithPriority = () => {
+  const { t } = useTranslation();
+  const { control } = useFormContext<RoutePostType>();
+  return (
+    <FormPartBasic>
+      <FormItemNumberInput
+        control={control}
+        name="priority"
+        label={t('form.route.priority')}

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to