25 lines
897 B
JavaScript
25 lines
897 B
JavaScript
export function jobLogRoute(selectedIds) {
|
|
if (!Array.isArray(selectedIds) || selectedIds.length !== 1) return null
|
|
const jobId = Number(selectedIds[0])
|
|
if (!Number.isInteger(jobId) || jobId < 1) return null
|
|
return { name: 'JobLog', query: { jobId: String(jobId) }}
|
|
}
|
|
|
|
export function executionStatusMeta(status) {
|
|
return {
|
|
running: { label: '执行中', type: 'primary' },
|
|
succeeded: { label: '成功', type: 'success' },
|
|
failed: { label: '失败', type: 'danger' },
|
|
interrupted: { label: '已中断', type: 'warning' }
|
|
}[status] || { label: status || '未知', type: 'info' }
|
|
}
|
|
|
|
export function executionLogQuery(query, dateRange) {
|
|
const result = { ...query }
|
|
if (Array.isArray(dateRange) && dateRange.length === 2) {
|
|
result.startedFrom = new Date(dateRange[0]).toISOString()
|
|
result.startedTo = new Date(dateRange[1]).toISOString()
|
|
}
|
|
return result
|
|
}
|