diff --git a/larigira/dbadmin/templates/list.html b/larigira/dbadmin/templates/list.html index 5e00df5..eeee2a8 100644 --- a/larigira/dbadmin/templates/list.html +++ b/larigira/dbadmin/templates/list.html @@ -12,7 +12,7 @@ $(function() { {%endblock%} -{% block title %}Larigira - DB list {%endblock%} +{% block title %}Larigira - DB list{%endblock%} {% block content %}
diff --git a/larigira/rpc.py b/larigira/rpc.py index ed6c67b..95fe52b 100644 --- a/larigira/rpc.py +++ b/larigira/rpc.py @@ -4,13 +4,15 @@ import gc from copy import deepcopy from greenlet import greenlet -from flask import current_app, Blueprint, Flask, jsonify +from flask import current_app, Blueprint, Flask, jsonify, render_template from flask_bootstrap import Bootstrap from .dbadmin import db from .config import get_conf rpc = Blueprint('rpc', __name__, url_prefix='/api') +viewui = Blueprint('view', __name__, url_prefix='/view', + template_folder='templates') def send_to_parent(kind, *args): @@ -59,6 +61,16 @@ def get_scheduled_audiogen(): return events +@viewui.route('/status/running') +def ui_wip(): + audiogens = get_scheduled_audiogen() + return render_template('running.html', + audiogens=sorted( + audiogens.items(), + key=lambda x: x[1]['running_time']) + ) + + @rpc.route('/debug/running') def rpc_wip(): def treeify(flat): @@ -114,6 +126,7 @@ def create_app(queue, larigira): app.config.update(get_conf()) Bootstrap(app) app.register_blueprint(rpc) + app.register_blueprint(viewui) app.register_blueprint(db) app.queue = queue app.larigira = larigira diff --git a/larigira/templates/running.html b/larigira/templates/running.html new file mode 100644 index 0000000..6c4f488 --- /dev/null +++ b/larigira/templates/running.html @@ -0,0 +1,45 @@ +{% extends "bootstrap/base.html" %} + +{% block title %}Larigira - Upcoming events{%endblock%} + +{%macro print_action(aid, action)%} + +{% if 'nick' in action %} +{{action['nick']}} +{% else %} +{{ action['kind'] }} +{% endif %} +{%endmacro%} + +{%macro print_actions(actions)%} +{% if actions|length == 0 %} +NOTHING +{% else %} +{{print_action(*actions.items()|first)}} +{% endif %} +{%endmacro%} + + +{% block content %} +

Upcoming events

+
+ + + + + + + + + {% for id, event in audiogens %} + + + + + + {%endfor%} +
IDRunning timeAction
{{id}}{{event['running_time']}}{{print_actions(event['timespec']['actions'])}}
+
+{% endblock content %} + +{# vim: set ts=2 sw=2 noet: #}