aboutsummaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-03-25 15:01:26 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-06-05 14:44:00 +0200
commit3c3860cd080dec5a71ae6c3c7bc3438fa8875d94 (patch)
tree7faf6e539db51c581c017f48274762e6ec6a6195 /data
parent39e8a732fed33c134a301fad446b13223c4b3fc3 (diff)
downloadbugzilla-triage-3c3860cd080dec5a71ae6c3c7bc3438fa8875d94.tar.gz
Starting another module ... all small embelishments to the page.
Diffstat (limited to 'data')
-rw-r--r--data/lib/otherButtons.js158
-rw-r--r--data/lib/rhbzpage.js154
2 files changed, 161 insertions, 151 deletions
diff --git a/data/lib/otherButtons.js b/data/lib/otherButtons.js
new file mode 100644
index 0000000..16adcea
--- /dev/null
+++ b/data/lib/otherButtons.js
@@ -0,0 +1,158 @@
+// Released under the MIT/X11 license
+// http://www.opensource.org/licenses/mit-license.php
+"use strict";
+
+/**
+ * Find default assignee based on the current component
+ *
+ * @return String what would be a default assignee if
+ * we haven't set it up.
+ */
+function getDefaultAssignee() {
+ return filterByRegexp(constantData.defaultAssignee,
+ getComponent()).toLowerCase();
+}
+
+/**
+ * Set default assignee
+ *
+ * @return none
+ * sets this.defaultAssignee property according to defaultAssignee list
+ */
+function setDefaultAssignee() {
+ var defAss = getDefaultAssignee();
+
+ // Add setting default assignee
+ if ((defAss.length > 0) && (defAss !== getOwner())) {
+ createNewButton("bz_assignee_edit_container",true, {
+ "name": "Def. Assignee",
+ "assignee": "default"
+ });
+ }
+}
+
+function markBugTriaged() {
+ // https://fedoraproject.org/wiki/BugZappers/Meetings/Minutes-2009-Oct-27
+ // http://meetbot.fedoraproject.org/fedora-meeting/2009-11-24\
+ // /fedora-meeting.2009-11-24-15.11.log.html
+ // http://meetbot.fedoraproject.org/fedora-meeting/2009-11-24\
+ // /fedora-meeting.2009-11-24-15.11.log.html
+ addStuffToTextBox("keywords","Triaged");
+}
+
+function addingEmbelishments(list) {
+ var FillMagicDoneRE = new RegExp("^\\s*\\[[0-9a-zA-Z_]*\\]");
+
+ var maintCCAddr = "";
+ if (constantData.CCmaintainer) {
+ maintCCAddr = filterByRegexp(constantData.CCmaintainer,
+ getComponent())[0]; // filterByRegexp returns array, not string
+ }
+
+ // we should make visible whether maintCCAddr is in CCList
+ if (maintCCAddr && isInList(maintCCAddr, getCCList())) {
+ var ccEditBoxElem = document.getElementById("cc_edit_area_showhide");
+ ccEditBoxElem.style.color = "navy";
+ ccEditBoxElem.style.fontWeight = "bolder";
+ ccEditBoxElem.style.textDecoration = "underline";
+ }
+
+ // Take care of signature for Fedora bugzappers
+ if (config.signature && config.signature.length > 0) {
+ var signaturesCounter = 0;
+ var signatureFedoraString = config.signature;
+ document.forms.namedItem("changeform").addEventListener("submit",
+ function(aEvt) {
+ if (signaturesCounter < 1) {
+ addStuffToTextBox("comment", signatureFedoraString);
+ signaturesCounter += 1;
+ }
+ }, false);
+ }
+
+ // set default assignee on change of the component
+ var compElement = document.getElementById("component");
+ if (compElement && (compElement.options)) {
+ document.getElementById("component").addEventListener("change",
+ function() {
+ changeAssignee("default");
+ }, false);
+ }
+
+ // TODO Get compiz bugs as well
+ if ((constantData.chipNames) &&
+ (list[0]) &&
+ (!FillMagicDoneRE.test(getSummary())) &&
+ (maintCCAddr === "xgl-maint@redhat.com")) {
+ // Add find chip magic button
+ var whiteboard_string = document.getElementById("status_whiteboard").value;
+ if (!/card_/.test(whiteboard_string)) {
+ fillInChipMagic(XorgLogAttList[0][1]);
+ }
+ }
+}
+
+function setBranding(xLogAtts) {
+ var brandColor = {};
+ var TriagedColor = {};
+
+ var ITbutton = document.getElementById("cf_issuetracker");
+ var its = ITbutton ? ITbutton.value.trim() : "";
+
+ if (isEnterprise()) {
+ if (its && (its.length > 0)) {
+ brandColor = RHITColor;
+ }
+ else {
+ brandColor = RHColor;
+ }
+ }
+ else if (new RegExp("Fedora").test(document.getElementById("product").value)) {
+ if (document.getElementById("version").value === "rawhide") {
+ brandColor = RawhideColor;
+ }
+ else {
+ brandColor = FedoraColor;
+ }
+ }
+
+ // Comment each of the following lines to get only partial branding
+ document.getElementsByTagName("body")[0].style.background = brandColor
+ .toString()
+ + " none";
+ document.getElementById("titles").style.background = brandColor.toString()
+ + " none";
+
+ // Remove "Bug" from the title of the bug page, so we have more space with
+ // plenty of tabs
+ var titleElem = document.getElementsByTagName("title")[0];
+
+ titleElem.textContent = titleElem.textContent.slice(4);
+ var bodyTitleParent = document.getElementById("summary_alias_container").parentNode;
+ var bodyTitleElem = bodyTitleParent.getElementsByTagName("b")[0];
+ bodyTitleElem.textContent = bodyTitleElem.textContent.slice(4);
+
+ // Make background-color of the body of bug salmon pink
+ // for security bugs.
+ if (hasKeyword("Security")) {
+ document.getElementById("bugzilla-body").style.background = SalmonPink
+ .toString() + ' none';
+ }
+
+ // Make it visible whether the bug has been triaged
+ if (isTriaged()) {
+ document.getElementById("bz_field_status").style.background = brandColor
+ .lightColor().toString()
+ + " none";
+ }
+
+ var compElems;
+ if (config.suspiciousComponents
+ && isInList(getComponent(), config.suspiciousComponents)
+ && (compElems = document
+ .getElementById("bz_component_edit_container"))) {
+ compElems.style.background = "red none";
+ }
+
+ addingEmbelishments(xLogAtts);
+}
diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js
index f57af79..ddec25e 100644
--- a/data/lib/rhbzpage.js
+++ b/data/lib/rhbzpage.js
@@ -88,35 +88,6 @@ function RHOnMessageHandler(msg) {
// RHBugzillaPage object
/**
- * Find default assignee based on the current component
- *
- * @return String what would be a default assignee if
- * we haven't set it up.
- */
-function getDefaultAssignee() {
- return filterByRegexp(constantData.defaultAssignee,
- getComponent()).toLowerCase();
-}
-
-/**
- * Set default assignee
- *
- * @return none
- * sets this.defaultAssignee property according to defaultAssignee list
- */
-function setDefaultAssignee() {
- var defAss = getDefaultAssignee();
-
- // Add setting default assignee
- if ((defAss.length > 0) && (defAss !== getOwner())) {
- createNewButton("bz_assignee_edit_container",true, {
- "name": "Def. Assignee",
- "assignee": "default"
- });
- }
-}
-
-/**
* Auxiliary function to compute more complicated resolution
*/
function closeSomeRelease() {
@@ -240,7 +211,7 @@ function pasteBacktraceInComments(atts) {
createDeadLink ("callAbrtQuery_link",
"Abrt bugs", mainTitle, abrtQueryURL, [], false, null, "a");
-
+
if (idContainsWord("cf_devel_whiteboard", 'btparsed')) {
addStuffToTextBox('status_whiteboard', 'btparsed');
}
@@ -253,7 +224,7 @@ function pasteBacktraceInComments(atts) {
});
// 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
+ //
btAttachments.forEach(function(x) {
var attURL = "https://bugzilla.redhat.com/attachment.cgi?id="
+ x[1];
@@ -428,68 +399,6 @@ function isTriaged() {
* @param its String with the IsueTracker numbers
* @return none
*/
-function setBranding() {
- var brandColor = {};
- var TriagedColor = {};
-
- var ITbutton = document.getElementById("cf_issuetracker");
- var its = ITbutton ? ITbutton.value.trim() : "";
-
- if (isEnterprise()) {
- if (its && (its.length > 0)) {
- brandColor = RHITColor;
- }
- else {
- brandColor = RHColor;
- }
- }
- else if (new RegExp("Fedora").test(document.getElementById("product").value)) {
- if (document.getElementById("version").value === "rawhide") {
- brandColor = RawhideColor;
- }
- else {
- brandColor = FedoraColor;
- }
- }
-
- // Comment each of the following lines to get only partial branding
- document.getElementsByTagName("body")[0].style.background = brandColor
- .toString()
- + " none";
- document.getElementById("titles").style.background = brandColor.toString()
- + " none";
-
- // Remove "Bug" from the title of the bug page, so we have more space with
- // plenty of tabs
- var titleElem = document.getElementsByTagName("title")[0];
-
- titleElem.textContent = titleElem.textContent.slice(4);
- var bodyTitleParent = document.getElementById("summary_alias_container").parentNode;
- var bodyTitleElem = bodyTitleParent.getElementsByTagName("b")[0];
- bodyTitleElem.textContent = bodyTitleElem.textContent.slice(4);
-
- // Make background-color of the body of bug salmon pink
- // for security bugs.
- if (hasKeyword("Security")) {
- document.getElementById("bugzilla-body").style.background = SalmonPink
- .toString() + ' none';
- }
-
- // Make it visible whether the bug has been triaged
- if (isTriaged()) {
- document.getElementById("bz_field_status").style.background = brandColor
- .lightColor().toString()
- + " none";
- }
-
- var compElems;
- if (config.suspiciousComponents
- && isInList(getComponent(), config.suspiciousComponents)
- && (compElems = document
- .getElementById("bz_component_edit_container"))) {
- compElems.style.background = "red none";
- }
-}
/**
*
@@ -837,15 +746,6 @@ function addClosingUpstream() {
}
}
-function markBugTriaged() {
- // https://fedoraproject.org/wiki/BugZappers/Meetings/Minutes-2009-Oct-27
- // http://meetbot.fedoraproject.org/fedora-meeting/2009-11-24\
- // /fedora-meeting.2009-11-24-15.11.log.html
- // http://meetbot.fedoraproject.org/fedora-meeting/2009-11-24\
- // /fedora-meeting.2009-11-24-15.11.log.html
- addStuffToTextBox("keywords","Triaged");
-}
-
/**
*
*/
@@ -888,10 +788,8 @@ function parseBacktrace (ret) {
function RHBZinit() {
// inheritance ... call superobject's constructor
var AbrtRE = new RegExp("^\\s*\\[abrt\\]");
- var FillMagicDoneRE = new RegExp("^\\s*\\[[0-9a-zA-Z_]*\\]");
var btSnippet = "";
- var signaturesCounter = 0;
var chipMagicInterestingLine = "";
// getBadAttachments
@@ -924,53 +822,7 @@ function RHBZinit() {
// Just add a link to every Xorg.0.log link analyzing it.
addCheckXorgLogLink(XorgLogAttList);
- var maintCCAddr = "";
- if (constantData.CCmaintainer) {
- maintCCAddr = filterByRegexp(constantData.CCmaintainer,
- getComponent())[0]; // filterByRegexp returns array, not string
- }
-
- // TODO Get compiz bugs as well
- if ((constantData.chipNames) &&
- (XorgLogAttList[0]) &&
- (!FillMagicDoneRE.test(getSummary())) &&
- (maintCCAddr === "xgl-maint@redhat.com")) {
- // Add find chip magic button
- var whiteboard_string = document.getElementById("status_whiteboard").value;
- if (!/card_/.test(whiteboard_string)) {
- fillInChipMagic(XorgLogAttList[0][1]);
- }
- }
-
- // we should make visible whether maintCCAddr is in CCList
- if (maintCCAddr && isInList(maintCCAddr, getCCList())) {
- var ccEditBoxElem = document.getElementById("cc_edit_area_showhide");
- ccEditBoxElem.style.color = "navy";
- ccEditBoxElem.style.fontWeight = "bolder";
- ccEditBoxElem.style.textDecoration = "underline";
- }
-
- // Take care of signature for Fedora bugzappers
- if (config.signature && config.signature.length > 0) {
- var signatureFedoraString = config.signature;
- document.forms.namedItem("changeform").addEventListener("submit",
- function(aEvt) {
- if (signaturesCounter < 1) {
- addStuffToTextBox("comment", signatureFedoraString);
- signaturesCounter += 1;
- }
- }, false);
- }
- setBranding();
-
- // set default assignee on change of the component
- var compElement = document.getElementById("component");
- if (compElement && (compElement.options)) {
- document.getElementById("component").addEventListener("change",
- function() {
- changeAssignee("default");
- }, false);
- }
+ setBranding(XorgLogAttList);
// Uncheck "set default assignee" when the assignee is changed by other means
document.getElementById("assigned_to").addEventListener("change",