From e88bd1f4415e2435c0f41ac7d274c4ecde56b0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 30 Jun 2020 17:48:54 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Action=20Command=20Notification:?= =?UTF-8?q?=20Fix=20visibility=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/action_command_notification/__init__.py | 10 +++++++--- .../static/js/action_command_notification.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/octoprint/plugins/action_command_notification/__init__.py b/src/octoprint/plugins/action_command_notification/__init__.py index c2b3c606c..eb06109a7 100644 --- a/src/octoprint/plugins/action_command_notification/__init__.py +++ b/src/octoprint/plugins/action_command_notification/__init__.py @@ -85,9 +85,10 @@ class ActionCommandNotificationPlugin(octoprint.plugin.AssetPlugin, custom_bindings=False), dict(type="sidebar", name=gettext("Printer Notifications"), - icon="bell-o", styles=["display: none"], - data_bind="visible: loginState.hasPermission(access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW) " - "&& settings.settings.plugins.action_command_notification.enable") + icon="bell-o", + styles_wrapper=["display: none"], + data_bind="visible: loginState.hasPermissionKo(access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW)" + " && settings.settings.plugins.action_command_notification.enable()") ] #~ action command handler @@ -110,9 +111,12 @@ class ActionCommandNotificationPlugin(octoprint.plugin.AssetPlugin, self._notifications.append((time.time(), message)) self._plugin_manager.send_plugin_message(self._identifier, dict(message=message)) + self._logger.info("Got a notification: {}".format(message)) + def _clear_notifications(self): self._notifications = [] self._plugin_manager.send_plugin_message(self._identifier, dict()) + self._logger.info("Notifications cleared") __plugin_name__ = "Action Command Notification Support" __plugin_description__ = "Allows your printer to trigger notifications via action commands on the connection" diff --git a/src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js b/src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js index c319d378c..46954ae99 100644 --- a/src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js +++ b/src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js @@ -60,6 +60,6 @@ $(function() { OCTOPRINT_VIEWMODELS.push({ construct: ActionCommandNotificationViewModel, dependencies: ["loginStateViewModel", "accessViewModel", "settingsViewModel"], - elements: ["#sidebar_plugin_action_command_notification"] + elements: ["#sidebar_plugin_action_command_notification_wrapper", "#sidebar_plugin_action_command_notification"] }); });