-
Notifications
You must be signed in to change notification settings - Fork 45
Update apps for element filtering #577
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
Draft
ElliottKasoar
wants to merge
7
commits into
ddmms:main
Choose a base branch
from
ElliottKasoar:add-app-filter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d7dc4e6
Update apps for element filtering
ElliottKasoar 3ff0f19
Add missing filters file and module name
ElliottKasoar a03f4fc
Fix sorting of apps
ElliottKasoar 973c4f1
Refactor filter
ElliottKasoar b7e9743
Fix broken sorting
ElliottKasoar 6d522ca
Fix setting metrics
ElliottKasoar 2ec7797
Set Si defects elements
ElliottKasoar 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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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,108 @@ | ||
| """Build data components.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from ase.data import chemical_symbols | ||
| from dash.dcc import Dropdown | ||
| from dash.html import Details, Div, Summary | ||
|
|
||
|
|
||
| def get_model_filter(models) -> Details: | ||
| """ | ||
| Get model filter component. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| models | ||
| List of model names to include in filter options. | ||
|
|
||
| Returns | ||
| ------- | ||
| Details | ||
| Model filter component. | ||
| """ | ||
| model_options = [{"label": m, "value": m} for m in models] | ||
|
|
||
| return Details( | ||
| [ | ||
| Summary( | ||
| "Visible models", | ||
| style={ | ||
| "cursor": "pointer", | ||
| "fontWeight": "600", | ||
| "fontSize": "11px", | ||
| "textTransform": "uppercase", | ||
| "letterSpacing": "0.07em", | ||
| "color": "#6c757d", | ||
| "padding": "5px", | ||
| }, | ||
| ), | ||
| Div( | ||
| [ | ||
| Dropdown( | ||
| id="model-filter-checklist", | ||
| options=model_options, | ||
| value=models, | ||
| multi=True, | ||
| maxHeight=600, | ||
| optionHeight=10, | ||
| placeholder="Select visible models", | ||
| closeOnSelect=False, | ||
| style={"fontSize": "12px"}, | ||
| ), | ||
| ], | ||
| style={"padding": "8px 12px"}, | ||
| ), | ||
| ], | ||
| id="model-filter-details", | ||
| open=True, | ||
| style={"marginBottom": "8px", "fontSize": "13px"}, | ||
| ) | ||
|
|
||
|
|
||
| def get_element_filter() -> Details: | ||
| """ | ||
| Get element filter component. | ||
|
|
||
| Returns | ||
| ------- | ||
| Details | ||
| Element filter component. | ||
| """ | ||
| # Exclude placeholder symbol for index 0 | ||
| elements = chemical_symbols[1:] | ||
|
|
||
| return Details( | ||
| [ | ||
| Summary( | ||
| "Filter by elements", | ||
| style={ | ||
| "cursor": "pointer", | ||
| "fontWeight": "600", | ||
| "fontSize": "11px", | ||
| "textTransform": "uppercase", | ||
| "letterSpacing": "0.07em", | ||
| "color": "#6c757d", | ||
| "padding": "5px", | ||
| }, | ||
| ), | ||
| Div( | ||
| [ | ||
| Dropdown( | ||
| id="element-filter", | ||
| options=elements, | ||
| value=None, | ||
| multi=True, | ||
| placeholder="Filter elements", | ||
| closeOnSelect=False, | ||
| style={"fontSize": "13px"}, | ||
| debounce=True, | ||
| ), | ||
| ], | ||
| style={"padding": "8px 12px"}, | ||
| ), | ||
| ], | ||
| id="element-filter-details", | ||
| open=True, | ||
| style={"marginBottom": "8px", "fontSize": "13px"}, | ||
| ) |
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.
i think this funciton mutating
self.table.datais dangerous for the hosted app with multiple users. i think we should build fromdeepcopy(self.original_table.data)?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.
Hmm yes I think you're right, thanks, I'll fix this soon
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.
Hmm yes I think you're right, thanks, I'll fix this soon
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.
we should also be careful if theres anything else that could have a similar effect, as its less strightforward to spot when we test locally