diff --git a/css/main.css b/css/main.css index 7af0a9b..c401225 100644 --- a/css/main.css +++ b/css/main.css @@ -212,3 +212,7 @@ div.more-link { div.more-link:hover { background: #f0f0f0; } + +emph { + color: red; +} \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..e00c954 Binary files /dev/null and b/favicon.ico differ diff --git a/index.html b/index.html index aa3b933..ada67de 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,7 @@ + Bugzilla Dashboard

Things To Review

+

Waiting for Input

+

Mentored Bugs

Assigned Bugs

Reported Bugs

CC'd Bugs

@@ -41,7 +44,10 @@

Bugzilla Dashboard

Enter a user's Bugzilla information below. If you don't provide a password, you'll only be able to see the user's public bugs, and you also won't be able to use some of this - page's awesome functionality.

+ page's awesome functionality. If you don't provide a mentor + identity, you will not be able to see the user's mentored bugs.

+

Security notice Any password will be + sent without encryption.

@@ -51,6 +57,10 @@

Bugzilla Dashboard

+ + + +
Bugzilla Username Bugzilla Password
Bugzilla Mentoring Nickname

diff --git a/js/bugzilla.js b/js/bugzilla.js index e7efaf0..a8b2b34 100644 --- a/js/bugzilla.js +++ b/js/bugzilla.js @@ -1,5 +1,5 @@ var Bugzilla = { - BASE_URL: "https://api-dev.bugzilla.mozilla.org/latest", + BASE_URL: "https://bugzilla.mozilla.org/rest", BASE_UI_URL: "https://bugzilla.mozilla.org", DEFAULT_OPTIONS: { method: "GET" @@ -27,9 +27,17 @@ var Bugzilla = { options = newOptions; function onLoad() { - var response = JSON.parse(xhr.responseText); - if (!response.error) + try { + var response = JSON.parse(xhr.responseText); + } catch (SyntaxError) { + console.error("Response is not JSON", xhr.responseText); + return; + } + if (!response.error) { options.success(response); + } else { + console.error("Error from Bugzilla", response); + } // TODO: We should really call some kind of error callback // if this didn't work. } @@ -39,6 +47,7 @@ var Bugzilla = { if (options.data) url = url + "?" + this.queryString(options.data); + xhr.open(options.method, url); xhr.setRequestHeader("Accept", "application/json"); xhr.setRequestHeader("Content-Type", "application/json"); diff --git a/js/modules/app.js b/js/modules/app.js index d195741..1220fc1 100644 --- a/js/modules/app.js +++ b/js/modules/app.js @@ -23,6 +23,7 @@ Require.modules["app/loader"] = function(exports, require) { Require.modules["app/login"] = function(exports) { var callbacks = []; var username; + var mentorname; var password; var passwordProvider; @@ -37,26 +38,39 @@ Require.modules["app/login"] = function(exports) { exports.get = function get() { var isLoggedIn = (username && username != ""); var isAuthenticated = (isLoggedIn && password && password != ""); + var isMentor = (mentorname && mentorname != ""); return { username: username, password: password, + mentorname: mentorname, isLoggedIn: isLoggedIn, - isAuthenticated: isAuthenticated + isAuthenticated: isAuthenticated, + isMentor: isMentor }; }; - exports.set = function set(newUsername, newPassword) { + exports.setUsername = function setUsername(newUsername) { + exports.set(newUsername, password, mentorname); + }; + exports.setMentorname = function setMentorname(newMentorname) { + exports.set(username, password, newMentorname); + }; + + exports.set = function set(newUsername, newPassword, newMentorname) { if ((newUsername && newUsername != "") && + (newMentorname && newMentorname != "") && (!newPassword || newPassword == "") && (passwordProvider)) newPassword = passwordProvider(newUsername); - if (newUsername == username && newPassword == password) + if (newUsername == username && newPassword == password + && newMentorname == mentorname) return; username = newUsername; password = newPassword; + mentorname = newMentorname; var info = exports.get(); @@ -155,7 +169,8 @@ Require.modules["app/ui/login-form"] = function(exports, require) { function(event) { event.preventDefault(); require("app/login").set($("#login .username").val(), - $("#login .password").val()); + $("#login .password").val(), + $("#login .mentorname").val()); $("#login").fadeOut(); }); @@ -421,7 +436,15 @@ Require.modules["app/ui"] = function(exports, require) { Require.modules["app/ui/hash"] = function(exports, require) { function usernameFromHash(location) { if (location.hash) { - var match = location.hash.match(/#username=(.*)/); + var match = location.hash.match(/[#&]username=([^&]*)/); + if (match) + return unescape(match[1]); + } + return ""; + } + function mentornameFromHash(location) { + if (location.hash) { + var match = location.hash.match(/[#&]mentorname=([^&]*)/); if (match) return unescape(match[1]); } @@ -430,21 +453,29 @@ Require.modules["app/ui/hash"] = function(exports, require) { function setLoginFromHash(location) { var username = usernameFromHash(location); + var mentorname = mentornameFromHash(location); var user = require("app/login").get(); if (user.username != username) - require("app/login").set(username); + require("app/login").setUsername(username); + if (user.mentorname != mentorname) + require("app/login").setMentorname(mentorname); + } - exports.usernameToHash = function usernameToHash(username) { - return "#username=" + escape(username); + exports.usernameToHash = function usernameToHash(username, mentorname) { + var prefix = "#username=" + escape(username); + if (mentorname) + return prefix + "&mentorname="+escape(mentorname); + else + return prefix; }; exports.init = function init(document) { require("app/login").whenChanged( function(user) { if (user.isLoggedIn) { - var hash = exports.usernameToHash(user.username); + var hash = exports.usernameToHash(user.username, user.mentorname); if (document.location.hash != hash) document.location.hash = hash; } else @@ -580,8 +611,9 @@ Require.modules["app/ui/dashboard"] = function(exports, require) { function report(selector, key, forceUpdate, searchTerms) { var newTerms = {__proto__: defaults}; - for (name in searchTerms) + for (var name in searchTerms) newTerms[name.replace(/_DOT_/g, ".")] = searchTerms[name]; + newTerms["include_fields"]="id,priority,severity,summary,status,component,assignee,last_change_time"; var cacheKey = key + "/" + selector; var cached = cache.get(cacheKey); @@ -613,48 +645,69 @@ Require.modules["app/ui/dashboard"] = function(exports, require) { changed_after: dateUtils.timeAgo(MS_PER_WEEK * 14) }; - function update(myUsername, isAuthenticated, forceUpdate) { + function update(myUsername, isAuthenticated, mentorName, forceUpdate) { xhrQueue.clear(); var key = myUsername + "_" + (isAuthenticated ? "PRIVATE" : "PUBLIC"); report("#code-reviews", key, forceUpdate, {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], - flag_DOT_requestee: myUsername}); + f1: "requestees.login_name", + o1: "substring", + v1: myUsername}); report("#assigned-bugs", key, forceUpdate, {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], - email1: myUsername, - email1_type: "equals", - email1_assigned_to: 1}); + emailtype1: "exact", + emailassigned_to1: 1, + email1: myUsername}); report("#reported-bugs", key, forceUpdate, {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], email1: myUsername, - email1_type: "equals", - email1_creator: 1, + emailtype1: "exact", + emailreporter1: 1, email2: myUsername, - email2_type: "not_equals", - email2_assigned_to: 1}); + emailtype2: "notequals", + emailassigned_to2: 1}); + report("#cc-bugs", key, forceUpdate, {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], email1: myUsername, - email1_type: "equals", - email1_cc: 1, + emailtype1: "exact", + emailcc1: 1, email2: myUsername, - email2_type: "not_equals", - email2_assigned_to: 1, - email2_creator: 1}); + emailtype2: "notequals", + emailreporter2: 1, + emailassigned_to2: 1}); + + report("#awaiting-input", key, forceUpdate, + {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], + f1: "setters.login_name", + o1: "equals", + v1: myUsername, + f2: "flagtypes.name", + o2: "anywords", + v2: "f? r? needinfo?" + }); + + report("#mentored-bugs", key, forceUpdate, + {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], + f1: "bug_mentor", + o1: "substring", + v1: myUsername, + }); report("#fixed-bugs", key, forceUpdate, {resolution: ["FIXED"], changed_after: dateUtils.timeAgo(MS_PER_WEEK), email1: myUsername, - email1_type: "equals", - email1_assigned_to: 1, - email1_creator: 1, - email1_cc: 1}); + emailtype1: "exact", + emailbug_mentor1: 1, + emailassigned_to1: 1, + emailcc1: 1, + }); }; var refreshCommand = { @@ -662,7 +715,7 @@ Require.modules["app/ui/dashboard"] = function(exports, require) { execute: function execute() { var user = require("app/login").get(); if (user.isLoggedIn) - update(user.username, user.isAuthenticated, true); + update(user.username, user.isAuthenticated, user.mentorname, true); } }; @@ -671,7 +724,7 @@ Require.modules["app/ui/dashboard"] = function(exports, require) { require("app/login").whenChanged( function changeSearchCriteria(user) { if (user.isLoggedIn) { - update(user.username, user.isAuthenticated, false); + update(user.username, user.isAuthenticated, user.mentorname, false); } }); };