mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 02:43:49 +08:00
chore: should hide change action when node is undeletable (#34592)
This commit is contained in:
parent
66183c1f0a
commit
1b7d0bd4e6
@ -222,6 +222,33 @@ describe('panel-operator details', () => {
|
|||||||
expect(screen.getByRole('link', { name: 'workflow.panel.helpLink' })).toHaveAttribute('href', 'https://docs.example.com/node')
|
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', () => {
|
it('should render workflow-tool and readonly popup variants', () => {
|
||||||
mockUseAllWorkflowTools.mockReturnValueOnce({
|
mockUseAllWorkflowTools.mockReturnValueOnce({
|
||||||
data: [{ id: 'workflow-tool', workflow_app_id: 'app-123' }],
|
data: [{ id: 'workflow-tool', workflow_app_id: 'app-123' }],
|
||||||
|
|||||||
@ -47,7 +47,7 @@ const PanelOperatorPopup = ({
|
|||||||
const { nodesReadOnly } = useNodesReadOnly()
|
const { nodesReadOnly } = useNodesReadOnly()
|
||||||
const edge = edges.find(edge => edge.target === id)
|
const edge = edges.find(edge => edge.target === id)
|
||||||
const nodeMetaData = useNodeMetaData({ id, data } as Node)
|
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 isChildNode = !!(data.isInIteration || data.isInLoop)
|
||||||
|
|
||||||
const { data: workflowTools } = useAllWorkflowTools()
|
const { data: workflowTools } = useAllWorkflowTools()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user