Skip to content

Commit 178ecc8

Browse files
author
Daniel Herzog
committed
Tweaked layout of un-raw network-details, added h1 with responsecode and uri, added method to "request" headline and responsecode to "response" headline; Simplified network-summary
1 parent 6dbba27 commit 178ecc8

File tree

3 files changed

+51
-34
lines changed

3 files changed

+51
-34
lines changed

src/network/network_details_templates.js

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,41 +51,38 @@ templates.details = function(entry, left_val, do_raw)
5151
};
5252

5353
templates._details_content = function(entry, do_raw)
54-
{
55-
var responsecode = entry.last_responsecode;
56-
if (responsecode && responsecode in cls.ResourceUtil.http_status_codes)
57-
responsecode = responsecode + " " + cls.ResourceUtil.http_status_codes[responsecode];
58-
54+
{
5955
// Bind a template function for raw / not-raw, on demand.
6056
var template_func_name = "_requests_responses_" + (do_raw ? "raw" : "not_raw" + "_bound");
6157
if (!this[template_func_name])
6258
this[template_func_name] = this.requests_responses.bind(this, do_raw);
6359

6460
var requests_responses = entry.requests_responses.map(this[template_func_name]);
65-
6661
if (do_raw)
6762
{
6863
return requests_responses;
6964
}
7065

66+
var responsecode = entry.last_responsecode;
67+
if (responsecode && responsecode in cls.ResourceUtil.http_status_codes)
68+
responsecode = responsecode + " " + cls.ResourceUtil.http_status_codes[responsecode];
69+
7170
return (
7271
["table",
7372
["tbody",
74-
["tr",
75-
["th", ui_strings.S_HTTP_LABEL_URL + ":"], ["td", entry.url]
76-
],
77-
["tr",
78-
["th", ui_strings.S_HTTP_LABEL_METHOD + ":"],
79-
["td", entry.touched_network ? entry.last_method : ui_strings.S_RESOURCE_ALL_NOT_APPLICABLE],
80-
"data-spec", "http#" + entry.last_method
81-
],
82-
["tr",
83-
["th", ui_strings.M_NETWORK_REQUEST_DETAIL_STATUS + ":"],
84-
["td",
85-
entry.touched_network && responsecode ? String(responsecode) : ui_strings.S_RESOURCE_ALL_NOT_APPLICABLE
86-
],
87-
"data-spec", "http#" + entry.last_responsecode
88-
]
73+
this._wrap_col_or_row(
74+
[
75+
"h1",
76+
[
77+
[
78+
"span",
79+
entry.touched_network && responsecode ? String(responsecode) : "",
80+
"data-spec", "http#" + entry.last_responsecode
81+
],
82+
["span", " – " + entry.url]
83+
]
84+
]
85+
)
8986
],
9087
entry.touched_network ? [] : this.did_not_touch_network(entry),
9188
requests_responses
@@ -219,11 +216,14 @@ templates._request_headers = function(req, do_raw)
219216
}
220217

221218
var ret = [];
219+
var method_str = req.method || "";
220+
if (method_str)
221+
method_str = " – " + method_str;
222222

223223
if (req.requestbody && req.requestbody.partList && req.requestbody.partList.length)
224-
ret.push(["h2", ui_strings.S_NETWORK_MULTIPART_REQUEST_TITLE]);
224+
ret.push(["h2", ui_strings.S_NETWORK_MULTIPART_REQUEST_TITLE + method_str]);
225225
else
226-
ret.push(["h2", ui_strings.S_NETWORK_REQUEST_DETAIL_REQUEST_TITLE]);
226+
ret.push(["h2", ui_strings.S_NETWORK_REQUEST_DETAIL_REQUEST_TITLE + method_str]);
227227

228228
if (!req.request_headers)
229229
{
@@ -262,8 +262,24 @@ templates._response_headers = function(resp, do_raw)
262262
}
263263

264264
var ret = [];
265+
var responsecode = resp.responsecode || "";
266+
if (responsecode)
267+
{
268+
if (responsecode in cls.ResourceUtil.http_status_codes)
269+
responsecode = responsecode + " " + cls.ResourceUtil.http_status_codes[responsecode];
270+
271+
responsecode = " – " + responsecode;
272+
}
273+
265274
if (resp.logger_entry_touched_network)
266-
ret.push(["h2", ui_strings.S_NETWORK_REQUEST_DETAIL_RESPONSE_TITLE]);
275+
{
276+
var head = ["h2", ui_strings.S_NETWORK_REQUEST_DETAIL_RESPONSE_TITLE + responsecode];
277+
if (responsecode)
278+
{
279+
head.extend(["data-spec", "http#" + resp.responsecode]);
280+
}
281+
ret.push(head);
282+
}
267283

268284
ret.extend(this.headers_list(resp.response_headers));
269285
return ["tbody", ret.map(this._wrap_col_or_row)];

src/network/network_style.css

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,21 +288,22 @@
288288
color: #006C0E;
289289
}
290290

291-
.network_logger .network-summary
291+
.network_logger .network-summary,
292+
.network-details-container h1
292293
{
293-
clear: both;
294294
text-align: center;
295-
}
296-
297-
.network_logger .network-summary div
298-
{
299-
text-align: center;
300-
display: inline-block;
301295
font-size: 1.4em;
302296
margin: 18px 0;
303297
color: #808080;
304298
}
305299

300+
.network-details-container h1
301+
{
302+
color: #444444;
303+
margin: 9px 0;
304+
background-color: transparent;
305+
}
306+
306307
.network-details-container pre,
307308
.network-details-container p
308309
{

src/network/network_templates.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ templates.main = function(ctx, entries, selected, detail_width, table_template)
152152
"class", "network-main-container"
153153
],
154154
[
155-
"div", templates.summary(entries), "class", "network-summary"
155+
templates.summary(entries)
156156
],
157157
ctx.window_contexts.map(templates.incomplete_warning)
158158
];
@@ -290,7 +290,7 @@ templates.summary = function(entries)
290290
if (total_size)
291291
str += ", " + cls.ResourceUtil.bytes_to_human_readable(total_size);
292292

293-
return ["div", str];
293+
return ["div", str, "class", "network-summary"];
294294
};
295295

296296
templates.icon = function(entry)

0 commit comments

Comments
 (0)