From dba0da249e5c63259318330e901522f5ea8ff57a Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Sat, 24 Oct 2020 00:52:25 +0200 Subject: [PATCH] Add paginator, updates machines, create aff_machines, and minor changes --- machines/templates/machines/aff_iptype.html | 14 +- machines/templates/machines/aff_machines.html | 175 +++++++++--------- machines/templates/machines/aff_portlist.html | 100 ++++++++++ machines/templates/machines/index_iptype.html | 2 + .../templates/machines/index_portlist.html | 51 +---- machines/views.py | 2 + .../templates/multi_op/aff_room_state.html | 111 +++++++---- topologie/templates/topologie/aff_switch.html | 8 + 8 files changed, 283 insertions(+), 180 deletions(-) create mode 100644 machines/templates/machines/aff_portlist.html diff --git a/machines/templates/machines/aff_iptype.html b/machines/templates/machines/aff_iptype.html index 4fe373ab..c6123f58 100644 --- a/machines/templates/machines/aff_iptype.html +++ b/machines/templates/machines/aff_iptype.html @@ -29,10 +29,9 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load i18n %} {% if iptype_list.paginator %} -{% include 'pagination.html' with list=iptype_list %} + {% include 'pagination.html' with list=iptype_list %} {% endif %} - {% for type in iptype_list %}
@@ -59,8 +58,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
- -
+
+
@@ -83,9 +82,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
-
+ {% endfor %} - - +{% if iptype_list.paginator %} + {% include 'pagination.html' with list=iptype_list %} +{% endif %} diff --git a/machines/templates/machines/aff_machines.html b/machines/templates/machines/aff_machines.html index 8e738df3..6d97d1c5 100644 --- a/machines/templates/machines/aff_machines.html +++ b/machines/templates/machines/aff_machines.html @@ -26,36 +26,22 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load logs_extra %} {% load i18n %} -
- {% if machines_list.paginator %} - {% include 'pagination.html' with list=machines_list go_to_id="machines" %} - {% endif %} +{% if machines_list.paginator %} + {% include 'pagination.html' with list=machines_list %} +{% endif %} - - - {% trans "DNS name" as tr_dns_name %} - - - - - - - {% for machine in machines_list %} - - - - + + + + +
+
+
{% include 'buttons/sort.html' with prefix='machine' col='name' text=tr_dns_name %}{% trans "Type" %}{% trans "MAC address" %}{% trans "IP address" %}{% trans "Actions" %}
- {% trans "No name" as tr_no_name %} - {% trans "View the profile" as tr_view_the_profile %} - {% if machine.active %} - - {% else %} - {% trans "Deactivated" %}: - {% endif %} - {{ machine.get_name|default:tr_no_name }} - - {{ machine.user }} - - +{% for machine in machines_list %} +
+
+
+
+
+ {% trans "No name" as tr_no_name %} + {{ machine.user }} + + {{ machine.get_name|default:tr_no_name }} +
+
{% can_create Interface machine.id %} {% trans "Create an interface" as tr_create_an_interface %} {% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc=tr_create_an_interface %} @@ -64,8 +50,22 @@ with this program; if not, write to the Free Software Foundation, Inc., {% can_delete machine %} {% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %} {% acl_end %} -
+ + + + + + + + + {% for interface in machine.interface_set.all %} - - - - {% if ipv6_enabled and interface.ipv6 != 'None' %} - - - - {% endif %} - {% if interface.domain.related_domain.all %} - - - - {% endif %} - {% endfor %} - - - + + + + {% if ipv6_enabled and interface.ipv6 != 'None' %} + + + + {% endif %} + {% if interface.domain.related_domain.all %} + + + + {% endif %} {% endfor %} - -
{% trans "DNS name"%}{% trans "Type" %}{% trans "MAC address" %}{% trans "IP address" %}{% trans "Actions" %}
@@ -74,7 +74,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% else %} {{ interface.domain }} @@ -159,59 +159,64 @@ with this program; if not, write to the Free Software Foundation, Inc., {% acl_end %}
-
-
    -
  • - {{ interface.get_vendor }} -
  • -
-
-
-
-
    - {% for ipv6 in interface.ipv6.all %} -
  • - {{ ipv6 }} -
  • - {% endfor %} -
-
-
-
-
    - {% for al in interface.domain.related_domain.all %} -
  • - - {{ al }} - - -
  • - {% endfor %} -
