aboutsummaryrefslogtreecommitdiffstats
path: root/bugzillaBugTriage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-05-17 14:46:26 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-05-17 14:46:26 +0200
commit0e8d7917b283b8cfff57fbee2fbd6424750e1b1b (patch)
tree0d89a023b72275bce6817a3af5bf1f1bf0ba2e42 /bugzillaBugTriage.js
parentf7f1c969292fefc432210d9046753ede4ffc67c9 (diff)
downloadbugzilla-triage-0e8d7917b283b8cfff57fbee2fbd6424750e1b1b.tar.gz
Tons of small bugs removed, seems like almost doing.
Diffstat (limited to 'bugzillaBugTriage.js')
-rw-r--r--bugzillaBugTriage.js120
1 files changed, 75 insertions, 45 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index 1dffa51..546be53 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -28,7 +28,14 @@ var manifest = {
type : "text",
label : "Configuration file URL",
"default" : "http://mcepl.fedorapeople.org/scripts/BugZappers_data.json"
- } ]
+ },
+ {
+ name : "enabledPacks",
+ type : "text",
+ label : "comment packs should be enabled",
+ "default" : ""
+ }
+ ]
};
jetpack.future.import("storage.settings");
@@ -268,27 +275,23 @@ hlpr.isInList = function(mbr, list) {
* @return Array
*
* If something else than Array or String is passed to the function
- * strange things may happen and the result will be untouched
- * actual argument of the call.
+ * the result will be untouched actual argument of the call.
*/
hlpr.valToArray = function valToArray(val) {
- return (val instanceof Array) ? val : [val.trim()];
+ return (val instanceof Array) ? val : [val];
};
/**
* Merges two comma separated string as a list and returns new string
*
- * @param str String with one values
+ * @param str String with old values
* @param value String/Array with other values
* @return String with merged lists
*/
hlpr.addCSVValue = function addCSVValue(str, value) {
- str = str.trim();
- let parts = (str ? str.split(",") : []);
- // FIXME this doesn't work when value is actually array
- // Should it work? (neither original function worked)
- if (this.isInList(value,parts)) {
- parts.concat(hlpr.valToArray(value));
+ let parts = (str.trim().length > 0 ? str.split(",") : []);
+ if (!hlpr.isInList(parts,value)) {
+ parts = parts.concat(hlpr.valToArray(value));
}
return parts.join(",");
};
@@ -336,6 +339,7 @@ hlpr.loadJSON = function(URL, cb_function, what) {
what = this;
}
+ console.log("URL = " + URL);
hlpr.loadText(URL, function(text) {
let data = JSON.parse(text);
cb_function.call(what, data);
@@ -624,6 +628,8 @@ BZPage.prototype.getInstalledPackages = function() {
* @param cmdParams Object with the appropriate parameters for the command
*/
BZPage.prototype.centralCommandDispatch = function (cmdLabel, cmdParams) {
+ console.log("BZPage centralCommandDispatch\n"+
+ "cmdLabel = " + cmdLabel + ", cmdParams = " + cmdParams);
switch (cmdLabel) {
// FIXME we don't have guaranteed order of execution, but
// for example resolution can be executed only after status;
@@ -696,7 +702,9 @@ BZPage.prototype.centralCommandDispatch = function (cmdLabel, cmdParams) {
this.addStuffToTextBox("comment", cmdParams);
break;
case "commentIdx":
+ console.log("commentIdx: idx = " + cmdParams);
let commentText = this.commentStrings[cmdParams];
+ console.log("comment = " + commentText);
this.addStuffToTextBox("comment", commentText);
break;
case "setNeedinfo":
@@ -728,9 +736,11 @@ BZPage.prototype.centralCommandDispatch = function (cmdLabel, cmdParams) {
*/
BZPage.prototype.executeCommand = function (cmd) {
let [pkg, id] = cmd.split("//");
- let commentObj = this.installedPackages[pkg][id];
+ let commentObj = this.packages[pkg][id];
for (let key in commentObj) {
+ console.log("key = " + key +
+ "\ncommentObj = " + commentObj.toSource());
this.centralCommandDispatch(key,commentObj[key]);
}
};
@@ -869,13 +879,13 @@ BZPage.prototype.generateButtons = function() {
for (let cmdIdx in this.packages[pkg]) {
let cmdObj = this.packages[pkg][cmdIdx];
switch (cmdObj.position) {
- "topRow":
+ case "topRow":
this.createNewButton(topRowPosition, false, pkg, cmdIdx);
break;
- "bottomRow":
+ case "bottomRow":
this.createNewButton(bottomRowPosition, false, pkg, cmdIdx);
break;
- "dropDown":
+ case "dropDown":
this.addToCommentsDropdown(pkg,cmdIdx);
break;
default: // [+-]ID
@@ -1029,10 +1039,15 @@ BZPage.prototype.filterByRegexp = function(list, chosingMark) {
*/
BZPage.prototype.addStuffToTextBox = function(id, stuff) {
let textBox = this.doc.getElementById(id);
+ console.log("textBox.id = " + id);
+ console.log("textBox.stuff = " + stuff);
+ console.log("textBox.tagname = " + textBox.tagName.toLowerCase());
if (textBox.tagName.toLowerCase() === "textarea") {
- stuff = "\n\n" + stuff;
+ stuff = textBox.value ? "\n\n" + stuff : stuff;
+ textBox.value += stuff;
+ } else {
+ textBox.value = hlpr.addCSVValue(textBox.value,stuff);
}
- textBox.value = hlpr.addCSVValue(textBox.value,stuff);
};
/**
@@ -1055,7 +1070,7 @@ BZPage.prototype.removeStuffFromTextBox = function(id, stuff) {
*/
BZPage.prototype.idContainsWord = function(id, str) {
try {
- let kwd = this.doc.getElementById(id).value;
+ var kwd = this.doc.getElementById(id).value;
} catch (e) {
// For those who don't have particular element at all or if it is empty
return false;
@@ -1246,16 +1261,17 @@ BZPage.prototype.setUpLoggingButtons = function() {
* @param who String with email address or "self" if the current user
* of the bugzilla should be added
*/
-BZPage.prototype.addToCCList(who) {
+BZPage.prototype.addToCCList = function(who) {
+ console.log("who = " + who);
if (who == "self") {
this.doc.getElementById("addselfcc").checked = true;
} else {
this.clickMouse("cc_edit_area_showhide");
if (!hlpr.isInList(who, this.CCList)) {
- this.doc.addStuffToTextBox("newcc",who);
+ this.addStuffToTextBox("newcc",who);
}
}
-}
+};
/**
* a collect a list of emails on CC list
@@ -1343,9 +1359,6 @@ MozillaBugzilla.prototype.constructor = MozillaBugzilla;
// RHBugzillaPage object
RHBugzillaPage = function(doc) {
- // inheritance ... call superobject's constructor
- BZPage.call(this,doc);
-
// For identification of graphics card
const manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ],
[ "ATI Mobility Radeon", "ATI", "1002" ],
@@ -1362,6 +1375,16 @@ RHBugzillaPage = function(doc) {
this.RHITColor = new Color(102, 0, 102); // RGB 102, 0, 102; HSL 300, 0, 20
// END OF CONSTANTS
+ // Prepare for query buttons
+ let commentArea = doc.getElementById("comment_status_commit");
+ let brElementPlacer = commentArea.getElementsByTagName("br")[0];
+ brElementPlacer.setAttribute("id","brElementPlacer_location");
+ brElementPlacer.parentNode.insertBefore(doc.createElement("br"),
+ brElementPlacer);
+
+ // inheritance ... call superobject's constructor
+ BZPage.call(this,doc);
+
let that = this;
this.reqCounter = 0;
this.chipMagicInterestingLine = "";
@@ -1382,13 +1405,6 @@ RHBugzillaPage = function(doc) {
this.its = ITbutton ? ITbutton.value.trim() : "";
this.CCList = this.getCCList();
- // Prepare for query buttons
- let commentArea = this.doc.getElementById("comment_status_commit");
- let brElementPlacer = commentArea.getElementsByTagName("br")[0];
- brElementPlacer.setAttribute("id","brElementPlacer_location");
- brElementPlacer.parentNode.insertBefore(this.doc.createElement("br"),
- brElementPlacer);
-
// set default assignee on change of the component
this.doc.getElementById("component").addEventListener("change",
function() {
@@ -1412,8 +1428,8 @@ RHBugzillaPage = function(doc) {
}
// Take care of signature for Fedora bugzappers
- if (config.gJSONData.configData.signatureFedoraString.length > 0) {
- let signatureFedoraString = config.gJSONData.configData.signatureFedoraString;
+ if (config.gJSONData.configData.signature.length > 0) {
+ let signatureFedoraString = config.gJSONData.configData.signature;
this.doc.forms.namedItem("changeform").addEventListener("submit",
function() {
that.addStuffToTextBox("comment", signatureFedoraString);
@@ -1448,6 +1464,7 @@ RHBugzillaPage.prototype.setDefaultAssignee = function() {
this.defaultAssignee = this.filterByRegexp(
this.constantData.defaultAssignee,
this.component).toLowerCase();
+ let defAss = this.defaultAssignee;
// Add setting default assignee
if ((defAss.length > 0) && (defAss !== this.getOwner())) {
@@ -1488,6 +1505,8 @@ RHBugzillaPage.prototype.closeSomeRelease = function() {
* Additional commands specific for this subclass, overriding superclass one.
*/
RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams) {
+ console.log("RHBugzillaPage centralCommandDispatch\n"+
+ "cmdLabel = " + cmdLabel + ", cmdParams = " + cmdParams);
switch (cmdLabel) {
// Set up our own commands
case "closeUpstream":
@@ -1514,7 +1533,7 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams)
break;
// If we don't have it here, call superclass method
default:
- BZPage.centralCommandDispatch.call(this, cmdLabel, cmdParams);
+ BZPage.prototype.centralCommandDispatch.call(this, cmdLabel, cmdParams);
break;
}
};
@@ -1952,6 +1971,7 @@ RHBugzillaPage.prototype.fillInChipMagic = function () {
this.chipMagicInterestingLine = interestingLine+"\t"+interestingArray[1]
.toUpperCase();
this.createNewButton("status_whiteboard", true, "rh-xorg", "chipMagic");
+ }
} else {
throw "Getting attachment " + attURL + "failed!";
}
@@ -2314,7 +2334,7 @@ RHBugzillaPage.prototype.addClosingUpstream = function() {
// to the upstream bug.
if ((externalBugID > 0) || (refs.length > 2)) {
let msgStr = this.commentStrings["sentUpstreamString"];
- msgStr.replace( "§§§", wholeURL));
+ msgStr = msgStr.replace("§§§", wholeURL);
this.centralCommandDispatch("comment",msgStr);
this.centralCommandDispatch("status", "CLOSED");
this.centralCommandDispatch("resolution", "UPSTREAM");
@@ -2337,12 +2357,15 @@ RHBugzillaPage.prototype.markBugTriaged = function() {
// for F13 and later, ASSIGNED is "add Triaged keyword" (as well)
// for <F13 it is "add both" (ASSIGNED status and Triaged keyword)
let ver = this.getVersion();
- if (!hlpr.isInList(this.maintCCAddr, this.CCList)) {
- this.addToCCList(this.maintCCAddr);
+ let assignee = this.getOwner();
+ if (!hlpr.isInList(assignee, this.CCList)) {
+ this.addToCCList(assignee);
}
if ((!this.isEnterprise()) && (ver < TriagedDistro)) {
this.selectOption("bug_status", "ASSIGNED");
}
+ console.log("calling addStuffToTextBox in markBugTriaged with\n" +
+ "keywords and Triaged");
this.addStuffToTextBox("keywords","Triaged");
}
@@ -2477,16 +2500,23 @@ let callback = function(doc) {
let config = {};
config.matches = [
"https://bugzilla.redhat.com/show_bug.cgi",
- ""
+ "https://bugzilla.mozilla.org/show_bug.cgi"
];
hlpr.loadJSON(jetpack.storage.settings.JSONURL, function(parsedData) {
console.log("jsonDataURL = " + jetpack.storage.settings.JSONURL);
config.gJSONData = parsedData;
-});
-// Get card translation table
-if ("PCIIDsURL" in config.gJSONData.configData) {
- hlpr.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) {
- config.PCI_ID_Array = response;
- });
-}
+
+ // Get card translation table
+ let keys = "";
+ for (let key in config.gJSONData) {
+ keys += key + " ";
+ }
+// console.log("configData = " + config.gJSONData.toSource());
+ console.log("keys = " + keys);
+ if ("PCIIDsURL" in config.gJSONData.configData) {
+ hlpr.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) {
+ config.PCI_ID_Array = response;
+ });
+ }
+}, this);
jetpack.pageMods.add(callback, config);