Drop workflow kinds, deliver reviews when done, rename/delete workflows
This commit is contained in:
@@ -115,13 +115,8 @@ private struct WorkflowRow: View {
|
||||
var body: some View {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 12) {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 6) {
|
||||
Text(workflow.name)
|
||||
.font(Fonts.font(13, weight: 700))
|
||||
if workflow.kind == .review {
|
||||
Text("reviews snapshots").font(Fonts.font(11)).foregroundStyle(Palette.muted)
|
||||
}
|
||||
}
|
||||
Text(workflow.name)
|
||||
.font(Fonts.font(13, weight: 700))
|
||||
if !workflow.description.isEmpty {
|
||||
Text(workflow.description)
|
||||
.foregroundStyle(Palette.muted)
|
||||
@@ -135,13 +130,18 @@ private struct WorkflowRow: View {
|
||||
}
|
||||
.buttonStyle(SmallLinkButtonStyle())
|
||||
.help("See and change this workflow's steps and prompts")
|
||||
if workflow.kind == .task {
|
||||
Button("run") {
|
||||
run()
|
||||
}
|
||||
.buttonStyle(SmallLinkButtonStyle())
|
||||
.help("Open the Lead tab with a request to run this workflow in its composer")
|
||||
Button("run") {
|
||||
run()
|
||||
}
|
||||
.buttonStyle(SmallLinkButtonStyle())
|
||||
.help("Open the Lead tab with a request to run this workflow in its composer")
|
||||
Button("delete") {
|
||||
Task {
|
||||
await delete()
|
||||
}
|
||||
}
|
||||
.buttonStyle(SmallLinkButtonStyle())
|
||||
.help("Delete this workflow; tasks already running it keep their copy")
|
||||
}
|
||||
.padding(.vertical, 6)
|
||||
.overlay(alignment: .top) {
|
||||
@@ -149,6 +149,17 @@ private struct WorkflowRow: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func delete() async {
|
||||
guard await overlays.showConfirm(["Delete the workflow \"\(workflow.name)\"?"], action: "Delete", danger: true) else {
|
||||
return
|
||||
}
|
||||
do {
|
||||
_ = try await store.api.client.deleteWorkflow(path: .init(name: workflow.name)).noContent
|
||||
} catch {
|
||||
overlays.showAlert(errorText(error))
|
||||
}
|
||||
}
|
||||
|
||||
private func run() {
|
||||
let key = "message:lead"
|
||||
let ask = "Run the \"\(workflow.name)\" workflow: "
|
||||
|
||||
Reference in New Issue
Block a user