8000 Implement AiiDA control page by yakutovicha · Pull Request #156 · aiidalab/aiidalab-home · GitHub
[go: up one dir, main page]

Skip to content
Closed
8000
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
95cc989
Draft implementation of the AiiDA control page.
yakutovicha Jul 20, 2023
15a9d10
Move widgets to control module.
yakutovicha Jun 21, 2024
885537f
Merge branch 'main' into feature/aiida-control-page
yakutovicha Jun 21, 2024
abb5e98
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 21, 2024
dea251e
Fix pre-commit
yakutovicha Jun 21, 2024
ee45eaa
Merge status page into daemon page
yakutovicha Jun 21, 2024
461cc32
Merge branch 'main' into feature/aiida-control-page
danielhollas Oct 14, 2024
cb5b3e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 14, 2024
8a0b24d
Merge branch 'main' into feature/aiida-control-page
danielhollas Oct 22, 2024
a2db55f
Merge branch 'main' into feature/aiida-control-page
yakutovicha Jul 9, 2026
693efd4
Fix control module
yakutovicha Jul 9, 2026
ebb09aa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 9, 2026
5026834
Fix profile handling
yakutovicha Jul 9, 2026
be0e3dd
Make daemon start/stop/restart non-blocking with proper feedback
yakutovicha Jul 9, 2026
d8c731f
Replace subprocess-based status refresh with in-process probes
yakutovicha Jul 9, 2026
c8ef698
Control.ipynb: show an alert instead of a traceback when a control se…
yakutovicha Jul 9, 2026
2ed9a94
Re-enable daemon buttons even if the status refresh fails
yakutovicha Jul 9, 2026
5b3dcf9
Surface process list query errors instead of failing silently
yakutovicha Jul 9, 2026
78ee72c
Cleanup of the control notebook
yakutovicha Jul 9, 2026
9ed87eb
Status overview section
yakutovicha Jul 9, 2026
b257de5
Implement system resources panel
yakutovicha Jul 9, 2026
c77e687
Merge branch 'main' into feature/aiida-control-page
yakutovicha Jul 9, 2026
aa70df2
Add storage widget
yakutovicha Jul 9, 2026
7435e81
Implement Danger Zone
yakutovicha Jul 10, 2026
df0633b
Improve daemon handling
yakutovicha Jul 10, 2026
d2ba999
Improve process control widget
yakutovicha Jul 10, 2026
e0b5f4e
Remove group control widget
yakutovicha Jul 10, 2026
3fb6fd1
Use Tab instead of ToggleButtons
yakutovicha Jul 10, 2026
ec87a8a
Add shared ControlSectionWidget base for control page sections
yakutovicha Jul 10, 2026
d4d309a
Unify theme colors and iconography across control page widgets
yakutovicha Jul 10, 2026
7ac5398
Polish control page content: safe status rows, alignment, profile and…
yakutovicha Jul 10, 2026
df6a53c
Drop redundant h3 headings from control-page sections
yakutovicha Jul 10, 2026
6bbec55
Add branded header and cap content width on control page
yakutovicha Jul 10, 2026
File filter
8000

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions control.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "0",
"metadata": {},
"outputs": [],
"source": [
"import re\n",
"from pathlib import Path\n",
"\n",
"import ipywidgets as ipw\n",
"from aiida import load_profile\n",
"\n",
"load_profile()\n",
"from home.control import (\n",
" DaemonControlWidget,\n",
" DangerZoneWidget,\n",
" ProcessControlWidget,\n",
" ProfileControlWidget,\n",
" StatusOverviewWidget,\n",
" StorageWidget,\n",
" SystemResourcesWidget,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {},
"outputs": [],
"source": [
"sections = {\n",
" \"Status\": StatusOverviewWidget,\n",
" \"Resources\": SystemResourcesWidget,\n",
" \"Storage\": StorageWidget,\n",
" \"Daemon\": DaemonControlWidget,\n",
" \"Processes\": ProcessControlWidget,\n",
" \"Profiles\": ProfileControlWidget,\n",
" \"Danger zone\": DangerZoneWidget,\n",
"}\n",
"\n",
"placeholders = [\n",
" ipw.VBox([ipw.HTML(\"Loading... <i class='fa fa-spinner fa-spin'></i>\")])\n",
" for _ in sections\n",
"]\n",
"section_names = list(sections)\n",
"section_instances = {}\n",
"\n",
"tabs = ipw.Tab(children=placeholders, titles=section_names)\n",
"\n",
"\n",
"def open_section(index):\n",
" name = section_names[index]\n",
" placeholder = placeholders[index]\n",
" widget = section_instances.get(name)\n",
" if widget is not None:\n",
" # Cached: just refresh if the section supports it.\n",
" refresher = getattr(widget, \"refresh\", None)\n",
" if callable(refresher):\n",
" refresher()\n",
" return\n",
" try:\n",
" widget = sections[name]()\n",
" except Exception as exc:\n",
" # Show the error but do NOT cache it: revisiting the tab retries.\n",
" placeholder.children = [\n",
" ipw.HTML(\n",
" f'<div class=\"alert alert-danger\" role=\"alert\">'\n",
" f'Failed to open the \"{name}\" section: {exc}</div>'\n",
" )\n",
" ]\n",
" return\n",
" section_instances[name] = widget\n",
" placeholder.children = [widget]\n",
"\n",
"\n",
"def on_tab_change(change):\n",
" open_section(change[\"new\"])\n",
"\n",
"\n",
"tabs.observe(on_tab_change, names=\"selected_index\")\n",
"\n",
"try:\n",
" _logo_svg = Path(\"aiidalab_logo_v4.svg\").read_text()\n",
" _logo_svg = _logo_svg.split(\"?>\", 1)[-1].strip()\n",
" _logo_svg = re.sub(\n",
" r\"<svg\\b[^>]*>\",\n",
" lambda m: re.sub(r'\\s(width|height)=\"[^\"]*\"', \"\", m.group(0)),\n",
" _logo_svg,\n",
" count=1,\n",
" )\n",
" header = ipw.HTML(\n",
" \"<div style='display:flex;align-items:center;gap:16px;margin:4px 0 12px 0;'>\"\n",
" f\"<div style='width:56px;flex:none;'>{_logo_svg}</div>\"\n",
" \"<div>\"\n",
" \"<h1 style='margin:0;font-size:26px;'>AiiDA control</h1>\"\n",
" \"<div style='color:gray;'>Manage the AiiDA installation behind your AiiDAlab apps.</div>\"\n",
" \"</div></div>\"\n",
" )\n",
"except OSError:\n",
" header = ipw.HTML(\n",
" \"<div style='margin:4px 0 12px 0;'>\"\n",
" \"<h1 style='margin:0;font-size:26px;'>AiiDA control</h1>\"\n",
" \"<div style='color:gray;'>Manage the AiiDA installation behind your AiiDAlab apps.</div>\"\n",
" \"</div>\"\n",
" )\n",
"\n",
"tabs.layout = ipw.Layout(max_width=\"1100px\")\n",
"header.layout = ipw.Layout(max_width=\"1100px\")\n",
"\n",
"display(header)\n",
"display(tabs)\n",
"# selected_index is already 0, so the observer never fired for the landing\n",
"# tab; fill it explicitly AFTER display so the page shell (tab bar +\n",
"# \"Loading...\") paints before the first, potentially slow, section probe runs.\n",
"open_section(0)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
0