portal/storage: expose storage information via the portal

This commit is contained in:
Iain Learmonth 2022-11-01 10:17:31 +00:00
parent 1ee75fd37f
commit 293acba317
6 changed files with 121 additions and 7 deletions

View file

@ -14,7 +14,7 @@
{% if section == "alarm" %}
{{ alarms_table(items) }}
{% elif item == "automation" %}
{{ automations_table(items) }}
{{ automations_table(items, states) }}
{% elif item == "bridge configuration" %}
{{ bridgeconfs_table(items) }}
{% elif item == "bridge" %}

View file

@ -0,0 +1,21 @@
{% extends "base.html.j2" %}
{% from 'bootstrap5/form.html' import render_form %}
{% from "tables.html.j2" import automation_logs_table %}
{% block content %}
<h1 class="h2 mt-3">State Storage</h1>
<h2 class="h3">{{ storage.key }}</h2>
<div style="border: 1px solid #666;" class="p-3">
{{ render_form(form) }}
</div>
<h3>Storage</h3>
<h4>Current Lock</h4>
<pre>{{ storage.lock | pretty_json }}</pre>
<h4>State Dump</h4>
<pre>{{ storage.state | pretty_json }}</pre>
{% endblock %}

View file

@ -114,7 +114,7 @@
{{ instances_table("eotk", instances) }}
{% endmacro %}
{% macro automations_table(automations) %}
{% macro automations_table(automations, states) %}
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
@ -122,6 +122,7 @@
<th scope="col">Description</th>
<th scope="col">Status</th>
<th scope="col">Enabled</th>
<th scope="col">Storage</th>
<th scope="col">Last Run</th>
<th scope="col">Next Run</th>
<th scope="col">Actions</th>
@ -141,6 +142,15 @@
{% endif %}
</td>
<td>{% if automation.enabled %}✅{% else %}❌{% endif %}</td>
<td>
{% if automation.short_name in states %}
<a href="#" title="{{ states[automation.short_name].lock or 'Unlocked' }}" class="text-decoration-none">
{% if states[automation.short_name].lock %}🔒{% else %}🔓{% endif %}
</a>
{% else %}
<span title="No Storage">✨</span>
{% endif %}
</td>
<td>{{ automation.last_run | format_datetime }}</td>
<td>{{ automation.next_run | format_datetime }}</td>
<td>