Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 587773 Details for
Bug 583988
Add colors specification of results
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
beaker-colorize v1.5
beaker-colorize.user.js (text/plain), 5.56 KB, created by
Ed Santiago
on 2012-05-30 16:22:09 UTC
(
hide
)
Description:
beaker-colorize v1.5
Filename:
MIME Type:
Creator:
Ed Santiago
Created:
2012-05-30 16:22:09 UTC
Size:
5.56 KB
patch
obsolete
>// ==UserScript== >// @name beaker-colorize >// @namespace http://www.edsantiago.com/gmscripts >// @version 1.5 >// @description Colorize, friendlyize beaker test results >// @include https://beaker.engineering.redhat.com/jobs/* >// ==/UserScript== > >/* >** $Id: beaker-colorize.user.js 699b0c95ed70 2012-05-30 10:20 -0600 esm $ >** >** >** As of this writing (2010-10-14, Beaker 0.5.59) there is no visual >** cue for distinguishing Fail vs Pass status in Beaker tests. >** See bz583988. This is a GreaseMonkey script for working around that. >** >** The gist is that 'Pass' and 'Fail' appear in the right-hand side, in >** table columns (td) with class 'list' and one of 'result' or 'task'. >** This script sets a highlight when it finds particular bad-status >** keywords. >** >** 2012-05-30: v1.5: optimization: don't blindly run every 5 seconds. >** Instead, detect if page has changed (by checking length) and only >** run then. -- Ales Zelinka <azelinka@redhat.com> >** >** 2011-12-05: v1.4: strip "_log" from test_log, console_log etc. This >** cleans up the display even more. -- Ales Zelinka <azelinka@redhat.com> >** >** 2011-07-22: v1.3: rename a variable (FF5 won't allow "class") >** >** 2010-12-02: v1.2: the unreadable Logs column is now friendlier. >** See bz600232 >*/ >function highlight_status() { > /* The statuses we wish to highlight. Note that Beaker doesn't > ** actually seem to have ERROR or WARNING -- only Fail -- but > ** I've included all as examples. > ** > ** Format of table is: > ** > ** [ <STRING>, <background>, <foreground> ] > ** > ** ...where <STRING> is the string to search for in the <td>. > ** > ** Note also that I refuse to colorize 'Pass'. It's perfect > ** as it is, light grey with no visual highlight. If it were > ** green or bold or anything, it would simply distract. But > ** this is now _your_ script, so do with it as you wish :) > */ > var statuses = new Array( > [ 'Fail', 'red', 'black' ], > [ 'ERROR', 'red', 'white' ], > [ 'WARNING', 'orange', 'black' ], > [ 'Warn', 'orange', 'black' ] > ); > > if (! document_has_changed()) { > /* No change. Do nothing, but remember to rerun ourself in 1 second. */ > window.setTimeout( highlight_status, 1000 ); > return; > } > > /* > ** Main loop. Iterate over all <td> elements, in particular, > ** those with class 'result' or 'task'. If we find a <td> > ** whose sole content consists of one of the above status > ** strings, set bg/fg accordingly. > */ > var tds = document.getElementsByTagName("td"); > for(var i = 0; i < tds.length; i++) { > var td = tds[i]; > > /* Only interested in cells of class 'result' or 'task' */ > if (! td.hasAttribute('class')) > continue; /* (no class) */ > var tdclass = td.getAttribute('class'); > if (tdclass.indexOf('result') < 0 && tdclass.indexOf('task') < 0) > continue; > > /* > ** OK, this is a td element of the right CSS class. > ** Now see if the cell content is one we're looking for. > */ > for (var j=0; j < statuses.length; j++) { > if (td.innerHTML.trim() == statuses[j][0]) { > td.style.background = statuses[j][1]; > td.style.color = statuses[j][2]; > /* FIXME: I see no need for bold, but...? */ > /* FIXME: break out of j loop */ > } > } > } > > /* > ** ESM 2010-12-02: friendlyize the log link names: > ** > ** st_log--tools-internal-rpmdiff- > [test][console][avc] > ** selftests-setup.log > > ** _dmesg--tools-internal-rpmdiff- > > ** selftests-setup.log > > ** vc_log--tools-internal-rpmdiff- > > ** selftests-setup.log > > */ > var as = document.getElementsByTagName("a"); > for (var i=0; i < as.length; i++) { > var a = as[i]; > > /* > ** The href will be something like: > ** https://.../logs/2010/12/.../test_log--blah-blah-blah.log > ** this is what we care about: ^^^^^^^^ > */ > x = a.href.match("/(test_log|console_dmesg|avc_log)-"); > if (x) { > a.innerHTML = '[' + x[1].split('_')[0] + ']'; /* e.g. [test_log] */ > var newHTML = a.parentNode.innerHTML; > newHTML = newHTML.replace("<br>",""); > a.parentNode.innerHTML = newHTML; > } > } > > /* rerun once a second. */ > window.setTimeout( highlight_status, 1000 ); >} > >/* >** Return true if the document has changed since the last time we were called. >** >** Do so by keeping track of document length (yes, we know that's not a >** reliable mechanism. It's good enough.) >*/ >function document_has_changed() { > var stamp = document.getElementById("stamp"); > > /* First time through (initial page load)? Create & preserve in page */ > if (stamp == null) { > stamp = document.createElement('meta'); > stamp.setAttribute("id","stamp"); > stamp.setAttribute("name","stamp"); > stamp.setAttribute("content",document.body.innerHTML.length); > head = document.getElementsByTagName('head'); > head[0].appendChild(stamp); > return true; > } > > /* Not the first time through. Is page length the same? */ > var l = document.body.innerHTML.length; > if (stamp.content == l) > return false; > > /* Page length has changed. Preserve new size, and indicate change. */ > stamp.setAttribute("content", l); > return true; >} > > >/* Run the above function once the page has finished loading. */ >window.addEventListener("load", highlight_status, false );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 583988
:
453609
|
453788
|
540995
|
541236
|
587667
| 587773 |
587826
|
591184