def show(self): notdata = notifications.load_failed_notifications(after=notifications.acknowledged_time(), stat_only=True) if notdata is None: failed_notifications = 0 else: failed_notifications = notdata[0] if not failed_notifications: return html.open_div(class_="has_failed_notifications") html.open_div(class_="failed_notifications_inner") confirm_url = html.makeuri_contextless([], filename="clear_failed_notifications.py") html.icon_button(confirm_url, _("Clear failed notifications"), "closetimewarp", target="main") view_url = html.makeuri_contextless([("view_name", "failed_notifications")], filename="view.py") html.a(_("%d failed notifications") % failed_notifications, href=view_url) html.close_div() html.close_div()
def _get_failed_notification_stats(self): try: return notifications.load_failed_notifications( after=notifications.acknowledged_time(), stat_only=True, )[0] except livestatus.MKLivestatusNotFoundError: return None