Skip to content

Commit 33a6256

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 33a6256

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

templates/viewer.html

+26-4
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@
133133
"suffix": "?search=kind%3Dcheckout&search=created%3E" + dayagostring,
134134
},
135135
];
136+
var lava_urls = {
137+
"lava-broonie": "lava.sirena.org.uk",
138+
"lava-collabora": "lava.collabora.dev",
139+
"lava-collabora-early-access": "staging.lava.collabora.dev",
140+
"lava-collabora-staging": "staging.lava.collabora.dev",
141+
};
136142

137143
function fancydisplayjson(jsontext) {
138144
// add indentation to json text
@@ -155,9 +161,16 @@
155161

156162
function miscclick(event) {
157163
event.preventDefault();
158-
var fullurl = pagebaseurl + this.getAttribute("href");
159-
window.history.pushState("", "", fullurl);
160-
parseParameters(fullurl);
164+
var fullurl = this.getAttribute("href");
165+
// if it looks like an absolute URL, open in new tab/window
166+
if (fullurl.startsWith("http")) {
167+
window.open(fullurl, '_blank');
168+
// otherwise build the full URL and load it in the current page
169+
} else {
170+
fullurl = pagebaseurl + this.getAttribute("href");
171+
window.history.pushState("", "", fullurl);
172+
parseParameters(fullurl);
173+
}
161174
console.log("miscclick fullurl: " + fullurl);
162175
}
163176

@@ -189,6 +202,15 @@
189202
// add download button
190203
miscbuttonshtml += "<button id=\"downloadbutton\" class=\"download\" href=\"\" onclick=\"\">Download</button>";
191204

205+
var node_data = data.data;
206+
if (node_data != null) {
207+
var runtime = node_data.runtime;
208+
var job = node_data.job_id;
209+
if (node_data.runtime.startsWith("lava") && node_data.job_id != null) {
210+
miscbuttonshtml += "<button id=\"lavajobbutton\" class=\"misc\" href=\"https://" + lava_urls[node_data.runtime] + "/scheduler/job/" + node_data.job_id + "\">LAVA Job</button>";
211+
}
212+
}
213+
192214
// add node size info (raw size)
193215
var nodesize = raw.length;
194216
miscbuttonshtml += "<span>Node size: " + nodesize + " bytes</span>";
@@ -569,4 +591,4 @@
569591
<div id="nodeinfo"></div>
570592
<div id="nodesearchdiv"></div>
571593
</body>
572-
</html>
594+
</html>

0 commit comments

Comments
 (0)