1
This commit is contained in:
parent
7045d6ccf7
commit
8cdf4ff318
@ -124,32 +124,6 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const renderFormItems = () => {
|
||||
if (!nodeDefinition?.graphConfig.configSchema) {
|
||||
console.log('NodeConfigModal - No configSchema found');
|
||||
return null;
|
||||
}
|
||||
|
||||
const {configSchema} = nodeDefinition.graphConfig;
|
||||
console.log('NodeConfigModal - Rendering form items with schema:', configSchema);
|
||||
|
||||
const formItems: ReactNode[] = [];
|
||||
|
||||
// 根据 configSchema 生成表单项
|
||||
if (configSchema.properties) {
|
||||
Object.entries(configSchema.properties).forEach(([key, property]) => {
|
||||
console.log('NodeConfigModal - Rendering field:', key, property);
|
||||
const isRequired = configSchema.required?.includes(key) || false;
|
||||
const formItem = renderFormItem(key, property, isRequired);
|
||||
if (formItem) {
|
||||
formItems.push(formItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return formItems;
|
||||
};
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
title={`编辑节点 - ${nodeDefinition?.nodeName || ''}`}
|
||||
@ -167,25 +141,25 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
}
|
||||
>
|
||||
<Form form={form} layout="vertical">
|
||||
<Tabs>
|
||||
{nodeDefinition?.panelVariablesSchema && (
|
||||
<Tabs.TabPane tab="面板变量" key="panel">
|
||||
{Object.entries(nodeDefinition.panelVariablesSchema.properties).map(([key, property]) => {
|
||||
<Tabs items={[
|
||||
nodeDefinition?.panelVariablesSchema && {
|
||||
key: 'panel',
|
||||
label: '面板变量',
|
||||
children: Object.entries(nodeDefinition.panelVariablesSchema.properties).map(([key, property]) => {
|
||||
const required = nodeDefinition.panelVariablesSchema?.properties.required?.includes(key) || false;
|
||||
return renderFormItem(key, property as SchemaProperty, required, false);
|
||||
})}
|
||||
</Tabs.TabPane>
|
||||
)}
|
||||
{nodeDefinition?.localVariablesSchema && (
|
||||
<Tabs.TabPane tab="环境变量" key="local">
|
||||
{Object.entries(nodeDefinition.localVariablesSchema.properties).map(([key, property]) => {
|
||||
})
|
||||
},
|
||||
nodeDefinition?.localVariablesSchema && {
|
||||
key: 'local',
|
||||
label: '环境变量',
|
||||
children: Object.entries(nodeDefinition.localVariablesSchema.properties).map(([key, property]) => {
|
||||
console.log('NodeConfigModal - Local Schema Property:', key, property);
|
||||
const required = nodeDefinition.localVariablesSchema?.properties.required?.includes(key) || false;
|
||||
return renderFormItem(key, property as SchemaProperty, required, true);
|
||||
})}
|
||||
</Tabs.TabPane>
|
||||
)}
|
||||
</Tabs>
|
||||
})
|
||||
}
|
||||
].filter(Boolean)} />
|
||||
</Form>
|
||||
</Drawer>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user