Skip to content

Commit

Permalink
perf: http
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Feb 27, 2024
1 parent 351a3c4 commit 2de74f9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 0 additions & 2 deletions packages/global/core/module/template/system/http468.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export const HttpModule468: FlowModuleTemplateType = {
...Input_Template_AddInputParam,
editField: {
key: true,
name: true,
description: true,
required: true,
dataType: true
Expand All @@ -106,7 +105,6 @@ export const HttpModule468: FlowModuleTemplateType = {
...Output_Template_AddOutput,
editField: {
key: true,
name: true,
description: true,
dataType: true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,47 +93,38 @@ const FieldEditModal = ({
const { register, getValues, setValue, handleSubmit, watch } = useForm<EditNodeFieldType>({
defaultValues: defaultField
});
const inputType = watch('inputType');
const outputType = watch('outputType');
const valueType = watch('valueType');
const [refresh, setRefresh] = useState(false);

const showDataTypeSelect = useMemo(() => {
if (!editField.dataType) return false;
const inputType = getValues('inputType');
const outputType = getValues('outputType');

if (inputType === FlowNodeInputTypeEnum.target) return true;

if (outputType === FlowNodeOutputTypeEnum.source) return true;

return false;
}, [editField.dataType, getValues, refresh]);
}, [editField.dataType, inputType, outputType]);

const showRequired = useMemo(() => {
const inputType = getValues('inputType');
const valueType = getValues('valueType');
if (inputType === FlowNodeInputTypeEnum.addInputParam) return false;

return editField.required;
}, [editField.required, getValues, refresh]);
}, [editField.required, inputType]);

const showNameInput = useMemo(() => {
const inputType = getValues('inputType');

return editField.name;
}, [editField.name, getValues, refresh]);
}, [editField.name]);

const showKeyInput = useMemo(() => {
const inputType = getValues('inputType');
const valueType = getValues('valueType');
if (inputType === FlowNodeInputTypeEnum.addInputParam) return false;

return editField.key;
}, [editField.key, getValues, refresh]);
}, [editField.key, inputType]);

const showDescriptionInput = useMemo(() => {
const inputType = getValues('inputType');

return editField.description;
}, [editField.description, getValues, refresh]);
}, [editField.description]);

return (
<MyModal
Expand Down Expand Up @@ -209,7 +200,18 @@ const FieldEditModal = ({
{showKeyInput && (
<Flex mb={5} alignItems={'center'}>
<Box flex={'0 0 70px'}>{t('core.module.Field key')}</Box>
<Input placeholder="appointment/sql" {...register('key', { required: true })} />
<Input
placeholder="appointment/sql"
{...register('key', {
required: true,
onChange: (e) => {
const value = e.target.value;
if (!showNameInput) {
setValue('label', value);
}
}
})}
/>
</Flex>
)}
{showDescriptionInput && (
Expand Down

0 comments on commit 2de74f9

Please sign in to comment.