chore: simplify the workflow details logic (#24714)

This commit is contained in:
crazywoola
2025-08-28 03:17:48 -07:00
committed by GitHub
parent 5a64f69456
commit 79e6138ce2
2 changed files with 9 additions and 17 deletions

View File

@@ -137,24 +137,14 @@ const Answer: FC<AnswerProps> = ({
/>
)
}
{/** Render the normal steps */}
{/** Render workflow process */}
{
workflowProcess && !hideProcessDetail && (
workflowProcess && (
<WorkflowProcessItem
data={workflowProcess}
item={item}
hideProcessDetail={hideProcessDetail}
/>
)
}
{/** Hide workflow steps by it's settings in siteInfo */}
{
workflowProcess && hideProcessDetail && appData && (
<WorkflowProcessItem
data={workflowProcess}
item={item}
hideProcessDetail={hideProcessDetail}
readonly={!appData.site.show_workflow_steps}
readonly={hideProcessDetail && appData ? !appData.site.show_workflow_steps : undefined}
/>
)
}

View File

@@ -39,6 +39,8 @@ const WorkflowProcessItem = ({
setCollapse(!expand)
}, [expand])
if (readonly) return null
return (
<div
className={cn(
@@ -51,8 +53,8 @@ const WorkflowProcessItem = ({
)}
>
<div
className={cn('flex cursor-pointer items-center', !collapse && 'px-1.5', readonly && 'cursor-default')}
onClick={() => !readonly && setCollapse(!collapse)}
className={cn('flex cursor-pointer items-center', !collapse && 'px-1.5')}
onClick={() => setCollapse(!collapse)}
>
{
running && (
@@ -72,10 +74,10 @@ const WorkflowProcessItem = ({
<div className={cn('system-xs-medium text-text-secondary', !collapse && 'grow')}>
{t('workflow.common.workflowProcess')}
</div>
{!readonly && <RiArrowRightSLine className={cn('ml-1 h-4 w-4 text-text-tertiary', !collapse && 'rotate-90')} />}
<RiArrowRightSLine className={cn('ml-1 h-4 w-4 text-text-tertiary', !collapse && 'rotate-90')} />
</div>
{
!collapse && !readonly && (
!collapse && (
<div className='mt-1.5'>
{
<TracingPanel