fix: hide replay button for non app-run workflow logs

This commit is contained in:
lyzno1 2025-10-25 14:42:26 +08:00
parent 33daedd7aa
commit 913d85302c
No known key found for this signature in database
2 changed files with 21 additions and 14 deletions

View File

@ -11,9 +11,10 @@ import { useRouter } from 'next/navigation'
type ILogDetail = {
runID: string
onClose: () => void
canReplay?: boolean
}
const DetailPanel: FC<ILogDetail> = ({ runID, onClose }) => {
const DetailPanel: FC<ILogDetail> = ({ runID, onClose, canReplay = false }) => {
const { t } = useTranslation()
const appDetail = useStore(state => state.appDetail)
const router = useRouter()
@ -30,19 +31,21 @@ const DetailPanel: FC<ILogDetail> = ({ runID, onClose }) => {
</span>
<div className='flex items-center bg-components-panel-bg'>
<h1 className='system-xl-semibold shrink-0 px-4 py-1 text-text-primary'>{t('appLog.runDetail.workflowTitle')}</h1>
<TooltipPlus
popupContent={t('appLog.runDetail.testWithParams')}
popupClassName='rounded-xl'
>
<button
type='button'
className='mr-1 flex h-6 w-6 items-center justify-center rounded-md hover:bg-state-base-hover'
aria-label={t('appLog.runDetail.testWithParams')}
onClick={handleReplay}
{canReplay && (
<TooltipPlus
popupContent={t('appLog.runDetail.testWithParams')}
popupClassName='rounded-xl'
>
<RiPlayLargeLine className='h-4 w-4 text-text-tertiary' />
</button>
</TooltipPlus>
<button
type='button'
className='mr-1 flex h-6 w-6 items-center justify-center rounded-md hover:bg-state-base-hover'
aria-label={t('appLog.runDetail.testWithParams')}
onClick={handleReplay}
>
<RiPlayLargeLine className='h-4 w-4 text-text-tertiary' />
</button>
</TooltipPlus>
)}
</div>
<WorkflowContextProvider>
<Run

View File

@ -179,7 +179,11 @@ const WorkflowAppLogList: FC<ILogs> = ({ logs, appDetail, onRefresh }) => {
footer={null}
panelClassName='mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[600px] rounded-xl border border-components-panel-border'
>
<DetailPanel onClose={onCloseDrawer} runID={currentLog?.workflow_run.id || ''} />
<DetailPanel
onClose={onCloseDrawer}
runID={currentLog?.workflow_run.id || ''}
canReplay={currentLog?.workflow_run.triggered_from === 'app-run' || currentLog?.workflow_run.triggered_from === 'debugging'}
/>
</Drawer>
</div>
)