<!DOCTYPE html>
<html>
<head><title>Φορτίο v{{.Version}}</title>
  <script src="{{.ChartJSPath}}"></script>
  <script src="{{.Version}}/static/js/fortio_chart.js"></script>
  <link rel="icon" href="{{.Version}}/static/img/favicon.ico"/>
  <link rel="stylesheet" href="{{.Version}}/static/css/fortio.css">
</head>
{{template "header" .}}
<h1>Φορτίο (fortio) v{{.Version}}{{if not .DoLoad}} control UI{{end}}</h1>
<p>Up for {{.UpTime}} (since {{.StartTime}}).
{{if .DoLoad}}
<p>{{.Labels}} {{.TargetURL}}
<div id="running">
  Running load test... Results pending...
  <br />
  <progress id="progressBar" max="100" value="0" style="width: 100%"></progress>
  <br />
  <button type="submit" onclick='javascript:fetch("./?stop=Stop&runid={{.RunID}}");'>Interrupt</button>
</div>
<script>runTestForDuration({{.TestExpectedDurationSeconds}})</script>
<div class="chart-container" id="cc1" style="position: relative; height:75vh; width:95vw; display:none;">
  <canvas id="chart1"></canvas>
</div>
<div id="update" style="visibility: hidden">
  <form id="updtForm" action="javascript:updateChart()">
    <input type="submit" value="Update:" />
    Time axis min <input type="text" name="xmin" size="5" /> ms,
    max <input type="text" name="xmax" size="5" /> ms,
    logarithmic:<input name="xlog" type="checkbox" onclick="updateChart()" />.
    Count axis min <input type="text" name="ymin" size="5" /> ms,
    max <input type="text" name="ymax" size="5" /> ms,
    logarithmic: <input name="ylog" type="checkbox" onclick="updateChart()" />
  </form>
</div>
<pre>{{else}}
{{if .DoStop}}
<p>Stoping runs as per request.</p>
{{else}}
<form id="run-form" method="GET" onsubmit="checkPayload()">
  <div>
    Title/Labels: <input type="text" name="labels" size="40" value="Fortio" /> (empty to skip title)<br />
    URL: <input type="text" name="url" size="80" value="http://{{.URLHostPort}}/echo?delay=250us:30,5ms:5&status=503:0.5,429:1.5" /> <br />
    QPS: <input type="text" name="qps" size="6" value="100" />
    Duration: <input id="duration" type="text" name="t" size="6" value="3s" />
    or run until interrupted:<input type="checkbox" name="t" onchange="toggleDuration(this)" />
    or run for exactly <input type="text" name="n" size="6" value="" /> calls. <br />
    Threads/Simultaneous connections: <input type="text" name="c" size="6" value="10" /> &nbsp;&nbsp;
    Log errors <input type="checkbox" name="log-errors" checked> <br />
    Connection reuse range: Min <input type="text" name="connection-reuse-range-min" size="6" value="" />
    Max <input type="text" name="connection-reuse-range-max" size="6" value="" />
    or Single value: <input type="text" name="connection-reuse-range-value" size="6" value="" /> <br />
    Uniform:<input type="checkbox" name="uniform" checked /> or Jitter:<input type="checkbox" name="jitter" /> &nbsp;&nbsp;
    No Catch-Up (qps is a ceiling): <input type="checkbox" name="nocatchup" checked /><br />
    Percentiles: <input type="text" name="p" size="20" value="50, 75, 90, 99, 99.9" /> <br />
    Histogram Resolution: <input type="text" name="r" size="8" value="0.0001" /> <br />
    Method override (empty for GET/POST based on payload): <input type="text" name="X" size="8" value="" /> <br />
    Extra Headers:<br />
    <input type="text" name="H" size=40 value="" /> <br />
    <button type="button" onclick="addCustomHeader()">+</button>
    <br />
    Payload:<br /><textarea name="payload" rows="5" cols="75" id="payload"></textarea><br />
    Load using:<br />
    tcp/udp/http: <input type="radio" name="runner" value="http/tcp/udp" checked/>
    (https insecure:<input type="checkbox" name="https-insecure" />,
    standard go client instead of fastclient:<input type="checkbox" name="stdclient" checked/>,
    h2: <input type="checkbox" name="h2"/>,
    sequential warmup: <input type="checkbox" name="sequential-warmup"/>,
    resolve: <input type="text" name="resolve" size="12" value="" />)
    <br />&nbsp;&nbsp;or<br />
    grpc: <input type="radio" name="runner" value="grpc"/>
    (grpc secure transport (tls):<input type="checkbox" name="grpc-secure" />,
    using ping backend:<input type="checkbox" name="ping" />,
    ping delay: <input type="text" name="grpc-ping-delay" size="6" value="0" />,
    health service: <input type="text" name="healthservice" size="6" value="" />) <br />
    JSON output:<input type="checkbox" name="json" />,
    Save output:<input type="checkbox" name="save" checked />) <br />
    Timeout: <input type="text" name="timeout" size="12" value="750ms" /> <br />
    <input type="submit" name="load" value="Start"/>
  </div>
</form>
<p><i>Or</i></p>
<div>
  Browse <a href='browse'>saved results</a> (or <a href="data/">raw JSON</a>)
</div>
<p><i>Or</i></p>
<form action="rest/dns">
  <div>
    DNS resolve <input type="text" id="name" name="name" value="" size=50/>
  </div>
</form>
<p><i>Or</i></p>
<form action="fetch2/">
<div>
    Debug fetch any single URL: <input type="text" id="url" name="url" value="" size=50/>
  </div>
</form>
<p><i>Or</i></p>
<form action="javascript:document.location += 'fetch/' + document.getElementById('uri').value">
  <div>
    HTTP/1.1 only semi proxy
    Debug fetch http://<input type="text" id="uri" name="uri" value="" size=50/>
  </div>
</form>
<p><i>Or</i></p>
Other endpoints: <a href="{{.DebugPath}}">Debug</a> and <a href="{{.DebugPath}}?env=dump">debug with env dump</a>
and <a href="/debug/pprof/">Internal PPROF</a>
and <a href="flags">Command line flags</a>
and <a href="{{.EchoDebugPath}}">Additional echo handler under {{.EchoDebugPath}}</a> (supports all the
query arguments mentioned on the <a href="https://github.com/fortio/fortio#server-urls-and-features">Echo url features</a> github doc)
<p><i>Or</i></p>
<a href="{{.MetricsPath}}">Metrics</a>
<p><i>Or</i></p>
<form action="sync">
  <div>
    Sync/download tsv or xml s3 bucket data from:<br />
    <input type="text" name="url" value="" size=50/>
  </div>
</form>
<p><i>Or</i></p>
<form method="POST">
  <div>
    Interrupt runs from this server: <input type="submit" name="stop" value="Stop" />
  </div>
</form>
{{end}}
<p></p>
<hr />
Fortio {{.LongVersion}}
</body>
</html>
{{end}}
