-
Notifications
You must be signed in to change notification settings - Fork 214
/
Copy pathlog.jade
100 lines (77 loc) · 3.06 KB
/
log.jade
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
extends ../layout.jade
mixin method (method)
- var mapping = { GET: 'success', POST: 'primary', PUT: 'info', PATCH: 'warning' , DELETE: 'danger' }
- var className = mapping[method] ? mapping[method] : 'default'
span(class='label-#{className}').label= method
block content
div(data-page="bin/log").container
div.btn-group.pull-right.hidden-xs
a(href= '/bin/' + req.params.uuid + '/view').btn.btn-primary View Details
h3
| Bin History: #[code= req.params.uuid]
label(for='clear_log').btn.btn-xs.btn-default
span.glyphicon.glyphicon-trash
| Clear History
form(method="POST", action='/bin/' + req.params.uuid + '/log/clear').hidden
button(type='submit', id='clear_log').btn.btn-xs
div.visible-xs
a(href= '/bin/' + req.params.uuid + '/view').btn.btn-block.btn-primary View Details
hr
div.alert.alert-warning.visible-xs
strong Warning
span Best viewed on a desktop screen, with minimum #[code 800px] width.
table.table.table-hover
thead
tr
th(width='10%') Method
th(width='30%') Path
th(width='10%') Size
th(width='20%') Date
th(width='15%') IP
th(width='15%').text-right Actions
tbody
for entry, id in data.raw.log.entries
tr(data-id= id)
td.method
+method(entry.request.method)
td= entry.request.url.slice(entry.request.url.indexOf('/bin/'))
td #{entry.request.bodySize / 1000} KB
td.date= moment(entry.startedDateTime).fromNow()
td.ip= entry.clientIPAddress
td.action.text-right
div.btn-group.btn-group-sm
a.btn.btn-default(href='#entry-#{id}'): i.fa.fa-link
button.btn.btn-default(data-id= id): i.fa.fa-chevron-down
tr.data(id='entry-#{id}')
td(colspan= 6)
div.row
div.col-sm-6
h4 Request Details #[small in #[a(href="https://ahmadnassri.github.io/har-resources/" target="_blank") HAR] format]
div#preview
pre: code= JSON.stringify(entry.request, null, 2)
div.col-sm-6
h4 Request Body
div#preview
pre: code= entry.request.postData && entry.request.postData.text ? entry.request.postData.text : 'No body was sent'
block scripts
script.
$(function() {
$('#clear_log').click(function (e) {
if (!confirm('Are you sure you want to clear the log?')) {
e.preventDefault();
}
});
$('tr[data-id] td, button[data-id]').on('click', function (e) {
var id = $(this).data('id')
if (e.target.tagName === 'TD') {
id = $(this).parent().data('id')
}
// clear state
history.pushState('', document.title, window.location.pathname);
$('#entry-' + id + ' td').toggle();
})
// highlight the code
$('pre code').each(function (i, block) {
hljs.highlightBlock(block);
});
});