Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

chore: should hide change action when node is undeletable (#34592)

非法操作1b7d0bd4e67d
diff --git a/web/app/components/workflow/nodes/_base/components/panel-operator/__tests__/details.spec.tsx b/web/app/components/workflow/nodes/_base/components/panel-operator/__tests__/details.spec.tsx
index 3e02aba077d..eeb6e489009 100644
--- a/web/app/components/workflow/nodes/_base/components/panel-operator/__tests__/details.spec.tsx
+++ b/web/app/components/workflow/nodes/_base/components/panel-operator/__tests__/details.spec.tsx
@@ -222,6 +222,33 @@ describe('panel-operator details', () => {
expect(screen.getByRole('link', { name: 'workflow.panel.helpLink' })).toHaveAttribute('href', 'https://docs.example.com/node')
})
+ it('should hide change action when node is undeletable', () => {
+ mockUseNodeMetaData.mockReturnValueOnce({
+ isTypeFixed: false,
+ isSingleton: true,
+ isUndeletable: true,
+ description: 'Undeletable node',
+ author: 'Dify',
+ } as ReturnType<typeof useNodeMetaData>)
+
+ renderWorkflowFlowComponent(
+ <PanelOperatorPopup
+ id="node-4"
+ data={{ type: BlockEnum.Code, title: 'Undeletable node', desc: '' } as any}
+ onClosePopup={vi.fn()}
+ showHelpLink={false}
+ />,
+ {
+ nodes: [],
+ edges: [],
+ },
+ )
+
+ expect(screen.getByText('workflow.panel.runThisStep')).toBeInTheDocument()
+ expect(screen.queryByText('workflow.panel.change')).not.toBeInTheDocument()
+ expect(screen.queryByText('common.operation.delete')).not.toBeInTheDocument()
+ })
+
it('should render workflow-tool and readonly popup variants', () => {
mockUseAllWorkflowTools.mockReturnValueOnce({
data: [{ id: 'workflow-tool', workflow_app_id: 'app-123' }],
diff --git a/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx b/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx
index b460aa651c0..a93c3e1d14e 100644
--- a/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx
+++ b/web/app/components/workflow/nodes/_base/components/panel-operator/panel-operator-popup.tsx
@@ -47,7 +47,7 @@ const PanelOperatorPopup = ({
const { nodesReadOnly } = useNodesReadOnly()
const edge = edges.find(edge => edge.target === id)
const nodeMetaData = useNodeMetaData({ id, data } as Node)
- const showChangeBlock = !nodeMetaData.isTypeFixed && !nodesReadOnly
+ const showChangeBlock = !nodeMetaData.isTypeFixed && !nodeMetaData.isUndeletable && !nodesReadOnly
const isChildNode = !!(data.isInIteration || data.isInLoop)
const { data: workflowTools } = useAllWorkflowTools()