Skip to content

Commit

Permalink
ctrl panel fix - v3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shashfrankenstien committed Aug 4, 2024
1 parent e2b87ac commit 6d977ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion flask_production/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.1.0"
__version__ = "3.1.1"
from .core import CherryFlask
from .sched import TaskScheduler
from .plugins import TaskMonitor
17 changes: 6 additions & 11 deletions flask_production/plugins/ctrl_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,14 @@ def _render_monitors(self):
attrs['title'] = monitor['error']
else:
mon = monitor['success']
err_msg_css = []
running_msg_css = []
if mon['summary']['errors'] > 0:
css.append('error-border')
err_msg_css.append('red')
if mon['summary']['running'] > 0:
running_msg_css.append('yellow')

task_msg = f"tasks: {DIV(mon['summary']['count'])}"
running_msg = f"running: {DIV(mon['summary']['running'], css=running_msg_css)}"
error_msg = f"errors: {DIV(mon['summary']['errors'], css=err_msg_css)}"
msg = f"tasks: {DIV(mon['summary']['count'])}"
if mon['summary'].get('running') or 0 > 0:
msg += f" running: {DIV(mon['summary']['running'], css=['yellow'])}"
if mon['summary'].get('error') or 0 > 0:
css.append('error-border')
msg += f" errors: {DIV(mon['summary']['errors'], css=['red'])}"

msg = f"{task_msg} {running_msg} {error_msg}"
elem = SPAN(B(mon['name']), css=['block-title']) + SPAN(msg, css=['block-msg'])
attrs['data-url'] = monitor['url']
attrs['title'] = f"{mon['name']}\n{monitor['url']}"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = flask_production
version = 3.1.0
version = 3.1.1
author = Shashank Gopikrishna
author_email = [email protected]
description = cherrypy server for Flask + task scheduler and monitor
Expand Down

0 comments on commit 6d977ff

Please sign in to comment.