()
| 19 | |
| 20 | const TaskTable = ({ loading, dataSource, pagination, archived = false }: TaskTableProps) => { |
| 21 | const getColumns = () => { |
| 22 | const columns: PrimaryTableCol<TaskData>[] = [{ |
| 23 | colKey: 'job.id', |
| 24 | title: t('JobID'), |
| 25 | width: 150, |
| 26 | fixed: 'left', |
| 27 | cell: ({ row }) => (<> |
| 28 | <a |
| 29 | className="link-name text-weight-bold" |
| 30 | href={getTaskRouter(row.job, row.id, archived)} |
| 31 | target='_blank' |
| 32 | rel="noopener noreferrer" |
| 33 | > |
| 34 | {row.job.id} - {row.id} |
| 35 | </a> |
| 36 | </>), |
| 37 | }, { |
| 38 | colKey: 'task_name', |
| 39 | title: t('执行任务'), |
| 40 | width: 150, |
| 41 | fixed: 'left', |
| 42 | }, { |
| 43 | colKey: 'state', |
| 44 | title: t('执行状态'), |
| 45 | width: 180, |
| 46 | cell: ({ row }) => ( |
| 47 | <Space align='center'> |
| 48 | {row.state !== TaskStateEnum.CLOSED |
| 49 | ? <Loading loading={true} text={TASK_STATE_CHOICES[row.state as TaskStateEnum]} size="small" /> |
| 50 | : <span>{TASK_STATE_CHOICES[row.state as TaskStateEnum]}</span>} |
| 51 | </Space> |
| 52 | ), |
| 53 | }, { |
| 54 | colKey: 'result_msg', |
| 55 | title: t('执行结果'), |
| 56 | width: 300, |
| 57 | cell: ({ row }) => ( |
| 58 | <> |
| 59 | {row.result_code !== null && ( |
| 60 | <Tag theme={row.result_code < 100 ? 'success' : 'danger'} variant='light'> |
| 61 | {row.result_code} {row.result_code_msg} |
| 62 | </Tag> |
| 63 | )} |
| 64 | {row.result_msg && <div className="mt-xs fs-12 text-grey-6">{row.result_msg}</div>} |
| 65 | </> |
| 66 | ), |
| 67 | }, { |
| 68 | colKey: 'total_time', |
| 69 | title: t('总耗时'), |
| 70 | width: 220, |
| 71 | cell: ({ row }) => secToHMS(row.total_time), |
| 72 | }, { |
| 73 | colKey: 'create_time', |
| 74 | title: t('创建时间'), |
| 75 | width: 200, |
| 76 | cell: ({ row }: any) => ( |
| 77 | <div style={{ minWidth: '150px' }}>{formatDateTime(get(row, 'create_time'))}</div> |
| 78 | ), |
no test coverage detected