|
1 | 1 | <html> |
| 2 | + |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | + <title>event-logging Versions</title> |
| 7 | + <link |
| 8 | + href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" |
| 9 | + rel="stylesheet" |
| 10 | + integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" |
| 11 | + crossorigin="anonymous"> |
| 12 | + </head> |
| 13 | + |
2 | 14 | <body> |
| 15 | + <h1 class="text-center display-2">event-logging Versions</h1> |
| 16 | + |
| 17 | + <div class="container"> |
| 18 | + <div class="mt-4 text-center">This table lists the latest patch release for each minor version of event-logging.</div> |
| 19 | + <table class="table mt-4" id="versions-content" /> |
| 20 | + </div> |
| 21 | + |
3 | 22 | <script> |
| 23 | + // Build a table of links for the various versions of event-logging |
4 | 24 | (async () => { |
| 25 | + const ghPagesBaseUrl = 'https://gchq.github.io/event-logging'; |
5 | 26 | const response = await fetch('https://api.github.com/repos/gchq/event-logging/contents/?ref=gh-pages'); |
6 | 27 | const data = await response.json(); |
7 | | - let htmlString = '<h1>event-logging Documentation</h1>'; |
8 | | - htmlString += '<table><tr>'; |
9 | | - htmlString += '<th>Version</th>'; |
| 28 | + let htmlString = ''; |
| 29 | + htmlString += '<tr>'; |
| 30 | + htmlString += '<th>Release</th>'; |
10 | 31 | htmlString += '<th>Swagger UI</th>'; |
11 | 32 | htmlString += '<th>Javadoc</th>'; |
12 | 33 | htmlString += '</tr>'; |
13 | 34 |
|
14 | 35 | // Add a row for each minor version dir in gh-pages |
15 | 36 | for (let file of data) { |
16 | | - if (file.type === "dir" && file.name.match("^[0-9]+\.[0-9]+") ) { |
| 37 | + if (file.type === "dir" && file.name.match("^v[0-9]+\.[0-9]+") ) { |
17 | 38 | // Get the actual patch version of this minor version e.g. v1.2.3 for minor version v1.2 |
18 | | - let version = await fetch(`https://gchq.github.io/event-logging/${file.name}/version.txt`); |
| 39 | + let version_response = await fetch(`${ghPagesBaseUrl}/${file.name}/version.txt`); |
| 40 | + let version = await version_response.text(); |
19 | 41 | htmlString += '<tr>'; |
20 | | - htmlString += `<td>${version}</td>`; |
21 | | - htmlString += `<td><a href="${file.path}/swagger-ui/">Link</a></td>`; |
22 | | - htmlString += `<td><a href="${file.path}/javadoc/">Link</a></td>`; |
| 42 | + htmlString += `<td class="version"><strong><a href="https://github.com/gchq/event-logging/releases/tag/${version}">${version}</a></strong></td>`; |
| 43 | + htmlString += `<td><a href="${ghPagesBaseUrl}/${file.path}/swagger-ui/">Link</a></td>`; |
| 44 | + htmlString += `<td><a href="${ghPagesBaseUrl}/${file.path}/javadoc/">Link</a></td>`; |
23 | 45 | htmlString += '</tr>'; |
24 | 46 | } |
25 | 47 | } |
26 | 48 |
|
27 | | - htmlString += '</table>'; |
28 | | - document.getElementsByTagName('body')[0].innerHTML = htmlString; |
| 49 | + //htmlString += '</table>'; |
| 50 | + document.getElementById('versions-content').innerHTML = htmlString; |
29 | 51 | })() |
30 | 52 | </script> |
31 | 53 | <body> |
|
0 commit comments