From c75f33a1e380a330f7824f17589c28937e196e49 Mon Sep 17 00:00:00 2001 From: Derek Antrican Date: Sat, 13 May 2023 17:49:43 -0700 Subject: [PATCH] Fix selectedHook saving --- octoprint_webhooks/static/js/webhooks.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/octoprint_webhooks/static/js/webhooks.js b/octoprint_webhooks/static/js/webhooks.js index 5946c3c..01b9c4b 100644 --- a/octoprint_webhooks/static/js/webhooks.js +++ b/octoprint_webhooks/static/js/webhooks.js @@ -51,6 +51,16 @@ $(function() { } } + self.onSettingsShown = function () { + // Once the settings are saved, the selectedHook will no longer be the same as + // settings.settings.plugins.webhooks.hooks()[self.selectedIndex()] (because + // new observables are created with the new settings values). So before the + // settings window is shown, we'll re-assign the selectedHook + self.selectHook(self.selectedIndex()); + + //Todo: is this what was intended by some of the code in onBeforeBinding? Should investigate + } + self.templateChanged = function(data) { self.templateActivated(false) self.templateDescription(self.template()["_description"]) @@ -232,7 +242,7 @@ $(function() { console.log('PLUGS - Ignoring '+plugin); return; } - + hide = true if (data["hide"] !== undefined) { hide = data["hide"]