{% extends "base2.html" %}
{% block title %}Okconfig{% endblock %}


{% block adagios_hausinn %}
        <ul class="breadcrumb">
            <li>
                <a href="{% url home %}">Home</a> <span class="divider">/</span>
            </li>
            <li>
                {% block nav1 %}
                    okconfig
                {% endblock %}
                <span class="divider">/</span>
                {% block nav2 %}
                {% endblock %}
            </li>
        </ul>
        <h2>
            <i class="icon-th-large"></i> <small>{% block smallheader %}block=smallheader{% endblock%} </small> {% block largeheader %}block=largeheader{% endblock %}
        </h2>
{% endblock %}


{% block sidebar %}
    <h5>Actions</h5>
    <ul class="nav nav-list">
        <li><a href="{% url okconfig_.views.addhost %}?host_name={{ host_name }}"><i class="icon-pencil"></i>Add Host</a></li>
        <li><a href="{% url okconfig_.views.addtemplate %}?host_name={{ host_name }}"><i class="icon-pencil"></i>Add Template</a></li>
        <li><a href="{% url okconfig_.views.addgroup %}"><i class="icon-pencil"></i>Add Group</a></li>
        <li><a href="{% url okconfig_.views.choose_host %}/{{ host_name }}?host_name={{ host_name }}"><i class="icon-pencil"></i>Edit Templates</a></li>
        <li><a href="{% url okconfig_.views.install_agent %}?remote_host={{ host_name }}"><i class="icon-pencil"></i>Install Agent</a></li>
        <li><a href="{% url okconfig_.views.scan_network %}"><i class="icon-search"></i>Scan Network</a></li>
    </ul>
{% endblock %}

{% block footer %}
    {{ block.super }}
    <!-- Use bootstrap style tooltips -->
    <script>
        $(document).ready(function() {
            $("[rel=tooltip]").popover();
            $("#popover").popover();
        });
    </script>

    <!-- Print a list of templates when one is selected -->
    <script>
        $('select#id_template_name').change(function() {
            $.getJSON('{% url rest/pynag %}json/get_objects',
                    {
                        object_type: 'service',
                        name__startswith: 'okc-' + $(this).val() + '-',
                        with_fields: 'service_description'
                    },
                    function(data) {
                        $('#template_services').html('');
                        var sorted = data.slice(0).sort(function(a, b) {
                            return a - b;
                        });
                        $.each(sorted, function(k, s) {
                            if (s['service_description'] != "null" &&
                                    s['service_description'] != "none" &&
                                    s['service_description'] != "null") {
                                $('#template_services').append('"' + s['service_description'] + "'<br/>");
                            }

                        });
                    }
            );
        });
    </script>
{% endblock %}