feat(web): 节点描述和名称直接放在节点数据中
This commit is contained in:
@@ -42,7 +42,7 @@ export function inputsFormColumns(
|
||||
data: any,
|
||||
): Schema[] {
|
||||
let inputSchemaVariables: InputFormOptions[] = Object.keys(inputSchema).map(key => ({
|
||||
label: inputSchema[key]?.label ?? '',
|
||||
label: `${key} (${inputSchema[key]?.label ?? ''})`,
|
||||
value: key,
|
||||
}))
|
||||
|
||||
@@ -50,10 +50,14 @@ export function inputsFormColumns(
|
||||
let incomerVariables: InputFormOptionsGroup[] = []
|
||||
for (const incomerId of incomerIds) {
|
||||
let nodeData = data[incomerId] ?? {}
|
||||
let group = incomerId
|
||||
if (has(nodeData, 'node') && has(nodeData.node, 'name')) {
|
||||
group = `${nodeData.node.name} ${incomerId}`
|
||||
}
|
||||
if (has(nodeData, 'outputs')) {
|
||||
let outputs = nodeData?.outputs ?? []
|
||||
incomerVariables.push({
|
||||
group: incomerId,
|
||||
group: group,
|
||||
variables: Object.keys(outputs).map(key => ({
|
||||
value: `${incomerId}.${key}`,
|
||||
label: key,
|
||||
@@ -151,8 +155,6 @@ export function outputsFormColumns(editable: boolean = false, required: boolean
|
||||
|
||||
type AmisNodeProps = {
|
||||
nodeProps: NodeProps
|
||||
defaultNodeName: String
|
||||
defaultNodeDescription?: String
|
||||
extraNodeDescription?: JSX.Element
|
||||
handler: JSX.Element
|
||||
columnSchema?: () => Schema[]
|
||||
@@ -187,8 +189,6 @@ export const NormalNodeHandler = () => {
|
||||
|
||||
const AmisNode: (props: AmisNodeProps) => JSX.Element = ({
|
||||
nodeProps,
|
||||
defaultNodeName,
|
||||
defaultNodeDescription,
|
||||
extraNodeDescription,
|
||||
handler,
|
||||
columnSchema,
|
||||
@@ -198,8 +198,8 @@ const AmisNode: (props: AmisNodeProps) => JSX.Element = ({
|
||||
const {id} = nodeProps
|
||||
// @ts-ignore
|
||||
const nodeData = getDataById(id)
|
||||
const nodeName = isEmpty(nodeData?.node?.name) ? defaultNodeName : nodeData.node.name
|
||||
const nodeDescription = isEmpty(nodeData?.node?.description) ? defaultNodeDescription : nodeData.node?.description
|
||||
const nodeName = nodeData?.node?.name ?? ''
|
||||
const nodeDescription = nodeData?.node?.description ?? ''
|
||||
|
||||
const [editDrawerOpen, setEditDrawerOpen] = useState(false)
|
||||
const [editDrawerForm, setEditDrawerForm] = useState<JSX.Element>(<></>)
|
||||
|
||||
Reference in New Issue
Block a user