migrate the conn table to a general table

- rename the template file
- get headline from table description
This commit is contained in:
Stefan Allius
2025-05-03 17:50:15 +02:00
parent 46ebfd9751
commit d2849e0e1e
4 changed files with 7 additions and 6 deletions

View File

@@ -48,6 +48,7 @@ def _get_row(inv: InverterBase):
def get_table_data():
'''build the connection table'''
table = {
"headline": _('Connections'),
"col_classes": [
"w3-hide-small w3-hide-medium", "w3-hide-large",
"",
@@ -75,7 +76,7 @@ async def data_fetch():
"proxy-cnt": f"<h3>{Infos.get_counter('ProxyMode_Cnt')}</h3>",
"emulation-cnt": f"<h3>{Infos.get_counter('EmuMode_Cnt')}</h3>",
}
data["conn-table"] = await render_template('templ_conn_table.html.j2',
data["conn-table"] = await render_template('templ_table.html.j2',
table=get_table_data())
data["notes-list"] = await render_template('templ_notes_list.html.j2')

View File

@@ -1,7 +1,6 @@
from inverter_base import InverterBase
from quart import render_template
from quart_babel import format_datetime, _
from infos import Infos
from mqtt import Mqtt
from . import web
@@ -49,6 +48,7 @@ def _get_row(inv: InverterBase):
def get_table_data():
'''build the connection table'''
table = {
"headline": _('MQTT devices'),
"col_classes": [
"w3-hide-small w3-hide-medium", "w3-hide-large",
"",
@@ -77,7 +77,7 @@ async def mqtt_fetch():
"mqtt-tx": f"<h3>{mqtt.published}</h3>",
"mqtt-rx": f"<h3>{mqtt.received}</h3>",
}
# data["conn-table"] = await render_template('templ_conn_table.html.j2',
# table=get_table_data())
data["mqtt-table"] = await render_template('templ_table.html.j2',
table=get_table_data())
return data

View File

@@ -45,7 +45,7 @@
</div>
</div>
</div>
<div id="mqtt-table"></div>
{% endblock content%}
{% block footer %}{% endblock footer %}

View File

@@ -13,7 +13,7 @@
{%- endmacro%}
<div class="w3-container w3-margin-bottom">
<h5>{{_('Connections')}}</h5>
<h5>{{table.headline}}</h5>
<div class="w3-card-4">
<table class="w3-table w3-striped w3-bordered w3-border w3-hoverable w3-white">