PASTA-ELN / pasta-eln

PASTA-ELN with new frontend
https://pasta-eln.github.io/pasta-eln/
Other
8 stars 2 forks source link

feat(data_hierarchy): implement changes for data type row #351

Closed jmurugan-fzj closed 1 month ago

jmurugan-fzj commented 1 month ago

Summary by Sourcery

Refactor the data hierarchy editor to separate the creation and editing of data types into distinct dialogs, enhancing the user interface and validation. Introduce a singleton class for managing QTA icons and add comprehensive tests for the new features.

New Features:

Enhancements:

Tests:

Additional Info: Pyside6 version has been fixed to 6.7.3 since there is some incompatibility between the dependent libraries with the latest PySide6 6.8.0, The issue is already backlogged: PASTA APP crashes with segmentation fault

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request implements significant changes to the data hierarchy editor dialog in the PASTA-ELN application. The changes focus on improving the functionality for creating and editing data types, enhancing the user interface, and refactoring the codebase for better maintainability.

User journey diagram for data type row changes

journey
    title User journey for data type row changes
    section Data Type Row
      User selects data type from combo-box: 5: User
      User clicks Add button: 5: User
      System displays form with data type, title, IRI, shortcut, icon: 5: System
      User fills form and submits: 5: User
      System saves new data type: 5: System
      User clicks Edit button: 5: User
      System displays form with read-only data type, icon, shortcut: 5: System
      User modifies title and IRI: 5: User
      System saves changes: 5: System
      User clicks Delete button: 5: User
      System checks if data type is structural: 5: System
      System disables delete for structural types: 5: System

File-Level Changes

Change Details Files
Refactored and enhanced the data hierarchy editor dialog
  • Replaced CreateTypeDialog with a more generic TypeDialog class
  • Implemented EditTypeDialog for editing existing data types
  • Updated UI elements and callbacks in DataHierarchyEditorDialog
  • Modified the data structure for storing data hierarchy types
  • Improved error handling and user feedback
pasta_eln/GUI/data_hierarchy/data_hierarchy_editor_dialog.py
pasta_eln/GUI/data_hierarchy/data_hierarchy_editor_dialog_base.py
tests/unit_tests/test_data_hierarchy_editor_dialog.py
Introduced new classes for managing data types and icons
  • Created DataTypeInfo class to represent data type information
  • Implemented DataTypeInfoValidator for validating DataTypeInfo instances
  • Added QTAIconsSingleton for managing icon collections
  • Created EditTypeDialog for editing existing data types
pasta_eln/dataverse/data_type_info.py
pasta_eln/dataverse/data_type_info_validator.py
pasta_eln/GUI/data_hierarchy/qtaicons_singleton.py
pasta_eln/GUI/data_hierarchy/edit_type_dialog.py
Updated utility functions and data structures
  • Modified can_delete_type function to handle structural levels differently
  • Updated generate_data_hierarchy_type function to use DataTypeInfo
  • Removed get_next_possible_structural_level_title function
  • Modified the structure of data hierarchy types in fixedStringsJson.py
pasta_eln/GUI/data_hierarchy/utility_functions.py
pasta_eln/fixedStringsJson.py
Expanded and updated test suite
  • Added new test files for DataTypeInfo, DataTypeInfoValidator, and QTAIconsSingleton
  • Updated existing tests to reflect changes in the data hierarchy editor dialog
  • Modified test fixtures and mocks to accommodate new class structures
tests/unit_tests/test_data_hierarchy_create_type_dialog.py
tests/unit_tests/test_data_hierarchy_edit_type_dialog.py
tests/unit_tests/test_data_hierarchy_type_dialog.py
tests/unit_tests/test_data_hierarchy_icon_names.py
tests/unit_tests/test_data_hierarchy_data_type_info.py
tests/unit_tests/test_data_hierarchy_data_type_info_validator.py

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
jmurugan-fzj commented 1 month ago

@SteffenBrinckmann Could you please do the review, had fixed all the failing problems and addressed valid comments from Sourcery too!