in dolphinscheduler-ui/src/views/projects/workflow/instance/components/table-action.tsx [103:300]
render() {
const { t } = useI18n()
const state = this.row?.state
return (
<NSpace>
<NTooltip trigger={'hover'}>
{{
default: () => t('project.workflow.edit'),
trigger: () => (
<NButton
tag='div'
size='small'
type='info'
circle
class='btn-edit'
disabled={
(state !== 'SUCCESS' &&
state !== 'PAUSE' &&
state !== 'FAILURE' &&
state !== 'STOP') ||
this.row?.disabled
}
onClick={this.handleEdit}
>
<NIcon>
<FormOutlined />
</NIcon>
</NButton>
)
}}
</NTooltip>
<NTooltip trigger={'hover'}>
{{
default: () => t('project.workflow.rerun'),
trigger: () => {
return (
<NButton
tag='div'
size='small'
type='info'
circle
onClick={this.handleReRun}
class='btn-rerun'
disabled={
(state !== 'SUCCESS' &&
state !== 'PAUSE' &&
state !== 'FAILURE' &&
state !== 'STOP') ||
this.row?.disabled
}
>
{this.row?.buttonType === 'run' ? (
<span>{this.row?.count}</span>
) : (
<NIcon>
<SyncOutlined />
</NIcon>
)}
</NButton>
)
}
}}
</NTooltip>
<NTooltip trigger={'hover'}>
{{
default: () => t('project.workflow.recovery_failed'),
trigger: () => (
<NButton
tag='div'
size='small'
type='primary'
circle
onClick={this.handleReStore}
disabled={state !== 'FAILURE' || this.row?.disabled}
>
{this.row?.buttonType === 'store' ? (
<span>{this.row?.count}</span>
) : (
<NIcon>
<CloseCircleOutlined />
</NIcon>
)}
</NButton>
)
}}
</NTooltip>
<NTooltip trigger={'hover'}>
{{
default: () =>
state === 'STOP'
? t('project.workflow.recovery_suspend')
: t('project.workflow.stop'),
trigger: () => (
<NButton
tag='div'
size='small'
type='error'
circle
onClick={this.handleStop}
disabled={
(state !== 'RUNNING_EXECUTION' && state !== 'STOP') ||
this.row?.disabled
}
>
<NIcon>
{state === 'STOP' ? (
<PlayCircleOutlined />
) : (
<CloseOutlined />
)}
</NIcon>
</NButton>
)
}}
</NTooltip>
<NTooltip trigger={'hover'}>
{{
default: () =>
state === 'PAUSE'
? t('project.workflow.recovery_suspend')
: t('project.workflow.pause'),
trigger: () => (
<NButton
tag='div'
size='small'
type='warning'
circle
disabled={
(state !== 'RUNNING_EXECUTION' && state !== 'PAUSE') ||
this.row?.disabled
}
onClick={this.handleSuspend}
>
<NIcon>
{state === 'PAUSE' ? (
<PlayCircleOutlined />
) : (
<PauseCircleOutlined />
)}
</NIcon>
</NButton>
)
}}
</NTooltip>
<NTooltip trigger={'hover'}>
{{
default: () => t('project.workflow.delete'),
trigger: () => (
<NPopconfirm onPositiveClick={this.handleDeleteInstance}>
{{
default: () => t('project.workflow.delete_confirm'),
trigger: () => (
<NButton
tag='div'
size='small'
type='error'
circle
disabled={
(state !== 'SUCCESS' &&
state !== 'FAILURE' &&
state !== 'STOP' &&
state !== 'PAUSE') ||
this.row?.disabled
}
>
<NIcon>
<DeleteOutlined />
</NIcon>
</NButton>
)
}}
</NPopconfirm>
)
}}
</NTooltip>
<NTooltip trigger={'hover'}>
{{
default: () => t('project.workflow.gantt'),
trigger: () => (
<NButton
tag='div'
size='small'
type='info'
circle
disabled={this.row?.disabled}
onClick={this.handleGantt}
>
<NIcon>
<ControlOutlined />
</NIcon>
</NButton>
)
}}
</NTooltip>
</NSpace>
)
}