pref(nodeEditor): 应用节点实例增加未运行状态下禁用选择

master
钟良源 3 weeks ago
parent ea8149106d
commit c8685ad7f5

@ -6,6 +6,8 @@ import { IconUnorderedList } from '@arco-design/web-react/icon';
import ParamsTable from '@/components/FlowEditor/nodeEditors/components/ParamsTable'; import ParamsTable from '@/components/FlowEditor/nodeEditors/components/ParamsTable';
import { queryInstance } from '@/api/components'; import { queryInstance } from '@/api/components';
const Option = Select.Option;
const BasicNodeEditor: React.FC<NodeEditorProps> = ({ const BasicNodeEditor: React.FC<NodeEditorProps> = ({
node, node,
nodeData, nodeData,
@ -84,9 +86,12 @@ const BasicNodeEditor: React.FC<NodeEditorProps> = ({
const newOptions = res.data.map((item: any) => { const newOptions = res.data.map((item: any) => {
return { return {
label: item.identifier, label: item.identifier,
value: item.identifier value: item.identifier,
runStatus: item.runStatus,
runType: item.runType
}; };
}); });
console.log('newOptions:', newOptions);
setOptions(newOptions); setOptions(newOptions);
} }
}; };
@ -125,7 +130,7 @@ const BasicNodeEditor: React.FC<NodeEditorProps> = ({
<span></span> <span></span>
<div>{currentCompInfo?.description}</div> <div>{currentCompInfo?.description}</div>
</div> </div>
<Form.Item label="节点类型"> <Form.Item label="运行实例(非运行中的实例无法选择)">
<Select <Select
value={nodeData?.component?.compIdentifier || ''} value={nodeData?.component?.compIdentifier || ''}
onChange={(value) => { onChange={(value) => {
@ -135,8 +140,13 @@ const BasicNodeEditor: React.FC<NodeEditorProps> = ({
compInstanceIdentifier: value compInstanceIdentifier: value
}); });
}} }}
options={options} >
/> {options.map((option, index) => (
<Option key={option.id} value={option.value} disabled={option.runType === 0}>
{option.value}
</Option>
))}
</Select>
</Form.Item> </Form.Item>
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} /></Typography.Title> <Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} /></Typography.Title>
<ParamsTable <ParamsTable

Loading…
Cancel
Save