From 7ea4c0275917bfe3dd3bd132c55c89137ea7345a Mon Sep 17 00:00:00 2001 From: "axel%pike.org" Date: Sat, 2 Sep 2006 17:03:09 +0000 Subject: [PATCH] bug 348731, fix waterfall display, add log display git-svn-id: svn://10.0.0.236/trunk@209067 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/testing/tests/l10n/web/code-base.js | 45 ++++++++++++++++--- mozilla/testing/tests/l10n/web/layout.css | 11 +++++ .../testing/tests/l10n/web/waterfall-code.js | 26 ++++++++++- 3 files changed, 75 insertions(+), 7 deletions(-) diff --git a/mozilla/testing/tests/l10n/web/code-base.js b/mozilla/testing/tests/l10n/web/code-base.js index ae50822c5fe..483b97131d5 100755 --- a/mozilla/testing/tests/l10n/web/code-base.js +++ b/mozilla/testing/tests/l10n/web/code-base.js @@ -101,12 +101,7 @@ JSON_c.prototype = { } }, handleFailure : function(o) { - if (o.callback) { - o.callback.handleFailure(); - delete o.callback; - return; - } - throw("load failed with " + o.status + " " + o.statusText); + YAHOO.widget.Logger("load failed with " + o.status + " " + o.statusText); } }; var JSON = new JSON_c(); @@ -262,6 +257,44 @@ baseController = { showView: function(aClosure) { view.updateView(controller.locales, aClosure); }, + showLog: function(aTag, aLocale) { + var _t = this; + var dlgProps = { xy: ["1em", "1em"], height: "40em", width: "40em", + modal:true, draggable:false } + var dlg = new YAHOO.widget.SimpleDialog("log-dlg", dlgProps); + var prefix = ''; + if (aLocale) { + prefix = '[' + aLocale * '] '; + } + dlg.setHeader(prefix + 'build log, ' + aTag); + dlg.setBody('Loading …'); + var okButton = { + text: 'OK', + handler: function(){ + this.hide(); + this.destroy() + }, + isDefault: true + }; + dlg.cfg.queueProperty("buttons", [okButton]); + dlg.render(document.body); + dlg.moveTo(10, 10); + var callback = function(obj) { + _t.handleLog.apply(_t, [obj, dlg, aLocale]); + }; + JSON.get('results/' + aTag + '/buildlog.json', callback); + }, + handleLog: function(aLog, aDlg, aLocale) { + var df = document.createDocumentFragment(); + for each (var r in aLog) { + var d = document.createElement('pre'); + d.className = 'log-row ' + r[1]; + // XXX filter on r[0:1] + d.textContent = r[2].replace(/[\n\r]$/, ''); + df.appendChild(d); + } + aDlg.setBody(df); + }, getContent: function(aLoc) { if (! this._target) return; return this._c[this._target].getContent(aLoc); diff --git a/mozilla/testing/tests/l10n/web/layout.css b/mozilla/testing/tests/l10n/web/layout.css index c172784bf61..b522647e44a 100755 --- a/mozilla/testing/tests/l10n/web/layout.css +++ b/mozilla/testing/tests/l10n/web/layout.css @@ -114,6 +114,17 @@ div.calbordered { float: none; } +/* waterfall view */ +#log-dlg { + overflow: scroll; +} +.log-row { + margin: 0pt; +} +.ERROR { + background-color: coral; +} + /* search view */ td.ordered {border: 2px solid black;} diff --git a/mozilla/testing/tests/l10n/web/waterfall-code.js b/mozilla/testing/tests/l10n/web/waterfall-code.js index e155b7c083e..b1c4aa34e68 100755 --- a/mozilla/testing/tests/l10n/web/waterfall-code.js +++ b/mozilla/testing/tests/l10n/web/waterfall-code.js @@ -54,6 +54,14 @@ var waterfallView = { head.appendChild(h); } var heads = head.childNodes; + var lastDate = -1; + function pad(aNumber, length) { + str = String(aNumber); + while (str.length < length) { + str = '0' + str; + } + return str; + }; for (var i = aResult.length - 1; i >= 0; i--) { var wf = document.createElement('tr'); wf.className = 'waterfall-row'; @@ -65,7 +73,15 @@ var waterfallView = { wf.setAttribute('style', style); var cell = view.getCell(); cell.className = 'cell-label'; - cell.textContent = b[0]; + var d = this.getUTCDate(b[0]); + var label = pad(d.getUTCHours(), 2) + ':' + + pad(d.getUTCMinutes(), 2); + if (lastDate != d.getUTCDate()) { + lastDate = d.getUTCDate(); + label = d.getUTCDate() +'/'+ (d.getUTCMonth()+1) + '
' + label; + } + cell.innerHTML = label + + '
L'; wf.appendChild(cell); var locs = keys(b[2]); var h = 1; @@ -122,6 +138,14 @@ var waterfallView = { _t = this; }, destroyHandlers: function() { + }, + // Helper functions + getUTCDate: function(aTag) { + var D = new Date(); + var d = aTag.split(/[ -]/).map(function(aEl){return Number(aEl);}); + d[1] -= 1; // adjust month + D.setTime(Date.UTC.apply(null,d)); + return D; } }; var waterfallController = {