bioarchlinux-packages/html/logs.html
2022-05-11 21:35:17 +01:00

138 lines
5.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>bioarchlinux Packages</title>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"
integrity="sha256-YY1izqyhIj4W3iyJOaGWOpXDSwrHWFL4Nfk+W0LyCHE=" crossorigin="anonymous">
<style>
a {
white-space: nowrap;
}
</style>
</head>
<body>
<table id="l" class="stripe cell-border" style="text-align:center">
</table>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/datatables.net@1.10.20/js/jquery.dataTables.min.js"
integrity="sha256-LXQzPhL1IRyKkA7HpCOBi8I+OC8HqzHUYkjK8S+LKTs=" crossorigin="anonymous"></script>
<script>
const DATE_FORMATTER = new Intl.DateTimeFormat(undefined, {
timeStyle: "medium",
dateStyle: "medium",
hour12: false,
});
$(window).on('hashchange', function () {
url = window.location.hash.includes("#") ? "/api/pkg/" + window.location.hash.slice(1) : "/api/logs"
$.get(url, function (newDataArray) {
let datatable = $('#l').DataTable()
datatable.clear()
datatable.rows.add(newDataArray)
datatable.draw()
});
});
$(document).ready(function () {
url = window.location.hash.includes("#") ? "/api/pkg/" + window.location.hash.slice(1) : "/api/logs"
$('#l').DataTable({
"searchDelay": 100,
"iDisplayLength": 100,
"aLengthMenu": [[100, 250, 500, 1000, -1], [100, 250, 500, 1000, "所有"]],
"ajax": {
url: url,
dataSrc: ""
},
"order": [[7, "desc"]],
"columnDefs": [
{
targets: 0,
title: "Package Name",
data: "pkgbase"
},
{
targets: 1,
title: "Maintainer",
data: "maintainer"
},
{
targets: 2,
title: "Package Version",
data: "pkg_version"
},
{
targets: 3,
title: "Status",
data: "result",
render: function (data, type, row, meta) {
switch (data) {
case "Successful": return "✅"
case "Failed": return "❌"
case "Staged": return "♻️"
default: return data
}
}
},
{
targets: 4,
title: "Last Time (s)",
data: "elapsed"
},
{
targets: 5,
title: "CPU Usage Percentage (%)",
data: "cpu"
},
{
targets: 6,
title: "RAM Usage (GiB)",
data: "memory",
render: function (data, type, row, meta) {
return data.toFixed(3)
}
},
{
targets: 7,
title: "Last Packaging Time",
data: "ts",
render: function (data, type, row, meta) {
if (type == 'display') {
return DATE_FORMATTER.format(new Date(data))
} else {
return data
}
}
},
{
targets: 8,
title: "GitHub",
data: "pkgbase",
render: function (data, type, row, meta) {
return `<a href=https://github.com/BioArchLinux/Packages/blob/master/BioArchLinux/${data}/ target=_blank rel=noopener>GitHub</a>`
}
},
{
targets: 9,
title: "Log",
data: "ts",
render: function (data, type, row, meta) {
return `<a href=https://build.bioarchlinux.org/api/pkg/${row.pkgbase}/log/${Math.floor(data / 1000)} target=_blank rel=noopener>Log</a>`
}
},
{
targets: 10,
title: "More",
data: "pkgbase",
render: function (data, type, row, meta) {
return `<a href=#${data}>More</a>`
}
}
]
});
});
</script>
</body>
</html>