P4.1: Wire desktop notifications for failed job runs
Add Service.ShouldNotifyOnFailure() (reads config under mu) and call fyne.CurrentApp().SendNotification in the mainwindow subscriber when a Manual/Schedule run completes with State == "Failed" and the setting is on. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -72,6 +72,15 @@ func newMainView(w fyne.Window) (fyne.CanvasObject, func(time.Duration, bool)) {
|
||||
fyne.Do(func() {
|
||||
if isRecorded {
|
||||
events = append(events, recorded.Record)
|
||||
r := recorded.Record
|
||||
if r.State == "Failed" &&
|
||||
(r.Trigger == "Manual" || r.Trigger == "Schedule") &&
|
||||
svc.ShouldNotifyOnFailure() {
|
||||
fyne.CurrentApp().SendNotification(&fyne.Notification{
|
||||
Title: "GoSentry: Job Failed",
|
||||
Content: r.JobName + ": " + r.Detail,
|
||||
})
|
||||
}
|
||||
}
|
||||
if isError {
|
||||
events = append(events, newEvent(0, "Service", "Error", errOccurred.Err.Error()))
|
||||
|
||||
Reference in New Issue
Block a user