Download:
child 52:b5f74e147343
parent 50:c074bc38b66a
51:7a01d0f93806
Anton Shestakov <av6@dwimlabs.net>, Sun, 07 Feb 2016 22:57:31 +0800
viewer: custom tooltip title

2 файлов изменено, 14 вставок(+), 3 удалений(-) [+]
templates/fancy.html file | annotate | diff | comparison | revisions
viewer.py file | annotate | diff | comparison | revisions
--- a/templates/fancy.html Sun Feb 07 22:55:52 2016 +0800
+++ b/templates/fancy.html Sun Feb 07 22:57:31 2016 +0800
@@ -47,12 +47,13 @@
<script type="application/json" id="data">{% raw json_encode(data) %}</script>
<script>
+ var data = JSON.parse(document.getElementById('data').firstChild.nodeValue);
var chart = c3.generate({
bindto: '#chart',
size: {height: 500},
- tooltip: {format: {title: function(x) { return x; }}},
- data: JSON.parse(document.getElementById('data').firstChild.nodeValue)
+ tooltip: {format: {title: function(x) { return data.titles[-x]; }}},
axis: {x: {tick: {format: function(x) { return -x; }}}},
+ data: data
});
</script>
</body>
--- a/viewer.py Sun Feb 07 22:55:52 2016 +0800
+++ b/viewer.py Sun Feb 07 22:57:31 2016 +0800
@@ -247,6 +247,7 @@
marks, moremarks = self.getmarks()
results, _ = self.getresults(changesets, marks=marks, colors=False)
json = []
+ titles = {}
for cset in changesets:
item = {'rev': -cset['rev']}
for mark in marks:
@@ -254,11 +255,20 @@
if values is not None:
item[mark] = values[0]
json.append(item)
+ extra = [cset['branch']] + cset['tags']
+ if len(cset['parents']) > 1:
+ extra.append('(merge)')
+ titles[cset['rev']] = '{}:{}: {} {}'.format(
+ cset['rev'],
+ cset['node'][:12],
+ ' '.join(extra),
+ cset['desc'].partition('\n')[0])
data = {
'names': marks,
'x': 'rev',
'json': json,
- 'keys': {'x': 'rev', 'value': marks.keys()}
+ 'keys': {'x': 'rev', 'value': marks.keys()},
+ 'titles': titles
}
context = {
'changesets': changesets,