HTTP Archive

/views/vhar/Detail.html (2.2 KB)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{% import (
"fmt"

"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/lib/har"
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/components"
"{{{ .Package }}}/views/layout"
) %}

{% code type Detail struct {
layout.Basic
Har *har.Log
} %}

{% func (p *Detail) Body(as *app.State, ps *cutil.PageState) %}
<div class="card">
<div class="right">
<a href="{%s p.Har.WebPath() %}/delete" class="link-confirm" data-message="Are you sure?"><button>Delete</button></a>
</div>
<h3>{%= components.SVGRefIcon(`book`, ps) %} {%s p.Har.Key %}</h3>
<div class="mt">
{%s util.MicrosToMillis(p.Har.Entries.TotalDuration()) %} elapsed, downloaded {%s util.ByteSizeSI(int64(p.Har.Entries.TotalResponseBodySize())) %}
</div>
<!-- $PF_SECTION_START(actions)$ -->
<div class="mt">
<a href="{%s p.Har.WebPath() %}/run"><button>Run</button></a>
<a href="{%s p.Har.WebPath() %}/bench"><button>Benchmark</button></a>
<a href="{%s p.Har.WebPath() %}/trim"><button>Trim</button></a>
</div>
<!-- $PF_SECTION_END(actions)$ -->
</div>

<div class="card">
<h3>{%s util.StringPlural(len(p.Har.Entries), "Entry") %}</h3>
<div class="mts">
<ul class="accordion">
{%- for i, e := range p.Har.Entries -%}
{%- code
key := fmt.Sprintf("%d", i)
e = e.Cleaned()
-%}
<li>
<input id="accordion-entry-{%s key %}" type="checkbox" hidden />
<label title="{%s e.Request.URL %}" for="accordion-entry-{%s key %}">
{%= RenderEntryOptions(key, e, false) %}
{%= components.ExpandCollapse(3, ps) %} {%s e.String() %}
<div class="clear"></div>
</label>
<div class="bd"><div><div>
{%= RenderEntry(key, e, ps) %}
</div></div></div>
{%= RenderEntryModals(key, e, false) %}
</li>
{%- endfor -%}
</ul>
</div>
</div>
<script>
function clip(k) {
if (!navigator.clipboard) {
return;
}
const el = document.getElementById("modal-entry-" + k + "-curl-data");
navigator.clipboard.writeText(el.innerText);
}
</script>
{% endfunc %}