Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

machine.html 2.8 KB
Newer Older
1
{% extends "machines/sidebar.html" %}
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
{% 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  Goulven 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 %}

26 27 28 29 30
{% load bootstrap3 %}

{% block title %}Création et modification de machines{% endblock %}

{% block content %}
chirac's avatar
chirac committed
31
{% if machineform %}
32
{% bootstrap_form_errors machineform %}
chirac's avatar
chirac committed
33
{% endif %}
34
{% if interfaceform %}
35
{% bootstrap_form_errors interfaceform %}
36
{% endif %}
chirac's avatar
chirac committed
37
{% if domainform %}
38
{% bootstrap_form_errors domainform %}
chirac's avatar
chirac committed
39 40
{% endif %}

41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
<script>
    var type_to_ipv4 = {
        type: [{% for type, iplist in type_to_ipv4.items %}"{{ type }}",{% endfor %}],
        iplist: [{% for type, iplist in type_to_ipv4.items %}
            [{% for ip in iplist %} {id:"{{ ip.id }}", ip:"{{ ip.ipv4 }}"},
            {% endfor %}], {% endfor %}
        ]
    }
    $(document).ready(function() {
        $("#id_ipv4").html("<option value='' selected='selected'>Choisisez un type de machine d'abord</options>");
        $("#id_type").change(function() {
            var val = $(this).val();
	    var options = "<option value='' selected='selected'>Assignation automatique de l'ipv4</option>";
	    for (var i = 0; i < type_to_ipv4.type.length; i++) {
                if (type_to_ipv4.type[i] == val) {
                    for (var j = 0; j < type_to_ipv4.iplist[i].length; j++) {
                        options += "<option value='"+type_to_ipv4.iplist[i][j].id+"'>"+type_to_ipv4.iplist[i][j].ip+"</option>";
                    }
                }
            }
            $("#id_ipv4").html(options)
	});
    });
</script>
65 66 67

<form class="form" method="post">
    {% csrf_token %}
chirac's avatar
chirac committed
68
    {% if machineform %}
69
    {% bootstrap_form machineform %}
chirac's avatar
chirac committed
70
    {% endif %}
71
    {% if interfaceform %}
72
    {% bootstrap_form interfaceform %}
73
    {% endif %}
chirac's avatar
chirac committed
74 75 76
    {% if domainform %}
    {% bootstrap_form domainform %}
    {% endif %}
77 78 79 80 81 82
    {% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
</form>
  <br />
  <br />
  <br />
{% endblock %}