增加工具栏提示。
This commit is contained in:
parent
7e5ffa605e
commit
18150eaa9b
@ -32,15 +32,17 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (visible && node && nodeDefinition) {
|
||||
// 获取节点当前的配置
|
||||
const currentConfig = {
|
||||
code: node.getProp('code'),
|
||||
name: node.attr('label/text'),
|
||||
description: node.getProp('description'),
|
||||
...node.getProp('config'),
|
||||
};
|
||||
// 添加日志
|
||||
console.log('NodeConfigModal - nodeDefinition:', nodeDefinition);
|
||||
console.log('NodeConfigModal - configSchema:', nodeDefinition.graphConfig.configSchema);
|
||||
|
||||
form.setFieldsValue(currentConfig);
|
||||
// 获取节点配置
|
||||
const config = node.getProp('config');
|
||||
console.log('NodeConfigModal - node config:', config);
|
||||
|
||||
// 设置表单值
|
||||
form.setFieldsValue(config || {});
|
||||
console.log('NodeConfigModal - form values after set:', form.getFieldsValue());
|
||||
}
|
||||
}, [visible, node, nodeDefinition, form]);
|
||||
|
||||
@ -120,14 +122,20 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
};
|
||||
|
||||
const renderFormItems = () => {
|
||||
if (!nodeDefinition?.graphConfig.configSchema) return null;
|
||||
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 = [];
|
||||
|
||||
// 根据 configSchema 生成表单项
|
||||
if (configSchema.properties) {
|
||||
Object.entries(configSchema.properties).forEach(([key, property]: [string, SchemaProperty]) => {
|
||||
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) {
|
||||
|
||||
@ -94,6 +94,13 @@ const WorkflowDesign: React.FC = () => {
|
||||
// 从节点定义列表中找到对应的定义
|
||||
const definition = nodeDefinitions.find(def => def.type === nodeType);
|
||||
if (definition) {
|
||||
console.log('Opening node config:', {
|
||||
type: nodeType,
|
||||
definition: definition,
|
||||
nodeData: node.getData(),
|
||||
nodeProps: node.getProp(),
|
||||
config: node.getProp('config')
|
||||
});
|
||||
setSelectedNode(node);
|
||||
setSelectedNodeDefinition(definition);
|
||||
setConfigModalVisible(true);
|
||||
@ -125,7 +132,10 @@ const WorkflowDesign: React.FC = () => {
|
||||
|
||||
// 创建节点
|
||||
response.graph.nodes.forEach((nodeData: any) => {
|
||||
console.log('Creating node with data:', nodeData); // 添加日志
|
||||
const node = addNodeToGraph(graphInstance, nodeData);
|
||||
// 保存节点配置
|
||||
node.setProp('config', nodeData.config);
|
||||
nodeMap.set(nodeData.id, node);
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user