{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Networks" %} - {{ compute.name }}{% endblock %}
{% block content %}
           <!-- Page Heading -->
            <div class="row">
                <div class="col-lg-12">
                    {% include 'create_net_block.html' %}
                    <h1 class="page-header">{{ compute.name }}</h1>
                    <ol class="breadcrumb">
                        <li class="active">
                            <i class="fa fa-dashboard"></i> <a href="{% url 'overview' compute.id %}">{% trans "Overview" %}</a>
                        </li>
                        <li>
                            <i class="fa fa-hdd-o"></i> <a href="{% url 'storages' compute.id %}">{% trans "Storages" %}</a>
                        </li>
                        <li>
                            <i class="fa fa-sitemap"></i> {% trans "Networks" %}
                        </li>
                        <li>
                            <i class="fa fa-wifi"></i> <a href="{% url 'interfaces' compute.id %}">{% trans "Interfaces" %}</a>
                        </li>
                        <li>
                            <i class="fa fa-key"></i> <a href="{% url 'secrets' compute.id %}">{% trans "Secrets" %}</a>
                        </li>
                    </ol>
                </div>
            </div>
            <!-- /.row -->

            {% include 'errors_block.html' %}

            <div class="row">
                {% if not networks %}
                    <div class="col-lg-12">
                        <div class="alert alert-warning alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning:" %}</strong> {% trans "Hypervisor doesn't have any Networks" %}
                        </div>
                    </div>
                {% else %}
                    {% for pool in networks %}
                        <div class="col-xs-12 col-sm-4">
                            <div class="panel {% if pool.status %}panel-success{% else %}panel-danger{% endif %} panel-data">
                                <div class="panel-heading">
                                    <h3 class="panel-title"><a href="{% url 'network' compute.id pool.name %}">{{ pool.name }}</a></h3>
                                </div>
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-xs-4 col-sm-4">
                                            <p><strong>{% trans "Device:" %}</strong></p>
                                            <p><strong>{% trans "Forward:" %}</strong></p>
                                        </div>
                                        <div class="col-xs-6 col-sm-7">
                                            <p>{{ pool.device }}</p>
                                            <p>{{ pool.forward|upper }}</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    {% endfor %}
                {% endif %}
            </div>
{% endblock %}
{% block script %}
<script>
    $(document).ready(function () {
        $('#forward_select').change(function (eventObject) {
            if ($(this).val() == 'bridge') {
                $('.bridge_name_form_group').show();
                $('.bridge_name_form_group_dhcp').hide();
            } else {
                $('.bridge_name_form_group').hide();
                $('.bridge_name_form_group_dhcp').show();
            }
        }).change();
    });
</script>
{% endblock %}