Compare commits

..

4 Commits

Author SHA1 Message Date
Stefan Allius
cb9344a476 set timezone of scanned creation time 2025-05-13 00:34:22 +02:00
Stefan Allius
7aab01bcfc add an empty file
- the empty file is needed for unit tests to force
  an exception on the try to scan the first line
  for an timestamp
2025-05-12 23:16:09 +02:00
Stefan Allius
60971be000 increase test coverage 2025-05-12 23:05:24 +02:00
Stefan Allius
9304407348 scan log files for timestamp as creating timestamp 2025-05-12 23:03:35 +02:00
5 changed files with 28 additions and 36 deletions

View File

@@ -10,40 +10,39 @@ from .log_handler import LogHandler
def _get_device_icon(client_mode: bool): def _get_device_icon(client_mode: bool):
'''returns the icon for the device conntection''' '''returns the icon for the device conntection'''
if client_mode: if client_mode:
return 'fa-download fa-rotate-180', 'Server Mode' return 'fa-download fa-rotate-180'
return 'fa-upload fa-rotate-180', 'Client Mode' return 'fa-upload fa-rotate-180'
def _get_cloud_icon(emu_mode: bool): def _get_cloud_icon(emu_mode: bool):
'''returns the icon for the cloud conntection''' '''returns the icon for the cloud conntection'''
if emu_mode: if emu_mode:
return 'fa-cloud-arrow-up-alt', 'Emu Mode' return 'fa-cloud-arrow-up-alt'
return 'fa-cloud', 'Proxy Mode' return 'fa-cloud'
def _get_row(inv: InverterBase): def _get_row(inv: InverterBase):
'''build one row for the connection table''' '''build one row for the connection table'''
client_mode = inv.client_mode client_mode = inv.client_mode
inv_serial = inv.local.stream.inv_serial inv_serial = inv.local.stream.inv_serial
icon1, descr1 = _get_device_icon(client_mode) icon1 = _get_device_icon(client_mode)
ip1, port1 = inv.addr ip1, port1 = inv.addr
icon2 = '' icon2 = ''
descr2 = ''
ip2 = '--' ip2 = '--'
port2 = '--' port2 = '--'
if inv.remote.ifc: if inv.remote.ifc:
ip2, port2 = inv.remote.ifc.r_addr ip2, port2 = inv.remote.ifc.r_addr
icon2, descr2 = _get_cloud_icon(client_mode) icon2 = _get_cloud_icon(client_mode)
row = [] row = []
row.append(f'<i class="fa {icon1}" title="{_(descr1)}"></i> {ip1}:{port1}') row.append(f'<i class="fa {icon1}"></i> {ip1}:{port1}')
row.append(f'<i class="fa {icon1}" title="{_(descr1)}"></i> {ip1}') row.append(f'<i class="fa {icon1}"></i> {ip1}')
row.append(inv_serial) row.append(inv_serial)
row.append(f'<i class="fa {icon2}" title="{_(descr2)}"></i> {ip2}:{port2}') row.append(f'<i class="fa {icon2}"></i> {ip2}:{port2}')
row.append(f'<i class="fa {icon2}" title="{_(descr2)}"></i> {ip2}') row.append(f'<i class="fa {icon2}"></i> {ip2}')
return row return row

View File

@@ -46,13 +46,10 @@ def get_table_data():
@web.route('/mqtt-fetch') @web.route('/mqtt-fetch')
async def mqtt_fetch(): async def mqtt_fetch():
mqtt = Mqtt(None) mqtt = Mqtt(None)
cdatetime = format_datetime(dt=mqtt.ctime, format='d.MM. HH:mm') ctime = format_datetime(dt=mqtt.ctime, format='short')
data = { data = {
"update-time": format_datetime(format="medium"), "update-time": format_datetime(format="medium"),
"mqtt-ctime": f""" "mqtt-ctime": f"<h3>{ctime}</h3>",
<h3 class="w3-hide-small w3-hide-medium">{cdatetime}</h3>
<h4 class="w3-hide-large">{cdatetime}</h4>
""",
"mqtt-tx": f"<h3>{mqtt.published}</h3>", "mqtt-tx": f"<h3>{mqtt.published}</h3>",
"mqtt-rx": f"<h3>{mqtt.received}</h3>", "mqtt-rx": f"<h3>{mqtt.received}</h3>",
} }

View File

@@ -7,9 +7,9 @@
<div id="id01" class="w3-modal"> <div id="id01" class="w3-modal">
<div class="w3-modal-content" style="width:600px"> <div class="w3-modal-content" style="width:600px">
<div class="w3-container w3-padding-24"> <div class="w3-container w3-padding-24">
<h2>{{_('Do you really want to delete the log file: <br>%(file)s ?', file='<b><span id="id03"></span></b>')}}</h2> <h2>{{_("Do you really want to delete the log file")}}:<br><b><span id="id03"></span></b> ?</h2>
<div class="w3-bar"> <div class="w3-bar">
<button id="id02" class="w3-button w3-red" onclick="deleteFile(); document.getElementById('id01').style.display='none'">{{_('Delete File')}}</button> <button id="id02" class="w3-button w3-red" onclick="deleteFile(); document.getElementById('id01').style.display='none'">{{_('Delete File</button')}}>
<button class="w3-button w3-grey w3-right" onclick="document.getElementById('id01').style.display='none'">{{_('Abort')}}</button> <button class="w3-button w3-grey w3-right" onclick="document.getElementById('id01').style.display='none'">{{_('Abort')}}</button>
</div> </div>
</div> </div>

