Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

265 lines (227 sloc) 6.737 kb
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>C3 Blockers</title>
<link rel="stylesheet" href="bootstrap.min.css">
<script type='text/javascript' src='jquery-1.7.1.min.js'></script>
<script type='text/javascript' src='jquery.isotope.min.js'></script>
<script type="text/javascript" src="bugzilla.js"></script>
<script type="text/javascript" src="github.js"></script>
<script type="text/javascript" src="mustache.js" ></script>
<script type="text/javascript" src="asyncStorage.js" ></script>
<script type="text/javascript" src="utils.js" ></script>
<!-- test data
<script type="text/javascript" src="bugzillaData.js" ></script>
<script type="text/javascript" src="githubData.js" ></script>
-->
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 9pt;
margin: 0 auto;
background-image: -moz-radial-gradient(center 45deg, circle closest-side, #fff 0%, #DDD 140%);
background-attachment: fixed;
text-align: left;
}
#controls {
float: left;
}
label {
width: 200px;
}
.ray {
background-color: rgba(255,255,255,.1);
width: 150%;
height: 10px;
position: fixed;
top: 50%;
left: -25%;
-moz-transform:
-moz-transform-origin: 100% 50%;
z-index: -1;
}
.main {
width: 100%;
}
.page-header {
margin-left: 0.5em;
}
.widget {
text-align: center;
height: 10em;
width: 15em;
clear: both;
padding-top: 2em;
margin: 10px;
border-radius: 0.5em;
background: rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.bugCount {
text-align: center;
}
.bugCount > h1 {
font-size: 6em;
}
.bugList {
text-align: left;
}
.bugList ul {
margin: 0;
}
</style>
</head>
<body>
<div>
<h1>C3 Blockers</h1>
</div>
<div id="controls"><input type="checkbox" id="loe"><label>bugs w/o LOE estimate</label></div>
<br clear="all">
<div id='feedback' style='text-align: center;'></div>
<br clear="all">
<div class="main container-fluid">
<div id="container"></div>
</div>
<script>
var main = document.querySelector('.main')
var feedback = document.querySelector('#feedback')
// bugzilla search options for all basecamp+ bugs targeting c3
var defaultSearchOpts = {
'bug_status': ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"],
'field0-0-0': 'cf_blocking_basecamp',
'type0-0-0': 'equals',
'value0-0-0': '+',
'target_milestone': 'B2G C3 (12dec-1jan)'
}
// bugzilla search options for all basecamp+ bugs without LOE estimates
var loeSearchOpts = {
'bug_status': ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"],
'field0-0-0': 'cf_blocking_basecamp',
'type0-0-0': 'equals',
'value0-0-0': '+',
'field1-0-0': 'whiteboard',
'type1-0-0': 'not_contains',
'value1-0-0': '[LOE:',
}
// user feedback message with spinner
// pass empty string to clear
function progress(msg) {
if (!msg)
feedback.innerHTML = ''
else
feedback.innerHTML = "<img src='http://www.fbi.gov/spinner.gif'><br>" + msg
}
// clear visible results and do a new search
function reload(searchOpts) {
// remove previous container
main.removeChild(document.querySelector('#container'))
// create new container
var container = document.createElement('div')
container.setAttribute('id', 'container')
main.appendChild(container)
// update user feedback to indicate progress
progress('Searching Bugzilla...')
var bzSearchOpts = searchOpts.noLOE ? loeSearchOpts : defaultSearchOpts
new bugSearch('bug').fetch(bzSearchOpts, function(results) {
/*
progress('Searched Bugzilla, now searching Github...');
// now do github search
var issuesOptions = {
per_page: 100,
state: 'open',
labels: 'blocking-basecamp+'
}
new issueSearch().fetch(issuesOptions, function(githubResults) {
if (searchOpts.noLOE) {
githubResults = githubResults.filter(function(issue) {
return issue.labels.every(function(label) {
return !(/\[LOE:/.test(label.name));
})
})
}
results = results.concat(githubResults)
*/
progress('');
displayResults(results)
/*
})
*/
})
}
// given a blank container and an array of results,
// process and write to main container
function displayResults(results) {
// aggregate bugs per user
var names = {}
var i = 0
results.forEach(function(bug) {
var searchURL = ''
// convert github to bugzilla
if (bug.user) {
bug.assigned_to = bug.assignee || (bug.assignee = {login:'No one'})
bug.assigned_to.name = bug.assignee.login
bug.assigned_to.real_name = bug.assignee.login
bug.searchURL = 'https://github.com/mozilla-b2g/gaia/issues/assigned/' + encodeURIComponent(bug.assignee.login) + '?labels=blocking-basecamp%2B&state=open'
}
else
bug.searchURL = 'https://bugzilla.mozilla.org/buglist.cgi?quicksearch=@' + encodeURIComponent(bug.assigned_to.name) + ' blocking-basecamp:%2b'
bug.nameKey = bug.assigned_to.name
if (!names[bug.nameKey]) {
names[bug.nameKey] = { user: bug.assigned_to, count: 1, bugs: [bug]}
}
else {
names[bug.nameKey].count++
names[bug.nameKey].bugs.push(bug)
names[bug.nameKey].searchURL = bug.searchURL
}
i++
});
feedback.innerHTML = results.length + ' Results';
var container = document.querySelector('#container')
for (var name in names) {
var template =
"<div class='widget' id='{{_id}}'>"
+ "<div class='bugCount'>"
+ "<h1>{{count}}</h1><br clear=all>"
+ "<a href='{{url}}' target='new'>"
+ "<div>{{title}}</div>"
+ "</a>"
+ "</div>"
+ "</div>";
container.innerHTML += Mustache.to_html(template, {
url: names[name].searchURL,
count: names[name].count,
title: name
});
}
$('#container').isotope({
itemSelector : '.widget',
sortBy : 'bugCount',
sortAscending : false,
layoutMode : 'fitRows',
getSortData : {
bugCount : function ( $elem ) {
return parseInt($elem.find('.bugCount').text(), 10);
}
}
});
}
// LOE checkbox
var loe = document.querySelector('#loe')
loe.addEventListener('change', function() {
loe.checked ? reload({noLOE: true}) : reload({})
})
// load default search
reload({})
</script>
<!--
<pre>
- cache data, reload on timer
- move LOE filter to work on local data
- filter on feature vs bug
- stats across top (total blockers, total github, total bugzilla, % estimated total and for each)
</pre>
-->
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.