Remove id from client's bubbles

Remove id from client's bubbles in the following commands: Power
(Poweroff, Poweron, Reboot); Setup (Set boot mode, Set ogLive); Client
(Start session)

To make the string replacement, a custom jinja filter has been created
master
Javier Hernandez 2023-12-21 12:19:49 +01:00 committed by OpenGnSys Support Team
parent 52c5555f65
commit 555460f982
3 changed files with 9 additions and 1 deletions

View File

@ -34,3 +34,4 @@ def localeselector():
return app.config.get('LANG', 'en')
import ogcp.views
import ogcp.filters

7
ogcp/filters.py 100644
View File

@ -0,0 +1,7 @@
from ogcp import app
import re
@app.template_filter('remove_id')
def remove_id(s):
return re.sub(r'_\d+$', '', s)

View File

@ -104,7 +104,7 @@
{% set max_clients = 50 %}
{% for name_id, ip in selected_clients[:max_clients] %}
<div id="pill-{{ name_id|replace(".", "_")|replace(" ", "_") }}" class="badge badge-pill og-pill badge-light">
{{ name_id }}<br>{{ ip }}
{{ name_id|remove_id }}<br>{{ ip }}
</div>
{% if loop.last and (selected_clients|length > max_clients) %}
<div class="badge badge-pill badge-light">...</div>