Skip to content

Commit

Permalink
fix(agent): 🐛 actually save agent preferences and show better dialogs…
Browse files Browse the repository at this point in the history
… for success/fail
  • Loading branch information
joshuar committed Jul 26, 2024
1 parent bf1f6c4 commit dfd1c47
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/agent/ui/fyneUI/fyneUI.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,13 @@ func (i *FyneUI) agentSettingsWindow(ctx context.Context) fyne.Window {
prefs.MQTTUser = mqttPrefs.User
prefs.MQTTPassword = mqttPrefs.Password

dialog.ShowInformation("Saved", "MQTT Preferences have been saved.", window)
logging.FromContext(ctx).Info("MQTT preferences saved.")
if err := prefs.Save(); err != nil {
dialog.ShowError(err, window)
logging.FromContext(ctx).Error("Failed to save MQTT preferences.", "error", err.Error())
} else {
dialog.ShowInformation("Saved", "MQTT Preferences have been saved. Restart agent to utilise them.", window)
logging.FromContext(ctx).Info("Saved MQTT preferences.")
}
}
settingsForm.OnCancel = func() {
window.Close()
Expand Down

0 comments on commit dfd1c47

Please sign in to comment.