@@ -12,7 +12,7 @@ templates.network_detail_row = function(wrap)
1212templates . network_log_details = function ( entry , left_val )
1313{
1414 return [
15- "div" ,
15+ "div" ,
1616 [ "span" ,
1717 [ "span" ,
1818 "class" , "close-request-detail" ,
@@ -30,7 +30,7 @@ templates.network_log_details = function(entry, left_val)
3030
3131templates . network_log_detail = function ( entry )
3232{
33- var responsecode = entry . responses . last && entry . responses . last . responsecode ;
33+ var responsecode = entry . responseCode ;
3434 if ( responsecode && responsecode in cls . ResourceUtil . http_status_codes )
3535 responsecode = responsecode + " " + cls . ResourceUtil . http_status_codes [ responsecode ] ;
3636
@@ -54,46 +54,53 @@ templates.network_log_detail = function(entry)
5454 "data-spec" , "http#" + entry . responsecode
5555 ]
5656 ] ,
57- templates . request_details ( entry ) ,
58- templates . network_request_body ( entry ) ,
59- entry . responses . map ( templates . network_response )
57+ entry . touched_network ? [ ] : templates . did_not_touch_network ( entry ) ,
58+ entry . requests_responses . map ( templates . requests_responses )
6059 ] ,
6160 "data-object-id" , String ( entry . id ) ,
6261 "class" , "request-details"
6362 ]
6463 ) ;
6564} ;
6665
67- templates . network_response = function ( response )
66+ templates . did_not_touch_network = function ( entry )
67+ {
68+ var data = cls . ResourceManager [ "1.2" ] . UrlLoad . URLType . DATA ;
69+ return [ "tbody" ,
70+ templates . network_detail_row ( // it would be kind of conistent to put this into a headline, as these otherwise say "Request", and it's clear they are not content. // ["h2",
71+ entry . urltype === data ? ui_strings . S_NETWORK_NOT_REQUESTED
72+ : ui_strings . S_NETWORK_SERVED_FROM_CACHE )
73+ ] ;
74+ } ;
75+
76+ templates . requests_responses = function ( request_response , index , requests_responses )
77+ {
78+ var is_last = index == requests_responses . length - 1 ;
79+ return request_response instanceof cls . NetworkLoggerRequest ?
80+ ( [ templates . request_details ( request_response ) , templates . network_request_body ( request_response ) ] ) : templates . network_response ( request_response , is_last )
81+ // todo: clean it up and make request one template like response.
82+ } ;
83+
84+ templates . network_response = function ( response , is_last )
6885{
6986 return [
7087 response . logger_entry_touched_network ?
7188 templates . network_detail_row ( [ "h2" , ui_strings . S_NETWORK_REQUEST_DETAIL_RESPONSE_TITLE ] ) : [ ] ,
7289 templates . response_details ( response ) ,
73- templates . network_response_body ( response )
90+ templates . network_response_body ( response , is_last )
7491 ]
7592} ;
7693
7794templates . request_details = function ( req )
7895{
79- var ret = [ ] ;
80- if ( ! req || req . urltype === cls . ResourceManager [ "1.2" ] . UrlLoad . URLType . DATA )
81- return ret ;
96+ var tbody = [ "tbody" ] ;
8297
83- if ( req . touched_network )
84- {
85- if ( req . requestbody && req . requestbody . partList && req . requestbody . partList . length )
86- ret . push ( templates . network_detail_row ( [ "h2" , ui_strings . S_NETWORK_MULTIPART_REQUEST_TITLE ] ) ) ;
87- else
88- ret . push ( templates . network_detail_row ( [ "h2" , ui_strings . S_NETWORK_REQUEST_DETAIL_REQUEST_TITLE ] ) ) ;
89- }
98+ if ( req . requestbody && req . requestbody . partList && req . requestbody . partList . length )
99+ tbody . push ( templates . network_detail_row ( [ "h2" , ui_strings . S_NETWORK_MULTIPART_REQUEST_TITLE ] ) ) ;
100+ else
101+ tbody . push ( templates . network_detail_row ( [ "h2" , ui_strings . S_NETWORK_REQUEST_DETAIL_REQUEST_TITLE ] ) ) ;
90102
91- var tbody = [ "tbody" ] ;
92- if ( req . is_finished && ! req . touched_network )
93- {
94- tbody . push ( templates . network_detail_row ( ui_strings . S_NETWORK_SERVED_FROM_CACHE ) ) ;
95- }
96- else if ( ! req . request_headers )
103+ if ( ! req . request_headers )
97104 {
98105 tbody . push ( templates . network_detail_row ( ui_strings . S_NETWORK_REQUEST_NO_HEADERS_LABEL ) ) ;
99106 }
@@ -114,8 +121,7 @@ templates.request_details = function(req)
114121 tbody . extend ( templates . network_headers_list ( req . request_headers , firstline ) ) ;
115122 }
116123 }
117- ret . push ( tbody ) ;
118- return ret ;
124+ return tbody ;
119125} ;
120126
121127templates . response_details = function ( resp )
@@ -233,11 +239,11 @@ templates.network_request_body = function(req)
233239} ;
234240
235241
236- templates . network_response_body = function ( resp )
242+ templates . network_response_body = function ( resp , is_last )
237243{
238244 var ret = [ templates . network_detail_row ( templates . network_body_seperator ( ) ) ] ;
239245 var classname = "" ;
240- if ( resp . body_unavailable ||
246+ if ( resp . body_unavailable ||
241247 ! resp . responsebody && resp . is_unloaded )
242248 {
243249 classname = "network_info" ;
@@ -247,12 +253,12 @@ templates.network_response_body = function(resp)
247253 {
248254 if ( ! resp . responsebody )
249255 {
250- if ( ! resp . logger_entry_is_finished )
256+ if ( is_last && ! resp . logger_entry_is_finished )
251257 {
252258 classname = "network_info" ;
253259 ret . push ( templates . network_detail_row ( ui_strings . S_NETWORK_REQUEST_DETAIL_BODY_UNFINISHED ) ) ;
254260 }
255- // else we're in the middle of getting it via GetResource, leave the response part empty until it updates .
261+ // else we're in the middle of getting it via GetResource, or there is in fact no responsebody .
256262 }
257263 else
258264 {
0 commit comments