HTTP Archive

/views/vhar/Entry.html (2.9 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{% import (
"fmt"

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

{% func RenderEntryOptions(key string, e *har.Entry, js bool) %}
<div class="right">
<a href="#modal-entry-{%s key %}-curl"><button type="button">cURL</button></a>
{%- if js -%}
<a href="#modal-entry-{%s key %}"><button type="button">JSON</button></a>
{%- endif -%}
</div>
{% endfunc %}

{% func RenderEntryModals(key string, e *har.Entry, js bool) %}
{%- if js -%}
{%= components.JSONModal(fmt.Sprintf("entry-%s", key), e.String(), e.Cleaned(), 3) %}
{%- endif -%}
<div id="modal-entry-{%s key %}-curl" class="modal" style="display: none;">
<a class="backdrop" href="#"></a>
<div class="modal-content">
<div class="modal-header">
<a href="#" class="modal-close">×</a>
<h2>cURL {%s e.String() %}</h2>
</div>
<div class="modal-body">
<div id="modal-entry-{%s key %}-curl-data" hidden="hidden" style="display:none;">{%s e.Curl() %}</div>
<button onclick="clip('{%s key %}');">Copy to clipboard</button>
<div class="mt">
<pre>{%s e.Curl() %}</pre>
</div>
</div>
</div>
</div>
{% endfunc %}

{% func RenderEntry(key string, e *har.Entry, ps *cutil.PageState) %}
<ul class="accordion">
<li>
<input id="accordion-entry-{%s key %}-duration" type="checkbox" hidden />
<label for="accordion-entry-{%s key %}-duration">
<div class="right"><em>{%s util.MicrosToMillis(e.Duration()) %}</em></div>
{%= components.ExpandCollapse(3, ps) %} Duration
</label>
<div class="bd"><div><div>
<div class="overflow full-width">
<table class="min-200 expanded">
<tbody>
{%- for k, v := range e.PageTimings.Map() -%}
<tr>
<th class="shrink">{%s k %}</th>
<td>{%s v %}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
</div></div></div>
</li>
<li>
<input id="accordion-entry-{%s key %}-request" type="checkbox" hidden />
<label for="accordion-entry-{%s key %}-request">
<div class="right"><em>{%s e.Request.Method %}</em></div>
{%= components.ExpandCollapse(3, ps) %} Request
</label>
<div class="bd"><div><div>
{%= RenderRequest(key, e.Request, ps) %}
</div></div></div>
</li>
<li>
<input id="accordion-entry-{%s key %}-response" type="checkbox" hidden />
<label for="accordion-entry-{%s key %}-response">
<div class="right"><em>{%s e.Response.StatusText %}</em></div>
{%= components.ExpandCollapse(3, ps) %} Response
</label>
<div class="bd"><div><div>
{%= RenderResponse(key, e.Response, ps) %}
</div></div></div>
</li>
</ul>
{% endfunc %}