Give each workflow run a parent task with no agent
This commit is contained in:
@@ -84,7 +84,7 @@ struct ProjectView: View {
|
||||
return
|
||||
}
|
||||
let active = (store.tasks[p.id] ?? []).filter { $0.status == .active }
|
||||
let rows = nested(store, active.filter { !$0.background }).map(\.task.id) + active.filter(\.background).map(\.id)
|
||||
let rows = nested(store, active).map(\.task.id)
|
||||
if rows.isEmpty {
|
||||
return
|
||||
}
|
||||
@@ -200,11 +200,7 @@ private struct ProjectBlock: View {
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.vertical, 6)
|
||||
}
|
||||
TaskRows(active: active.filter { !$0.background })
|
||||
ForEach(active.filter(\.background), id: \.id) { task in
|
||||
BackgroundRow(task: task)
|
||||
.id(task.id)
|
||||
}
|
||||
TaskRows(active: active)
|
||||
heading("TODO")
|
||||
TodoBlock(project: project, todo: todo, active: active)
|
||||
}
|
||||
@@ -229,12 +225,17 @@ private func nested(_ store: Store, _ active: [ByreTask]) -> [(task: ByreTask, d
|
||||
add(child, depth + 1)
|
||||
}
|
||||
}
|
||||
for task in store.byRank(active.filter { $0.parentTaskId == nil || !ids.contains($0.parentTaskId!) }) {
|
||||
let roots = active.filter { $0.parentTaskId == nil || !ids.contains($0.parentTaskId!) }
|
||||
for task in store.byRank(roots.filter { !$0.background }) + roots.filter(\.background) {
|
||||
add(task, 0)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
private func rowIndent(_ task: ByreTask, _ depth: Int) -> CGFloat {
|
||||
task.parentTaskId != nil ? 20 * CGFloat(depth - 1) : 0
|
||||
}
|
||||
|
||||
private struct TaskRows: View {
|
||||
let active: [ByreTask]
|
||||
@Environment(Store.self) private var store
|
||||
@@ -243,8 +244,13 @@ private struct TaskRows: View {
|
||||
if !active.isEmpty {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
ForEach(nested(store, active), id: \.task.id) { row in
|
||||
TaskRow(task: row.task, depth: row.depth)
|
||||
.id(row.task.id)
|
||||
if row.task.background {
|
||||
BackgroundRow(task: row.task, depth: row.depth)
|
||||
.id(row.task.id)
|
||||
} else {
|
||||
TaskRow(task: row.task, depth: row.depth)
|
||||
.id(row.task.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 8)
|
||||
@@ -285,14 +291,10 @@ private struct TaskRow: View {
|
||||
let ts = store.taskState(task)
|
||||
let color = taskPalette[task.color]
|
||||
let count = store.inbox.filter { $0.taskId == task.id }.count
|
||||
HoverRow(selected: task.id == store.selectedTaskId, indent: task.parentTaskId != nil ? 20 * CGFloat(depth - 1) : 0) {
|
||||
HoverRow(selected: task.id == store.selectedTaskId, indent: rowIndent(task, depth)) {
|
||||
store.focusTask(task.id)
|
||||
} content: {
|
||||
if let parent = task.parentTaskId {
|
||||
Text("↳")
|
||||
.foregroundStyle(Palette.muted)
|
||||
.help("Subtask of \(store.findTask(parent)?.name ?? parent)")
|
||||
}
|
||||
SubtaskMark(task: task)
|
||||
StateMark(state: ts, color: color)
|
||||
Text(task.name)
|
||||
.foregroundStyle(color)
|
||||
@@ -318,15 +320,30 @@ private struct TaskRow: View {
|
||||
}
|
||||
}
|
||||
|
||||
private struct BackgroundRow: View {
|
||||
private struct SubtaskMark: View {
|
||||
let task: ByreTask
|
||||
@Environment(Store.self) private var store
|
||||
|
||||
var body: some View {
|
||||
if let parent = task.parentTaskId {
|
||||
Text("↳")
|
||||
.foregroundStyle(Palette.muted)
|
||||
.help("Subtask of \(store.findTask(parent)?.name ?? parent)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct BackgroundRow: View {
|
||||
let task: ByreTask
|
||||
let depth: Int
|
||||
@Environment(Store.self) private var store
|
||||
|
||||
var body: some View {
|
||||
let ts = store.taskState(task)
|
||||
HoverRow(selected: task.id == store.selectedTaskId) {
|
||||
HoverRow(selected: task.id == store.selectedTaskId, indent: rowIndent(task, depth)) {
|
||||
store.focusTask(task.id)
|
||||
} content: {
|
||||
SubtaskMark(task: task)
|
||||
Text(task.name)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
|
||||
Reference in New Issue
Block a user