Skip to content

Commit

Permalink
logpage: stay in iframe if embedded for latest build link
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaas80 committed Jan 10, 2023
1 parent 9e6a463 commit 88d1fe1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions logpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ def create_test_results(readfile):
<a href="{baseurl}/tree/gh-pages/records/version_{curr_ver}" target="_blank">Build #{curr_ver}</a>
</h3>
<h6 style="text-align:center">
<a href="index.html">Go to latest build</a>
<a href="index.html"id="current_build">Go to latest build</a>
<script>if(window!==window.parent) // embedded in iframe (works also locally with cross-origin protection)
document.getElementById("current_build")["href"] = "build.html";
</script>
</h6>
<h3 style="text-align:center">{build_date}</h3>
<table class="table table-bordered " >
Expand Down Expand Up @@ -453,6 +456,11 @@ def summary_to_html(readfile,writefile):
sidebar_template = create_sidebar()
with open(writefile,"w") as fp:
curr_build_file = create_test_results(readfile)
try:
os.remove(f"{gh_pages}/docs/build.html")
except FileNotFoundError:
pass
os.symlink(curr_build_file, f"{gh_pages}/docs/build.html")

# The formatted string holds the html template and loads in the values for content and status
# This templated gets injected to index.html, holding both the sidebar and test results
Expand Down Expand Up @@ -518,7 +526,7 @@ def summary_to_html(readfile,writefile):
<div class="sidebar">
{sidebar_template}
</div>
<iframe class="iframe" src={curr_build_file} name="results_iframe"></iframe>
<iframe class="iframe" src="build.html" name="results_iframe"></iframe>
<script src='version.js'>
</script>
</body>
Expand Down

0 comments on commit 88d1fe1

Please sign in to comment.