Skip to content
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

Add a button to download bandstructure and DOS Json data (#46) #47

Merged
merged 9 commits into from
Feb 8, 2023

Conversation

dou-du
Copy link
Contributor

@dou-du dou-du commented Feb 3, 2023

Add a button to download bandstructure and DOS Json data together.

@dou-du dou-du requested a review from unkcpz February 3, 2023 03:18
@dou-du
Copy link
Contributor Author

dou-du commented Feb 3, 2023

@unkcpz could you help me to check why the "pre-commit" CI failed?

@unkcpz
Copy link
Collaborator

unkcpz commented Feb 6, 2023

Changing sort to version 5.12.0 will solve the problem, please add a commit to fix that.

Copy link
Collaborator

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -19,7 +19,7 @@ jobs:

- name: Install dependencies
run: |
python -m pip install pre-commit==2.11.1
python -m pip install pre-commit==3.0.3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This need to be compatible with the pre-commit.yaml, I guess you change the to fix the pre-commit issue. If it is not work, please revert it back to old version.

theDownloadJsonButton.onclick = function () {
if ($.isEmptyObject(dosFile)) {
var a = document.createElement('a');
if (dataFilePaths.length) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this for loop, it will go through every band and download or it will download all as a archived file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will download mutiple json files, if more than one bandstructure data were given.

theDownloadJsonButton.onclick = function () {
var a = document.createElement('a');

if (dataFilePaths.length) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the length is to check if the data exist. So rather than check the length it would be clear to check the existence directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dataFilePaths can be empty, if only DOS file was given.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see, but the for dos and bands data here the variable's name are messed up and very confusion. If you can fix it in another PR, that would be helpful for future maintenance. Can you do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this vriable is confusion. I am going to change it.

@dou-du
Copy link
Contributor Author

dou-du commented Feb 7, 2023

@unkcpz
Copy link
Collaborator

unkcpz commented Feb 8, 2023

Changing sort to version 5.12.0 will solve the problem, please add a commit to fix that.

As I said, this should fix the pre-commit error.

@unkcpz
Copy link
Collaborator

unkcpz commented Feb 8, 2023

@dou-du thanks, I go to https://hub-binder.mybinder.ovh/user/osscar-org-widget-bandsplot-uumbakpe/doc/tree/examples/bandsplot-example.ipynb but can not find the button and to check it.

Please check this binder link:

https://mybinder.org/v2/gh/osscar-org/widget-bandsplot/download-json?labpath=%2Fexamples%2Fbandsplot-example.ipynb

It is super slow to access this URL, is there other way I can see the effect and test? Is there any reason that cause the notebook load so slow, can we fix that?

Copy link
Collaborator

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dou-du, I give it a try and looks good. If you fix the pre-commit error, this can be merged.

theDownloadJsonButton.onclick = function () {
var a = document.createElement('a');

if (dataFilePaths.length) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see, but the for dos and bands data here the variable's name are messed up and very confusion. If you can fix it in another PR, that would be helpful for future maintenance. Can you do that?

@unkcpz
Copy link
Collaborator

unkcpz commented Feb 8, 2023

Please check the fix aiidalab/aiidalab-widgets-base#428

@dou-du dou-du merged commit d7979b5 into main Feb 8, 2023
@unkcpz unkcpz deleted the download-json branch February 8, 2023 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants