aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-10-10 14:11:50 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-10-10 14:13:30 +0200
commitdf33c6920d9dd3765202b86614b660d2c8f85db2 (patch)
tree9644a35ec23e2a3fa588bc56c86d0c52906e8592
parent5be47e95d1cef282046cdf8d159cd69f986245c8 (diff)
downloadbugzilla-triage-df33c6920d9dd3765202b86614b660d2c8f85db2.tar.gz
Update to the latest Request API
-rw-r--r--bugs/project.yaml8
-rw-r--r--lib/bzpage.js6
-rw-r--r--lib/main.js12
-rw-r--r--lib/rhbzpage.js35
-rw-r--r--package.json2
5 files changed, 27 insertions, 36 deletions
diff --git a/bugs/project.yaml b/bugs/project.yaml
deleted file mode 100644
index dfc2d0d..0000000
--- a/bugs/project.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
---- !ditz.rubyforge.org,2008-03-06/project
-name: bugzilla-triage
-version: "0.5"
-components:
-- !ditz.rubyforge.org,2008-03-06/component
- name: bugzilla-triage
-releases: []
-
diff --git a/lib/bzpage.js b/lib/bzpage.js
index b8c38b8..94689ce 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -150,9 +150,9 @@ BZPage.prototype.getRealBugNo = function () {
// https://bugzilla.redhat.com/show_bug.cgi?ctype=xml&id=serialWacom
Request({
url: this.win.location.href+"&ctype=xml",
- onComplete: function() {
- if (this.response.status === 200) {
- var xmlRepr = this.response.xml;
+ onComplete: function(response) {
+ if (response.status === 200) {
+ var xmlRepr = response.xml;
var bugID = parseInt(xmlRepr.getElementsByTagName("bug_id")[0].textContent, 10);
if (isNaN(bugID)) {
throw new Error("Cannot get bug no. even from XML representation!");
diff --git a/lib/main.js b/lib/main.js
index ea01925..8e8aeaa 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -65,9 +65,9 @@ function initialize(callback) {
Request({
url: urlStr,
- onComplete: function () {
- if (this.response.status == 200) {
- config.gJSONData = this.response.json;
+ onComplete: function (response) {
+ if (response.status == 200) {
+ config.gJSONData = response.json;
// Get additional tables
if ("downloadJSON" in config.gJSONData.configData) {
@@ -78,9 +78,9 @@ function initialize(callback) {
var url = arr[1];
Request({
url: url,
- onComplete: function() {
- if (this.response.status == 200) {
- config.gJSONData.constantData[title] = this.response.json;
+ onComplete: function(response) {
+ if (response.status == 200) {
+ config.gJSONData.constantData[title] = response.json;
}
}
}).get();
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index 2ab161f..0d9aad0 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -256,10 +256,9 @@ RHBugzillaPage.prototype.addAttachment = function addAttachment(data, callback,
Request({
url: this.constantData.XMLRPCData[this.hostname].url,
- onComplete: function() {
- if (this.response.status == 200) {
- console.log("this.response = " + this.response);
- var resp = util.parseXMLfromString(this.response.text);
+ onComplete: function(response) {
+ if (response.status == 200) {
+ var resp = util.parseXMLfromString(response.text);
var newAttachID = parseInt(resp.params.param.value.array.data.value.int, 10);
console.log("attachID = " + newAttachID);
callback.call(that, param, newAttachID, data.length);
@@ -324,9 +323,9 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() {
var that = this;
Request({
url: attURL,
- onComplete: function() {
- if (this.response.status == 200) {
- that.btSnippet = that.parseBacktrace(this.response.text);
+ onComplete: function(response) {
+ if (response.status == 200) {
+ that.btSnippet = that.parseBacktrace(response.text);
if (that.btSnippet) {
that.addCheckShowLink.call(that,x,that.btSnippet);
}
@@ -354,15 +353,15 @@ RHBugzillaPage.prototype.showAttachment = function showAttachment(id) {
var that = this;
Request({
url: "https://" + that.hostname + "/attachment.cgi?id=" + id,
- onComplete: function () {
- if (this.response.status == 200) {
+ onComplete: function (response) {
+ if (response.status == 200) {
var infoWin = that.win.open("", "Check att. " + id,
"width=640,height=640,status=no,location=no,"+
"titlebar=no,scrollbars=yes,resizable=yes"+
"alwaysRaised=yes");
var doc = infoWin.document;
doc.body.innerHTML = "<pre id='textPre'>"+
- this.response.text + "</pre>";
+ response.text + "</pre>";
}
}
}).get();
@@ -740,9 +739,9 @@ RHBugzillaPage.prototype.fillInChipMagic = function fillInChipMagic() {
// parse Xorg.0.log
Request({
url: attURL,
- onComplete: function () {
- if (this.response.status == 200) {
- var interestingLineArr = this.response.text.split("\n").
+ onComplete: function (response) {
+ if (response.status == 200) {
+ var interestingLineArr = response.text.split("\n").
filter(function (v,i,a) {
return that.RE.Chipset.test(v);
});
@@ -777,9 +776,9 @@ RHBugzillaPage.prototype.analyzeXorgLog = function analyzeXorgLog(attachID) {
var that = this;
Request({
url: attURL,
- onComplete: function() {
- if (this.response.status == 200) {
- var results = this.response.text.split("\n").
+ onComplete: function(response) {
+ if (response.status == 200) {
+ var results = response.text.split("\n").
filter(function(line) {
return (that.RE.soughtLines.test(line));
});
@@ -886,8 +885,8 @@ RHBugzillaPage.prototype.fixAttachById = function fixAttachById(id, type, email)
// test on https://bugzilla.redhat.com/show_bug.cgi?id=485145
Request({
url: this.constantData.XMLRPCData[this.hostname].url,
- onComplete: function() {
- if (this.response.status == 200) {
+ onComplete: function(response) {
+ if (response.status == 200) {
that.XMLRPCcallback.call(that);
}
},
diff --git a/package.json b/package.json
index 7935d18..1886364 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"id": "jid0-uXmbeWgOltUUuqrHKhrR7hW3IQY",
"dependencies": [
- "jetpack-core"
+ "jetpack-core", "addon-kit"
],
"fullName": "bugzilla-triage-scripts",
"description": "Additional buttons and other function helping in the triage on bugzilla",