aboutsummaryrefslogtreecommitdiffstats
path: root/bugzillaBugTriage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2009-11-17 23:56:52 +0100
committerMatěj Cepl <mcepl@redhat.com>2009-11-17 23:56:52 +0100
commit32451515a95063e467e780a9956f3107bb66d87f (patch)
treeb173e76c2bf59322090cc4f16c450da52309d258 /bugzillaBugTriage.js
parent22d53525ec9195e5d7256da96161fb2ce7d6571d (diff)
downloadbugzilla-triage-32451515a95063e467e780a9956f3107bb66d87f.tar.gz
Attempts to fix XML-RPC (unsuccesful) & support for new Triage keyword
instead of ASSIGNED.
Diffstat (limited to 'bugzillaBugTriage.js')
-rw-r--r--bugzillaBugTriage.js97
1 files changed, 77 insertions, 20 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index f300cb8..5a7ca59 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -15,6 +15,7 @@ var ReporterColor = "#FFFFA6";
var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
var myConfig = jetpack.storage.simple;
var badMIMEArray = ["application/octet-stream","text/x-log"];
+var TriagedDistro = 12
//==============================================================
// CONFIGURE: The easiest method how to set up the configuration
@@ -184,14 +185,45 @@ function parseURL(url) {
*
* @param str string with the keyword
* @return Boolean
- *
*/
bzPage.prototype.hasKeyword = function (str) {
- var kwd = $.trim($('#keywords', this.doc).text());
+ var kwd = $.trim($('#keywords', this.doc).val());
return (new RegExp(str).test(kwd));
};
/**
+ * Set additional keyword if it isn't there
+ *
+ * @param str string with the keyword
+ * @return none
+ */
+bzPage.prototype.setKeyword = function (str) {
+ var keywordInput = $('#keywords', this.doc);
+ var kwd = $.trim(keywordInput.val());
+ if (!/str/.test(kwd)) {
+ keywordInput.val(kwd ? kwd + ", " + str : str);
+ };
+};
+
+/**
+ * Get the current version of the Fedora release ... even if changed
+ * meanwhile by bug triager.
+ *
+ * @return string (integer for released Fedora, float for RHEL, rawhide)
+ */
+bzPage.prototype.getVersion = function () {
+ var verStr = $("#version option:selected:first", this.doc).text().toLowerCase();
+ var verNo = new Number();
+ if (/rawhide/.test(verStr)) {
+ verNo = 999;
+ } else {
+ verNo = Number(verStr);
+ }
+ console.log("getVersion verStr = " + verStr + ", verNo = " + verNo);
+ return verNo;
+};
+
+/**
* Send mouse click to the specified element
* @param element where to send mouseclick to
* @return None
@@ -238,6 +270,15 @@ bzPage.prototype.checkComments = function () {
};
/**
+ * Is this bug a RHEL bug?
+ *
+ * @return Boolean true if it is a RHEL bug
+ */
+bzPage.prototype.isRHEL = function() {
+ return /Red Hat Enterprise Linux/.test(this.product);
+}
+
+/**
* Set branding colours to easily distinguish between Fedora and RHEL bugs
*
* @param brand string with product of the current bug
@@ -249,14 +290,15 @@ bzPage.prototype.checkComments = function () {
bzPage.prototype.setBranding = function () {
var brandColor = "";
- if (new RegExp("Red Hat Enterprise Linux").test(this.product)) {
+ if (this.isRHEL()) {
if (this.its.length > 0) {
brandColor = RHITColor;
} else {
brandColor = RHColor;
}
} else if (new RegExp("Fedora").test(this.product)) {
- if (new RegExp("rawhide", "i").test(this.version)) {
+ console.log("version = " + this.version);
+ if (this.version == 999) {
brandColor = RawhideColor;
} else {
brandColor = FedoraColor;
@@ -788,7 +830,6 @@ bzPage.prototype.createXMLRPCMessage = function(login,password,attachId,mimeType
</param>
</params>
</methodCall>;
- console.log("XMLRPC message:\n" + msg.toXMLString());
return msg.toXMLString();
}
@@ -800,22 +841,27 @@ bzPage.prototype.createXMLRPCMessage = function(login,password,attachId,mimeType
* @param type string with the new MIME type, e.g. "text/plain"
*/
bzPage.prototype.fixAttachById = function(id,type) {
- var ret = {};
var msg = this.createXMLRPCMessage(this.login,this.password,id,type);
- ret = $.post(XMLRPCurl,
- msg,this.callBack);
-// spec is http://www.xmlrpc.com/spec
- // FIXME content-type MUST be text/xml
-// // The following is most likely nonsense, because jQuery.post doesn't return
-// // with failure. Commenting out for now.
-// }
-// catch (e) {
-// console.log("XMLRPC failed: error = " + e + ", return = " + ret);
-// throw(e);
-// }
+ var ret = $.ajax({
+ type: "POST",
+ url: XMLRPCurl,
+ success: this.callBack,
+ contentType: "text/xml",
+ data: msg,
+ processData: false,
+ dataType: "xml"
+ });
+
+//function (data, textStatus) {
+// // data could be xmlDoc, jsonObj, html, text, etc...
+// this; // the options for this ajax request
+//}
+
+ // spec is http://www.xmlrpc.com/spec
+ // FIXME content-type MUST be text/xml
this.reqCounter++;
}
-
+
bzPage.prototype.fixAllAttachments = function(list) {
var tmpElem = {};
@@ -967,10 +1013,20 @@ bzPage.prototype.generalPurposeCureForAllDisease = function
}
this.addKeyword(secondParameter);
} else if (nextState == "ASSIGNED") {
+ // We lie, this is not just plain ASSIGNED, but
+ // modified according to
+ // https://fedoraproject.org/wiki/BugZappers/Meetings/Minutes-2009-Oct-27
+ // for F12 and later, ASSIGNED is "don't change status, add
+ // Triaged keyword"
if (!isInList(this.maintCCAddr, this.CCList)) {
$("#newcc",this.doc).text(this.maintCCAddr);
}
- this.selectOption("bug_status", nextState);
+ var verNo = this.getVersion();
+ if ((!this.isRHEL()) && (verNo < TriagedDistro)) {
+ this.selectOption("bug_status", nextState);
+ } else {
+ this.setKeyword("Triaged");
+ }
} else if (nextState == "QUERYSEL") {
this.queryForSelection();
} else if (nextState == "SETDEFASS") {
@@ -1059,7 +1115,8 @@ function bzPage(doc) {
this.doc).attr("title");
this.product = $("#product option:selected:first", this.doc).text();
this.component = $("#component option:selected:first", this.doc).text();
- this.version = $("#version option:selected:first", this.doc).text();
+ this.version = this.getVersion();
+ console.log("version = " + this.version);
this.its = $.trim($("#cf_issuetracker", this.doc).attr("value"));
console.log("its = " + this.its);
this.CCList = $.makeArray($("#cc", this.doc).attr("value"));