aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-10-02 14:29:48 +0200
committerTaras Madan <tarasmadan@google.com>2024-10-03 06:29:13 +0000
commitd7906effc263366a8b067258cec67072b29aa5e0 (patch)
tree8b43de31469292e290b9a7f61cd5a5fab913f9cc
parent8d93ec36dfa27399f02ef29ca40b09d1fe582319 (diff)
pkg/cover: show the file source information
-rw-r--r--pkg/cover/templates/heatmap.html21
1 files changed, 17 insertions, 4 deletions
diff --git a/pkg/cover/templates/heatmap.html b/pkg/cover/templates/heatmap.html
index c5db61db6..14c2aad2f 100644
--- a/pkg/cover/templates/heatmap.html
+++ b/pkg/cover/templates/heatmap.html
@@ -22,12 +22,19 @@
});
}
- function reqListener() {
+ function setContent(url, htmlContent) {
document.getElementById("file-content-prev").innerHTML = document.getElementById("file-content-curr").innerHTML;
- document.getElementById("file-content-curr").innerHTML = this.responseText;
+ document.getElementById("file-details-prev").innerHTML = document.getElementById("file-details-curr").innerHTML;
+
+ document.getElementById("file-content-curr").innerHTML = htmlContent;
+ details = url.split("?")[1].split("&")
+ document.getElementById("file-details-curr").innerHTML = "Source information:\n" + details.join("\n");
}
function onShowFileContent(url){
+ var reqListener = function() {
+ setContent(url, this.responseText)
+ }
const req = new XMLHttpRequest();
req.addEventListener("load", reqListener);
req.open("GET", url);
@@ -163,9 +170,15 @@
{{template "dir" .Root}}
</ul>
</div>
- <div id="file-content-curr" style="display:inline-block; vertical-align: top">
+ <div style="display:inline-block; vertical-align: top">
+ <pre id="file-details-curr"></pre>
+ <br>
+ <div id="file-content-curr"></div>
</div>
- <div id="file-content-prev" style="display:inline-block; vertical-align: top">
+ <div style="display:inline-block; vertical-align: top">
+ <pre id="file-details-prev"></pre>
+ <br>
+ <div id="file-content-prev"></div>
</div>
</div>
{{ end }}