bug 348731, fix waterfall display, add log display

git-svn-id: svn://10.0.0.236/trunk@209067 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
axel%pike.org
2006-09-02 17:03:09 +00:00
parent 2f5e795e57
commit 7ea4c02759
3 changed files with 75 additions and 7 deletions

View File

@@ -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);

View File

@@ -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;}

View File

@@ -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) + '<br>' + label;
}
cell.innerHTML = label +
'<br><a href="javascript:controller.showLog(\'' + b[0] + '\');">L</a>';
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 = {