diff --git a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js index eedafd807..63cc35841 100644 --- a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js +++ b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js @@ -992,19 +992,25 @@ $(function() { var options = { title: title, text: text, - type: type + type: type, + hide: false }; - if (self.logNotification !== undefined) { - self.logNotification.remove(); - } - if (confirm !== undefined) { options.confirm = confirm; - options.hide = false; - self.logNotification = PNotify.singleButtonNotify(options); + + if (self.logNotification === undefined) { + self.logNotification = PNotify.singleButtonNotify(options); + } else { + self.logNotification.update(options); + self.logNotification = PNotify.fixSingleButton(self.logNotification, options); + } } else { - self.logNotification = new PNotify(options); + if (self.logNotification === undefined) { + self.logNotification = new PNotify(options); + } else { + self.logNotification.update(options); + } } }; diff --git a/src/octoprint/static/js/app/main.js b/src/octoprint/static/js/app/main.js index 804adbca1..1ac813665 100644 --- a/src/octoprint/static/js/app/main.js +++ b/src/octoprint/static/js/app/main.js @@ -250,8 +250,7 @@ $(function() { params.auto_display = false; var notify = new PNotify(params); - notify.options.confirm.buttons = [notify.options.confirm.buttons[0]]; - notify.modules.confirm.makeDialog(notify, notify.options.confirm); + notify = PNotify.fixSingleButton(notify, options); if (autoDisplay) { notify.open(); @@ -259,6 +258,16 @@ $(function() { return notify; }; + PNotify.fixSingleButton = function(notify, options) { + if (!options.confirm || !options.confirm.buttons || !options.confirm.buttons.length) { + return notify; + } + + notify.options.confirm.buttons = [notify.options.confirm.buttons[0]]; + notify.modules.confirm.makeDialog(notify, notify.options.confirm); + return notify; + } + //~~ Initialize view models // the view model map is our basic look up table for dependencies that may be injected into other view models