aboutsummaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/lib/bzpage.js3
-rw-r--r--data/lib/logging-front.js65
2 files changed, 67 insertions, 1 deletions
diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js
index d4c393f..43cf5cb 100644
--- a/data/lib/bzpage.js
+++ b/data/lib/bzpage.js
@@ -30,6 +30,9 @@ self.on('message', function onMessage(msg) {
case "queryLocal":
queryInNewTab(msg.data, getComponent(), getProduct(), equivalentComponents);
break;
+ case "ReturningLogData":
+ timeSheetRecordsPrinter(msg.data, new Date());
+ break;
case "CreateButtons":
constantData = msg.data.constData;
config = msg.data.config;
diff --git a/data/lib/logging-front.js b/data/lib/logging-front.js
index 2f85a51..5874561 100644
--- a/data/lib/logging-front.js
+++ b/data/lib/logging-front.js
@@ -57,7 +57,7 @@ function setUpLogging() {
// (id, text, parent, callback, params, before, covered, accesskey)
createDeadLink("generateTSButton", "Generate TS",
additionalButtons, function(evt) {
- self.postMessage(new Message("GenerateTS"));
+ self.postMessage(new Message("GetTSData"));
}, [], "dash", "li");
createDeadLink("clearLogs", "Clear TS", additionalButtons,
@@ -78,3 +78,66 @@ function setUpLogging() {
* clearLogAElem.style.fontWeight = "bolder"; }
*/
}
+
+
+function getBugzillaAbbr(url) {
+ // Abbreviations are in constantData.BugzillaAbbreviations
+ // for https://bugzilla.redhat.com/show_bug.cgi?id=579123 get RH
+ // for https://bugzilla.mozilla.org/show_bug.cgi?id=579123 get MoFo
+ return constantData.BugzillaAbbreviations[parseURL(url).host];
+}
+
+function timeSheetRecordsPrinter(records, date) {
+ var commentBugRE = new RegExp("[bB]ug\\s+([0-9]+)", "g");
+ // sort the records into temporary array
+ var tmpArr = [];
+ var dateStr = getISODate(date);
+ var outStr = "data:text/html;charset=utf-8," +
+ '<!DOCTYPE html>' + "<html><head>\n" +
+ "<meta charset='utf-8'/>\n" + "<title>TimeSheet-" +
+ dateStr + "</title>\n</head>\n<body>\n" +
+ "<h1>TimeSheet</h1>\n";
+
+ for ( var i in records) {
+ if (records.hasOwnProperty(i)) {
+ tmpArr.push([
+ i, records[i]
+ ]);
+ }
+ }
+ tmpArr.sort(function(a, b) {
+ if (a[0] > b[0]) {
+ return 1;
+ }
+ else if (a[0] < b[0]) {
+ return -1;
+ }
+ else {
+ return 0;
+ }
+ });
+
+ var currentDay = "";
+ // now print the array
+ tmpArr.forEach(function(rec) {
+ var x = rec[1];
+ var dayStr = getISODate(x.date);
+ var host = parseURL(x.url).host;
+ var BZName = getBugzillaAbbr(x.url);
+ var bugNo = getBugNo(x.url);
+ if (dayStr != currentDay) {
+ currentDay = dayStr;
+ outStr += "<hr/><p><strong>" + currentDay
+ + "</strong></p>\n";
+ }
+ // replace "bug ####" with a hyperlink to the current bugzilla
+ var comment = x.comment.replace(commentBugRE,
+ "<a href='http://" + host
+ + "/show_bug.cgi?id=$1'>$&</a>");
+ outStr += "<p><em><a href='" + x.url + "'>Bug " + BZName
+ + "/" + bugNo + ": " + x.title + "</a>"
+ + " </em>\n<br/>" + comment + "</p>\n";
+ });
+ outStr += "</body></html>";
+ self.postMessage(new Message("OpenURLinTab", outStr));
+};