Commit e3b994e9 authored by Vincent Pelletier's avatar Vincent Pelletier

Generate an HTML index when there is more than one section.

parent 80244895
...@@ -828,8 +828,19 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict, ...@@ -828,8 +828,19 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
else: else:
out.write('<script type="text/javascript" src="%s/%s"></script>' % ( out.write('<script type="text/javascript" src="%s/%s"></script>' % (
js_path, script)) js_path, script))
out.write('</head><body><h1>Overall</h1><h2>Parameters</h2>' out.write('</head><body><h1>Overall</h1>')
'<table class="stats">') if len(per_site) > 1:
out.write('<h2>Index</h2><ol>')
site_list = list(enumerate(sorted(per_site.iteritems(),
key=lambda x: site_caption_dict[x[0]])))
html_site_caption_dict = {}
for i, (site_id, _) in site_list:
html_caption = unquoteToHtml(site_caption_dict[site_id], encoding)
html_site_caption_dict[site_id] = html_caption
out.write('<li><a href="#%s" title="%s">%s</a></li>' % (i,
escape(repr(site_id), quote=True), html_caption))
out.write('</ol>')
out.write('<h2>Parameters</h2><table class="stats">')
for caption, value in ( for caption, value in (
('apdex threshold', '%.2fs' % args.apdex), ('apdex threshold', '%.2fs' % args.apdex),
('period', args.period or (period + ' (auto)')), ('period', args.period or (period + ' (auto)')),
...@@ -845,9 +856,9 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict, ...@@ -845,9 +856,9 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
for date, hit in sorted(hit_per_day.iteritems(), key=ITEMGETTER0): for date, hit in sorted(hit_per_day.iteritems(), key=ITEMGETTER0):
out.write('<tr><td>%s</td><td>%s</td></tr>' % (date, hit)) out.write('<tr><td>%s</td><td>%s</td></tr>' % (date, hit))
out.write('</table>') out.write('</table>')
for site_id, data in sorted(per_site.iteritems(), key=ITEMGETTER0): for i, (site_id, data) in site_list:
out.write('<h1>Site: %s</h1>' % unquoteToHtml(site_caption_dict.get( out.write('<h1 id="%s" title="%s">%s</h1>' % (i, escape(repr(site_id),
site_id, site_id), encoding)) quote=True), html_site_caption_dict[site_id]))
apdex_data = data.getApdexData() apdex_data = data.getApdexData()
if apdex_data: if apdex_data:
out.write( out.write(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment