Skip to content
Browse files

Layout changes. Now showing actual bugs. Added third party sites.

  • Loading branch information...
1 parent c17a447 commit 5a823fcabbfd5e52d735530097e07d0c866de1d8 @st3fan committed Apr 3, 2013
Showing with 68 additions and 11 deletions.
  1. +24 −0 index.html
  2. +44 −11 index.js
View
24 index.html
@@ -41,6 +41,7 @@ <h2 class="form-signin-heading">Please sign in</h2>
<div ng-controller="PageController" ng-show="ready && loggedIn">
+
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
@@ -81,6 +82,9 @@ <h2 class="form-signin-heading">Please sign in</h2>
<li ng-class="{active: filterName == 'mofo'}">
<a href="#" ng-click="filter('mofo')">MoFo Sites</a>
</li>
+ <li ng-class="{active: filterName == 'thirdparty'}">
+ <a href="#" ng-click="filter('thirdparty')">Third-Party Sites</a>
+ </li>
</ul>
<ul class="nav nav-pills pull-right">
@@ -94,7 +98,26 @@ <h2 class="form-signin-heading">Please sign in</h2>
<a href="#" ng-click="sort('name')">Sort by Name</a>
</li>
</ul>
+ </div>
+
+ <div ng-show="!loading" class="container">
+
+ <h3>Showing {{sites.length}} sites with {{sitesBugCount}} unresolved web security bugs :-(</h3>
+
+ <div ng-repeat="site in sites">
+ <h4 style="text-overflow: hidden; text-transform:uppercase;" class="site-title-big">#{{$index+1}} {{site.name}} <span class="label label-{{site.averageAgeLabel}} pull-right">{{site.averageAge}} days</span> </h4>
+ <ul style="list-style: none;">
+ <li ng-repeat="bug in site.bugs">
+ <span style="width: 30px; margin-right: 6px; text-align: center;" class="label label-{{bug.shortStatusColor}}">{{bug.shortStatus}}</span>
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id={{bug.id}}" target="_blank">
+ <span class="bug-{{bug.status}}">{{bug.id}} {{bug.summary}}</span>
+ </a>
+ </li>
+ </ul>
+ </div>
+
+<!--
<table ng-show="!loading" class="table table-striped">
<thead>
<tr>
@@ -113,6 +136,7 @@ <h2 class="form-signin-heading">Please sign in</h2>
<td><span class="label label-{{site.averageAgeLabel}}">{{site.averageAge}} days</span></td>
</tr>
</table>
+-->
</div>
</div>
View
55 index.js
@@ -1,4 +1,3 @@
-
var app = angular.module('blockers', []);
app.run(function($rootScope, sessionService, bugzillaService) {
@@ -200,6 +199,7 @@ app.controller('PageController', function ($scope, $http, bugzillaService) {
$scope.bugs = [];
$scope.sites = {};
+ $scope.sitesBugCount = 0;
$scope.projectReviewBugs = [];
$scope.blockingBugs = {};
@@ -214,10 +214,18 @@ app.controller('PageController', function ($scope, $http, bugzillaService) {
const MOCO_SITES = ["www.mozilla.com", "plugins.mozilla.org", "forums.mozilla.org", "addons.mozilla.org", "developer.mozilla.org", "vreplay.mozilla.com"];
const MOFO_SITES = ["www.drumbeat.org", "donate.mozilla.org", "thimble.webmaker.org", "2011.mozillafestival.org", "popcorn.webmadecontent.org", "popcorn.webmaker.org"];
+ const THIRD_PARTY_SITES = ["vreplay.mozilla.org"];
$scope.filterName = "all";
$scope.sortName = "count";
+ var countTotalBugs = function() {
+ return _.chain($scope.sites)
+ .map(function (site) {return site.new + site.unconfirmed;})
+ .reduce(function (memo, num) {return memo + num;}, 0)
+ .value();
+ };
+
$scope.filter = function(what) {
$scope.filterName = what;
@@ -234,8 +242,12 @@ app.controller('PageController', function ($scope, $http, bugzillaService) {
$scope.sites = _.filter($scope.allSites, function(site) {return MOFO_SITES.indexOf(site.name) != -1;});
break;
}
+ case "thirdparty": {
+ $scope.sites = _.filter($scope.allSites, function(site) {return THIRD_PARTY_SITES.indexOf(site.name) != -1;});
+ }
}
+ $scope.sitesBugCount = countTotalBugs();
$scope.sort($scope.sortName);
};
@@ -263,7 +275,7 @@ app.controller('PageController', function ($scope, $http, bugzillaService) {
// First we get the project review bugs
var options = {
- include_fields:"id,creation_time,summary,status,whiteboard",
+ include_fields:"id,creation_time,summary,status,resolution,whiteboard",
advanced: [["status_whiteboard", "substring", "[site:"], ["bug_group", "substring", "websites-security"]]
};
@@ -280,20 +292,41 @@ app.controller('PageController', function ($scope, $http, bugzillaService) {
$scope.bugs = data.bugs;
$scope.loading = false;
+ var shortStatus = function(bug) {
+ switch (bug.status) {
+ case "UNCONFIRMED":
+ return {status: "UNC", color: "info"};
+ case "NEW":
+ return {status: "NEW", color: "info"};
+ case "RESOLVED":
+ return {status: bug.resolution.substr(0,3), color: "default"};
+ case "VERIFIED":
+ return {status: bug.resolution.substr(0,3), color: "default"};
+ case "REOPENED":
+ return {status: "NEW", color: "info"};
+ case "ASSIGNED":
+ return {status: "ASS", color: "info"};
+ }
+ return {status: "UNK", color: "default"};
+ };
+
// Loop over all bugs and group sites
var sites = {};
_.each($scope.bugs, function(bug) {
- bugzillaService.cleanupBug(bug);
- _.each(parseSites(bug['whiteboard']), function (site) {
- if (!sites[site]) {
- sites[site] = {name:site,unconfirmed:0,resolved:0,new:0,verified:0,averageAge:0};
- }
- sites[site][bug.status.toLowerCase()]++;
- if (bug.status === 'UNCONFIRMED' || bug.status === 'NEW') {
+ if (bug.status === 'UNCONFIRMED' || bug.status === 'NEW' || bug.status === "REOPENED" || bug.status == "ASSIGNED") {
+ bugzillaService.cleanupBug(bug);
+ bug.shortStatus = shortStatus(bug).status;
+ bug.shortStatusColor = shortStatus(bug).color;
+ _.each(parseSites(bug['whiteboard']), function (site) {
+ if (!sites[site]) {
+ sites[site] = {name:site,unconfirmed:0,resolved:0,new:0,verified:0,averageAge:0,bugs:[]};
+ }
+ sites[site].bugs.push(bug);
+ sites[site][bug.status.toLowerCase()]++;
sites[site].averageAge += bug.age;
- }
- });
+ });
+ }
});
_.each(sites, function(site) {

0 comments on commit 5a823fc

Please sign in to comment.
Something went wrong with that request. Please try again.