-
-
+
+
    +
  • + {{ interface.get_vendor }} +
  • +
+
+
+
+
    + {% for ipv6 in interface.ipv6.all %} +
  • + {{ ipv6 }} +
  • + {% endfor %} +
+
+
+
+
    + {% for al in interface.domain.related_domain.all %} +
  • + + {{ al }} + + +
  • + {% endfor %} +
+
+
+ +
+ + +{% endfor %} - - {% if machines_list.paginator %} - {% include 'pagination.html' with list=machines_list go_to_id="machines" %} - {% endif %} - diff --git a/machines/templates/machines/aff_portlist.html b/machines/templates/machines/aff_portlist.html new file mode 100644 index 00000000..814e0b55 --- /dev/null +++ b/machines/templates/machines/aff_portlist.html @@ -0,0 +1,100 @@ +{% comment %} +Re2o est un logiciel d'administration développé initiallement au rezometz. Il +se veut agnostique au réseau considéré, de manière à être installable en +quelques clics. + +Copyright © 2017 Gabriel Détraz +Copyright © 2017 Lara Kermarec +Copyright © 2017 Augustin Lemesle + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +{% endcomment %} + +{% load design %} + +{% load acl %} +{% load logs_extra %} +{% load i18n %} + +{% if port_list.paginator %} + {% include 'pagination.html' with list=port_list %} +{% endif %} + +{% for ports in port_list %} +
+
+
+
+
+

{{ ports.name }}

+
+
+ {% can_edit ports %} + {% include 'buttons/edit.html' with href='machines:edit-portlist' id=ports.id %} + {% acl_end %} + {% can_delete ports %} + {% include 'buttons/suppr.html' with href='machines:del-portlist' id=ports.id %} + {% acl_end %} +
+
+
+
+
+
+ + + + + + + + + + + + + + + +
{% trans "TCP (input)" %}{% trans "TCP (output)" %}{% trans "UDP (input)" %}{% trans "UDP (output)" %}
{% for p in ports.tcp_ports_in %}{{ p.show_port }}, {% endfor %}{% for p in ports.tcp_ports_out %}{{ p.show_port }}, {% endfor %}{% for p in ports.udp_ports_in %}{{ p.show_port }}, {% endfor %}{% for p in ports.udp_ports_out %}{{ p.show_port }}, {% endfor %}
+
+
+ +
+{% endfor %} + +{% if port_list.paginator %} + {% include 'pagination.html' with list=port_list %} +{% endif %} + diff --git a/machines/templates/machines/index_iptype.html b/machines/templates/machines/index_iptype.html index 65f78f74..38a3a8ad 100644 --- a/machines/templates/machines/index_iptype.html +++ b/machines/templates/machines/index_iptype.html @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block title %}{% trans "Machines" %}{% endblock %} {% block content %} +

{% trans "List of IP types" %}

{% can_create IpType %} @@ -39,5 +40,6 @@ with this program; if not, write to the Free Software Foundation, Inc., {% trans "Delete one or several IP types" %} +
{% include 'machines/aff_iptype.html' with iptype_list=iptype_list %} {% endblock %} diff --git a/machines/templates/machines/index_portlist.html b/machines/templates/machines/index_portlist.html index 671f8e74..867e51d0 100644 --- a/machines/templates/machines/index_portlist.html +++ b/machines/templates/machines/index_portlist.html @@ -14,52 +14,7 @@ {% trans "Add a configuration" %} {% acl_end %} - - - - - - - - - - - - - {% for pl in port_list %} - - - - - - - - - {% endfor %} -
{% trans "Name" %}{% trans "TCP (input)" %}{% trans "TCP (output)" %}{% trans "UDP (input)" %}{% trans "UDP (output)" %}{% trans "Machines" %}
{{ pl.name }}{% for p in pl.tcp_ports_in %}{{ p.show_port }}, {% endfor %}{% for p in pl.tcp_ports_out %}{{ p.show_port }}, {% endfor %}{% for p in pl.udp_ports_in %}{{ p.show_port }}, {% endfor %}{% for p in pl.udp_ports_out %}{{ p.show_port }}, {% endfor %} - {% if pl.interface_set.all %} - - {% endif %} - - {% can_edit pl %} - {% include 'buttons/edit.html' with href='machines:edit-portlist' id=pl.id %} - {% acl_end %} - {% can_delete pl %} - {% include 'buttons/suppr.html' with href='machines:del-portlist' id=pl.id %} - {% acl_end %} -
+

