First step

This commit is contained in:
nemunaire 2024-05-29 12:09:31 +02:00
commit 36f5dde838
4 changed files with 123 additions and 0 deletions

38
index.html Normal file
View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<title>Meetup Go</title>
<link href="/style.css" type="text/css" rel="stylesheet">
</head>
<body>
<h1>Meetup Go&nbsp;!</h1>
<table>
<thead>
<tr>
<th>CONTAINER ID</th>
<th>IMAGE</th>
<th>COMMAND</th>
<th>CREATED</th>
<th>STATUS</th>
<th>PORTS</th>
<th>NAMES</th>
</tr>
</thead>
<tbody id="containers">
</tbody>
</table>
<script>
fetch('/containers').then(
(res) => res.json()
).then(
(containers) => {
document.getElementById('containers').innerHTML = '';
for (const container of containers) {
let div = document.createElement('tr');
div.innerHTML = `<td>${container.Id.substring(0, 8)}</td><td>${container.Image}</td><td>${container.Command}</td><td>${container.Created}</td><td>${container.Status}</td><td>${container.Ports.map((port) => port.PrivatePort + '/' + port.Type).join(" ")}</td><td>${container.Names.join(" ")}</td>`;
document.getElementById('containers').appendChild(div);
}
})
</script>
</body>
</html>