Skip to content

Commit

Permalink
update(console): combine task logs with online & offline (#2438)
Browse files Browse the repository at this point in the history
  • Loading branch information
waynelwz authored Jul 3, 2023
1 parent 8049b6b commit 4d2b85d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions console/src/pages/Job/JobTasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,27 @@ export default function JobTasks() {
if ([TaskStatusType.RUNNING].includes(task.taskStatus)) {
const key = [task?.stepName, task?.id].join('@')
files[key] = 'ws'
setCurrentLogFiles({
...files,
})
} else {
const data = await fetchTaskOfflineLogFiles(task?.id)
if (!_.isEmpty(data)) {
}

const data = await fetchTaskOfflineLogFiles(task?.id)
if (!_.isEmpty(data)) {
await Promise.all(
data.map(async (v: string) => {
const content = await fetchTaskOfflineFileLog(task?.id, v)
const key = [task?.stepName, v].join('@')
files[key] = content ?? ''
setCurrentLogFiles({
...files,
})
})
} else {
toaster.negative('No logs collected for this task', { autoHideDuration: 2000 })
}
)
}

if (Object.keys(files).length === 0) {
toaster.negative('No logs collected for this task', { autoHideDuration: 2000 })
}

setCurrentLogFiles({
...files,
})

setExpanded(true)
}, [])

Expand Down

0 comments on commit 4d2b85d

Please sign in to comment.