Skip to content

Commit 6db3c52

Browse files
committed
templates: viewer: add button to open the LAVA job page
This adds a new button for LAVA jobs executed on Collabora's instance, so we can easily open the job page for debugging/analysis purpose. Signed-off-by: Arnaud Ferraris <[email protected]>
1 parent 694d0cb commit 6db3c52

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

templates/viewer.html

+20-4
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,16 @@
155155

156156
function miscclick(event) {
157157
event.preventDefault();
158-
var fullurl = pagebaseurl + this.getAttribute("href");
159-
window.history.pushState("", "", fullurl);
160-
parseParameters(fullurl);
158+
var fullurl = this.getAttribute("href");
159+
// if it looks like an absolute URL, open in new tab/window
160+
if (fullurl.startsWith("http")) {
161+
window.open(fullurl, '_blank');
162+
// otherwise build the full URL and load it in the current page
163+
} else {
164+
fullurl = pagebaseurl + this.getAttribute("href");
165+
window.history.pushState("", "", fullurl);
166+
parseParameters(fullurl);
167+
}
161168
console.log("miscclick fullurl: " + fullurl);
162169
}
163170

@@ -189,6 +196,15 @@
189196
// add download button
190197
miscbuttonshtml += "<button id=\"downloadbutton\" class=\"download\" href=\"\" onclick=\"\">Download</button>";
191198

199+
var node_data = data.data;
200+
if (node_data != null) {
201+
var runtime = node_data.runtime;
202+
var job = node_data.job_id;
203+
if (node_data.runtime == "lava-collabora" && node_data.job_id != null) {
204+
miscbuttonshtml += "<button id=\"lavajobbutton\" class=\"misc\" href=\"https://lava.collabora.dev/scheduler/job/" + node_data.job_id + "\">LAVA Job</button>";
205+
}
206+
}
207+
192208
// add node size info (raw size)
193209
var nodesize = raw.length;
194210
miscbuttonshtml += "<span>Node size: " + nodesize + " bytes</span>";
@@ -569,4 +585,4 @@
569585
<div id="nodeinfo"></div>
570586
<div id="nodesearchdiv"></div>
571587
</body>
572-
</html>
588+
</html>

0 commit comments

Comments
 (0)