doctype html
html(lang="en")
    head
        title= "Turbulence Run Report"
        link(rel="stylesheet",
        href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css",
        integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7",
        crossorigin="anonymous")
        link(rel="stylesheet", href= cssPath)
        script(type="text/javascript" src="./node_modules/moment/min/moment.min.js")
        script(type="text/javascript" src="./node_modules/chart.js/dist/Chart.min.js")

    body
        nav(class="navbar navbar-default header")
            div(class="container-fluid")
                a(class="navbar-brand", href="./")
                    img(alt="Brand", height="30", src="http://turbulence.io/turbulence-logo.png")
                h2(class="navbar-left") turbulence run report

        div(class="container")
            h3 Summary
            p Total Requests: 
                span(class="TotalRequests") #{requests.length}
            p Total Average Response Time: 
                span(class="TotalAverageResponseTime") #{averageResponseTime}

        div(class="container")
            h3 Detailed Breakdown

            table(class="table")
                thead
                    tr
                        th Label
                        th Url
                        th Invocations
                        th Error Rate
                tbody
                    each req in requests
                        tr
                            th(class="Name") #{req.name}
                            th(class="Url") #{req.url}
                            th(class="Invocations") #{req.invocations}
                            - var errorRate = Math.round(req.errorRate * 10000) / 100
                            th(class="ErrorRate") #{errorRate}%
        div(class="container")
            h3 Response Times Over Time
            canvas(id="responseTimesChart")
        div(class="container")
            h3 Responses Per Interval
            canvas(id="responsesPerIntervalChart")
        script(type="text/javascript").
            responseTimesData = !{JSON.stringify(responseTimesData)};
            responsesPerIntervalData = !{JSON.stringify(responsesPerIntervalData)};
        script(type="text/javascript", src= chartjsPath)
