aboutsummaryrefslogtreecommitdiffstats
path: root/bugzillaBugTriage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2009-12-28 19:06:46 +0100
committerMatěj Cepl <mcepl@redhat.com>2009-12-28 19:06:46 +0100
commit629418c499e26227a54ee6452441545ed9e89490 (patch)
tree8a8b7af2df20a7553888436703f59f9a0f6bda72 /bugzillaBugTriage.js
parentae4bc5d4588ae0dc01009ef4eda540f08ef99e67 (diff)
downloadbugzilla-triage-629418c499e26227a54ee6452441545ed9e89490.tar.gz
Nucleus of the upstreaming button.
Diffstat (limited to 'bugzillaBugTriage.js')
-rw-r--r--bugzillaBugTriage.js58
1 files changed, 49 insertions, 9 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index 2c6bc7d..79b3b6e 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -110,6 +110,8 @@ $.getJSON(jsonDataURL, function (response) {
AddrArray = response.CCmaintainer;
defAssigneeList = response.defaultAssignee;
queryButtonAvailable = response.queryButton;
+ upstreamButtonAvailable = response.upstreamButton;
+ upstreamBugzillasArray = response.upstreamBugzillas;
chipIDsGroupings = response.chipIDsGroupings;
topRow = response.topRow;
bottomRow = response.bottomRow;
@@ -512,20 +514,33 @@ BzPage.prototype.addTextToTextBox = function(id,string2BAdded) {
textBox.value = textBox.value + string2BAdded;
};
+BzPage.prototype.commentsWalker = function (fce) {
+ var comments = this.dok.getElementById("comments").
+ getElementsByClassName("bz_comment");
+ Array.forEach(comments,function (item) { fce (item); },this);
+};
+
/**
* Set background color of all comments made by reporter in ReporterColor color
*
*/
BzPage.prototype.checkComments = function () {
- var comments = this.dok.getElementById("comments").
- getElementsByClassName("bz_comment");
- Array.forEach(comments,function (item) {
- var email = item.getElementsByClassName("vcard")[0].
+ var that = this;
+ this.commentsWalker( function (x) {
+ var email = x.getElementsByClassName("vcard")[0].
getElementsByTagName("a")[0].textContent;
- if (new RegExp(this.reporter).test(email)) {
- item.style.backgroundColor = ReporterColor.toString();
+ if (new RegExp(that.reporter).test(email)) {
+ x.style.backgroundColor = ReporterColor.toString();
}
- },this);
+ });
+};
+
+BzPage.prototype.collectComments = function () {
+ var outStr = "";
+ this.commentsWalker( function (x) {
+ outStr += x.getElementsByTagName("pre")[0].textContent + "\n";
+ });
+ return outStr;
};
/**
@@ -835,6 +850,23 @@ BzPage.prototype.queryForSelection = function() {
};
/**
+ * Get the text to search for and prepare other things for the real executive
+ * function this.queryInNewTab, and run it.
+ */
+BzPage.prototype.sendBugUpstream = function() {
+ var baseURL = filterByRegexp(upstreamBugzillasArray,
+ this.getOptionValue("component"));
+
+ var text = jetpack.selection.text;
+ if (!text) {
+ text = jetpack.clipboard.get();
+ }
+ if (text) {
+ this.queryInNewTab(text, this.component);
+ }
+};
+
+/**
* Parse the row with the attachment
*
* @param <tr> DOM element to be parsed
@@ -1280,6 +1312,8 @@ BzPage.prototype.generalPurposeCureForAllDisease = function
this.setKeyword("Triaged");
} else if (nextState === "QUERYSEL") {
this.queryForSelection();
+ } else if (nextState === "SENDUPSTREAM") {
+ this.sendBugUpstream();
} else if (nextState === "SETDEFASS") {
if (secondParameter.length > 0) {
this.changeOwner(secondParameter);
@@ -1354,13 +1388,19 @@ BzPage.prototype.buildButtons = function (above,below) {
this.generateToolBar(commentBox.previousSibling,above);
this.generateToolBar(this.originalButton,below);
+ var commentArea = this.dok.getElementById("comment_status_commit");
+ var brElementPlacer = commentArea.getElementsByTagName("br")[0];
+
if (queryButtonAvailable) {
// Add query search button
- var triagedButton = this.dok.getElementById("comment_status_commit");
- var brElementPlacer = triagedButton.getElementsByTagName("br")[0];
this.addNewButton(brElementPlacer,"newqueryintab",
"Query for string","","QUERYSEL","",false);
}
+ // Button for upstreaming
+ if (upstreamButtonAvailable) {
+ this.addNewButton(brElementPlacer,"sendupstream",
+ "Send upstream","","SENDUPSTREAM","",false);
+ }
// FIXME Get compiz bugs as well
if ((chipIDsGroupings.length >0) &&
this.maintCCAddr === "xgl-maint@redhat.com") {