diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-03-10 11:00:17 +0100 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-03-10 11:03:40 +0100 |
commit | feed13555454335355063f6b06dd9f035c5369ae (patch) | |
tree | 825c52cc0599aef0091b1109751b655552d8d740 | |
parent | 406f578597b283cd555d3b82e6743e6ace8808d2 (diff) |
Disable scopes tree's checkboxes in action views
Now users can select clients only in scopes and command views, in any
other view we set the scopes tree read only.
22 files changed, 45 insertions, 7 deletions
diff --git a/ogcp/templates/actions/add_center.html b/ogcp/templates/actions/add_center.html index 5e52752..53fbdc0 100644 --- a/ogcp/templates/actions/add_center.html +++ b/ogcp/templates/actions/add_center.html @@ -1,6 +1,8 @@ {% extends 'scopes.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_center %} active{% endblock %} {% block nav_center_add %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/add_room.html b/ogcp/templates/actions/add_room.html index a925116..7ccf086 100644 --- a/ogcp/templates/actions/add_room.html +++ b/ogcp/templates/actions/add_room.html @@ -1,6 +1,8 @@ {% extends 'scopes.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_room %} active{% endblock %} {% block nav_room_add %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/client_details.html b/ogcp/templates/actions/client_details.html index 62d73c7..f6c2fd1 100644 --- a/ogcp/templates/actions/client_details.html +++ b/ogcp/templates/actions/client_details.html @@ -1,6 +1,8 @@ {% extends parent %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_client %} active{% endblock %} {% block nav_client_details %} active{% endblock %} {% block nav_client_add %}active{% endblock %} diff --git a/ogcp/templates/actions/delete_center.html b/ogcp/templates/actions/delete_center.html index d8c0c31..ddb6114 100644 --- a/ogcp/templates/actions/delete_center.html +++ b/ogcp/templates/actions/delete_center.html @@ -1,6 +1,8 @@ {% extends 'scopes.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_center %} active{% endblock %} {% block nav_center_delete %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/delete_client.html b/ogcp/templates/actions/delete_client.html index 637be21..80e91c7 100644 --- a/ogcp/templates/actions/delete_client.html +++ b/ogcp/templates/actions/delete_client.html @@ -2,6 +2,8 @@ {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} +{% set sidebar_state = 'disabled' %} + {% block nav_client %} active{% endblock %} {% block nav_client_delete %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/delete_image.html b/ogcp/templates/actions/delete_image.html index 608375f..83cbc41 100644 --- a/ogcp/templates/actions/delete_image.html +++ b/ogcp/templates/actions/delete_image.html @@ -1,6 +1,8 @@ {% extends 'images.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block content %} {{ args }} diff --git a/ogcp/templates/actions/delete_room.html b/ogcp/templates/actions/delete_room.html index ae4ca40..6dbb5fc 100644 --- a/ogcp/templates/actions/delete_room.html +++ b/ogcp/templates/actions/delete_room.html @@ -1,6 +1,8 @@ {% extends 'scopes.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_room %} active{% endblock %} {% block nav_room_delete %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/hardware.html b/ogcp/templates/actions/hardware.html index 6b6e4d2..87b3285 100644 --- a/ogcp/templates/actions/hardware.html +++ b/ogcp/templates/actions/hardware.html @@ -1,6 +1,8 @@ {% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_inventory %} active{% endblock %} {% block nav_inventory_hardware %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/image_create.html b/ogcp/templates/actions/image_create.html index d549828..1ea8690 100644 --- a/ogcp/templates/actions/image_create.html +++ b/ogcp/templates/actions/image_create.html @@ -1,6 +1,8 @@ {% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_image %} active{% endblock %} {% block nav_image_create %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/image_restore.html b/ogcp/templates/actions/image_restore.html index ddfe245..03b0558 100644 --- a/ogcp/templates/actions/image_restore.html +++ b/ogcp/templates/actions/image_restore.html @@ -2,6 +2,8 @@ {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} +{% set sidebar_state = 'disabled' %} + {% block nav_image %} active{% endblock %} {% block nav_image_restore %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/mode.html b/ogcp/templates/actions/mode.html index 184e046..d4cb9de 100644 --- a/ogcp/templates/actions/mode.html +++ b/ogcp/templates/actions/mode.html @@ -2,6 +2,8 @@ {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} +{% set sidebar_state = 'disabled' %} + {% block nav_setup %} active{% endblock %} {% block nav_setup_set_bootmode %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/oglive.html b/ogcp/templates/actions/oglive.html index cacba18..fc92218 100644 --- a/ogcp/templates/actions/oglive.html +++ b/ogcp/templates/actions/oglive.html @@ -2,6 +2,8 @@ {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} +{% set sidebar_state = 'disabled' %} + {% block nav_setup %} active{% endblock %} {% block nav_setup_set_oglive %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/poweroff.html b/ogcp/templates/actions/poweroff.html index 4f7713c..5a992c7 100644 --- a/ogcp/templates/actions/poweroff.html +++ b/ogcp/templates/actions/poweroff.html @@ -2,6 +2,8 @@ {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} +{% set sidebar_state = 'disabled' %} + {% block nav_power %} active{% endblock %} {% block nav_power_poweroff %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/reboot.html b/ogcp/templates/actions/reboot.html index e8bc30d..0dac1b7 100644 --- a/ogcp/templates/actions/reboot.html +++ b/ogcp/templates/actions/reboot.html @@ -2,6 +2,8 @@ {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} +{% set sidebar_state = 'disabled' %} + {% block nav_power %} active{% endblock %} {% block nav_power_reboot %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/session.html b/ogcp/templates/actions/session.html index 3bbeb10..3e581a1 100644 --- a/ogcp/templates/actions/session.html +++ b/ogcp/templates/actions/session.html @@ -1,6 +1,8 @@ {% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_client %} active{% endblock %} {% block nav_client_session %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/setup.html b/ogcp/templates/actions/setup.html index 84f4d4d..bad143d 100644 --- a/ogcp/templates/actions/setup.html +++ b/ogcp/templates/actions/setup.html @@ -1,5 +1,7 @@ {% extends 'commands.html' %} +{% set sidebar_state = 'disabled' %} + {% block nav_setup %} active{% endblock %} {% block nav_setup_setup %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/software.html b/ogcp/templates/actions/software.html index 9393537..253ea30 100644 --- a/ogcp/templates/actions/software.html +++ b/ogcp/templates/actions/software.html @@ -1,6 +1,8 @@ {% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_inventory %} active{% endblock %} {% block nav_inventory_software %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/software_list.html b/ogcp/templates/actions/software_list.html index 8c50edb..3984be6 100644 --- a/ogcp/templates/actions/software_list.html +++ b/ogcp/templates/actions/software_list.html @@ -1,6 +1,8 @@ {% extends 'commands.html' %} {% import "bootstrap/wtf.html" as wtf %} +{% set sidebar_state = 'disabled' %} + {% block nav_inventory %} active{% endblock %} {% block nav_inventory_software %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/actions/wol.html b/ogcp/templates/actions/wol.html index 9a41a75..b108adb 100644 --- a/ogcp/templates/actions/wol.html +++ b/ogcp/templates/actions/wol.html @@ -2,6 +2,8 @@ {% import "bootstrap/wtf.html" as wtf %} {% import "macros.html" as macros %} +{% set sidebar_state = 'disabled' %} + {% block nav_power %} active{% endblock %} {% block nav_power_wol %} active{% endblock %} {% block content %} diff --git a/ogcp/templates/commands.html b/ogcp/templates/commands.html index 9fa8617..5298bcc 100644 --- a/ogcp/templates/commands.html +++ b/ogcp/templates/commands.html @@ -12,7 +12,7 @@ {% endblock %} {% block sidebar %} - {{ macros.scopes_tree_collapse(scopes) }} + {{ macros.scopes_tree_collapse(scopes, sidebar_state) }} {% endblock %} {% block commands %} diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html index 19ec8c7..fed48a6 100644 --- a/ogcp/templates/macros.html +++ b/ogcp/templates/macros.html @@ -1,7 +1,7 @@ -{% macro scopes_tree_collapse(scopes) -%} +{% macro scopes_tree_collapse(scopes, state='') -%} <ul id="scopes" class="nav flex-column nav-pills"> - {{ scopes_tree_collapse_level(scopes["scope"], 1, "") }} + {{ scopes_tree_collapse_level(scopes["scope"], 1, "", state) }} </ul> <script> // Launch the javascript on document ready, so all the global functions exists @@ -19,12 +19,12 @@ {% endmacro %} -{% macro scopes_tree_collapse_level(scopes, i, parent_id) -%} +{% macro scopes_tree_collapse_level(scopes, i, parent_id, state) -%} {% for scope in scopes %} <li id="{{ scope["name"]|replace(".", "_") }}_{{ scope["id"] }}" class="nav-item"> {% if " ".join(scope["ip"]) %} <input class="form-check-input" type="checkbox" form="scopesForm" - value="{{ " ".join(scope["ip"]) }}" + value="{{ " ".join(scope["ip"]) }}" {{ state }} {% if scope.get("selected", False) %}checked{% endif %} name="{{ scope["name"] }}_{{ scope["id"] }}" /> {% endif %} @@ -42,7 +42,7 @@ </a> {% if scope["scope"] %} <ul class="nav flex-column collapse level{{i}}" id="id{{parent_id ~ "_" ~ i ~ "-" ~ loop.index}}"> - {{ scopes_tree_collapse_level(scope["scope"], i + 1, parent_id ~ "_" ~ i ~ "-" ~ loop.index) }} + {{ scopes_tree_collapse_level(scope["scope"], i + 1, parent_id ~ "_" ~ i ~ "-" ~ loop.index, state) }} </ul> {% endif %} </li> diff --git a/ogcp/templates/scopes.html b/ogcp/templates/scopes.html index d565c96..08e0482 100644 --- a/ogcp/templates/scopes.html +++ b/ogcp/templates/scopes.html @@ -12,7 +12,7 @@ {% endblock %} {% block sidebar %} - {{ macros.scopes_tree_collapse(scopes) }} + {{ macros.scopes_tree_collapse(scopes, sidebar_status) }} {% endblock %} {% block commands %} |