WebUI supports multiple actions for one alarm

This commit is contained in:
boyska 2016-09-13 10:49:45 +02:00
parent 2642199be1
commit 5b70da982a
No known key found for this signature in database
GPG key ID: 7395DCAE58289CA9
3 changed files with 14 additions and 9 deletions

View file

@ -153,7 +153,8 @@ class Monitor(ParentedLet):
self.running[timespec.eid] = {
'greenlet': audiogen,
'running_time': datetime.now() + timedelta(seconds=delta),
'audiospec': audiospecs
'timespec': timespec,
'audiospecs': audiospecs
}
def process_action(self, timespec, audiospecs):

View file

@ -44,19 +44,19 @@ def rpc_refresh():
def get_scheduled_audiogen():
larigira = current_app.larigira
model = larigira.controller.monitor.model
running = larigira.controller.monitor.running
events = {t: {} for t in running.keys()}
for timespec_eid in events:
orig_info = running[timespec_eid]
info = events[timespec_eid]
info['running_time'] = orig_info['running_time'].isoformat()
info['audiospec'] = orig_info['audiospec']
info['timespec'] = model.get_alarm_by_id(timespec_eid)
if 'actions' in info['timespec']:
info['timespec']['actions'] = {
actid: model.get_action_by_id(actid)
for actid in info['timespec']['actions']}
info['audiospecs'] = orig_info['audiospecs']
info['timespec'] = orig_info['timespec']
info['timespec']['actions'] = {aid: spec
for aid, spec
in zip(info['timespec']['actions'],
info['audiospecs'])
}
info['greenlet'] = hex(id(orig_info['greenlet']))
return events

View file

@ -15,7 +15,11 @@
{% if actions|length == 0 %}
<span class="action-none">NOTHING</span>
{% else %}
<span class="action">{{print_action(*actions.items()|first)}}</span>
<ol>
{% for aid, spec in actions.items() %}
<li>{{print_action(aid, spec)}}</li>
{% endfor %}
</li>
{% endif %}
{%endmacro%}