aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-02-14 17:51:53 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-02-14 17:57:45 +0100
commit04657077ba12e8f23feaa0c3787b590c44446056 (patch)
treeebe206422871e71b142985786a9472ff447be0cd
parent838c1d4abd72bd87dcc8ee41310ca3a8af498c96 (diff)
downloadbugzilla-triage-04657077ba12e8f23feaa0c3787b590c44446056.tar.gz
Basic functionality working. Switching to this bug for my day-to-day work.
-rw-r--r--bugs/issue-19e01fc733de5d53809f3423cb6ff0a5fb7d3019.yaml8
-rw-r--r--bugs/issue-237027cea4bc85bfad8931daa7143ac13293d7fd.yaml19
-rw-r--r--bugs/issue-40324045db21fe6260149c43b369302baf19518b.yaml6
-rw-r--r--bugs/issue-4b0135b3f8d3675913978d8cf258a28dd9dabb3d.yaml26
-rw-r--r--bugs/issue-7511cacab3bd611fd72ada886a2d3735d02e281a.yaml19
-rw-r--r--bugs/issue-e972aae37941e9d9e87b431929135b67168a2ac1.yaml8
-rw-r--r--data/bzpage.js85
-rw-r--r--data/rhbzpage.js49
-rw-r--r--data/skip-bug.js20
-rw-r--r--data/util.js86
-rw-r--r--lib/main.js12
-rw-r--r--lib/util.js2
12 files changed, 244 insertions, 96 deletions
diff --git a/bugs/issue-19e01fc733de5d53809f3423cb6ff0a5fb7d3019.yaml b/bugs/issue-19e01fc733de5d53809f3423cb6ff0a5fb7d3019.yaml
index cfc2e7e..2b34b8e 100644
--- a/bugs/issue-19e01fc733de5d53809f3423cb6ff0a5fb7d3019.yaml
+++ b/bugs/issue-19e01fc733de5d53809f3423cb6ff0a5fb7d3019.yaml
@@ -5,8 +5,8 @@ type: :bugfix
component: bugzilla-triage
release:
reporter: Matej Cepl <mcepl@redhat.com>
-status: :unstarted
-disposition:
+status: :closed
+disposition: :fixed
creation_time: 2011-01-31 19:47:02.506618 Z
references: []
@@ -16,4 +16,8 @@ log_events:
- Matej Cepl <mcepl@redhat.com>
- created
- ""
+- - 2011-02-14 16:55:15.729691 Z
+ - Matej Cepl <mcepl@redhat.com>
+ - closed with disposition fixed
+ - doesn't happen anymore.
trac_id:
diff --git a/bugs/issue-237027cea4bc85bfad8931daa7143ac13293d7fd.yaml b/bugs/issue-237027cea4bc85bfad8931daa7143ac13293d7fd.yaml
new file mode 100644
index 0000000..483f33c
--- /dev/null
+++ b/bugs/issue-237027cea4bc85bfad8931daa7143ac13293d7fd.yaml
@@ -0,0 +1,19 @@
+--- !ditz.rubyforge.org,2008-03-06/issue
+title: "\"Def. Assignee\" button doesn't hide"
+desc: ""
+type: :bugfix
+component: bugzilla-triage
+release:
+reporter: Matej Cepl <mcepl@redhat.com>
+status: :unstarted
+disposition:
+creation_time: 2011-02-14 16:24:37.870775 Z
+references: []
+
+id: 237027cea4bc85bfad8931daa7143ac13293d7fd
+log_events:
+- - 2011-02-14 16:24:38.601662 Z
+ - Matej Cepl <mcepl@redhat.com>
+ - created
+ - ""
+trac_id:
diff --git a/bugs/issue-40324045db21fe6260149c43b369302baf19518b.yaml b/bugs/issue-40324045db21fe6260149c43b369302baf19518b.yaml
index 14d6cce..4005159 100644
--- a/bugs/issue-40324045db21fe6260149c43b369302baf19518b.yaml
+++ b/bugs/issue-40324045db21fe6260149c43b369302baf19518b.yaml
@@ -1,5 +1,5 @@
--- !ditz.rubyforge.org,2008-03-06/issue
-title: swithc to pageMods
+title: switch to pageMods
desc: What I am doing right now :)
type: :task
component: bugzilla-triage
@@ -31,4 +31,8 @@ log_events:
[17:02:16] dietrich: not sure if does what you want, but should have examples
[17:02:21] mcepl: will take a look
[17:03:07] * mcepl makes note to switch to proper pageMods ...
+- - 2011-02-14 16:56:14.748946 Z
+ - Matej Cepl <mcepl@redhat.com>
+ - edited title
+ - done, but no testing. Will add next.
trac_id:
diff --git a/bugs/issue-4b0135b3f8d3675913978d8cf258a28dd9dabb3d.yaml b/bugs/issue-4b0135b3f8d3675913978d8cf258a28dd9dabb3d.yaml
new file mode 100644
index 0000000..2543afd
--- /dev/null
+++ b/bugs/issue-4b0135b3f8d3675913978d8cf258a28dd9dabb3d.yaml
@@ -0,0 +1,26 @@
+--- !ditz.rubyforge.org,2008-03-06/issue
+title: Remove all ifExist elements
+desc: |-
+ I really don't like them, and now when createNewButton accepts whole
+ objects, we can avoid them (see setDefaultAssignee in rhbzpage.js for
+ an example).
+type: :task
+component: bugzilla-triage
+release:
+reporter: Matej Cepl <mcepl@redhat.com>
+status: :unstarted
+disposition:
+creation_time: 2011-02-14 12:05:04.006931 Z
+references: []
+
+id: 4b0135b3f8d3675913978d8cf258a28dd9dabb3d
+log_events:
+- - 2011-02-14 12:05:05.114654 Z
+ - Matej Cepl <mcepl@redhat.com>
+ - created
+ - ""
+- - 2011-02-14 12:07:18.816791 Z
+ - Matej Cepl <mcepl@redhat.com>
+ - commented
+ - also line 669 in fillInChipMagic
+trac_id:
diff --git a/bugs/issue-7511cacab3bd611fd72ada886a2d3735d02e281a.yaml b/bugs/issue-7511cacab3bd611fd72ada886a2d3735d02e281a.yaml
new file mode 100644
index 0000000..ed4bea6
--- /dev/null
+++ b/bugs/issue-7511cacab3bd611fd72ada886a2d3735d02e281a.yaml
@@ -0,0 +1,19 @@
+--- !ditz.rubyforge.org,2008-03-06/issue
+title: no password
+desc: ""
+type: :bugfix
+component: bugzilla-triage
+release:
+reporter: Matej Cepl <mcepl@redhat.com>
+status: :unstarted
+disposition:
+creation_time: 2011-02-14 16:50:55.160771 Z
+references: []
+
+id: 7511cacab3bd611fd72ada886a2d3735d02e281a
+log_events:
+- - 2011-02-14 16:50:55.884697 Z
+ - Matej Cepl <mcepl@redhat.com>
+ - created
+ - ""
+trac_id:
diff --git a/bugs/issue-e972aae37941e9d9e87b431929135b67168a2ac1.yaml b/bugs/issue-e972aae37941e9d9e87b431929135b67168a2ac1.yaml
index bfc3579..9da52e3 100644
--- a/bugs/issue-e972aae37941e9d9e87b431929135b67168a2ac1.yaml
+++ b/bugs/issue-e972aae37941e9d9e87b431929135b67168a2ac1.yaml
@@ -5,8 +5,8 @@ type: :bugfix
component: bugzilla-triage
release:
reporter: Matej Cepl <mcepl@redhat.com>
-status: :unstarted
-disposition:
+status: :closed
+disposition: :fixed
creation_time: 2011-02-01 23:55:23.152405 Z
references: []
@@ -16,4 +16,8 @@ log_events:
- Matej Cepl <mcepl@redhat.com>
- created
- ""
+- - 2011-02-14 16:54:55.434724 Z
+ - Matej Cepl <mcepl@redhat.com>
+ - closed with disposition fixed
+ - additional pageMod for process_bug.cgi page. Doesn't work for attachments.
trac_id:
diff --git a/data/bzpage.js b/data/bzpage.js
index b980e96..f99bc21 100644
--- a/data/bzpage.js
+++ b/data/bzpage.js
@@ -100,9 +100,10 @@ function executeCommand(cmdObj) {
* @param cmdParams Object with the appropriate parameters for the command
*/
function centralCommandDispatch (cmdLabel, cmdParams) {
- console.log("centralCommandDispatch : cmdLabel = " + cmdLabel +
- ", cmdParams = " + cmdParams);
+ console.log("centralCommandDispatch : cmdLabel = " + cmdLabel);
switch (cmdLabel) {
+ case "name":
+ break;
case "resolution":
case "product":
case "component":
@@ -231,6 +232,7 @@ function killNodes(doc, target, remove) {
* @return none
*/
function changeAssignee (newAssignee) {
+ console.log("changeAssignee : newAssignee = " + newAssignee);
var defAssigneeButton = null;
// Previous assignee should know what's going on in his bug
addToCCList(getOwner());
@@ -357,7 +359,13 @@ function createDeadLink (id, text, parent, callback, params, before, covered, ac
* @return none
*/
function createNewButton (location, after, cmdObj) {
- var newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn";
+ try {
+ var newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn";
+ } catch (e) {
+ console.log("createNewButton : e = " + e);
+ console.log("createNewButton : cmdObj.toSource() = " +
+ cmdObj.toSource());
+ }
// protection against double-firings
if (document.getElementById(newId)) {
@@ -428,24 +436,34 @@ function generateButtons (pkgs, kNodes) {
for (var pkg in pkgs) {
for (var cmdIdx in pkgs[pkg]) {
var cmdObj = pkgs[pkg][cmdIdx];
- switch (cmdObj.position) {
- case "topRow":
- createNewButton(topRowPosition, false, cmdObj);
- break;
- case "bottomRow":
- createNewButton(bottomRowPosition, false, cmdObj);
- break;
- case "dropDown":
- addToCommentsDropdown(cmdObj);
- break;
- default: // [+-]ID
- var firstChr = cmdObj.position.charAt(0);
- var newId = cmdObj.position.substr(1);
- createNewButton(newId, firstChr === "+", cmdObj);
- break;
+ if (cmdObj.position !== undefined) {
+ switch (cmdObj.position) {
+ case "topRow":
+ createNewButton(topRowPosition, false, cmdObj);
+ break;
+ case "bottomRow":
+ createNewButton(bottomRowPosition, false, cmdObj);
+ break;
+ case "dropDown":
+ addToCommentsDropdown(cmdObj);
+ break;
+ default: // [+-]ID
+ var firstChr = cmdObj.position.charAt(0);
+ var newId = cmdObj.position.substr(1);
+ createNewButton(newId, firstChr === "+", cmdObj);
+ break;
+ }
+ } else {
+ console.log("generateButtons : rejected cmdObj = " +
+ cmdObj.toSource());
}
}
}
+ // TODO This is weird in this place, but that's the place where all constantData etc.
+ // are finally defined and available.
+ if (RHBZinit) {
+ RHBZinit();
+ }
}
function setConfigurationButton () {
@@ -463,31 +481,6 @@ function setConfigurationButton () {
}, false);
}
-/*
- * From <a> element diggs out just plain email address
- * Note that bugzilla.gnome.org doesn't have mailto: url but
- * https://bugzilla.gnome.org/page.cgi?id=describeuser.html&login=mcepl%40redhat.com
- *
- * @param aElement Element with href attribute or something else
- * @return String with the address or null
- *
- */
-function parseMailto(aElement) {
- var emailStr = "", hrefStr = "";
- // use url utils
- if (aElement) {
- hrefStr = decodeURIComponent(aElement.getAttribute("href"));
- emailStr = hrefStr.split(":");
- // workaround for Gnome bugzilla ... no mailto: here.
- if (emailStr.length < 2) {
- var params = getParamsFromURL("https://" + window.location.hostname + "/" + hrefStr);
- return decodeURI(params.login);
- }
- return emailStr[1];
- }
- return null;
-}
-
/**
* Get the current title of the bug
*
@@ -757,7 +750,7 @@ function parseAttachmentLine(inElem) {
var aHref = Array.filter(aHrefsArr, function(x) {
return x.textContent.trim() === "Details";
})[0];
- var id = getParamsFromURL(aHref.getAttribute("href")).id;
+ var id = parseURL(aHref.getAttribute("href")).params.id;
// getting MIME type and size
var stringArray = inElem.getElementsByClassName("bz_attach_extra_info")[0].textContent.
@@ -1017,10 +1010,6 @@ function startup() {
location: window.location.href,
login: getLogin()
}));
-
- if (RHBZinit) {
- RHBZinit();
- }
}
startup();
diff --git a/data/rhbzpage.js b/data/rhbzpage.js
index 60dda35..fa511c7 100644
--- a/data/rhbzpage.js
+++ b/data/rhbzpage.js
@@ -78,8 +78,11 @@ function setDefaultAssignee() {
// Add setting default assignee
if ((defAss.length > 0) && (defAss !== getOwner())) {
- constantData.defaultAssigneeTrigger = true;
- createNewButton("bz_assignee_edit_container",true,"rh-common","setDefaultAssignee");
+ createNewButton("bz_assignee_edit_container",true, {
+ "name": "Def. Assignee",
+ "assignee": "default"
+ }); // TODO when this will be a production we can remove
+ // rh-common/setDefaultAssignee from RH_Data-packages.json
}
}
@@ -111,7 +114,6 @@ function closeSomeRelease() {
* Additional commands specific for this subclass, overriding superclass one.
*/
function RHcentralCommandDispatch(cmdLabel, cmdParams) {
- console.log("cmdLabel = " + cmdLabel + ", cmdParams = " + cmdParams);
switch (cmdLabel) {
// Set up our own commands
case "closeUpstream":
@@ -155,7 +157,7 @@ function addAttachment(data, callback, param) {
var params = [];
if (!constantData.passwordState.passAvailable) {
- console.log("No password, no XML-RPC calls; sorry");
+ console.log("addAttachment : No password, no XML-RPC calls; sorry");
return null;
}
@@ -341,8 +343,20 @@ function addCheckShowLink(oldAtt, snippet) {
*/
function markBadAttachments(atts) {
var badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ];
+/* FIXME
+error: An exception occurred.
+Traceback (most recent call last):
+ File "/home/matej/archiv/2011/projekty/bugzilla-triage/data/bzpage.js", line 1005, in
+ File "/home/matej/archiv/2011/projekty/bugzilla-triage/data/bzpage.js", line 998, in startup
+ File "/home/matej/archiv/2011/projekty/bugzilla-triage/data/rhbzpage.js", line 915, in RHBZinit
+ File "/home/matej/archiv/2011/projekty/bugzilla-triage/data/rhbzpage.js", line 344, in markBadAttachments
+TypeError: "use strict";constantData.passwordState is undefined
+*/
+ // FIXME this should work
+ console.log("markBadAttachments : constantData.passwordState.toSource() = " +
+ constantData.passwordState.toSource());
if (!constantData.passwordState.passAvailable) {
- console.log("No password, no XML-RPC calls; sorry");
+ console.log("markBadAttachments : No password, no XML-RPC calls; sorry");
return null;
}
@@ -456,15 +470,13 @@ function setBranding() {
}
*/
-/* // mark suspicious components FIXME
var compElems;
- if (suspiciousComponents
- && isInList(getComponent(), suspiciousComponents)
+ if (config.suspiciousComponents
+ && isInList(getComponent(), config.suspiciousComponents)
&& (compElems = document
.getElementById("bz_component_edit_container"))) {
compElems.style.background = "red none";
}
-*/
}
/**
@@ -649,13 +661,13 @@ function fillInChipMagic(XorgLogAttList, XorgLogAttListIndex) {
interestingArray = ChipsetRE.exec(interestingLineArr[0]);
interestingLine = interestingArray[2].
replace(/[\s"]+/g," ").trim();
- // Persuade createNewButton to have mercy and to actually add
- // non-default button
- constantData.chipMagicTrigger = true;
- // FIXME packages don't exist anymore
// that.packages["rh-xorg"].chipMagic.chipMagic = interestingLine+"\t"+interestingArray[1]
// .toUpperCase();
- createNewButton("status_whiteboard", true, "rh-xorg", "chipMagic");
+ // TODO we can remove rh-common / chipMagic element from RH_Data-packages.json
+ createNewButton("status_whiteboard", true, {
+ "name": "Fill In",
+ "chipMagic": true
+ });
}
}
}
@@ -667,7 +679,7 @@ function analyzeXorgLog(attachID) {
postMessage(new Message("GetURL", {
url: "https://bugzilla.redhat.com/attachment.cgi?id=" + attachID,
backMessage: "AnalyzeXorgLogBacktrace"
- };
+ }));
}
function analyzeXorgLogBacktrace(reponseText) {
@@ -897,6 +909,7 @@ function parseBacktrace (ret) {
function RHBZinit() {
// inheritance ... call superobject's constructor
+ console.log("We are in RHBZinit");
var AbrtRE = new RegExp("^\\s*\\[abrt\\]");
var btSnippet = "";
@@ -915,7 +928,7 @@ function RHBZinit() {
var attachments = getAttachments();
markBadAttachments(attachments);
- parsedAttachments = attachments.filter(function (att) {
+ var parsedAttachments = attachments.filter(function (att) {
return (new RegExp(titleParsedAttachment).test(att[0]));
});
@@ -926,7 +939,7 @@ function RHBZinit() {
// Dig out backtrace protection against double-firing?
btSnippet = "";
- var parseAbrtBacktraces = config.gJSONData.configData.parseAbrtBacktraces;
+ var parseAbrtBacktraces = config.parseAbrtBacktraces;
if (parseAbrtBacktraces && AbrtRE.test(getSummary())) {
pasteBacktraceInComments(parsedAttachments);
}
@@ -952,7 +965,7 @@ function RHBZinit() {
*/
// Take care of signature for Fedora bugzappers
- if (config.signature.length > 0) {
+ if (config.signature && config.signature.length > 0) {
var signatureFedoraString = config.signature;
document.forms.namedItem("changeform").addEventListener("submit",
function(aEvt) {
diff --git a/data/skip-bug.js b/data/skip-bug.js
new file mode 100644
index 0000000..9fcb531
--- /dev/null
+++ b/data/skip-bug.js
@@ -0,0 +1,20 @@
+// Released under the MIT/X11 license
+// http://www.opensource.org/licenses/mit-license.php
+// "use strict";
+
+function reloadPage() {
+ var stemURL = 'https://HOSTNAME/show_bug.cgi?id=';
+ var titleElems = document.getElementsByTagName('title');
+ if (titleElems) {
+ var REArr = new RegExp('[bB]ug\\s+([0-9]+)').
+ exec(titleElems[0].textContent);
+ var hostname = document.location.hostname;
+ if (REArr) {
+ console.log("Reloading bug " + REArr[1] + "!");
+ document.location = stemURL.
+ replace('HOSTNAME',hostname) + REArr[1];
+ }
+ }
+}
+
+reloadPage();
diff --git a/data/util.js b/data/util.js
index 5e8afcc..09360a0 100644
--- a/data/util.js
+++ b/data/util.js
@@ -4,29 +4,46 @@
// http://www.opensource.org/licenses/mit-license.php
"use strict";
// ==============================================================
+
/**
- * get parameters of URL as an object (name, value)
+ * parse URL to get its parts.
+ *
+ * @param url
+ * @return object with all parsed parts of URL as properties
+ *
+ * Originally from http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
+ * Copyright February 19th, 2009, James Padolsey, <license undeclared>
+ *
+ * This function creates a new anchor element and uses location
+ * properties (inherent) to get the desired URL data. Some String
+ * operations are used (to normalize results across browsers).
*/
-function getParamsFromURL (url, base) {
- if (!url || (url.toString().length === 0)) {
- throw new Error("Missing URL value!");
- }
-
- var aElem = document.createElement("a");
- aElem.href = url;
-
- var paramsArr = url.pathname.split("?");
- if (paramsArr.length === 1) {
- return {};
- }
-
- // get convert URL parameters to an Object
- var params = {}, s = [];
- paramsArr[1].split('&').forEach(function(par) {
- s = par.split('=');
- params[s[0]] = s[1];
- });
- return params;
+function parseURL(url) {
+ var a = document.createElement('a');
+ a.href = url;
+ return {
+ source: url,
+ protocol: a.protocol.replace(':',''),
+ host: a.hostname,
+ port: a.port,
+ query: a.search,
+ params: (function(){
+ var ret = {},
+ seg = a.search.replace(/^\?/,'').split('&'),
+ len = seg.length, i = 0, s;
+ for (;i<len;i++) {
+ if (!seg[i]) { continue; }
+ s = seg[i].split('=');
+ ret[s[0]] = s[1];
+ }
+ return ret;
+ })(),
+ file: (a.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1],
+ hash: a.hash.replace('#',''),
+ path: a.pathname.replace(/^([^\/])/,'/$1'),
+ relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [,''])[1],
+ segments: a.pathname.replace(/^\//,'').split('/')
+ };
}
/**
@@ -56,12 +73,37 @@ function getBugNo() {
* @return String with the bug ID
*/
function getBugNoFromURL(url) {
- var params = getParamsFromURL(url);
+ var params = parseURL(url).params;
if (params && params.id) {
return params.id;
}
}
+/*
+ * From <a> element diggs out just plain email address
+ * Note that bugzilla.gnome.org doesn't have mailto: url but
+ * https://bugzilla.gnome.org/page.cgi?id=describeuser.html&login=mcepl%40redhat.com
+ *
+ * @param aElement Element with href attribute or something else
+ * @return String with the address or null
+ *
+ */
+function parseMailto(aElement) {
+ var emailStr = "", hrefStr = "";
+ // use url utils
+ if (aElement) {
+ hrefStr = decodeURIComponent(aElement.getAttribute("href"));
+ emailStr = hrefStr.split(":");
+ // workaround for Gnome bugzilla ... no mailto: here.
+ if (emailStr.length < 2) {
+ var params = parseURL("https://" + window.location.hostname + "/" + hrefStr).params;
+ return decodeURI(params.login);
+ }
+ return emailStr[1];
+ }
+ return null;
+}
+
/**
* format date to be in ISO format (just day part)
*
diff --git a/lib/main.js b/lib/main.js
index abdc758..be4ff8d 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -115,8 +115,8 @@ var contentScriptLibraries = {
"bugzilla.redhat.com": [
self.data.url("util.js"),
self.data.url("color.js"),
+ self.data.url("rhbzpage.js"),
self.data.url("bzpage.js")
-// self.data.url("rhbzpage.js")
]
};
@@ -136,4 +136,12 @@ libbz.initialize(libbz.config, function () {
});
});
-tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=595017");
+pageMod.PageMod({
+ include: [
+ "https://bugzilla.redhat.com/process_bug.cgi"
+ ],
+ contentScriptWhen: 'ready',
+ contentScriptFile: self.data.url("skip-bug.js")
+});
+
+//tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=595017");
diff --git a/lib/util.js b/lib/util.js
index 8556951..3532203 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -23,7 +23,7 @@ function getParamsFromURL (url, base) {
var paramsArr = url.path.split("?");
if (paramsArr.length === 1) {
return {};
- }
+ }
// get convert URL parameters to an Object
var params = {}, s = [];