host-edit.html 2.68 KB
Newer Older
1 2 3 4 5 6 7 8 9
{% extends "network/base.html" %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% load crispy_forms_tags %}

{% block content %}
<div class="page-header">
10
    <a href="{% url "network.host_delete" pk=host_pk%}" class="btn btn-danger pull-right"><i class="icon-remove-sign"></i> {% trans "Delete this host" %}</a>
11 12 13 14
    <h2>{{ form.hostname.value }}</h2>
</div>

<div class="row">
15
    <div class="col-sm-7">
16 17
        {% crispy form %}
    </div>
18
    <div class="col-sm-5">
19
        <div class="page-header">
20
            <a href="{% url "network.rule_create" %}?host={{ host_pk }}" class="btn btn-success pull-right btn-xs"><i class="icon-plus-sign"></i> {% trans "Add new rule" %}</a>
21 22 23 24 25 26 27 28 29 30 31
            <h3>{% trans "Rules" %}</h3>
        </div>
        {% if rule_list.data.data.count > 0 %}
            {% render_table rule_list %}
        {% else %}
            {% trans "No rules associated with this host!" %}
        {% endif %}
        
        <div class="page-header">
            <h3>{% trans "Groups" %}</h3>
        </div>
32 33
        {% if group_rule_list|length > 0 %}
            {% for group in group_rule_list %}
34 35
            <div>
                <h4 id="{{ group.pk }}_group_pk">{{ group.name }} 
36
                    <a href="{% url "network.remove_host_group" pk=host_pk group_pk=group.pk %}?from={{ request.path }}">
37
                        <i class="icon-remove" style="vertical-align: middle;"></i></a>
38
                <a href="{% url "network.group" group.pk %}">
39 40 41
                    <i class="icon-pencil" style="vertical-align: middle;"></i></a>
                </h4>
            </div>
42 43 44 45
            {% endfor %}
        {% else %}
            {% trans "This host is not added to any host groups!" %}
        {% endif %}
46 47 48 49 50 51 52

    <div class="page-header">
        <h3>Add host group</h3>
    </div>
    {% if not_used_groups|length == 0 %}
      No more groups to add!
    {% else %}
53
        <form action="{% url "network.add_host_group" pk=host_pk %}" method="POST">
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
        {% csrf_token %}
            <div class="input-group">
                <select name="group" id="add_group" class="form-control">
                    {% for rest in not_used_groups %}
                        <option value="{{ rest.pk }}">{{ rest }}</option>
                    {% endfor %}
                </select>
                <div class="input-group-btn">
                    <input type="submit" value="{% trans "Add group" %}" class="btn btn-default"></input>
                </div>
            </div><!-- input-group -->
        </form>
    {% endif %}
    </div><!-- col-sm-4 -->
</div><!-- row -->

{% endblock %}
71 72 73 74

{% block extra_etc %}
<script src="{% static "js/host.js" %}"></script>
{% endblock %}