aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/rhbzpage.js71
1 files changed, 38 insertions, 33 deletions
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index ef49383..9acb299 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -256,8 +256,8 @@ RHBugzillaPage.prototype.addAttachment = function addAttachment(data, callback)
var respStr = this.response.text; // bug 270553
respStr = respStr.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551
var resp = new XML(respStr);
- console.log("resp = " + resp.toXMLString());
- callback.call(that, parseInt(resp.id, 10));
+ console.log("resp = " + resp[0]);
+ callback.call(that, parseInt(resp[0], 10));
}
},
content: msg.xml(),
@@ -299,17 +299,18 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() {
'btparsed'))) {
var btAttachments = this.attachments
.filter(function(att, idx, arr) {
- return (/backtrace/.test(att[0]));
+ return (/File: backtrace/.test(att[0]));
});
// TODO we need to go through all backtrace attachments, but
// just the first one will do for now, we would need to do async
// parsing
+ console.log("btAttachments = " + btAttachments.toSource());
btAttachments.forEach(function(x) {
var attURL = "https://bugzilla.redhat.com/attachment.cgi?id="
+ x[1];
console.log("attURL = " + attURL);
console.log("this.btSnippet = " + this.btSnippet);
- console.log("btparsed = " + this.idContainsWord("cf_devel_whiteboard", 'btparsed'))
+ console.log("btparsed = " + this.idContainsWord("cf_devel_whiteboard", 'btparsed'));
if ((!this.btSnippet) &&
(!this.idContainsWord("cf_devel_whiteboard", 'btparsed'))) {
var that = this;
@@ -317,6 +318,7 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() {
url: attURL,
onComplete: function() {
if (this.response.status == 200) {
+ console.log("response = " + this.response.text);
that.btSnippet = that.parseBacktrace(this.response.text);
if (that.btSnippet) {
that.addCheckShowLink.call(that,x,that.btSnippet);
@@ -329,39 +331,42 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() {
}
};
-
-RHBugzillaPage.prototype.addCheckShowLink = function addCheckXorgLogLink(elem, snippet) {
- var that = this;
- var elemS = elem[4].getElementsByTagName("td");
- var elem = elemS[elemS.length - 1];
- elem.innerHTML += "<br/><a id='#attachBacktraceActivator' href='#'>check</a>";
- elem.addEventListener("click", function(x) {
- var meAElem = that.doc.getElementById("attachBacktraceActivator");
- meAElem.parentNode.removeChild(meAElem);
- that.addAttachment.call(that, snippet, function (attID) {
- elem.innerHTML += "<br/><a id='#showBacktrace' href='#'>show BT</a>";
- elem.addEventListener("click", function(evt) {
- that.showAttachment.call(that,attID);
- }, false);
- });
- }, false);
- this.addStuffToTextBox("status_whiteboard", "btparsed");
+RHBugzillaPage.prototype.showAttachment = function showAttachment(id) {
+ Request({
+ url: "https://" + this.hostname + "/attachment.cgi?id=" + id,
+ onComplete: function () {
+ var infoWin = this.win.open("", "Check att. " + id,
+ "width=640,height=640,status=no,location=no");
+ var doc = infoWin.document;
+ doc.body.innerHTML = "<pre id='textPre'>"+
+ this.response.text + "</pre>";
+ }
+ }).get();
};
-RHBugzillaPage.prototype.showAttachment = function showAttachment(id) {
- var attURL = "https://"+ this.hostname + "/attachment.cgi?id="+id;
- var infoWin = this.win.open("", "Check att. " + attachID,
- "width=640,height=640,status=no,location=no");
- var doc = infoWin.document;
- doc.body.innerHTML = "<pre id='textPre'>\n"+
-
- "</pre>";
+RHBugzillaPage.prototype.addNewAttachmentRow = function addNewAttachmentRow(oldRow) {
+ var newTRElem = oldRow.cloneNode(true);
+ var elem = newTRElem.querySelector("td:last-of-type");
+ elem.innerHTML += "<br/><a id='#showBacktrace' href='#'>show BT</a>";
+ elem.addEventListener("click", function(evt) {
+ that.showAttachment.call(that,attID);
+ },false);
+ oldRow.parentNode.insertBefore(newTRElem,oldRow.nextSibling);
+};
-/*
-FIXME this is unfinished and non-working
-we have to also make somehow that "show" link is created when loading the page
-*/
+RHBugzillaPage.prototype.addCheckShowLink = function addCheckXorgLogLink(oldElem, snippet) {
+ var that = this;
+ var elem = oldElem[4].querySelector("td:last-of-type");
+ elem.innerHTML += "<br/><a id='attachBacktraceActivator' href='#'>check</a>";
+ var meAElem = that.doc.getElementById("attachBacktraceActivator");
+ meAElem.addEventListener("click", function(x) {
+ that.addAttachment.call(that, snippet, function () {
+ that.addNewAttachmentRow(oldElem[4]);
+ }, false);
+ }, false);
+ meAElem.parentNode.removeChild(meAElem);
+ // this.addStuffToTextBox("status_whiteboard", "btparsed");
};
/**