Skip to content

Commit

Permalink
Rename job history and convert the button to a link to a new tab (aii…
Browse files Browse the repository at this point in the history
…dalab#995)

* Rename to calculation history
* Convert "Job history" button on top to a link to a new tab
* Add space between Quantum Espresso
* make the table expand to full page width
  • Loading branch information
superstar54 authored Dec 19, 2024
1 parent dcb7c93 commit b288780
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 40 deletions.
23 changes: 17 additions & 6 deletions job_list.ipynb → calculation_history.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# AiiDAlab QuantumESPRESSO App"
"# AiiDAlab Quantum ESPRESSO App"
]
},
{
Expand All @@ -19,6 +19,17 @@
"load_profile()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from aiidalab_widgets_base.utils.loaders import load_css\n",
"\n",
"load_css(css_path=\"src/aiidalab_qe/app/static/styles\")"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -27,9 +38,9 @@
"source": [
"from aiidalab_qe.app.utils.search_jobs import QueryInterface\n",
"\n",
"job_history = QueryInterface()\n",
"job_history.setup_table()\n",
"job_history.filters_layout"
"calculation_history = QueryInterface()\n",
"calculation_history.setup_table()\n",
"calculation_history.filters_layout"
]
},
{
Expand All @@ -38,13 +49,13 @@
"metadata": {},
"outputs": [],
"source": [
"job_history.table"
"calculation_history.table"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion src/aiidalab_qe/app/static/templates/guide.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</p>

<p>
Completed workflows can be viewed in the <strong>Job History</strong> section.
Completed workflows can be viewed in the <strong>Calculation history</strong> section.
</p>

<p>
Expand Down
44 changes: 12 additions & 32 deletions src/aiidalab_qe/app/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def enable_toggles(self) -> None:
"""Enable the toggle buttons."""
self._view.guide_toggle.disabled = False
self._view.about_toggle.disabled = False
self._view.job_history_toggle.disabled = False

@without_triggering("about_toggle")
def _on_guide_toggle(self, change: dict):
Expand All @@ -69,7 +68,6 @@ def _on_guide_toggle(self, change: dict):
),
]
self._view.info_container.layout.display = "flex"
self._view.job_history_toggle.value = False
else:
self._view.info_container.children = []
self._view.info_container.layout.display = "none"
Expand All @@ -80,26 +78,10 @@ def _on_about_toggle(self, change: dict):
if change["new"]:
self._view.info_container.children = [self._view.about]
self._view.info_container.layout.display = "flex"
self._view.job_history_toggle.value = False
else:
self._view.info_container.children = []
self._view.info_container.layout.display = "none"

def _on_job_history_toggle(self, change: dict):
"""Toggle the job list section."""
if change["new"]:
self._view.about_toggle.value = False
self._view.guide_toggle.value = False
self._old_view = self._view.main.children
self._view.main.children = [LoadingWidget("Loading job history")]
self._view.job_history.setup_table()
self._view.main.children = [
self._view.job_history.filters_layout,
self._view.job_history.table,
]
else:
self._view.main.children = self._old_view

def _on_guide_category_select(self, change: dict):
self._view.guide_selection.options = guide_manager.get_guides(change["new"])
self._update_active_guide()
Expand Down Expand Up @@ -131,10 +113,6 @@ def _set_event_handlers(self) -> None:
self._on_about_toggle,
"value",
)
self._view.job_history_toggle.observe(
self._on_job_history_toggle,
"value",
)
self._view.guide_category_selection.observe(
self._on_guide_category_select,
"value",
Expand Down Expand Up @@ -168,9 +146,7 @@ def __init__(self) -> None:
from jinja2 import Environment

from aiidalab_qe.app.static import templates
from aiidalab_qe.app.utils.search_jobs import QueryInterface
from aiidalab_qe.common.infobox import InfoBox
from aiidalab_qe.common.widgets import LoadingWidget
from aiidalab_qe.version import __version__

#################################################
Expand Down Expand Up @@ -208,21 +184,21 @@ def __init__(self) -> None:
disabled=True,
)

self.job_history_toggle = ipw.ToggleButton(
self.calculation_history_button = ipw.Button(
layout=ipw.Layout(width="auto"),
button_style="",
icon="list",
value=False,
description="Job History",
tooltip="View all jobs run with this app",
disabled=True,
description="Calculation history",
tooltip="View all calculations run with this app",
)

self.calculation_history_button.on_click(self._open_calculation_history)

info_toggles = ipw.HBox(
children=[
self.guide_toggle,
self.about_toggle,
self.job_history_toggle,
self.calculation_history_button,
]
)
info_toggles.add_class("info-toggles")
Expand All @@ -242,8 +218,6 @@ def __init__(self) -> None:
)
self.guide_selection = ipw.RadioButtons(layout=ipw.Layout(margin="2px 20px"))

self.job_history = QueryInterface()

self.info_container = InfoBox()

header = ipw.VBox(
Expand Down Expand Up @@ -275,3 +249,9 @@ def __init__(self) -> None:
footer,
],
)

def _open_calculation_history(self, _):
from IPython.display import Javascript

url = "./calculation_history.ipynb"
display(Javascript(f"window.open('{url}', '_blank')"))
2 changes: 1 addition & 1 deletion start.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_start_widget(appbase, jupbase, notebase): # noqa: ARG001
</a>
<a
class="feature"
href="{appbase}/job_list.ipynb"
href="{appbase}/calculation_history.ipynb"
target="_blank">
<img
class="feature-logo"
Expand Down

0 comments on commit b288780

Please sign in to comment.