Commit 00e121ca authored by Vincent Pelletier's avatar Vincent Pelletier

Include module- and document-level graphs in ERP5 table.

parent 31723edb
...@@ -269,7 +269,8 @@ class GenericSiteStats(object): ...@@ -269,7 +269,8 @@ class GenericSiteStats(object):
def getApdexData(self): def getApdexData(self):
return getDataPoints(self.apdex) return getDataPoints(self.apdex)
def asHTML(self, stat_filter=lambda x: x): def asHTML(self, date_format, placeholder_delta, graph_period,
stat_filter=lambda x: x):
result = [] result = []
append = result.append append = result.append
apdex = APDEXStats(self.threshold, None) apdex = APDEXStats(self.threshold, None)
...@@ -377,11 +378,12 @@ class ERP5SiteStats(GenericSiteStats): ...@@ -377,11 +378,12 @@ class ERP5SiteStats(GenericSiteStats):
else: else:
self.no_module[date].accumulate(match) self.no_module[date].accumulate(match)
def asHTML(self, stat_filter=lambda x: x): def asHTML(self, date_format, placeholder_delta, graph_period,
stat_filter=lambda x: x):
result = [] result = []
append = result.append append = result.append
append('<h2>Stats per module</h2><table class="stats stats_erp5"><tr>' append('<h2>Stats per module</h2><table class="stats stats_erp5"><tr>'
'<th rowspan="2" colspan="2">module</th>' '<th rowspan="2" colspan="3">module</th>'
'<th colspan="4" class="overall_right">overall</th>') '<th colspan="4" class="overall_right">overall</th>')
filtered_module = defaultdict(partial(defaultdict, partial( filtered_module = defaultdict(partial(defaultdict, partial(
defaultdict, partial(APDEXStats, self.threshold, None)))) defaultdict, partial(APDEXStats, self.threshold, None))))
...@@ -410,18 +412,34 @@ class ERP5SiteStats(GenericSiteStats): ...@@ -410,18 +412,34 @@ class ERP5SiteStats(GenericSiteStats):
append(getApdexStatsAsHtml(data_total, self.threshold, True)) append(getApdexStatsAsHtml(data_total, self.threshold, True))
for date in column_list: for date in column_list:
append(getApdexStatsAsHtml(data_dict[date], self.threshold)) append(getApdexStatsAsHtml(data_dict[date], self.threshold))
def hiddenGraph(data_dict):
append('<td class="text group_right hover">')
data = getDataPoints(data_dict)
if len(data) > 1:
append('+<div class="hover_target">')
append(graphPair(
prepareDataForGraph(data, date_format, placeholder_delta),
date_format,
graph_period,
))
append('</div>')
append('</td>')
for module_id, data_dict in sorted(filtered_module.iteritems(), for module_id, data_dict in sorted(filtered_module.iteritems(),
key=ITEMGETTER0): key=ITEMGETTER0):
append('<tr class="group_top"><th rowspan="2">%s</th>' append('<tr class="group_top"><th rowspan="2">%s</th>'
'<th>module</th>' % module_id) '<th>module</th>' % module_id)
hiddenGraph(self.module[module_id][False])
apdexAsColumns(data_dict[False]) apdexAsColumns(data_dict[False])
append('</tr><tr class="group_bottom"><th>document</th>') append('</tr><tr class="group_bottom"><th>document</th>')
hiddenGraph(self.module[module_id][True])
apdexAsColumns(data_dict[True]) apdexAsColumns(data_dict[True])
append('</tr>') append('</tr>')
append('<tr class="group_top group_bottom"><th colspan="2">(none)</th>') append('<tr class="group_top group_bottom"><th colspan="2">(none)</th>')
hiddenGraph(self.no_module)
apdexAsColumns(filtered_no_module) apdexAsColumns(filtered_no_module)
append('</tr></table>') append('</tr></table>')
append(super(ERP5SiteStats, self).asHTML(stat_filter=stat_filter)) append(super(ERP5SiteStats, self).asHTML(date_format,
placeholder_delta, graph_period, stat_filter=stat_filter))
return '\n'.join(result) return '\n'.join(result)
DURATION_US_FORMAT = '%D' DURATION_US_FORMAT = '%D'
...@@ -701,6 +719,9 @@ def main(): ...@@ -701,6 +719,9 @@ def main():
'.stats_erp5 td.group_left { border-left-style: solid; } ' '.stats_erp5 td.group_left { border-left-style: solid; } '
'.stats_erp5 td.group_right { border-right-style: solid; } ' '.stats_erp5 td.group_right { border-right-style: solid; } '
'.stats_erp5 .overall_right { border-right-width: .2em; } ' '.stats_erp5 .overall_right { border-right-width: .2em; } '
'.hover_target { visibility: hidden; position: fixed; '
'top: 0; right: 0; background-color: #fff; border: 1px solid #000; } '
'.hover:hover .hover_target { visibility: visible; } '
'table.stats { border-collapse: collapse; } ' 'table.stats { border-collapse: collapse; } '
'.problem { background-color: #f00; color: white; } ' '.problem { background-color: #f00; color: white; } '
'.warning { background-color: #f80; color: white; } ' '.warning { background-color: #f80; color: white; } '
......
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