Skip to content

Commit

Permalink
feat(web): add link to parent in tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp committed May 24, 2022
1 parent 61d6c7d commit 34bf92f
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions packages/xo-web/src/xo-app/logs/backup-ng/log-alert-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const SrTask = ({ children, className, task }) => (
</li>
)

const TransferMergeTask = ({ className, task, parentTask }) => {
const TransferMergeTask = ({ className, task }) => {
const size = defined(() => task.result.size, 0)
if (task.status === 'success' && size === 0) {
return null
Expand All @@ -252,7 +252,7 @@ const TransferMergeTask = ({ className, task, parentTask }) => {
return (
<li className={className}>
{task.message === 'transfer' ? (
parentTask?.message === 'health check' ? (
task.parent?.message === 'health check' ? (
<Icon icon='download' />
) : (
<Icon icon='upload' />
Expand Down Expand Up @@ -316,7 +316,20 @@ export default decorate([
addSubscriptions(({ id }) => ({
log: cb =>
subscribeBackupNgLogs(logs => {
cb(logs[id])
const linkParent = parent => {
const { tasks } = parent
if (tasks !== undefined) {
for (const task of tasks) {
task.parent = parent
linkParent(task)
}
}
}
const log = logs[id]
if (log !== undefined) {
linkParent(log)
}
cb(log)
}),
})),
connectStore({
Expand Down Expand Up @@ -498,10 +511,10 @@ export default decorate([
<TaskLi key={subTaskLog.id} task={subTaskLog}>
<ul>
{map(subTaskLog.tasks, subSubTaskLog => (
<TaskLi task={subSubTaskLog} key={subSubTaskLog.id} parentTask={subTaskLog}>
<TaskLi task={subSubTaskLog} key={subSubTaskLog.id}>
<ul>
{map(subSubTaskLog.tasks, subSubSubTaskLog => (
<TaskLi task={subSubSubTaskLog} key={subSubSubTaskLog.id} parentTask={subSubTaskLog} />
<TaskLi task={subSubSubTaskLog} key={subSubSubTaskLog.id} />
))}
</ul>
</TaskLi>
Expand Down

0 comments on commit 34bf92f

Please sign in to comment.