gitlab-jobs/runners.html
2022-07-24 01:44:47 +02:00

59 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<style>
table tbody tr:hover {
cursor: pointer;
}
</style>
</head>
<body>
<h1>Pick a runner</h1>
<table>
<thead>
<tr class="heading">
<th>ID</th>
<th>Description</th>
</tr>
</thead>
<tbody></tbody>
</table>
<a href="runner.html">Show all runners</a>
<div class="template">
<table>
<tr>
<td class="id"></td>
<td class="desc"></td>
</tr>
</table>
</div>
<script src="common.js"></script>
<script>
const template = $('.template')
const table = $('tbody')
listRunners()
.then(runners => {
runners.forEach(runner => {
const fragment = initTemplate(template, {
id: runner.id,
desc: runner.description
})
const row = $(fragment, 'tr')
row.addEventListener('click', ev => {
document.location.href = 'runner.html?id=' + runner.id
})
table.appendChild(row)
})
})
.catch(err => {
console.error(err)
alert(err.toString())
})
</script>
</body>
</html>