-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Centralized notebook for managing AiiDA codes #188
Merged
edan-bainglass
merged 14 commits into
aiidalab:main
from
edan-bainglass:code-setup-notebook
Jan 10, 2025
Merged
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e1b4e39
Add external notebook for managing codes
edan-bainglass 78ddccd
Refresh available codes on code creation
edan-bainglass 102043c
Improve pagination
edan-bainglass 008a11f
Remove pandas dependency
edan-bainglass b6e4c5c
Fix table reset from null-result searches
edan-bainglass 8fd2256
Simplify new code setup observation
edan-bainglass 3ff3c40
Change only active filter to only hidden
edan-bainglass a37c265
Fix filter overriding
edan-bainglass 168da67
Add tooltip to show all codes button
edan-bainglass 21843ac
Improve control layout
edan-bainglass 8fb61a3
Adjust capitalization
edan-bainglass d277602
Update use of AWB class w.r.t changes in AWB
edan-bainglass c892ea2
Add refresh button
edan-bainglass 67d18dc
Add in-notebook instructions
edan-bainglass File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from aiida import load_profile\n", | ||
"\n", | ||
"load_profile();" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# AiiDAlab Code Setup\n", | ||
"\n", | ||
"This page provides an interface for creating AiiDA codes on local or remote machines." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"vscode": { | ||
"languageId": "html" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%%html\n", | ||
"\n", | ||
"<style>\n", | ||
" .output_subarea {\n", | ||
" max-width: none !important;\n", | ||
" }\n", | ||
" .header-tr {\n", | ||
" column-gap: 5px;\n", | ||
" }\n", | ||
" .th {\n", | ||
" padding: 2px 5px;\n", | ||
" font-weight: bold;\n", | ||
" color: #fff;\n", | ||
" text-align: center;\n", | ||
" background-color: #000;\n", | ||
" }\n", | ||
" .tr:hover {\n", | ||
" background-color: #f5f5f5;\n", | ||
" }\n", | ||
"</style>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Create new code" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ipywidgets as ipw\n", | ||
"from aiidalab_widgets_base.computational_resources import _ResourceSetupBaseWidget\n", | ||
"from aiidalab_widgets_base.utils import StatusHTML\n", | ||
"\n", | ||
"setup_message = StatusHTML(clear_after=15)\n", | ||
"\n", | ||
"widget = _ResourceSetupBaseWidget()\n", | ||
"ipw.dlink(\n", | ||
" (widget, \"message\"),\n", | ||
" (setup_message, \"message\"),\n", | ||
")\n", | ||
"\n", | ||
"ipw.VBox(\n", | ||
" children=[\n", | ||
" widget,\n", | ||
" setup_message,\n", | ||
" ]\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Available codes" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from home.code_setup import create_paginated_table, fetch_code_data\n", | ||
"\n", | ||
"output = ipw.Output()\n", | ||
"\n", | ||
"\n", | ||
"def render():\n", | ||
" data = fetch_code_data()\n", | ||
" paginated_table = create_paginated_table(data)\n", | ||
" output.clear_output()\n", | ||
" with output:\n", | ||
" display(paginated_table)\n", | ||
"\n", | ||
"\n", | ||
"display(output)\n", | ||
"render()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def on_code_setup_message_change(change):\n", | ||
" if \"created\" in change[\"new\"]:\n", | ||
" render()\n", | ||
"\n", | ||
"\n", | ||
"widget.aiida_code_setup.observe(\n", | ||
" on_code_setup_message_change,\n", | ||
" \"message\",\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "base", | ||
"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": 2 | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why observe the
message
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a code was created ("created" in
message
), I rerender the table to refresh and pick up the new code. If none create, no need to refresh.