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.

Hide the copy button when there is no content to copy (#4546)

非法操作ee53f98d8ccb
diff --git a/web/app/components/workflow/panel/workflow-preview.tsx b/web/app/components/workflow/panel/workflow-preview.tsx
index 0f9997f06dd..f0434db46f7 100644
--- a/web/app/components/workflow/panel/workflow-preview.tsx
+++ b/web/app/components/workflow/panel/workflow-preview.tsx
@@ -119,20 +119,21 @@ const WorkflowPreview = () => {
error={workflowRunningData?.result?.error}
onClick={() => switchTab('DETAIL')}
/>
- <SimpleBtn
- isDisabled={workflowRunningData?.result.status !== WorkflowRunningStatus.Succeeded}
- className={cn('ml-4 mb-4 inline-flex space-x-1')}
- onClick={() => {
- const content = workflowRunningData?.resultText
- if (typeof content === 'string')
- copy(content)
- else
- copy(JSON.stringify(content))
- Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') })
- }}>
- <Clipboard className='w-3.5 h-3.5' />
- <div>{t('common.operation.copy')}</div>
- </SimpleBtn>
+ {(workflowRunningData?.result.status !== WorkflowRunningStatus.Succeeded || !workflowRunningData?.resultText) && (
+ <SimpleBtn
+ className={cn('ml-4 mb-4 inline-flex space-x-1')}
+ onClick={() => {
+ const content = workflowRunningData?.resultText
+ if (typeof content === 'string')
+ copy(content)
+ else
+ copy(JSON.stringify(content))
+ Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') })
+ }}>
+ <Clipboard className='w-3.5 h-3.5' />
+ <div>{t('common.operation.copy')}</div>
+ </SimpleBtn>
+ )}
</>
)}
{currentTab === 'DETAIL' && (