From ee53f98d8ccbb81fc506a1e8802b5658d6fdbe54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=9E=E6=B3=95=E6=93=8D=E4=BD=9C?= Date: Wed, 22 May 2024 11:15:13 +0800 Subject: [PATCH] Hide the copy button when there is no content to copy (#4546) --- .../workflow/panel/workflow-preview.tsx | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/web/app/components/workflow/panel/workflow-preview.tsx b/web/app/components/workflow/panel/workflow-preview.tsx index 0f9997f06d..f0434db46f 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')} /> - { - const content = workflowRunningData?.resultText - if (typeof content === 'string') - copy(content) - else - copy(JSON.stringify(content)) - Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') }) - }}> - -
{t('common.operation.copy')}
-
+ {(workflowRunningData?.result.status !== WorkflowRunningStatus.Succeeded || !workflowRunningData?.resultText) && ( + { + const content = workflowRunningData?.resultText + if (typeof content === 'string') + copy(content) + else + copy(JSON.stringify(content)) + Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') }) + }}> + +
{t('common.operation.copy')}
+
+ )} )} {currentTab === 'DETAIL' && (