diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-10-26 14:01:45 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-11-17 17:56:07 +0100 |
commit | 285dfb6eac9b1a358a1bc48d076352151259d7ac (patch) | |
tree | 16892b3485fe46098dbf88d158c306fd4d47bbd2 | |
parent | 20935966efdae847023680217a4c109648698340 (diff) |
wip make tree async parte 2async-tree
Estos cambio eran necesarios porque si no había elementos del html con
el mismo id y esto provoca que se rompa parte del javascript.
-rw-r--r-- | ogcp/templates/macros.html | 10 | ||||
-rw-r--r-- | ogcp/templates/tree.html | 2 | ||||
-rw-r--r-- | ogcp/views.py | 3 |
3 files changed, 8 insertions, 7 deletions
diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html index e114692..5e10b0f 100644 --- a/ogcp/templates/macros.html +++ b/ogcp/templates/macros.html @@ -23,9 +23,9 @@ {% endmacro %} -{% macro scopes_tree_collapse_level(scopes, parent_room, parent_id, state, selection_mode) -%} +{% macro scopes_tree_collapse_level(scopes, parent_server, parent_room, parent_id, state, selection_mode) -%} {% for scope in scopes %} - <li id="{{ scope["name"]|replace(".", "_")|replace(" ", "_") }}_{{ scope["id"] }}" class="nav-item"> + <li id="{{ parent_server }}_{{ scope["name"]|replace(".", "_")|replace(" ", "_") }}_{{ scope["id"] }}" class="nav-item"> {% if scope["type"] == "server" %} <input class="form-check-input" type="checkbox" form="scopesForm" value="{{ scope["server_ip_port"] }}" onclick="return false;" @@ -53,7 +53,7 @@ {% if scope.get("selected", False) %}checked{% endif %} name="{{ scope["name"] }}_{{ scope["id"] }}" /> {% endif %} - <a class="nav-link {% if not scope["scope"] %}disabled{% endif %}" href="#scope{{parent_id ~ "-" ~ loop.index}}" + <a class="nav-link {% if not scope["scope"] %}disabled{% endif %}" href="#{{parent_server ~ parent_id ~ "-" ~ loop.index}}" {% if scope["scope"] %}data-toggle="collapse"{% endif %}> {% if "state" in scope %} <i class="nav-icon fa-circle @@ -70,8 +70,8 @@ {{ scope["name"] }} </a> {% if scope["scope"] %} - <ul class="nav flex-column collapse level{{i}}" id="scope{{parent_id ~ "-" ~ loop.index}}"> - {{ scopes_tree_collapse_level(scope["scope"], parent_room, parent_id ~ "-" ~ loop.index, state, selection_mode) }} + <ul class="nav flex-column collapse level{{i}}" id="{{parent_server ~ parent_id ~ "-" ~ loop.index}}"> + {{ scopes_tree_collapse_level(scope["scope"], parent_server, parent_room, parent_id ~ "-" ~ loop.index, state, selection_mode) }} </ul> {% endif %} </li> diff --git a/ogcp/templates/tree.html b/ogcp/templates/tree.html index fc06105..5cc53c9 100644 --- a/ogcp/templates/tree.html +++ b/ogcp/templates/tree.html @@ -1,2 +1,2 @@ {% import "macros.html" as macros %} -{{ macros.scopes_tree_collapse_level(scopes["scope"], '', '', '', 'scopes') }} +{{ macros.scopes_tree_collapse_level(scopes["scope"], parent_server, '', '', '', 'scopes') }} diff --git a/ogcp/views.py b/ogcp/views.py index 5be8647..4e444f3 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -445,7 +445,8 @@ def scopes_tree(): params = request.args.to_dict() server = get_server_from_ip_port(params['server']) scopes = get_scopes_from_server(server) - return render_template('tree.html', scopes=scopes) + return render_template('tree.html', scopes=scopes, + parent_server=server.name) @app.route('/scopes/') |