+ + {% include 'machines/aff_portlist.html' with port_list=port_list %} {% endblock %} diff --git a/machines/views.py b/machines/views.py index 76d12eca..811bf2a0 100644 --- a/machines/views.py +++ b/machines/views.py @@ -1351,11 +1351,13 @@ def aff_profil(request, user): @can_view_all(IpType) def index_iptype(request): """View used to display the list of existing types of IP.""" + pagination_large_number = GeneralOption.get_cached_value("pagination_large_number") iptype_list = ( IpType.objects.select_related("extension") .select_related("vlan") .order_by("name") ) + iptype_list = re2o_paginator(request, iptype_list, pagination_large_number) return render(request, "machines/index_iptype.html", {"iptype_list": iptype_list}) diff --git a/multi_op/templates/multi_op/aff_room_state.html b/multi_op/templates/multi_op/aff_room_state.html index bdfdd98b..f58e8148 100644 --- a/multi_op/templates/multi_op/aff_room_state.html +++ b/multi_op/templates/multi_op/aff_room_state.html @@ -30,44 +30,79 @@ with this program; if not, write to the Free Software Foundation, Inc., {% include 'pagination.html' with list=room_list %} {% endif %} - - - - {% trans "Room" as tr_room %} - {% trans "Building" as tr_building %} - - - - - - - - - - - {% for room in room_list %} - - - - - - - - - - - {% endfor %} -
{% include 'buttons/sort.html' with prefix='building' col='name' text=tr_building %}{% include 'buttons/sort.html' with prefix='room' col='name' text=tr_room %}{% trans "Connnected to" %}{% trans "User" %}{% trans "Details" %}{% trans "End of subscription on" %}{% trans "Internet access" %}{% trans "Action" %}
{{ room.building }}{{ room.name }}{% if room.port_set.all %}{{ asso_name }}{% else %}{% trans "Other operator" %}{% endif %}{% if room.adherent %}{{ room.adherent }}{% else %} {% trans "None" %}{% endif %}{{ room.details }}{% if room.adherent.is_adherent %}{% else %}{% endif %}{% if room.adherent.end_adhesion %}{{ room.adherent.end_adhesion}}{% else %}{% trans "Non member" %}{% endif %} - {% if room.adherent.has_access == True %} - {% trans "Active" %} - {% else %} - {% trans "Disabled" %} - {% endif %} - - {% if room.port_set.all %} - - {% endif %} -
+{%for room in room_list %} +
+
+
+
+
+

{{ room.building }} - {{room.name }}

+
+
+ {% if room.port_set.all %} + + {% endif %} +
+
+
+
+
+
+ + + + + + + + + + + + + + + +
{% trans "User"%}{% trans "Connected to"%}{% trans "End of subscription on" %}{% trans "Internet access" %}
+ {% if room.adherent %} + {{ room.adherent }} + {% else %} + {% trans "None" %} + {% endif %} + + {% if room.port_set.all %} + {{ asso_name }} + {% else %} + {% trans "Other operator" %} + {% endif %} + + {% if room.adherent.is_adherent %} + + {% else %} + + {% endif %} + {% if room.adherent.end_adhesion %} + {{ room.adherent.end_adhesion}} + {% else %} + {% trans "Non member" %} + {% endif %} + + + {% if room.adherent.has_access == True %} + {% trans "Active" %} + {% else %} + {% trans "Disabled" %} + {% endif %} +
+
+
+ {% if room.details %} + + {% endif %} +
+{% endfor %} {% if room_list.paginator %} {% include 'pagination.html' with list=room_list %} diff --git a/topologie/templates/topologie/aff_switch.html b/topologie/templates/topologie/aff_switch.html index a3ce33ed..86c899ba 100644 --- a/topologie/templates/topologie/aff_switch.html +++ b/topologie/templates/topologie/aff_switch.html @@ -26,6 +26,10 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load logs_extra %} {% load i18n %} +{% if switch_list.paginator %} + {% include 'pagination.html' with list=switch_list %} +{% endif %} + {% for switch in switch_list %}
@@ -85,3 +89,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %} +{% if switch_list.paginator %} + {% include 'pagination.html' with list=switch_list %} +{% endif %} +