{% extends "rockload/apps/base/auth_base.html" %}

{% block css %}
    <link rel="stylesheet" href="/static/rockload/apps/main/css/test_details.css" />
{% end %}

{% block offgrid %}
<div class="grey">
   
    <div class="container statistics-container">
        {% if test_scheduled %}
        <div class="alert-message success">
            <a class="close" href="#">×</a>
            <p><strong>Test</strong> scheduled successfully!</p>
        </div>
        {% end %}

        <h1 class="title">{{ project.name }} - {{ test.name }} (<a class="view-tests" href="#tests">view tests</a>)</h1>
        <h2 class="statistics">Statistics</h2>
        <div class="main-container row">
            <div class="span4 columns">
                <h2 class="test-statistics">{{ test.stats.number_of_tests }}</h2>
            </div>
            <div class="span4 columns">
                <h2 class="test-statistics">{{ test.stats.total_duration }}</h2>
            </div>
            <div class="span4 columns">
                <h2 class="test-statistics">{{ test.stats.avg_reqs_sec }}</h2>
            </div>
            <div class="span4 columns">
                <h2 class="test-statistics">{{ test.stats.avg_response_time }}s</h2>
            </div>
        </div>

        <div class="main-container row">
            <div class="span4 columns">
                <p>number of tests</p>
            </div>
            <div class="span4 columns">
                <p>total testing time</p>
            </div>
            <div class="span4 columns">
                <p>average reqs/sec</p>
            </div>
            <div class="span4 columns">
                <p>average response time</p>
            </div>
        </div>

        {% if len(test.runs) > 0 %}
        <div class="main-container row">
            <div class="span16 columns">

                <h2 class="perf-over-time">Performance over time (out of {{ len(test.runs) }} tests)</h2>

                <ul class="perf-actions">
                    <li class="action active">
                        <a href="#reqspersec">Requests per second</a>
                    </li>
                    <li class="action">
                        <a href="#avgreqtime">Average request time</a>
                    </li>
                </ul>

                <div class="chart">
                    <img src="/static/rockload/apps/main/img/chart.png" />
                </div>
                <a name="tests"></a>

            </div>
        </div>
        {% end %}
    </div>
</div>

<div class="separator"></div>

<div class="white">
    <div class="container">
        {% if len(test.runs) > 0 %}
        <div class="main-container row previous-tests">
            <h2>Previous Tests</h2>
            <div class="span16 columns funkload-test">
                <form>
                    <div class="clearfix">
                        <label for="tests">Available test results</label>
                        <div class="input">
                            <select id="available-tests" name="tests" class="test-results">
                                <option value='' selected="selected">--</option>
                                {% for result in results %}
                                <option value="/reports/{{ result.html_path }}">{{ result.formatted_date }}</option>
                                {% end %}
                            </select>
                        </div>
                    </div>
                </form>

                <div class="report">
                    <iframe id="report-item" width="100%"></iframe>
                </div>
            </div>
        </div>
        {% else %}
        <h2>No recorded tests yet.</h2>
        {% end %}

    </div>
</div>

{% end %}

{% block js %}
    <script src="/static/rockload/apps/main/js/test_details.js" type="text/javascript"></script>
{% end %}
