feat(ui): disable nodes during workflow running

This commit is contained in:
Fu Diwei
2025-01-04 12:58:45 +08:00
parent 52dfa5e8c3
commit 2213399f5e
8 changed files with 38 additions and 26 deletions

View File

@@ -10,9 +10,10 @@ import { useWorkflowStore } from "@/stores/workflow";
export type WorkflowElementsProps = {
className?: string;
style?: React.CSSProperties;
disabled?: boolean;
};
const WorkflowElements = ({ className, style }: WorkflowElementsProps) => {
const WorkflowElements = ({ className, style, disabled }: WorkflowElementsProps) => {
const { workflow } = useWorkflowStore(useZustandShallowSelector(["workflow"]));
const elements = useMemo(() => {
@@ -20,7 +21,7 @@ const WorkflowElements = ({ className, style }: WorkflowElementsProps) => {
let current = workflow.draft as WorkflowNode;
while (current) {
nodes.push(<NodeRender node={current} key={current.id} />);
nodes.push(<NodeRender key={current.id} node={current} disabled={disabled} />);
current = current.next as WorkflowNode;
}