aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bzpage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-05 01:13:12 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-05 01:13:12 +0200
commit2b95e7ae6cb53f987931de8f567870b9e69cdf9a (patch)
tree9280099d9a70ea4f1c45734fe1b13944eb599f21 /lib/bzpage.js
parent4f2e73837a000844c75bfa70d1be5debc0ac4859 (diff)
downloadbugzilla-triage-2b95e7ae6cb53f987931de8f567870b9e69cdf9a.tar.gz
Unfinished mess of everything, unworking.
Diffstat (limited to 'lib/bzpage.js')
-rw-r--r--lib/bzpage.js54
1 files changed, 11 insertions, 43 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index bad7b5e..8f11eb5 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -3,13 +3,13 @@
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
-var utilMod = require("util");
+var util = require("util");
+var simpleStorage = require("simple-storage");
var TriagedDistro = 13;
var NumberOfFrames = 7;
var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id=";
-var myStorage = jetpack.storage.simple;
// ====================================================================================
// BZPage's methods
@@ -20,20 +20,6 @@ exports.BZPage = function BZPage(doc) {
// 85
this.ReporterColor = new Color(255, 255, 166); // RGB 255, 255, 166; HSL 60, 2,
// 83
- this.RE = {
- Comment: new RegExp("^\\s*#"), // unsused
- BlankLine: new RegExp("^\\s*$"), // unused
- // nová řádka
- // [ 65.631] (--) intel(0): Chipset: "845G"
- Chipset: new RegExp("^\\s*\\[?[ 0-9.]*\\]?\\s*\\(--\\) "+
- "([A-Za-z]+)\\([0-9]?\\): Chipset: (.*)$"),
- ATIgetID: new RegExp("^.*\\(ChipID = 0x([0-9a-fA-F]+)\\).*$"),
- Abrt: new RegExp("^\\s*\\[abrt\\]"),
- signalHandler: new RegExp("^\\s*#[0-9]*\\s*<signal handler called>"),
- frameNo: new RegExp("^\\s*#([0-9]*)\\s")
- };
-
-
// initialize dynamic properties
this.doc = doc;
this.packages = this.getInstalledPackages();
@@ -41,7 +27,11 @@ exports.BZPage = function BZPage(doc) {
this.commentStrings = config.gJSONData.commentStrings;
}
+
if ("constantData" in config.gJSONData) {
+ // this is wrong, I shouldn't bother anybody with my Xorg data, and
+ // I should load it from URL
+ // var stuff = JSON.parse(self.data.load("chiIDsGroupings.json"));
this.constantData = config.gJSONData.constantData;
}
@@ -56,7 +46,7 @@ exports.BZPage = function BZPage(doc) {
}
this.submitHandlerInstalled = false;
- this.bugNo = utilMod.getBugNo(this.doc.location.toString());
+ this.bugNo = util.getBugNo(this.doc.location.toString());
this.reporter = this.getReporter();
this.product = this.getOptionValue("product");
this.component = this.getOptionValue("component");
@@ -452,28 +442,6 @@ BZPage.prototype.clickMouse = function(targetID) {
};
/**
- * select element of the array where regexp in the first element matches second
- * parameter of this function
- *
- * @param list Array with regexps and return values
- * @param chosingMark String by which the element of array is to be matched
- * @return Object chosen element
- */
-BZPage.prototype.filterByRegexp = function(list, chosingMark) {
- let chosenPair = [];
- if (list.length > 0) {
- chosenPair = list.filter(function(pair) {
- return new RegExp(pair.regexp, "i").test(chosingMark);
- });
- }
- if (chosenPair.length > 0) {
- return chosenPair[0].addr;
- } else {
- return "";
- }
-};
-
-/**
* Add object to the text box (comment box or status whiteboard)
*
* @param id String with the id of the element
@@ -487,7 +455,7 @@ BZPage.prototype.addStuffToTextBox = function(id, stuff) {
stuff = textBox.value ? "\n\n" + stuff : stuff;
textBox.value += stuff;
} else {
- textBox.value = utilMod.addCSVValue(textBox.value,stuff);
+ textBox.value = util.addCSVValue(textBox.value,stuff);
}
};
@@ -499,7 +467,7 @@ BZPage.prototype.addStuffToTextBox = function(id, stuff) {
*/
BZPage.prototype.removeStuffFromTextBox = function(id, stuff) {
let changedElement = this.getElementById(id);
- changedElement.value = utilMod.removeCSVValue(changedElement.value,stuff);
+ changedElement.value = util.removeCSVValue(changedElement.value,stuff);
}
/**
@@ -587,7 +555,7 @@ BZPage.prototype.getLogin = function () {
* @return String with the maintainer's email address
*/
BZPage.prototype.getDefaultBugzillaMaintainer = function(component) {
- let address = this.filterByRegexp(this.defBugzillaMaintainerArr, component);
+ let address = util.filterByRegexp(this.defBugzillaMaintainerArr, component);
return address;
}
@@ -724,7 +692,7 @@ BZPage.prototype.addToCCList = function(who) {
this.doc.getElementById("addselfcc").checked = true;
} else {
this.clickMouse("cc_edit_area_showhide");
- if (!utilMod.isInList(who, this.CCList)) {
+ if (!util.isInList(who, this.CCList)) {
this.addStuffToTextBox("newcc",who);
}
}