-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
76 lines (68 loc) · 3.51 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!-- Credit where it is due, the idea for this came from https://stackoverflow.com/a/53218452 -->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>event-logging Versions</title>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor"
crossorigin="anonymous">
</head>
<body>
<h1 class="text-center display-3"><strong>event-logging Versions</strong></h1>
<div class="container">
<div class="mt-4 text-center">This table lists the latest patch release for each minor version of event-logging.</div>
<table class="table mt-4" id="versions-content" />
</div>
<script>
// Build a table of links for the various versions of event-logging
(async () => {
const ghPagesBaseUrl = 'https://gchq.github.io/event-logging';
const response = await fetch('https://api.github.com/repos/gchq/event-logging/contents/?ref=gh-pages');
const data = await response.json();
let htmlString = '';
htmlString += '<tr>';
htmlString += '<th>Release</th>';
htmlString += '<th>XML Schema</th>';
htmlString += '<th>Javadoc</th>';
htmlString += '<th>Readme</th>';
htmlString += '<th>Change Log</th>';
htmlString += '<th>XML Schema Change Log</th>';
htmlString += '</tr>';
// Add a row for each minor version dir in gh-pages
let dirs = [];
for (let file of data) {
if (file.type === "dir" && file.name.match("^v[0-9]+\.[0-9]+") ) {
dirs.push(file.name);
}
}
// Reverse sort the versions by padding then de-padding the number parts
dirs = dirs
.map( a => a.replace(/\d+/g, n => +n+100000 ) )
.sort(function(a, b){return b-a})
.map( a => a.replace(/\d+/g, n => +n-100000 ) );
for (var i = 0; i < dirs.length; i++) {
let dir = dirs[i];
// Get the actual patch version of this minor version e.g. v1.2.3 for minor version v1.2
let versionResponse = await fetch(`${ghPagesBaseUrl}/${dir}/version.txt`);
let versionTag = await versionResponse.text();
// versionTag looks like v5.0-beta.35_schema-v4.0-beta.10, so split it up
let matchResult = versionTag.match(/(.*)_schema-(.*)/)
let libVersion = matchResult[1]
let schemaVersion = matchResult[2]
htmlString += '<tr>';
htmlString += `<td class="version"><strong><a href="https://github.com/gchq/event-logging/releases/tag/${versionTag}">${versionTag}</a></strong></td>`;
htmlString += `<td class="version"><a href="https://github.com/gchq/event-logging-schema/releases/tag/${schemaVersion}">${schemaVersion}</a></td>`;
htmlString += `<td><a href="${ghPagesBaseUrl}/${dir}/javadoc/">Link</a></td>`;
htmlString += `<td><a href="https://github.com/gchq/event-logging/blob/${versionTag}/README.md">Link</a></td>`;
htmlString += `<td><a href="https://github.com/gchq/event-logging/blob/${versionTag}/CHANGELOG.md">Link</a></td>`;
htmlString += `<td><a href="https://github.com/gchq/event-logging-schema/blob/${schemaVersion}/CHANGELOG.md">Link</a></td>`;
htmlString += '</tr>';
};
document.getElementById('versions-content').innerHTML = htmlString;
})()
</script>
<body>
</html>