Skip to content
Snippets Groups Projects

fix html frame hardcoding and file transfer

Merged Charlotte Hausman requested to merge testing into main
5 files
+ 102
23
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -22,6 +22,7 @@ CARTA_URL_REPLACE_TEXT = "CARTA_URL_GOES_HERE"
CARTA_HTML_TEMPLATE_FILENAME = "carta_url_template.html"
CARTA_HTML_FILENAME = "carta_url_page.html"
class CartaLauncher:
"""Runs CARTA"""
@@ -144,7 +145,7 @@ class CartaLauncher:
else:
carta_html = self.create_frame_html(carta_url=carta_url, html_dir=file_browser_path)
# CARTA is running and accessible, so send CARTA URL to AAT system or notify user
# CARTA is running and accessible, so send CARTA URL to AAT system or notify user
self.notify_ready(carta_url=carta_url, carta_html=carta_html)
# Activate timeout handler
@@ -201,9 +202,7 @@ class CartaLauncher:
else:
self.logger.warning("WARNING: CARTA not running.")
@staticmethod
def create_frame_html(carta_url: str, html_dir: Path) -> Path:
def create_frame_html(self, carta_url: str, html_dir: Path) -> Path:
"""
Generate the HTML page containing the CARTA URL in a frame.
@@ -211,19 +210,22 @@ class CartaLauncher:
:param html_dir: where HTML will be written
:return: HTML file we just created
"""
original_content = CartaLauncher.read_carta_url_template()
original_content = self.read_carta_url_template()
new_content = original_content.replace(CARTA_URL_REPLACE_TEXT, carta_url)
html_file = html_dir / CARTA_HTML_FILENAME
html_file.write_text(new_content)
return html_file
@staticmethod
def read_carta_url_template() -> str:
def read_carta_url_template(self) -> str:
"""
Get contents of carta_url_template.html
:return:
"""
path = Path("/packages/apps/cli/executables/pexable/carta_envoy/carta_envoy/carta_url_template.html")
if "rawdata" in self.settings["data_location"]:
path = Path("../carta_url_template.html")
else:
path = Path("carta_url_template.html")
return path.read_text()
Loading