Skip to content

Commit 1fc9328

Browse files
committed
Popover with error details.
And display download errors too.
1 parent 2a549b5 commit 1fc9328

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

Diffusion-macOS/ControlsView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ struct ControlsView: View {
8989
pipelineState = .uncompressing
9090
case .readyOnDisk:
9191
pipelineState = .loading
92+
case .failed(let error):
93+
pipelineState = .failed(error)
9294
default:
9395
break
9496
}

Diffusion-macOS/StatusView.swift

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ struct StatusView: View {
1212
@EnvironmentObject var generation: GenerationContext
1313
var pipelineState: Binding<PipelineState>
1414

15+
@State private var showErrorPopover = false
16+
1517
func submit() {
1618
if case .running = generation.state { return }
1719
Task {
@@ -77,8 +79,31 @@ struct StatusView: View {
7779

7880
AnyView(generationStatusView())
7981
}
80-
case .failed:
81-
Text("Pipeline loading error")
82+
case .failed(let error):
83+
HStack {
84+
Text("Pipeline loading error")
85+
Spacer()
86+
Button {
87+
showErrorPopover.toggle()
88+
} label: {
89+
Image(systemName: "info.circle")
90+
}.buttonStyle(.plain)
91+
.popover(isPresented: $showErrorPopover) {
92+
VStack {
93+
Text(verbatim: "\(error)")
94+
.lineLimit(nil)
95+
.padding(.all, 5)
96+
Button {
97+
showErrorPopover.toggle()
98+
} label: {
99+
Text("Dismiss").frame(maxWidth: 200)
100+
}
101+
.padding(.bottom)
102+
}
103+
.frame(minWidth: 400, idealWidth: 400, maxWidth: 400)
104+
.fixedSize()
105+
}
106+
}
82107
}
83108
}
84109
}

0 commit comments

Comments
 (0)