{% extends "base.html" %}
{% set active_page = "admin_console" %}
{% block title %}<title>Admin Console - {{ SITE_NAME }}</title>{% endblock %}

{% block dashboard_stat %}
<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        PowerDNS server configuration & statistics
    </h1>
    <ol class="breadcrumb">
        <li><a href="{{ url_for('dashboard.dashboard') }}"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">Admin Console</li>
    </ol>
</section>
{% endblock %}

{% block content %}
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <h3 class="box-title">PDNS Statistics</h3>
                </div>
                <div class="box-body">
                    <table id="tbl_statistics" class="table table-bordered table-striped">
                        <thead>
                            <tr>
                                <th width="6%">Docs</th>
                                <th>Statistic</th>
                                <th>Value</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for statistic in statistics %}
                            <tr class="odd gradeX">
                                <td><a href="https://google.com/search?q=site:doc.powerdns.com+{{ statistic['name'] }}"
                                        target="_blank" class="btn btn-flat btn-xs blue"><i
                                            class="fa fa-search"></i></a></td>
                                <td>{{ statistic['name'] }}</td>
                                <td>{{ statistic['value'] }}</td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <h3 class="box-title">PDNS Configuration</h3>
                </div>
                <div class="box-body">
                    <table id="tbl_configuration" class="table table-bordered table-striped">
                        <thead>
                            <tr>
                                <th width="6%">Docs</th>
                                <th>Statistic</th>
                                <th>Value</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for config in configs %}
                            <tr class="odd gradeX">
                                <td><a href="https://google.com/search?q=site:doc.powerdns.com+{{ config['name'] }}"
                                        target="_blank" class="btn btn-flat btn-xs blue"><i
                                            class="fa fa-search"></i></a></td>
                                <td>{{ config['name'] }}</td>
                                <td>
                                    {{ config['value'] }}
                                </td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
</section>
{% endblock %}
{% block extrascripts %}
<script>
    // set up statistics data table
    $("#tbl_statistics").DataTable({
        "paging": true,
        "lengthChange": false,
        "searching": true,
        "ordering": true,
        "info": true,
        "autoWidth": false
    });

    // set up configuration data table
    $("#tbl_configuration").DataTable({
        "paging": true,
        "lengthChange": false,
        "searching": true,
        "ordering": true,
        "info": true,
        "autoWidth": false
    });
</script>
{% endblock %}
