I have some UI values that I would like to persist, and I'm working on the principal that writing those to the plugin settings is the correct way to do.
I'm drawing my inspiration from the timelapse tab at the moment, which has some settings, and a big 'Save Settings' button. However what I'd like is for the setting to be saved every time it's updated (e.g. when a control is blurred.
The best I have come up with so far is to have a checkbox that is bound to a computed KO observable implemented like this:
self.confirmAllGcode = ko.computed({
read: function() {
self.settings.settings.plugins.calibrationtests.confirmAllGcode()
},
write: function (value) {
OctoPrint.settings.savePluginSettings("calibration_tests", {confirmAllGcode: value}, null)
},
owner: this
});
However, even though the call to save the plugin settings returns success, the backend octoprint settings yaml file doesn't change. Am I missing something obvious?