Merge branch 'master' into job_headers

This commit is contained in:
Graham Christensen
2019-03-17 17:16:37 -04:00
committed by GitHub
16 changed files with 259 additions and 15 deletions

View File

@ -147,3 +147,8 @@ td.step-status span.warn {
.table thead th {
border-top: 0;
}
.date {
cursor: help;
border-bottom: 1px dotted #999;
}

View File

@ -97,6 +97,35 @@ $(document).ready(function() {
}
});
});
/* Makes dates more user friendly. */
// Friendly date format
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss";
// Local timezone offset to display.
var tz = moment().format("Z");
$("time.date").each(function(i, el) {
var el = $(el);
var localTime = moment(el.data("timestamp"), "%X");
var hydraTime = el.attr("title");
if (el.hasClass("is-absolute")) {
el.attr( "title", [
"Adjusted to local time (" + tz + ")",
"Other timezones:",
" UTC: " + localTime.clone().utc().format(DATE_FORMAT),
" As Hydra reported: " + hydraTime,
].join("\n"));
el.text(localTime.format(DATE_FORMAT));
el.addClass("is-local");
}
else if (el.hasClass("is-relative")) {
el.attr( "title", [
"Local (" + tz + "): " + localTime.format(DATE_FORMAT),
"UTC: " + localTime.clone().utc().format(DATE_FORMAT),
"As Hydra reported: " + hydraTime,
].join("\n"));
el.addClass("is-local");
}
});
});
var tabsLoaded = {};
@ -108,9 +137,13 @@ function makeLazyTab(tabName, uri) {
if (id == '#' + tabName && !tabsLoaded[id]) {
tabsLoaded[id] = 1;
$('#' + tabName).load(uri, function(response, status, xhr) {
if (status == "error") {
var lazy = xhr.getResponseHeader("X-Hydra-Lazy") === "Yes";
if (status == "error" && !lazy) {
$('#' + tabName).html("<div class='alert alert-error'>Error loading tab: " + xhr.status + " " + xhr.statusText + "</div>");
}
else {
$('#' + tabName).html(response);
}
});
}
});

File diff suppressed because one or more lines are too long