feat: add Cancel and Defaults buttons to Settings
Cancel discards unsaved edits by reloading the saved config; Defaults loads built-in default values into the form for review before saving. Extracts the default config into domain.DefaultConfig() so the store and settings UI share one source of truth. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+1
-14
@@ -68,20 +68,7 @@ func (s *Store) SaveJobs(jobs []domain.Job) error {
|
||||
func loadOrCreateConfig(paths Paths) (domain.Config, error) {
|
||||
// Defaults favor a portable installation: settings and jobs begin next to the
|
||||
// executable, while logs are grouped under a dedicated subdirectory.
|
||||
config := domain.Config{
|
||||
JobsDir: ".",
|
||||
LogsDir: "logs",
|
||||
MaxLogFiles: 100,
|
||||
MaxLogAgeDays: 30,
|
||||
StartOnLogin: false,
|
||||
KeepRunningInTray: true,
|
||||
NotifyOnFailure: true,
|
||||
ExecutionMode: domain.ExecutionModeParallel,
|
||||
OverlapPolicy: domain.OverlapPolicySkip,
|
||||
Theme: domain.ThemeDefault,
|
||||
|
||||
DefaultTimeoutSeconds: 30,
|
||||
}
|
||||
config := domain.DefaultConfig()
|
||||
|
||||
if _, err := os.Stat(paths.ConfigPath); errors.Is(err, os.ErrNotExist) {
|
||||
return config, writeJSON(paths.ConfigPath, config)
|
||||
|
||||
Reference in New Issue
Block a user