Skip to content

Commit

Permalink
Fix links to the notebooks. (#238)
Browse files Browse the repository at this point in the history
Notebooks were recently placed in the 'notebooks' folder, so many
links became broken.
  • Loading branch information
yakutovicha committed Sep 16, 2021
1 parent 1a656cc commit dfffaf5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion aiidalab_widgets_base/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def __init__(
setup_code_params[key] = value

# For later: use base_url here, when it will be implemented in the appmode.
url_string = f"<a href={path_to_root}aiidalab-widgets-base/setup_code.ipynb?"
url_string = (
f"<a href={path_to_root}aiidalab-widgets-base/notebooks/setup_code.ipynb?"
)
url_string += "&".join(
[f"{k}={v}".replace(" ", "%20") for k, v in setup_code_params.items()]
)
Expand Down
2 changes: 1 addition & 1 deletion aiidalab_widgets_base/computers.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ def __init__(self, description="Select computer:", path_to_root="../", **kwargs)
self.observe(self.refresh, names="allow_select_disabled")

self._setup_another = ipw.HTML(
value=f"""<a href={path_to_root}aiidalab-widgets-base/setup_computer.ipynb target="_blank">
value=f"""<a href={path_to_root}aiidalab-widgets-base/notebooks/setup_computer.ipynb target="_blank">
Setup new computer</a>"""
)

Expand Down
8 changes: 4 additions & 4 deletions aiidalab_widgets_base/elns.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, path_to_root="../", **kwargs):
eln = connect_to_eln(**kwargs)

if eln is None:
url = f"{path_to_root}aiidalab-widgets-base/eln_configure.ipynb"
url = f"{path_to_root}aiidalab-widgets-base/notebooks/eln_configure.ipynb"
error_message.value = f"""Warning! The access to ELN {kwargs['eln_instance']} is not configured. Please follow <a href="{url}" target="_blank">the link</a> to configure it."""
return

Expand Down Expand Up @@ -99,7 +99,7 @@ def __init__(self, path_to_root="../", **kwargs):
else:
self.modify_settings.disabled = True
send_button.disabled = True
self.message.value = f"""Warning! The access to an ELN is not configured. Please follow <a href="{self.path_to_root}/aiidalab-widgets-base/eln_configure.ipynb" target="_blank">the link</a> to configure it."""
self.message.value = f"""Warning! The access to an ELN is not configured. Please follow <a href="{self.path_to_root}/aiidalab-widgets-base/notebooks/eln_configure.ipynb" target="_blank">the link</a> to configure it."""

super().__init__(children=children, **kwargs)

Expand Down Expand Up @@ -137,15 +137,15 @@ def send_to_eln(self, _=None):
f"\u2705 The data were successfully sent to {self.eln.eln_instance}."
)
else:
self.message.value = f"""\u274C Something isn't right! We were not able to send the data to the "<strong>{self.eln.eln_instance}</strong>" ELN instance. Please follow <a href="{self.path_to_root}/aiidalab-widgets-base/eln_configure.ipynb" target="_blank">the link</a> to update the ELN's configuration."""
self.message.value = f"""\u274C Something isn't right! We were not able to send the data to the "<strong>{self.eln.eln_instance}</strong>" ELN instance. Please follow <a href="{self.path_to_root}/aiidalab-widgets-base/notebooks/eln_configure.ipynb" target="_blank">the link</a> to update the ELN's configuration."""

def handle_output(self, _=None):
with self._output:
clear_output()
if self.modify_settings.value:
display(
ipw.HTML(
f"""Currently used ELN is: "<strong>{self.eln.eln_instance}</strong>". To change it, please follow <a href="{self.path_to_root}/aiidalab-widgets-base/eln_configure.ipynb" target="_blank">the link</a>."""
f"""Currently used ELN is: "<strong>{self.eln.eln_instance}</strong>". To change it, please follow <a href="{self.path_to_root}/aiidalab-widgets-base/notebooks/eln_configure.ipynb" target="_blank">the link</a>."""
)
)
display(self.eln.sample_config_editor())
Expand Down
8 changes: 4 additions & 4 deletions aiidalab_widgets_base/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ def on_btn_submit_press(self, _=None):

if self.append_output:
self.submit_out.value += f"""Submitted process {self.process}. Click
<a href={self.path_to_root}aiidalab-widgets-base/process.ipynb?id={self.process.pk}
<a href={self.path_to_root}aiidalab-widgets-base/notebooks/process.ipynb?id={self.process.pk}
target="_blank">here</a> to follow.<br>"""
else:
self.submit_out.value = f"""Submitted process {self.process}. Click
<a href={self.path_to_root}aiidalab-widgets-base/process.ipynb?id={self.process.pk}
<a href={self.path_to_root}aiidalab-widgets-base/notebooks/process.ipynb?id={self.process.pk}
target="_blank">here</a> to follow."""

for func in self._run_after_submitted:
Expand Down Expand Up @@ -378,7 +378,7 @@ def calc_info(self, node):
raise TypeError("Unknown type: {}".format(type(node)))

process_state = node.process_state.value.capitalize()
pk = """<a#space#href={0}aiidalab-widgets-base/process.ipynb?id={1}#space#target="_blank">{1}</a>""".format(
pk = """<a#space#href={0}aiidalab-widgets-base/notebooks/process.ipynb?id={1}#space#target="_blank">{1}</a>""".format(
self.path_to_root, node.pk
)

Expand Down Expand Up @@ -659,7 +659,7 @@ def update(self, _=None):

# Add HTML links.
dataf["PK"] = dataf["PK"].apply(
lambda x: """<a href={0}aiidalab-widgets-base/process.ipynb?id={1} target="_blank">{1}</a>""".format(
lambda x: """<a href={0}aiidalab-widgets-base/notebooks/process.ipynb?id={1} target="_blank">{1}</a>""".format(
self.path_to_root, x
)
)
Expand Down
1 change: 1 addition & 0 deletions eln_import.ipynb

0 comments on commit dfffaf5

Please sign in to comment.