View File

@@ -8,7 +8,7 @@
<div class="w3-third"> <div class="w3-third">
<div class="w3-card-4"> <div class="w3-card-4">
<div class="w3-container w3-indigo w3-padding-16"> <div class="w3-container w3-indigo w3-padding-16">
<div class="w3-left"><i class="fa fa-business-time w3-xxxlarge"></i></div> <div class="w3-left"><i class="fa fa-link w3-xxxlarge"></i></div>
<div id = "mqtt-ctime" class="w3-right"> <div id = "mqtt-ctime" class="w3-right">
<h3>-</h3> <h3>-</h3>
</div> </div>
@@ -21,7 +21,7 @@
<div class="w3-third"> <div class="w3-third">
<div class="w3-card-4"> <div class="w3-card-4">
<div class="w3-container w3-purple w3-padding-16"> <div class="w3-container w3-purple w3-padding-16">
<div class="w3-left"><i class="fa fa-angle-double-right w3-xxxlarge"></i></div> <div class="w3-left"><i class="fa fa-server w3-xxxlarge"></i></div>
<div id = "mqtt-tx" class="w3-right"> <div id = "mqtt-tx" class="w3-right">
<h3>-</h3> <h3>-</h3>
</div> </div>
@@ -34,7 +34,7 @@
<div class="w3-third"> <div class="w3-third">
<div class="w3-card-4"> <div class="w3-card-4">
<div class="w3-container w3-orange w3-text-white w3-padding-16"> <div class="w3-container w3-orange w3-text-white w3-padding-16">
<div class="w3-left"><i class="fa fa-angle-double-left w3-xxxlarge"></i></div> <div class="w3-left"><i class="fa fa-user w3-xxxlarge"></i></div>
<div id = "mqtt-rx" class="w3-right"> <div id = "mqtt-rx" class="w3-right">
<h3>-</h3> <h3>-</h3>
</div> </div>

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: tsun-gen3-proxy 0.14.0\n" "Project-Id-Version: tsun-gen3-proxy 0.14.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-05-13 22:34+0200\n" "POT-Creation-Date: 2025-05-04 18:16+0200\n"
"PO-Revision-Date: 2025-04-18 16:24+0200\n" "PO-Revision-Date: 2025-04-18 16:24+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: de\n" "Language: de\n"
@@ -19,34 +19,30 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.17.0\n" "Generated-By: Babel 2.17.0\n"
#: src/web/conn_table.py:53 src/web/templates/base.html.j2:58 #: src/web/conn_table.py:52 src/web/templates/base.html.j2:58
msgid "Connections" msgid "Connections"
msgstr "Verbindungen" msgstr "Verbindungen"
#: src/web/conn_table.py:60 #: src/web/conn_table.py:59
msgid "Device-IP:Port" msgid "Device-IP:Port"
msgstr "Geräte-IP:Port" msgstr "Geräte-IP:Port"
#: src/web/conn_table.py:60 #: src/web/conn_table.py:59
msgid "Device-IP" msgid "Device-IP"
msgstr "Geräte-IP" msgstr "Geräte-IP"
#: src/web/conn_table.py:61 src/web/mqtt_table.py:34 #: src/web/conn_table.py:60 src/web/mqtt_table.py:34
msgid "Serial-No" msgid "Serial-No"
msgstr "Seriennummer" msgstr "Seriennummer"
#: src/web/conn_table.py:62 #: src/web/conn_table.py:61
msgid "Cloud-IP:Port" msgid "Cloud-IP:Port"
msgstr "Cloud-IP:Port" msgstr "Cloud-IP:Port"
#: src/web/conn_table.py:62 #: src/web/conn_table.py:61
msgid "Cloud-IP" msgid "Cloud-IP"
msgstr "Cloud-IP" msgstr "Cloud-IP"
#: src/web/log_files.py:48
msgid "n/a"
msgstr "keine Angabe"
#: src/web/mqtt_table.py:27 #: src/web/mqtt_table.py:27
msgid "MQTT devices" msgid "MQTT devices"
msgstr "MQTT Geräte" msgstr "MQTT Geräte"
@@ -120,12 +116,12 @@ msgid "TSUN Proxy - Log Files"
msgstr "TSUN Proxy - Log Dateien" msgstr "TSUN Proxy - Log Dateien"
#: src/web/templates/page_logging.html.j2:10 #: src/web/templates/page_logging.html.j2:10
msgid "Do you really want to delete the log file: <br>%(file)s ?" msgid "Do you really want to delete the log file"
msgstr "Soll die Datei: <br>%(file)s<br>wirklich gelöscht werden?" msgstr "Soll die Datei wirklich gelöscht werden"
#: src/web/templates/page_logging.html.j2:12 #: src/web/templates/page_logging.html.j2:12
msgid "Delete File" msgid "Delete File</button"
msgstr "Datei löschen" msgstr "File löschen"
#: src/web/templates/page_logging.html.j2:13 #: src/web/templates/page_logging.html.j2:13
msgid "Abort" msgid "Abort"