{% extends "base_objectbrowser.html" %}
{% load i18n %}

{% block content %}

    {% if query %}
    {% trans "This was your query: " %}<pre>{{ query }}</pre>
    {%  endif %}
    {% if results %}
        {% trans "Results:" %}
        <table class="table well">
            <tr>
                {% for i in header %}
                    <th>{{ i }}</th>
                {% endfor %}
            </tr>
            {% for row in results %}
                <tr>
                    {% for x in row.values %}
                        <td>{{ x }}</td>
                    {% endfor %}
                </tr>
            {% endfor %}
        </table>
    {% endif %}
    {% if table %}

        <form action="" method="get" class="form-horizontal">
            {% trans "Limit results to: " %}<input name="limit" id="id_limit" value=10>{% trans " rows." %}
            <button name="submit" type="submit">{% blocktrans %}Get {{ table }}{% endblocktrans %}</button>
            <br>
            {% blocktrans %}Show only the following columns {{ table }}:{% endblocktrans %}
            <input type="hidden" value="{{ table }}" name=table>
            <table class="well table" border=1>
                <tr>
                    <th><input title="select all" type="checkbox" name="check_all"></th>
                    <th>{% trans "Column Name" %}</th>
                    <th>{% trans "Type" %}</th>
                    <th>{% trans "Description" %}</th>
                </tr>
                {% for i in columns %}
                <tr>
                    <td><input type="checkbox" name="check_{{ i.name }}" {% if i.name == "name" %}checked="checked"{% endif %}{% if i.name == "host_name" %}checked="checked"{% endif %}{% if i.name == "description" %}checked="checked"{% endif %}></td>
                    <td>{{ i.name }}</td>
                    <td>{{ i.type }}</td>
                    <td>{{ i.description }}</td>
                </tr>
                {% endfor %}
            </table>
        </form>

    {% else %}
        {% trans "Please select a table in the sidebar to the right." %}
    {% endif %}

{% endblock %}

{%  block sidebar %}
    <h5>Tables</h5>
    <ul>
    <li><a href="?table=hosts" title="{% trans "your Nagios hosts" %}">{% trans "hosts" %}</a></li>
    <li><a href="?table=services" title="{% trans "your Nagios services, joined with all data from hosts" %}">{% trans "services" %}</a></li>
    <li><a href="?table=hostgroups" title="{% trans "you Nagios hostgroups" %}">{% trans "hostgroups" %}</a></li>
    <li><a href="?table=servicegroups" title="{% trans "Your Nagios Servicegroups" %}">{% trans "servicegroups" %}</a></li>
    <li><a href="?table=contactgroups" title="{% trans "you Nagios contact groups" %}">{% trans "contactgroups" %}</a></li>
    <li><a href="?table=servicesbygroup" title="{% trans "all services grouped by service groups" %}">{% trans "servicesbygroup" %}</a></li>
    <li><a href="?table=servicesbyhostgroup" title="{% trans "all services grouped by host groups" %}">{% trans "servicesbyhostgroup" %}</a></li>
    <li><a href="?table=hostsbygroup" title="{% trans "all hosts group by host groups" %}">{% trans "hostsbygroup" %}</a></li>
    <li><a href="?table=contacts" title="{% trans "your Nagios contacts" %}">{% trans "contacts" %}</a></li>
    <li><a href="?table=commands" title="{% trans "your defined Nagios commands" %}">{% trans "commands" %}</a></li>
    <li><a href="?table=timeperiods" title="{% trans "time period definitions (currently only name and alias)" %}">{% trans "timeperiods" %}</a></li>
    <li><a href="?table=downtimes" title="{% trans "all scheduled host and service downtimes, joined with data from hosts and services" %}">{% trans "downtimes" %}</a></li>
    <li><a href="?table=comments" title="{% trans "all host and service comments" %}">{% trans "comments" %}</a></li>
    <li><a href="?table=log" title="{% trans "a transparent access to the nagios logfiles (include archived ones)ones" %}">{% trans "log" %}</a></li>
    <li><a href="?table=status" title="{% trans "general performance and status information. This table contains exactly one dataset." %}">{% trans "status" %}</a></li>
    <li><a href="?table=colimns" title="{% trans "a complete list of all tables and columns available via Livestatus, including descriptions!" %}">{% trans "columns" %}</a></li>
    <li><a href="?table=statehist" title="{% trans "sla statistics for hosts and services, joined with data from" %}">{% trans "statehist" %}</a> </li>
    </ul>
{% endblock %}
