aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-11 21:49:43 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-11 21:49:43 +0200
commite8d6c71ee96a96230aadd5504e3f312774896920 (patch)
tree7ef6382a0dca5614fb0852ebc3cf95e801918ceb /lib
parentf87bad6c212acaa4d33052eb53d01431dda3e103 (diff)
downloadbugzilla-triage-e8d6c71ee96a96230aadd5504e3f312774896920.tar.gz
More cleanup to make a simple reproducer
Diffstat (limited to 'lib')
-rw-r--r--lib/bzpage.js16
-rw-r--r--lib/logger.js4
-rw-r--r--lib/puvodni/color.js (renamed from lib/color.js)0
-rw-r--r--lib/puvodni/old-main.js (renamed from lib/old-main.js)0
-rw-r--r--lib/puvodni/xmlrpc.js (renamed from lib/xmlrpc.js)0
-rw-r--r--lib/rhbzpage.js19
-rw-r--r--lib/util.js109
7 files changed, 6 insertions, 142 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index d150031..8395ba9 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -5,12 +5,6 @@
"use strict";
var util = require("util");
var simpleStorage = require("simple-storage");
-var Color = require("color").Color;
-
-var TriagedDistro = 13;
-var NumberOfFrames = 7;
-var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
-var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id=";
// ====================================================================================
// BZPage's methods
@@ -18,16 +12,12 @@ var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id=";
var BZPage = exports.BZPage = function BZPage(doc, config) {
console.log("doc = " + doc.title);
console.log("config = " + config);
- // constants
- this.SalmonPink = new Color(255, 224, 176); // RGB 255, 224, 176; HSL 36, 2,
- // 85
- this.ReporterColor = new Color(255, 255, 166); // RGB 255, 255, 166; HSL 60, 2,
- // 83
+
// initialize dynamic properties
- this.doc = doc;
+ this.doc = doc;
console.log("Now we are inside!");
};
BZPage.prototype.getBugId = function getBugId () {
return util.getBugNo(this.doc.location.href);
-}; \ No newline at end of file
+};
diff --git a/lib/logger.js b/lib/logger.js
index 702465a..cc3f213 100644
--- a/lib/logger.js
+++ b/lib/logger.js
@@ -3,11 +3,8 @@
"use strict";
var urlMod = require("url");
var urilMod = require("util");
-var Color = require("color").Color;
var Logger = exports.Logger = function Logger(store, abbsMap) {
- this.EmptyLogsColor = new Color(0, 255, 0);
- this.FullLogsColor = new Color(0, 40, 103);
this.store = store;
this.abbsMap = abbsMap;
@@ -27,7 +24,6 @@ Logger.prototype.addLogRecord = function(that) {
+ urlMod.parse(rec.url).host
+ "+" + that.bugNo;
let clearLogAElem = that.doc.getElementById("clearLogs");
- clearLogAElem.style.color = this.FullLogsColor;
clearLogAElem.style.fontWeight = "bolder";
if (this.store[recKey]) {
this.store[recKey].comment += "<br/>\n" + comment;
diff --git a/lib/color.js b/lib/puvodni/color.js
index 2da2fa7..2da2fa7 100644
--- a/lib/color.js
+++ b/lib/puvodni/color.js
diff --git a/lib/old-main.js b/lib/puvodni/old-main.js
index db81448..db81448 100644
--- a/lib/old-main.js
+++ b/lib/puvodni/old-main.js
diff --git a/lib/xmlrpc.js b/lib/puvodni/xmlrpc.js
index 69bb77e..69bb77e 100644
--- a/lib/xmlrpc.js
+++ b/lib/puvodni/xmlrpc.js
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index 468818b..407d383 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -4,15 +4,7 @@
// http://www.opensource.org/licenses/mit-license.php
"use strict";
var util = require("util");
-var xrpc = require("xmlrpc");
-var xhr = require("xhr");
-var clip = require("clipboard");
-var Color = require("color").Color;
var BZPage = require("bzpage").BZPage;
-// var TriagedDistro = 13;
-// var NumberOfFrames = 7;
-// var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
-// var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id=";
// ====================================================================================
// RHBugzillaPage object
@@ -21,17 +13,12 @@ var RHBugzillaPage = exports.RHBugzillaPage = function RHBugzillaPage(doc, confi
// inheritance ... call superobject's constructor
BZPage.call(this, doc, config);
- // For identification of graphics card
- var manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ],
- [ "ATI Mobility Radeon", "ATI", "1002" ],
- [ "Intel Corporation", "INTEL", "8086" ], [ "NVIDIA", "NV", "10de" ] ];
-
- console.log("Now we are outside!");
-
console.log("location = " + this.doc.location);
+
this.bugId = this.getBugId();
console.log("bug number = " + this.bugId);
+ console.log("Now we are outside!");
}; // END OF RHBugzillaPage CONSTRUCTOR
RHBugzillaPage.prototype = util.heir(BZPage);
-RHBugzillaPage.prototype.constructor = RHBugzillaPage; \ No newline at end of file
+RHBugzillaPage.prototype.constructor = RHBugzillaPage;
diff --git a/lib/util.js b/lib/util.js
index 3ce50c5..b019022 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -34,116 +34,7 @@ exports.heir = function heir(p) {
return new f();
};
-/**
- * Check whether an item is member of the list. Idea is just to make long if
- * commands slightly more readable.
- *
- * @param mbr string to be searched in the list
- * @param list list
- * @return position of the string in the list, or -1 if none found.
- */
-var isInList = exports.isInList = function isInList(mbr, list) {
- if (!list) {
- return false;
- }
- return (list.indexOf(mbr) !== -1);
-};
-
-/**
- * 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
- */
-exports.filterByRegexp = function filterByRegexp(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 "";
- }
-};
-
-/**
- * format date to be in ISO format (just day part)
- *
- * @param date
- * @return string with the formatted date
- */
-exports.getISODate = function getISODate(dateStr) {
- function pad(n) {
- return n < 10 ? '0' + n : n;
- }
- var date = new Date(dateStr);
- return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' +
- pad(date.getDate());
-};
-/**
- * Make sure value returned is Array
- *
- * @param Array/String
- * @return Array
- *
- * If something else than Array or String is passed to the function
- * the result will be untouched actual argument of the call.
- */
-var valToArray = exports.valToArray = function valToArray(val) {
- var isArr = val &&
- val.constructor &&
- val.constructor.name === "Array";
- return isArr ? val : [val];
-};
-
-/**
- * Merges two comma separated string as a list and returns new string
- *
- * @param str String with old values
- * @param value String/Array with other values
- * @return String with merged lists
- */
-exports.addCSVValue = function addCSVValue(str, value) {
- var parts = (str.trim().length > 0 ? str.split(/,\s*/) : []);
- if (!value) {
- return str;
- }
- if (!isInList(value, parts)) {
- var newValue = valToArray(value);
- parts = parts.concat(newValue);
- }
- // this is necessary to get comma-space separated string even when
- // value is an array already
- parts = parts.join(",").split(",");
- return parts.join(", ");
-};
-
-/**
- * Treats comma separated string as a list and removes one item from it
- *
- * @param str String treated as a list
- * @param value String with the value to be removed from str
- * @return String with the resulting list comma separated
- */
-exports.removeCSVValue = function removeCSVValue(str, value) {
- str = str.trim();
- var parts = str ? str.split(/,\s*/) : [];
- var valueArr = value instanceof Array ? value : value.split(/,\s*/);
- parts = parts.filter(function (e, i, a) {
- return (!isInList(e, valueArr));
- });
- return parts.join(", ");
-};
-
-/**
- *
- */
var getBugNo = exports.getBugNo = function getBugNo(url) {
var re = new RegExp(".*id=([0-9]+).*$");
var bugNo = null;