Browse Source

Gestion automatique des switchs, affichage plus clair

reminder-serializer
Gabriel Detraz 8 years ago
committed by grizzly
parent
commit
76183df6a8
  1. 8
      preferences/models.py
  2. 12
      preferences/templates/preferences/display_preferences.html

8
preferences/models.py

@ -225,12 +225,18 @@ class OptionalTopologie(AclMixin, PreferencesModel):
help_text="Plage d'ip de management des switchs"
)
@cached_property
def provisioned_switchs(self):
"""Liste des switches provisionnés"""
from topologie.models import Switch
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:
permissions = (
("view_optionaltopologie", _("Can view the topology options")),

12
preferences/templates/preferences/display_preferences.html

@ -132,9 +132,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Rest management, activé si provision auto</th>
<td>{{ topologieoptions.switchs_rest_management }}</td>
</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>
<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>
</table>

Loading…
Cancel
Save