1
This commit is contained in:
parent
a6f0fb89a0
commit
7045d6ccf7
@ -55,6 +55,7 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
};
|
||||
|
||||
const renderFormItem = (key: string, property: SchemaProperty, required: boolean, isReadOnly: boolean) => {
|
||||
console.log('NodeConfigModal - renderFormItem:', { key, property, required, isReadOnly, default: property.default });
|
||||
const baseProps = {
|
||||
name: key,
|
||||
label: (
|
||||
@ -68,6 +69,7 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
</Space>
|
||||
),
|
||||
rules: [{required, message: `请输入${property.title}`}],
|
||||
initialValue: property.default // 添加默认值支持
|
||||
};
|
||||
|
||||
if (isReadOnly) {
|
||||
@ -164,24 +166,27 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Tabs>
|
||||
{nodeDefinition?.panelVariablesSchema && (
|
||||
<Tabs.TabPane tab="面板变量" key="panel">
|
||||
{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]) => {
|
||||
const required = nodeDefinition.localVariablesSchema?.properties.required?.includes(key) || false;
|
||||
return renderFormItem(key, property as SchemaProperty, required, true);
|
||||
})}
|
||||
</Tabs.TabPane>
|
||||
)}
|
||||
</Tabs>
|
||||
<Form form={form} layout="vertical">
|
||||
<Tabs>
|
||||
{nodeDefinition?.panelVariablesSchema && (
|
||||
<Tabs.TabPane tab="面板变量" key="panel">
|
||||
{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]) => {
|
||||
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>
|
||||
</Form>
|
||||
</Drawer>
|
||||
);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user