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 <WorkflowProcessItem
data={workflowProcess} data={workflowProcess}
item={item} item={item}
hideProcessDetail={hideProcessDetail} hideProcessDetail={hideProcessDetail}
/> readonly={hideProcessDetail && appData ? !appData.site.show_workflow_steps : undefined}
)
}
{/** 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}
/> />
) )
} }

View File

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