Mercurial > bugzilla-dashboard
changeset 76:ea27d04a6522
Got rid of legacy files
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Sun, 25 Apr 2010 19:45:30 -0700 |
parents | 312d4af344c2 |
children | 00d2584cdd7b |
files | css/dashboard.css css/file-bug.css file-bug.html find-user.html index.html js/cache.js js/dashboard.js js/date-utils.js js/file-bug.js js/find-user.js |
diffstat | 10 files changed, 0 insertions(+), 624 deletions(-) [+] |
line wrap: on
line diff
--- a/css/dashboard.css Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -body { - font-family: Helvetica Neue, Arial, sans-serif; - font-size: 9pt; - background: white; -} - -a { - color: black; - text-decoration: none; -} - -a:hover { - background: yellow; -} - -#reports .container { - display: table; -} - -#reports .container > div:first-child { - padding: 0; -} - -#reports .container > div { - display: table-cell; - padding: 0 0.5em; -} - -#reports .container h2 { - margin-top: 0; - width: 20em; -} - -#templates, #form-cache { - display: none; -} - -/* Rule to fix quirks-mode inheritance behavior */ -table, caption { - font-size: inherit; - font-weight: inherit; - font-style: inherit; - font-variant: inherit; -} - -table { - width: 100%; - border-collapse: collapse; -} - -tr { - border-bottom: 1px black dotted; -} - -th { - text-align: left; -} - -tr.bug-row { - cursor: pointer; -} - -tr.bug-row:hover { - background: #f0f0f0; -} - -th, td { - padding: 0.5em; -} - -.P1.critical, .P1.blocker { - color: red; -} - -.status-RESOLVED, .status-VERIFIED { - text-decoration: line-through; -} - -.countdown { - color: #f0f0f0; -} - -.bug-tooltip { - /* TODO: Actually display this. */ - display: none; -} - -.loading { - background-image: url('images/ajax-loader.gif'); - background-repeat: no-repeat; - background-position: top right; -}
--- a/css/file-bug.css Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -table { - width: 40em; -} - -tr { - border: none; -} - -td { - padding-left: 0; -} - -form { - width: 40em; -} - -input, textarea { - border: 1px solid black; - width: 100%; - font-family: Helvetica Neue, Arial, sans-serif; - font-size: 9pt; -} - -.ui-autocomplete-loading { - background-image: url('images/ajax-loader.gif'); -}
--- a/file-bug.html Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -<html> -<head> - <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" media="all" - href="css/jquery-ui.css" /> - <link rel="stylesheet" type="text/css" media="all" - href="css/dashboard.css" /> - <link rel="stylesheet" type="text/css" media="all" - href="css/file-bug.css" /> - <title>Atul's Bug-Filer</title> -</head> -<body> -<div id="reports"> - <h1>Atul's Bug-Filer</h1> - <form id="file-bug"> - <p>Just type in part of a product or component below, select from - the auto-complete list, and press enter. You'll then get sent to a - Bugzilla page where you can fill out a summary, description, and - more details for the bug.</p> - <table> - <tr> - <td>Category</td> - <td><input type="text" id="category"/></td> - </tr> - </table> - </form> -</div> -<div id="form-cache"> - <form><textarea class="data"></textarea></form> -</div> -</body> -<script src="js/jquery.js"></script> -<script src="js/jquery-ui.js"></script> -<script src="js/bugzilla.js"></script> -<script src="js/cache.js"></script> -<script src="js/file-bug.js"></script> -</html>
--- a/find-user.html Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -<html> -<head> - <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" media="all" - href="css/jquery-ui.css" /> - <link rel="stylesheet" type="text/css" media="all" - href="css/dashboard.css" /> - <link rel="stylesheet" type="text/css" media="all" - href="css/file-bug.css" /> - <title>Atul's User-Finder</title> -</head> -<body> -<div id="reports"> - <h1>Atul's User-Finder</h1> - <form id="find-user"> - <p>Just type in part of a user name below. You can optionally - open a customized Bugzilla dashboard for the user, too.</p> - <p>You'll also need to provide your username and password to perform - the search. Your browser sends these credentials directly to - Bugzilla over a secure connection—no third parties can access - them, including the server this page is hosted on.</p> - <table> - <tr> - <td>Your Username</td> - <td><input type="text" id="username" - value="avarma@mozilla.com"/></td> - </tr> - <tr> - <td>Your Password</td> - <td><input type="password" id="password"/></td> - </tr> - <tr> - <td>Name</td> - <td><input type="text" id="query"/></td> - </tr> - </table> - <br/> - <input type="submit" id="submit" value="Show User Dashboard"/> - </form> -</div> -</body> -<script src="js/jquery.js"></script> -<script src="js/jquery-ui.js"></script> -<script src="js/bugzilla.js"></script> -<script src="js/find-user.js"></script> -</html>
--- a/index.html Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -<html> -<head> - <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" media="all" - href="css/dashboard.css" /> - <title>Atul's Bugzilla Dashboard</title> -</head> -<body> -<div id="reports"> - <h1><span id="who">Atul</span>'s Bugzilla Dashboard</h1> - <div class="container"> - <div id="code-reviews"><h2>My Things To Review</h2></div> - <div id="assigned-bugs"><h2>My Assigned Bugs</h2></div> - <div id="reported-bugs"><h2>My Reported Bugs</h2></div> - <div id="cc-bugs"><h2>My CC'd Bugs</h2></div> - <div id="fixed-bugs"><h2>Recently Fixed Bugs</h2></div> - </div> -</div> -<div id="templates"> - <div class="bug-tooltip"> - <div> - <span class="priority"></span> - <span class="severity"></span> - </div> - <div> - <span class="product"></span> - <span class="component"></span> - </div> - <div>Created <span class="age"></span></div> - </div> - <table class="bugs"> - <tr class="header"> - <th>Summary</th> - <th>Last Changed</th> - </tr> - <tr class="bug-row"> - <td class="summary"></td> - <td class="last-changed"></td> - </tr> - </table> -</div> -<div id="form-cache"> - <form><textarea class="data"></textarea></form> -</div> -</body> -<script src="js/jquery.js"></script> -<script src="js/date-utils.js"></script> -<script src="js/bugzilla.js"></script> -<script src="js/cache.js"></script> -<script src="js/dashboard.js"></script> -</html>
--- a/js/cache.js Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -// Really simple JSON cache that uses a form field as -// a back-end. -function buildCache(selector) { - var data = {}; - var json = $(selector).val(); - if (json.length) - data = JSON.parse(json); - - return { - set: function set(key, value) { - data[key] = value; - $(selector).val(JSON.stringify(data)); - }, - get: function get(key) { - return data[key]; - } - }; -}
--- a/js/dashboard.js Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -$(window).ready( - function() { - var cache = buildCache("#form-cache .data"); - - function sortByLastChanged(bugs) { - var lctimes = {}; - - bugs.forEach( - function(bug) { - lctimes[bug.id] = dateFromISO8601(bug.last_change_time); - }); - - function compare(a, b) { - var alc = lctimes[a.id]; - var blc = lctimes[b.id]; - - if (alc < blc) - return -1; - if (alc > blc) - return 1; - return 0; - } - - bugs.sort(compare); - } - - function updatePrettyDates(query) { - query.find(".last-changed").each( - function() { - var lcTime = $(this).attr("data-last-change"); - $(this).text(prettyDate(lcTime)); - }); - } - - const PRETTY_DATE_UPDATE_INTERVAL = 1000 * 60; - - window.setInterval(function() { updatePrettyDates($("#reports")); }, - PRETTY_DATE_UPDATE_INTERVAL); - - function showBugs(query, bugs) { - var table = $("#templates .bugs").clone(); - var rowTemplate = table.find(".bug-row").remove(); - sortByLastChanged(bugs); - bugs.reverse(); - bugs.forEach( - function(bug) { - var row = rowTemplate.clone(); - row.attr("id", "bug-id-" + bug.id); - row.find(".summary").text(bug.summary); - row.addClass("status-" + bug.status); - if (bug.priority != "--") { - row.addClass(bug.priority); - row.addClass(bug.severity); - } - row.find(".last-changed").attr("data-last-change", - bug.last_change_time); - - row.click( - function onClick() { - window.open(Bugzilla.getShowBugURL(bug.id)); - }); - - row.hover( - function onIn() { - var tooltip = $("#templates .bug-tooltip").clone(); - tooltip.find(".priority").text(bug.priority); - // TODO: Show more information in tooltip. - $(this).append(tooltip); - }, - function onOut() { - $(this).find(".bug-tooltip").remove(); - }); - - table.append(row); - }); - updatePrettyDates(table); - query.find(".bugs").remove(); - query.append(table); - table.hide(); - removeDuplicateBugs(); - table.fadeIn(); - } - - // Remove duplicate bugs, preferring the first listing of a bug in - // the DOM to later ones. This is b/c the reports further down the - // page are the less "interesting" ones, and we want to capture - // the most "interesting" part of each bug. - function removeDuplicateBugs() { - var visited = {}; - $("#reports .bug-row").each( - function() { - var id = $(this).attr("id"); - if (id in visited) - $(this).remove(); - else - visited[id] = true; - }); - } - - function report(selector, searchTerms) { - var newTerms = {__proto__: defaults}; - for (name in searchTerms) - newTerms[name.replace(/_DOT_/g, ".")] = searchTerms[name]; - - var cached = cache.get(selector); - if (cached) - showBugs($(selector), cached); - - $(selector).find("h2").addClass("loading"); - - Bugzilla.search(newTerms, - function(response) { - cache.set(selector, response.bugs); - showBugs($(selector), response.bugs); - $(selector).find("h2").removeClass("loading"); - }); - } - - function timeAgo(ms) { - var now = new Date(); - var then = new Date(now - ms); - return dateToISO8601(then); - } - - const MS_PER_HOUR = 1000 * 60 * 60; - const MS_PER_DAY = MS_PER_HOUR * 24; - const MS_PER_WEEK = MS_PER_DAY * 7; - - var myUsername = "avarma@mozilla.com"; - - if (location.search) { - var match = location.search.match(/\?username=(.*)/); - if (match) { - myUsername = unescape(match[1]); - $("#who").text(myUsername); - } - } - - var defaults = { - changed_after: timeAgo(MS_PER_WEEK * 14) - }; - - report("#assigned-bugs", - {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], - email1: myUsername, - email1_type: "equals", - email1_assigned_to: 1}); - - report("#fixed-bugs", - {resolution: ["FIXED"], - changed_after: timeAgo(MS_PER_WEEK), - email1: myUsername, - email1_type: "equals", - email1_assigned_to: 1, - email1_reporter: 1, - email1_cc: 1}); - - report("#code-reviews", - {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], - flag_DOT_requestee: myUsername}); - - report("#reported-bugs", - {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], - email1: myUsername, - email1_type: "equals", - email1_reporter: 1, - email2: myUsername, - email2_type: "not_equals", - email2_assigned_to: 1}); - - report("#cc-bugs", - {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], - email1: myUsername, - email1_type: "equals", - email1_cc: 1, - email2: myUsername, - email2_type: "not_equals", - email2_assigned_to: 1, - email2_reporter: 1}); - });
--- a/js/date-utils.js Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -// Taken from MDC @ Core_JavaScript_1.5_Reference/Objects/Date. -function dateToISO8601(d) { - function pad(n) { return n < 10 ? '0' + n : n; } - - return (d.getUTCFullYear() + '-' + - pad(d.getUTCMonth() + 1) + '-' + - pad(d.getUTCDate()) + 'T' + - pad(d.getUTCHours()) + ':' + - pad(d.getUTCMinutes()) + ':' + - pad(d.getUTCSeconds()) + 'Z'); -} - -// Taken from http://delete.me.uk/2005/03/iso8601.html -function dateFromISO8601(string) { - var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" + - "(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?" + - "(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?"; - var d = string.match(new RegExp(regexp)); - - var offset = 0; - var date = new Date(d[1], 0, 1); - - if (d[3]) { date.setMonth(d[3] - 1); } - if (d[5]) { date.setDate(d[5]); } - if (d[7]) { date.setHours(d[7]); } - if (d[8]) { date.setMinutes(d[8]); } - if (d[10]) { date.setSeconds(d[10]); } - if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); } - if (d[14]) { - offset = (Number(d[16]) * 60) + Number(d[17]); - offset *= ((d[15] == '-') ? 1 : -1); - } - - offset -= date.getTimezoneOffset(); - var time = (Number(date) + (offset * 60 * 1000)); - date.setTime(Number(time)); - return date; -} - -/* - * JavaScript Pretty Date - * Copyright (c) 2008 John Resig (jquery.com) - * Licensed under the MIT license. - */ - -// Takes an ISO time and returns a string representing how -// long ago the date represents. -function prettyDate(time){ - var date = dateFromISO8601(time), - diff = (((new Date()).getTime() - date.getTime()) / 1000), - day_diff = Math.floor(diff / 86400); - - if ( isNaN(day_diff) || day_diff < 0 || day_diff >= 31 ) - return; - - return day_diff == 0 && ( - diff < 60 && "just now" || - diff < 120 && "1 minute ago" || - diff < 3600 && Math.floor( diff / 60 ) + " minutes ago" || - diff < 7200 && "1 hour ago" || - diff < 86400 && Math.floor( diff / 3600 ) + " hours ago") || - day_diff == 1 && "Yesterday" || - day_diff < 7 && day_diff + " days ago" || - day_diff < 31 && Math.ceil( day_diff / 7 ) + " weeks ago"; -} - -// If jQuery is included in the page, adds a jQuery plugin to handle it as well -if ( typeof jQuery != "undefined" ) - jQuery.fn.prettyDate = function(){ - return this.each(function(){ - var date = prettyDate(this.title); - if ( date ) - jQuery(this).text( date ); - }); - };
--- a/js/file-bug.js Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -$(window).ready( - function() { - const EM_DASH = "\u2014"; - - var cache = buildCache("#form-cache .data"); - var config = cache.get("configuration"); - var categories; - var queuedRespond; - - function buildCategories() { - categories = []; - for (product in config.product) - for (component in config.product[product].component) - categories.push(product + EM_DASH + component); - } - - var categoryOptions = { - minLength: 2, - source: function(request, response) { - function respond() { - queuedRespond = null; - - var suggs = []; - var terms = request.term.split(" "); - - if (!categories) - buildCategories(); - - categories.forEach( - function(category) { - for (var i = 0; i < terms.length; i++) - if (!category.match(terms[i], "i")) - return; - suggs.push(category); - }); - - response(suggs); - }; - - if (!config) - queuedRespond = respond; - else - respond(); - } - }; - - $("input#category").autocomplete(categoryOptions); - $("#file-bug").submit( - function(event) { - event.preventDefault(); - var parts = $("input#category").val().split(EM_DASH); - window.open(Bugzilla.BASE_UI_URL + "/enter_bug.cgi?" + - "product=" + escape(parts[0]) + "&" + - "component=" + escape(parts[1])); - }); - - Bugzilla.ajax({url: "/configuration", - data: {flags: 0}, - success: function(result) { - config = result; - cache.set("configuration", result); - if (queuedRespond) - queuedRespond(); - }}); - });
--- a/js/find-user.js Sun Apr 25 19:31:19 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -$(window).ready( - function() { - var currReq; - - var options = { - minLength: 2, - delay: 1000, - source: function(request, response) { - function success(result) { - currReq = null; - var suggs = []; - result.users.forEach( - function(user) { - suggs.push({label: user.real_name + " (" + user.name + ")", - value: user.name}); - }); - response(suggs); - } - if (currReq) - currReq.abort(); - currReq = Bugzilla.ajax({url: "/user", - data: {match: request.term, - username: $("#username").val(), - password: $("#password").val()}, - success: success}); - } - }; - $("input#query").autocomplete(options); - $("#find-user").submit( - function(event) { - event.preventDefault(); - window.open("index.html?username=" + escape($("input#query").val())); - }); - });