diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-07-25 14:44:41 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-07-25 14:44:41 +0200 |
commit | 3a51ae92a501e9eb8dc1bed4eb1419473aba4604 (patch) | |
tree | 4ee3b33d3413d733622858816c765384b5662c61 | |
parent | d428a8122cbc803ef99acd6db03323ceb5b76f53 (diff) | |
download | bugzilla-triage-3a51ae92a501e9eb8dc1bed4eb1419473aba4604.tar.gz |
Move queryForSelection and affiiliated methods to BZPage.
Plus another attempt to make update.rdf work.
-rw-r--r-- | lib/bzpage.js | 65 | ||||
-rw-r--r-- | lib/rhbzpage.js | 147 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | update.rdf | 19 |
4 files changed, 126 insertions, 107 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js index 084b924..e315922 100644 --- a/lib/bzpage.js +++ b/lib/bzpage.js @@ -249,6 +249,9 @@ BZPage.prototype.centralCommandDispatch = function centralCommandDispatch (cmdLa case "addCC": this.addToCCList(cmdParams); break; + case "queryStringOurBugzilla": + this.queryForSelection(); + break; // TODO flags, see also case "commit": @@ -488,7 +491,7 @@ BZPage.prototype.setConfigurationButton = function setConfigurationButton () { BZPage.prototype.parseMailto = function parseMailto(aElement) { if (aElement) { var email = decodeURI(aElement.getAttribute("href")). - split(":")[1]; + split(":")[1]; } return null; }; @@ -839,6 +842,66 @@ BZPage.prototype.setUpLogging = function setUpLogging () { } }; +BZPage.prototype.getSelectionOrClipboard = function getSelectionOrClipboard () { + var text = selection.text; + if (!text) { + text = clip.get(); + } + return text; +}; + +/** + * Opens a new tab with a query for the given text in the selected component + * + * @param text to be searched for + * @param component String with the component name (maybe latter regexp?) + * @param product (optional) string with the product name, if undefined, + * search in all products + * @return None + * + */ +BZPage.prototype.queryInNewTab = function(text, component, product) { + var urlStr = "https://bugzilla.redhat.com/buglist.cgi?query_format=advanced"; + if (product) { + urlStr += "&product=" + product.trim(); + } + if (component) { + urlStr += "&field0-0-0=component&type0-0-0=substring&value0-0-0=" + + component.trim(); + } + // using more complicated query tables here, because they can be more easily + // edited + // for further investigative searches + if (text) { + text = encodeURIComponent(text.trim()); + var searchText = "&field1-0-0=longdesc&type1-0-0=substring&value1-0-0=" + + text + + "&field1-0-1=attach_data.thedata&type1-0-1=substring&value1-0-1=" + + text + + "&field1-0-2=status_whiteboard&type1-0-2=substring&value1-0-2=" + + text; + urlStr += searchText; + tabs.open({ + url: urlStr, + inBackground: true, + onOpen: function (t) { + tabs.activeTab = t; + } + }); + } +}; + +/** + * Get the text to search for and prepare other things for the real executive + * function this.queryInNewTab, and run it. + */ +BZPage.prototype.queryForSelection = function() { + var text = this.getSelectionOrClipboard(); + if (text) { + this.queryInNewTab(text, this.component); + } +}; + /** * adds a person to the CC list, if it isn't already there * diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js index 4458e28..92c6e28 100644 --- a/lib/rhbzpage.js +++ b/lib/rhbzpage.js @@ -228,9 +228,6 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams) case "computeResolution": this.closeSomeRelease(); break; - case "queryStringOurBugzilla": - this.queryForSelection(); - break; case "queryStringUpstreamBugzilla": this.queryUpstream(); break; @@ -437,6 +434,48 @@ RHBugzillaPage.prototype.setBranding = function() { } }; +/** + * Search simple query in the upstream bugzilla appropriate for the component. + */ +RHBugzillaPage.prototype.queryUpstream = function() { + var text = this.getSelectionOrClipboard(); + if (text) { + text = encodeURIComponent(text.trim()); + var queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug; + var urlBase = util.filterByRegexp(queryUpstreamBugsURLArray, this.component); + tabs.open({ + url: urlBase + text, + inBackground: true, + onOpen: function (tab) { + tabs.activeTab = tab; + } + }); + } +}; + +/** + * + */ +RHBugzillaPage.prototype.sendBugUpstream = function() { + var that = this; + var urlStr = util.filterByRegexp(JSON.parse(self.data.load("newUpstreamBug.json")), this + .getOptionValue("component")); + + tabs.open({ + url: urlStr, + inBackground: true, + onOpen: function (tab) { + var otherDoc = tab.contentDocument; + var otherElems = otherDoc.forms.namedItem("Create").elements; + otherElems.namedItem("short_desc").value = that.doc + .getElementById("short_desc_nonedit_display").textContent + .trim(); + otherElems.namedItem("comment").value = that.collectComments(); + tabs.activeTab = tab; + } + }); +}; + RHBugzillaPage.prototype.addCheckXorgLogLink = function addCheckXorgLogLink() { var that = this; if (this.xorglogAnalysis) { @@ -579,108 +618,6 @@ RHBugzillaPage.prototype.fillInChipMagic = function fillInChipMagic() { this.XorgLogAttListIndex++; }; -RHBugzillaPage.prototype.getSelectionOrClipboard = function getSelectionOrClipboard () { - var text = selection.text; - if (!text) { - text = clip.get(); - } - return text; -}; - -/** - * Opens a new tab with a query for the given text in the selected component - * - * @param text to be searched for - * @param component String with the component name (maybe latter regexp?) - * @param product (optional) string with the product name, if undefined, - * search in all products - * @return None - * - */ -RHBugzillaPage.prototype.queryInNewTab = function(text, component, product) { - var urlStr = "https://bugzilla.redhat.com/buglist.cgi?query_format=advanced"; - if (product) { - urlStr += "&product=" + product.trim(); - } - if (component) { - urlStr += "&field0-0-0=component&type0-0-0=substring&value0-0-0=" - + component.trim(); - } - // using more complicated query tables here, because they can be more easily - // edited - // for further investigative searches - if (text) { - text = encodeURIComponent(text.trim()); - var searchText = "&field1-0-0=longdesc&type1-0-0=substring&value1-0-0=" - + text - + "&field1-0-1=attach_data.thedata&type1-0-1=substring&value1-0-1=" - + text - + "&field1-0-2=status_whiteboard&type1-0-2=substring&value1-0-2=" - + text; - urlStr += searchText; - tabs.open({ - url: urlStr, - inBackground: true, - onOpen: function (t) { - tabs.activeTab = t; - } - }); - } -}; - -/** - * Get the text to search for and prepare other things for the real executive - * function this.queryInNewTab, and run it. - */ -RHBugzillaPage.prototype.queryForSelection = function() { - var text = this.getSelectionOrClipboard(); - if (text) { - this.queryInNewTab(text, this.component); - } -}; - -/** - * Search simple query in the upstream bugzilla appropriate for the component. - */ -RHBugzillaPage.prototype.queryUpstream = function() { - var text = this.getSelectionOrClipboard(); - if (text) { - text = encodeURIComponent(text.trim()); - var queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug; - var urlBase = util.filterByRegexp(queryUpstreamBugsURLArray, this.component); - tabs.open({ - url: urlBase + text, - inBackground: true, - onOpen: function (tab) { - tabs.activeTab = tab; - } - }); - } -}; - -/** - * - */ -RHBugzillaPage.prototype.sendBugUpstream = function() { - var that = this; - var urlStr = util.filterByRegexp(JSON.parse(self.data.load("newUpstreamBug.json")), this - .getOptionValue("component")); - - tabs.open({ - url: urlStr, - inBackground: true, - onOpen: function (tab) { - var otherDoc = tab.contentDocument; - var otherElems = otherDoc.forms.namedItem("Create").elements; - otherElems.namedItem("short_desc").value = that.doc - .getElementById("short_desc_nonedit_display").textContent - .trim(); - otherElems.namedItem("comment").value = that.collectComments(); - tabs.activeTab = tab; - } - }); -}; - /** * Parse the row with the attachment * diff --git a/package.json b/package.json index da1e13f..7253efa 100644 --- a/package.json +++ b/package.json @@ -7,5 +7,5 @@ "description": "Additional buttons and other function helping in the triage on bugzilla", "author": "Matej Cepl (http://matej.ceplovi.cz)", "license": "MIT/X11 (http://opensource.org/licenses/mit-license.php)", - "version": "0.15" + "version": "0.16" } @@ -24,6 +24,25 @@ <em:updateHash>e5009393f1ae052efb221d948a7fbb520f68e776</em:updateHash> </RDF:Description> </RDF:li> + <RDF:li> + <RDF:Description> + <em:version>0.16</em:version> <!-- This is the version number of the add-on --> + <!-- One targetApplication for each application the add-on is compatible with --> + <em:targetApplication> + <RDF:Description> + <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> + <em:minVersion>3.6</em:minVersion> + <em:maxVersion>4.*</em:maxVersion> + </RDF:Description> + </em:targetApplication> + <!-- This is where this version of the add-on will be downloaded from --> + <em:updateLink>https://fedorahosted.org/released/bugzilla-triage-scripts/bugzilla-triage-0.16.xpi</em:updateLink> + + <!-- A page describing what is new in this updated version --> + <em:updateInfoURL>https://fedorahosted.org/bugzilla-triage-scripts/wiki/ChangeLog</em:updateInfoURL> + <em:updateHash>d8bbddeeaf87f8f2f8c47d6a85d37caf0ba6df10</em:updateHash> + </RDF:Description> + </RDF:li> </RDF:Seq> </em:updates> </RDF:Description> |