diff --git a/docs/PRE-RELEASE-TASKS.md b/docs/PRE-RELEASE-TASKS.md index ebb5a5a..53f8b58 100644 --- a/docs/PRE-RELEASE-TASKS.md +++ b/docs/PRE-RELEASE-TASKS.md @@ -97,7 +97,7 @@ These land together because both edit `domain/job.go` and `storage/store.go`. - [x] P3.1 — Config/runtime fields + defaults - [x] P3.2 — Split dispatch into `app/run.go` - [x] P3.3 — Rework `RunDue`/`executeRun` for mode + overlap policy -- [ ] P3.4 — Settings Queue selects +- [x] P3.4 — Settings Queue selects - [ ] P3.5 — Queue tests ### Phase 4 — Notifications + Command browse diff --git a/src/ui/settings_view.go b/src/ui/settings_view.go index 5f4e3c5..98ef0fe 100644 --- a/src/ui/settings_view.go +++ b/src/ui/settings_view.go @@ -8,6 +8,7 @@ import ( "strings" "gitea.mixdep.ru/mix/gosentry/src/app" + "gitea.mixdep.ru/mix/gosentry/src/domain" "fyne.io/fyne/v2" "fyne.io/fyne/v2/container" @@ -46,6 +47,16 @@ func settingsView(w fyne.Window, svc *app.Service) fyne.CanvasObject { minimizeToTray.SetChecked(store.Config.KeepRunningInTray) notifications := widget.NewCheck("Show desktop notifications for failed jobs", nil) notifications.SetChecked(store.Config.NotifyOnFailure) + executionModeSelect := widget.NewSelect( + []string{string(domain.ExecutionModeParallel), string(domain.ExecutionModeSequential)}, + nil, + ) + executionModeSelect.SetSelected(string(store.Config.ExecutionMode)) + overlapPolicySelect := widget.NewSelect( + []string{string(domain.OverlapPolicySkip), string(domain.OverlapPolicyQueue)}, + nil, + ) + overlapPolicySelect.SetSelected(string(store.Config.OverlapPolicy)) jobsDir := widget.NewEntry() jobsDir.SetText(store.Config.JobsDir) jobsDirBrowse := widget.NewButtonWithIcon("Browse", theme.FolderOpenIcon(), func() { @@ -92,6 +103,8 @@ func settingsView(w fyne.Window, svc *app.Service) fyne.CanvasObject { config.StartOnLogin = startOnLogin.Checked config.KeepRunningInTray = minimizeToTray.Checked config.NotifyOnFailure = notifications.Checked + config.ExecutionMode = domain.ExecutionMode(executionModeSelect.Selected) + config.OverlapPolicy = domain.OverlapPolicy(overlapPolicySelect.Selected) if err := svc.UpdateSettings(config); err != nil { settingsStatus.SetText("Save failed: " + err.Error()) return @@ -111,6 +124,10 @@ func settingsView(w fyne.Window, svc *app.Service) fyne.CanvasObject { settingsRow("Tray", container.New(minWidthLayout{width: settingsControlWidth}, minimizeToTray)), settingsRow("Notifications", container.New(minWidthLayout{width: settingsControlWidth}, notifications)), widget.NewSeparator(), + widget.NewLabelWithStyle("Queue", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), + settingsRow("Execution mode", container.New(minWidthLayout{width: settingsControlWidth}, executionModeSelect)), + settingsRow("Overlap policy", container.New(minWidthLayout{width: settingsControlWidth}, overlapPolicySelect)), + widget.NewSeparator(), widget.NewLabelWithStyle("Storage", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), settingsRow("Config YAML", widget.NewLabel(store.Paths.ConfigPath)), settingsRow("Jobs directory", container.NewBorder(nil, nil, nil, jobsDirBrowse, jobsDir)),