From 2697454a8e5b76ac38f6d7a9196a587fb7124685 Mon Sep 17 00:00:00 2001 From: StyleZhang Date: Wed, 20 Mar 2024 13:49:02 +0800 Subject: [PATCH] fix --- web/app/components/workflow/header/index.tsx | 23 +++--- .../components/workflow/header/publish.tsx | 12 ++- .../workflow/header/run-and-history.tsx | 17 +++-- .../workflow/hooks/use-edges-interactions.ts | 34 +++------ .../workflow/hooks/use-node-data-update.ts | 10 +-- .../workflow/hooks/use-nodes-interactions.ts | 74 +++++++----------- .../workflow/hooks/use-nodes-sync-draft.ts | 11 +-- .../workflow/hooks/use-workflow-run.ts | 75 +++++++++++++++---- .../components/workflow/hooks/use-workflow.ts | 45 ++++++++++- web/app/components/workflow/index.tsx | 24 +++--- .../components/workflow/operator/index.tsx | 15 ++-- .../workflow/operator/zoom-in-out.tsx | 22 ++++-- .../workflow/panel/chat-record/index.tsx | 3 +- .../panel/debug-and-preview/chat-wrapper.tsx | 7 +- web/app/components/workflow/panel/index.tsx | 47 +++++++----- web/app/components/workflow/panel/record.tsx | 7 +- .../components/workflow/panel/run-history.tsx | 16 ++-- .../workflow/panel/workflow-preview.tsx | 67 +++++++++++++++++ web/app/components/workflow/run/index.tsx | 2 +- web/app/components/workflow/run/node.tsx | 2 +- web/app/components/workflow/store.ts | 70 +++++++---------- web/app/components/workflow/types.ts | 32 ++++++++ 22 files changed, 390 insertions(+), 225 deletions(-) create mode 100644 web/app/components/workflow/panel/workflow-preview.tsx diff --git a/web/app/components/workflow/header/index.tsx b/web/app/components/workflow/header/index.tsx index 9bc38f792f..c02717e7d2 100644 --- a/web/app/components/workflow/header/index.tsx +++ b/web/app/components/workflow/header/index.tsx @@ -8,7 +8,10 @@ import { useStore, useWorkflowStore, } from '../store' -import { useWorkflowRun } from '../hooks' +import { + useNodesReadOnly, + useWorkflowRun, +} from '../hooks' import RunAndHistory from './run-and-history' import EditingTitle from './editing-title' import RunningTitle from './running-title' @@ -24,7 +27,10 @@ const Header: FC = () => { const workflowStore = useWorkflowStore() const appDetail = useAppStore(s => s.appDetail) const appSidebarExpand = useAppStore(s => s.appSidebarExpand) - const runningStatus = useStore(s => s.runningStatus) + const { + nodesReadOnly, + getNodesReadOnly, + } = useNodesReadOnly() const isRestoring = useStore(s => s.isRestoring) const { handleRunSetting, @@ -32,11 +38,11 @@ const Header: FC = () => { } = useWorkflowRun() const handleShowFeatures = useCallback(() => { - if (runningStatus) + if (getNodesReadOnly()) return workflowStore.setState({ showFeaturesPanel: true }) - }, [runningStatus, workflowStore]) + }, [getNodesReadOnly, workflowStore]) const handleGoBackToEdit = useCallback(() => { handleRunSetting(true) @@ -65,10 +71,10 @@ const Header: FC = () => { ) } { - !runningStatus && !isRestoring && + !nodesReadOnly && !isRestoring && } { - runningStatus && !isRestoring && + nodesReadOnly && !isRestoring && } { isRestoring && @@ -78,7 +84,7 @@ const Header: FC = () => { !isRestoring && (
{ - runningStatus && ( + nodesReadOnly && (