Skip to content

Commit

Permalink
Unassigned items are now the backlog
Browse files Browse the repository at this point in the history
PRs are merged rather than closed.
  • Loading branch information
quattor-releaser committed Jun 16, 2016
1 parent 748f3f1 commit 39a9f54
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 20 deletions.
59 changes: 42 additions & 17 deletions github_pulls_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@
color: #6cc644;
}
.text-github-closed {
color: #BD2C00;
}
.text-github-merged {
color: #6E5494;
}
.thing-closed {
.thing-closed, .thing-merged {
display: none;
opacity: 0.75;
}
Expand All @@ -47,21 +50,26 @@
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<a class="navbar-brand"><img src="/img/quattor_logo_navbar.png" width="94" height="23" alt="quattor logo"> &mdash; Releasing</a>
<ul class="nav navbar-nav">
<li class="active"><a href="/release/">Backlog</a></li>
<li><a href="/release/burndown.html">Burndown</a></li>
</ul>
</div>
</div>
'''

FOOTER = '''
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="regression.js"></script>
<script src="burndown.js"></script>
<script type="text/javascript">
$(function() {
$('.reldate').each(function(index) {
$(this).text(moment.tz($(this).text(), "YYYY-MM-DDTHH:mm:ss", "UTC").fromNow());
});
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
release = String(e.target).split("#",2)[1].replace("-", "."); //Ugh.
if (release != "Backlog") burndown(release);
else $('#burndown-container').html('');
})
</script>
</body>
</html>
Expand All @@ -74,28 +82,40 @@
from cgi import escape
from datetime import datetime

previous_releases = [
# '14.8',
# '14.10',
# '15.2',
# '15.4',
# '15.8',
# '15.12',
]

# Render data
with open('/tmp/github-pulls.json') as f_in:
data = load(f_in)

# Hacky numerical sort for our release numerbing scheme
milestones = data.keys()
milestones = [[int(i) for i in m.split('.')] for m in milestones if m != 'Unassigned']
milestones = [[int(i) for i in m.split('.')] for m in milestones if m != 'Backlog']
milestones.sort()
milestones = [u'.'.join(map(str,m)) for m in milestones] + ['Unassigned']
milestones = previous_releases + [u'.'.join(map(str,m)) for m in milestones] + ['Backlog']
print milestones


with open(OUTFILE, 'w') as f:
f.write(HEADER)

f.write('<div class="container">\n')
f.write('''<button class="btn btn-default btn-sm pull-right" onclick="$('.thing-closed').toggle('slow')">Show/Hide Closed Items</button>\n''')
f.write('''<button class="btn btn-default btn-sm pull-right" onclick="$('.thing-closed').toggle('slow'); $('.thing-merged').toggle('slow');">Toggle Closed &amp; Merged Items</button>\n''')

f.write('<ul class="nav nav-tabs" role="tablist">\n')
for milestone in milestones:
f.write('<li><a href="#%s" role="tab" data-toggle="tab">%s</a></li>\n' % (milestone.replace('.', '-'), milestone))
tab_class = ''
if milestone in previous_releases:
tab_class = 'thing-closed'
tab_class = ' class="%s"' % tab_class
f.write('<li><a href="#%s" role="tab" data-toggle="tab"%s>%s</a></li>\n' % (milestone.replace('.', '-'), tab_class, milestone))
f.write('</ul>\n')

f.write('<div class="tab-content">\n')
Expand All @@ -107,6 +127,8 @@
f.write('</div>\n')
f.write('</div>\n')

f.write('<div id="burndown-container" style="min-width: 800px; margin: 0 auto;"></div>\n');

for milestone in milestones:
i_progress = 0
i_closed = 0
Expand All @@ -115,10 +137,14 @@

print " %s" % (milestone)
style = 'default'
if milestone == 'Unassigned':
if milestone == 'Backlog':
style = 'danger'
repos = data[milestone].keys()

repos = []
if milestone in data:
repos = data[milestone].keys()
repos.sort()

f.write('<div class="tab-pane panel panel-%s" id="%s">\n' % (style, milestone.replace('.', '-')))
f.write('<table class="table panel-body">\n')

Expand All @@ -140,14 +166,14 @@
f.write('<ul class="list-unstyled">\n')
things = sorted(things, key=lambda k: k['title'], reverse=True)
for t in things:
if not (milestone == 'Unassigned' and t['state'] != 'open'):
# if not (milestone == 'Backlog' and t['state'] == 'closed'):
t['icon'] = 'issue-opened'

if t['type'] == 'issue' and t['state'] == 'closed':
t['icon'] = 'issue-closed'
elif t['type'] == 'pull-request' and t['state'] == 'open':
elif t['type'] == 'pull-request' and t['state'] != 'merged':
t['icon'] = 'git-pull-request'
elif t['type'] == 'pull-request' and t['state'] == 'closed':
elif t['type'] == 'pull-request' and t['state'] == 'merged':
t['icon'] = 'git-merge'

f.write('<li class="thing-%(state)s">' % t)
Expand All @@ -169,9 +195,8 @@
f.write('</tr>\n')
f.write('</table>\n')

if milestone != 'Unassigned':
if i_closed > 0:
i_progress = i_closed * 100 / (i_open + i_closed) # Do this as integer maths
if i_closed > 0 or i_open > 0:
i_progress = i_closed * 100 / (i_open + i_closed) # Do this as integer maths

f.write(
'''<div class="panel-footer">
Expand Down
9 changes: 6 additions & 3 deletions github_pulls_render_burndown.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
from json import load, dump
from cgi import escape
from datetime import datetime
import sys

# Render data
with open('/tmp/github-pulls.json') as f_in:
data = load(f_in)

# Hacky numerical sort for our release numbering scheme
milestones = data.keys()
milestones = [[int(i) for i in m.split('.')] for m in milestones if m != 'Unassigned']
milestones = [[int(i) for i in m.split('.')] for m in milestones if m != 'Backlog']
milestones.sort()
milestones = [u'.'.join(map(str,m)) for m in milestones if m != 'Unassigned']
milestones = [u'.'.join(map(str,m)) for m in milestones if m != 'Backlog']

print('# Quattor Backlog')

Expand All @@ -24,13 +25,15 @@
burned = []

for repo in repos:
sys.stdout.write('R')
things = data[milestone][repo]['things']
if things:
for t in things:
sys.stdout.write('.')
to_burn += 1
if 'closed' in t:
burned.append(t['closed'])

print
burned.sort()

bdata = {
Expand Down

0 comments on commit 39a9f54

Please sign in to comment.