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

Resource setting tabs #939

Merged
merged 5 commits into from
Nov 22, 2024

Conversation

superstar54
Copy link
Member

@superstar54 superstar54 commented Nov 21, 2024

This PR implemented the plugin panel for the resource setting step. The design is agreed by the team, and as show in this diagram:
https://www.figma.com/board/EAwAPebMQLnoexFirWXbCO/qeapp-codes-panel-design?node-id=0-1&node-type=canvas&t=RA169OqQuAXSHmU0-0

The core ideas are:

  • Find all codes in the plugins
  • Only list one code for each code kind
  • Each plugin has a code panel
  • Modification in basic will update all plugins
  • Add an override box in each plugin panel
  • Warning and blocker messages implemented in the global settings currently. But the plugin developer can implement their own logic to update the warning and blocker.
  • Global settings panel only shows the Base QEcode class, and the plugin decides how to update its custom code widget

Plugin design

  • Refactor the step 3 to support plugin tabs
  • The warning and blocker messages from the plugins are also collected and shown.

MVC base class

I created base classes for the code setting model and view. The plugin only needs inheritance from them, which becomes quick and simple for the developer.

Above _on_xxx_change in MVC

In the following example, the _on_global_codes_change only acts on the model, so sometimes, it is confusing why we need to move the logic to the setting.

def __init__(self, model, **kwargs):
    super().__init__(model, **kwargs)
    self._model.observe(
            self._on_global_codes_change,
            "global_codes",
        )

def _on_global_codes_change(self, _):
        self._model.update_code_from_global()

Closes #879

@superstar54 superstar54 marked this pull request as draft November 21, 2024 13:01
- Find all codes in the plugins
- Only list one code for each code kind
- Each plugin has a code panel
- Modification in basic will update all plugins
- Add a override box in each plugin panel
- Warning and blocker message
- Basic panel only show the Base QEcode class, and plugin decide how to update their custom code widget
@superstar54 superstar54 force-pushed the add_plugin_code_panel branch from 28b3af5 to 5f67bc0 Compare November 21, 2024 13:02
@superstar54 superstar54 force-pushed the add_plugin_code_panel branch 2 times, most recently from c1491b8 to aabefa3 Compare November 21, 2024 17:38
@superstar54 superstar54 force-pushed the add_plugin_code_panel branch from aabefa3 to cfe0ae7 Compare November 21, 2024 22:59
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 82.28700% with 79 lines in your changes missing coverage. Please review.

Project coverage is 68.40%. Comparing base (ab528b6) to head (9ec10df).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/aiidalab_qe/common/panel.py 39.00% 61 Missing ⚠️
...iidalab_qe/app/submission/global_settings/model.py 93.91% 7 Missing ⚠️
...dalab_qe/app/submission/global_settings/setting.py 93.18% 6 Missing ⚠️
src/aiidalab_qe/app/submission/model.py 94.11% 3 Missing ⚠️
src/aiidalab_qe/app/submission/__init__.py 96.49% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #939      +/-   ##
==========================================
+ Coverage   68.05%   68.40%   +0.34%     
==========================================
  Files         104      110       +6     
  Lines        5795     6096     +301     
==========================================
+ Hits         3944     4170     +226     
- Misses       1851     1926      +75     
Flag Coverage Δ
python-3.11 68.38% <82.28%> (+0.33%) ⬆️
python-3.9 68.42% <82.28%> (+0.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@superstar54 superstar54 force-pushed the add_plugin_code_panel branch from 1c030f0 to 8245320 Compare November 21, 2024 23:18
@superstar54 superstar54 force-pushed the add_plugin_code_panel branch from 8245320 to b170550 Compare November 21, 2024 23:40
@superstar54 superstar54 marked this pull request as ready for review November 21, 2024 23:49
@superstar54
Copy link
Member Author

superstar54 commented Nov 21, 2024

Hi @edan-bainglass , please take a look at this PR and let me know if I am on the design following the MVC.

Hi @mikibonacci and @AndresOrtegaGuerrero, I created base classes for the code setting model and view. The plugin only needs inheritance from them, making it quite simple for the developer. You can look at the code.py file in the plugins (e.g., bands).

@edan-bainglass
Copy link
Member

Hi @edan-bainglass , please take a look at this PR and let me know if I am on the design following the MVC.

Thanks @superstar54. I will look at it this morning.

Hi @mikibonacci and @AndresOrtegaGuerrero, I created base classes for the code setting model and view. The plugin only needs inheritance from them, making it quite simple for the developer. You can look at the code.py file in the plugins (e.g., bands).

@mikibonacci @AndresOrtegaGuerrero maybe hold off on implementing these features for your plugins until we review the PR.

Copy link
Member

@edan-bainglass edan-bainglass left a comment

Choose a reason for hiding this comment

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

This is great @superstar54! Thank you. As discussed, we'll do a bit of refactoring in a follow-up PR, now that we see the added shared functionality across steps 2 and 4.

Leaving here comments from @mikibonacci:

  • Parallelization pool not synching from global resources to plugin resources
  • Unchecking the override on a plugin resources panel should resync to global resources
  • We should check that adding a new code is reflected correctly in the relevant panels

But in general, LGTM! Let's get this merged!

@edan-bainglass edan-bainglass merged commit 363be6f into aiidalab:main Nov 22, 2024
8 checks passed
edan-bainglass added a commit that referenced this pull request Dec 9, 2024
This PR looks to clean up the recently implemented plugin-based tab system in the resources/submission step (#939).
The idea is to leverage the newly developed abstraction in #945 to encapsulate the behavior of ANY resource settings panel, leaving the global resource settings panel to override based on its unique added features.

A few added items addressed in this PR:

- PW code parallelization widget syncing between tabs
- Support for syncing newly setup codes
- Warning notification for overridden plugin resources
- Syncing back with global resources on un-override
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.

Two projwfc.x code
2 participants