Add repo link to single build page

This commit is contained in:
Stéphane Bidoul 2021-11-21 12:38:16 +01:00
parent 301fec8860
commit da4a545a00
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92

View file

@ -13,6 +13,7 @@
</head> </head>
<body> <body>
<runboat-build id="build"></runboat-build> <runboat-build id="build"></runboat-build>
<p>Other builds for <a href="" id="repolink">this repo</a>.</p>
<div id="footer"> <div id="footer">
{{ footer_html }} {{ footer_html }}
{{ additional_footer_html }} {{ additional_footer_html }}
@ -26,7 +27,11 @@
const evtSource = new EventSource(`/api/v1/build-events?build_name=${buildName}`); const evtSource = new EventSource(`/api/v1/build-events?build_name=${buildName}`);
evtSource.onmessage = function(event) { evtSource.onmessage = function(event) {
var oEvent = JSON.parse(event.data); var oEvent = JSON.parse(event.data);
buildElement.build = oEvent.event == "upd" ? oEvent.build : {}; const build = oEvent.build;
buildElement.build = oEvent.event == "upd" ? build : {};
const repolinkElement = document.getElementById("repolink");
repolinkElement.href = `./builds.html?repo=${build.repo}`;
repolinkElement.text = build.repo;
} }
// TODO: evtSource error handling // TODO: evtSource error handling
</script> </script>