WebUI supports multiple actions for one alarm
This commit is contained in:
parent
2642199be1
commit
5b70da982a
3 changed files with 14 additions and 9 deletions
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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%}
|
||||
|
||||
|
|
Loading…
Reference in a new issue