8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +00:00

Gestion automatique des switchs, affichage plus clair

This commit is contained in:
Gabriel Detraz 2018-07-11 01:37:08 +02:00
parent 3d881c4f40
commit e623813312
2 changed files with 18 additions and 10 deletions

View file

@ -236,12 +236,18 @@ class OptionalTopologie(AclMixin, PreferencesModel):
help_text="Plage d'ip de management des switchs" help_text="Plage d'ip de management des switchs"
) )
@cached_property @cached_property
def provisioned_switchs(self): def provisioned_switchs(self):
"""Liste des switches provisionnés"""
from topologie.models import Switch from topologie.models import Switch
return Switch.objects.filter(automatic_provision=True) return Switch.objects.filter(automatic_provision=True)
@cached_property
def provision_switchs_enabled(self):
"""Return true if all settings are ok : switchs on automatic provision,
ip_type"""
return bool(self.provisioned_switchs and self.switchs_ip_type)
class Meta: class Meta:
permissions = ( permissions = (
("view_optionaltopologie", "Peut voir les options de topologie"), ("view_optionaltopologie", "Peut voir les options de topologie"),

View file

@ -123,9 +123,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Rest management, activé si provision auto</th> <th>Rest management, activé si provision auto</th>
<td>{{ topologieoptions.switchs_rest_management }}</td> <td>{{ topologieoptions.switchs_rest_management }}</td>
</tr> </tr>
</table>
<h5>{% if topologieoptions.provision_switchs_enabled %}<span class="label label-success">Provision de la config des switchs{% else %}<span class="label label-danger">Provision de la config des switchs{% endif%}</span></h5>
<table class="table table-striped">
<tr>
<th>Switchs configurés automatiquement</th>
<td>{{ topologieoptions.provisioned_switchs|join:", " }} {% if topologieoptions.provisioned_switchs %}<span class="label label-success"> OK{% else %}<span class="label label-danger">Manquant{% endif %}</span></td>
</tr>
<tr> <tr>
<th>Plage d'ip de management des switchs</th> <th>Plage d'ip de management des switchs</th>
<td>{{ topologieoptions.switchs_ip_type }}</td> <td>{{ topologieoptions.switchs_ip_type }} {% if topologieoptions.switchs_ip_type %}<span class="label label-success"> OK{% else %}<span class="label label-danger">Manquant{% endif %}</span></td>
</tr> </tr>
</table> </table>
@ -135,14 +145,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% acl_end %} {% acl_end %}
{% include "preferences/aff_radiuskey.html" with radiuskey_list=radiuskey_list %} {% include "preferences/aff_radiuskey.html" with radiuskey_list=radiuskey_list %}
<h5>{% if topologieoptions.provisioned_switchs %}<span class="label label-success">Provision de la config des switchs{% else %}<span class="label label-danger">Provision de la config des switchs{% endif%}</span></h5>
<table class="table table-striped">
<tr>
<th>Switchs configurés automatiquement</th>
<td>{{ topologieoptions.provisioned_switchs|join:", " }}</td>
</tr>
</table>
<h4>Préférences generales</h4> <h4>Préférences generales</h4>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'GeneralOption' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'GeneralOption' %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>