-
Notifications
You must be signed in to change notification settings - Fork 3
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
Metadata Templates Selection UI #914
Open
joshsadam
wants to merge
62
commits into
main
Choose a base branch
from
metadata-templates/dropdown
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.
Open
+234
−94
Conversation
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
joshsadam
force-pushed
the
metadata-templates/dropdown
branch
2 times, most recently
from
January 30, 2025 14:12
bb04467
to
7cc8fc8
Compare
…thorization checks - Added `create_metadata_template?` method to `GroupPolicy` and `ProjectNamespacePolicy` for authorization. - Removed the obsolete `MetadataTemplatePolicy` class. - Enhanced `CreateService` to include authorization logic for creating metadata templates. - Updated locale files to include new activity messages for metadata template creation.
…ndling - Introduced parameter validation in CreateService to ensure required fields are present before creating a metadata template. - Added custom error handling for missing name and fields, improving user feedback during template creation. - Updated tests to cover new validation scenarios, ensuring robust functionality for metadata template creation. - Standardized quotation marks in locale files for consistency across English and French translations.
…ror handling and validation - Initialized @metadata_template to streamline template creation process. - Simplified error handling by directly adding errors to the namespace instead of the template. - Refined parameter validation to ensure required fields are checked before template creation. - Updated tests to reflect changes in error handling and validation logic, ensuring robust functionality.
- Added support for displaying metadata template creation activities in both group and project activity components. - Introduced a new method `metadata_template_link` in the activity components to check for metadata template creation actions. - Updated HTML templates to render appropriate translations for metadata template activities, ensuring user clarity. - Refactored locale files to standardize the use of `template_name` in activity messages for consistency across English and French translations. - Improved parameter handling in the `track_activity` concern to include metadata template details during activity tracking.
… error handling - Updated CreateService to enforce validation rules ensuring fields are either present as an array or raise appropriate errors. - Enhanced error messages in locale files for better user feedback during template creation. - Added tests to cover scenarios for missing fields, unauthorized access, and duplicate template names, ensuring robust functionality. - Standardized quotation marks in locale files for consistency across English and French translations.
…ncements - Added a new `DestroyService` for handling the destruction of metadata templates, including authorization checks. - Updated `ProjectNamespacePolicy` to include `destroy_metadata_template?` method for permission validation. - Enhanced tests for both the `DestroyService` and `ProjectNamespacePolicy` to ensure correct permission handling and functionality. - Improved clarity in policy and service interactions for better maintainability and user feedback.
- Refactored `create_metadata_template?` and `destroy_metadata_template?` methods to use effective access level checks for authorization. - Updated tests to include assertions for the new permission methods, ensuring proper functionality and coverage. - Improved clarity in permission handling for metadata template operations.
…ermissions - Introduced `UpdateService` for handling updates to metadata templates, including authorization checks. - Added `update_metadata_template?` method to `GroupPolicy` and `ProjectNamespacePolicy` for permission validation. - Updated activity components to recognize metadata template update actions. - Enhanced locale files to include new activity messages for metadata template updates. - Added tests for `UpdateService` to ensure correct functionality and permission handling.
…a templates - Eliminated the `validate_params` method from the `UpdateService`, simplifying the update process. - Streamlined the execution flow by directly handling updates without pre-validation of parameters. - Maintained authorization checks to ensure proper permissions during metadata template updates.
- Changed the update method to use `update!` for better error management during metadata template updates. - Updated error handling to capture `ActiveRecord::RecordInvalid` exceptions and add relevant error messages to the template. - Modified tests to reflect the new error handling behavior, ensuring accurate assertions for invalid update scenarios.
…mplate updates - Fixed a typo in the test description for invalid parameter updates. - Updated the test for numerical fields to assert specific error messages returned by the metadata template, ensuring accurate validation feedback. - Improved clarity and accuracy in test cases related to metadata template updates.
- Changed the save method in CreateService to use `save!` for better error management. - Added new validation error messages for the `name` attribute in both English and French locale files. - Updated tests to assert the presence of specific error messages for invalid metadata template creation scenarios, ensuring accurate feedback for users.
- Refactored methods to modularize the addition of sample activity and metadata template parameters. - Replaced conditional merges with dedicated methods for clarity and maintainability. - Introduced a new method to handle bulk sample parameters for 'sample_destroy_multiple' action. - Improved overall readability and structure of the parameter handling logic.
- Eliminated redundant blank lines in the `create_service.rb` file to improve code readability. - Ensured that the file maintains a clean and consistent formatting style.
…services - Changed the save method in CreateService to use `save` instead of `save!`, raising a custom error with detailed messages on failure. - Updated the update method in UpdateService to use `update` instead of `update!`, removing the rescue block for `ActiveRecord::RecordInvalid`. - Adjusted tests to reflect the new error handling logic, ensuring accurate assertions for invalid metadata template creation scenarios.
…mplate action types - Introduced `template_name` to both group and project activity components for enhanced context. - Refined `metadata_template_link` method in both components to exclude the `metadata_template_destroy` action, simplifying the action types handled. - Removed the `template_id` parameter from the destroy service to streamline the metadata template destruction process.
- Changed the access level requirement for creating, updating, and destroying metadata templates from ANALYST to MAINTAINER in both GroupPolicy and ProjectNamespacePolicy. - This change enhances security by ensuring that only users with higher privileges can perform these actions.
- Replaced direct comparisons with `Member::AccessLevel.manageable.include?` for determining access levels in `create_metadata_template?`, `update_metadata_template?`, and `destroy_metadata_template?` methods in both GroupPolicy and ProjectNamespacePolicy. - This change improves code readability and maintainability by utilizing a more flexible access level management approach.
- Changed the test description to clarify that the update operation fails when incorrect permissions are provided. - This enhances the readability and understanding of the test's purpose, ensuring it accurately reflects the expected behavior of the system.
- Changed the test description to clarify that the operation fails when incorrect permissions are provided, enhancing the readability and understanding of the test's purpose.
- Extracted `current_metadata_template` method from SamplesController to the Metadata concern - Centralized metadata template parameter handling in the shared concern - Simplified code by removing duplicate method definition
- Created `MetadataTemplatesDropdownComponent` to render a reusable dropdown for metadata templates - Updated `Namespace` model to return metadata templates with their IDs - Modified `Metadata` concern to return metadata templates as `[name, id]` pairs - Refactored samples table filter to use the new dropdown component - Improved metadata template selection with grouped options for all, none, and custom templates
- Deleted the `_metadata_toggle.html.erb` partial from shared samples views - Removes an unused view component related to metadata display
- Updated dropdown component to use default 'none' selection - Replaced hardcoded options with internationalized translations - Added conditional rendering for metadata templates - Removed unnecessary `w-full` class from dropdown styling
Modify `fields_for_namespace_or_template` method to correctly handle blank metadata templates by adding an additional condition to the existing template checks
- Introduced `metadata_templates` before action to load available metadata templates - Updated `query` method to use `metadata_fields` with selected metadata template - Refactored metadata field selection logic to support template-based filtering - Added `metadata_templates` method to retrieve templates for the current group
- Replaced metadata toggle partial with MetadataTemplatesDropdownComponent in groups and projects samples table filters - Refactored table filter views to use new dropdown component with metadata templates - Updated locales to include translations for metadata templates dropdown
Clean up unnecessary `puts` debugging output in the MetadataTemplatesDropdownComponent, improving code cleanliness
Improve accessibility by adding a hidden label for the metadata templates dropdown, ensuring better screen reader support for form inputs
- Wrapped dropdown in a relative container for better layout control - Added an explicit ID to the select element for improved accessibility - Refactored class names to use an array for better readability and maintainability - Simplified and consolidated Tailwind CSS classes for light and dark mode styling
…wn component Remove unnecessary `puts` debugging output in the component initialization method, improving code cleanliness and removing potential performance overhead
Update en.yml and fr.yml to use consistent single quotes for string values, improving code readability and maintaining a uniform style across localization files
Remove unnecessary metadata toggle label translations from both English and French locale files, cleaning up unused localization entries
Remove unused `fields_for_namespace` method and update `WorkflowExecutions::SubmissionsController` to use `fields_for_namespace_or_template`
Modify system test to assert the presence of the metadata template select dropdown instead of the import metadata button
Replace metadata toggle label click with select dropdown interaction in system tests, ensuring consistent test coverage for the new metadata template selection method
…ject namespace policy
Replace metadata toggle label click with select dropdown interaction across multiple test scenarios, ensuring consistent test coverage for the new metadata template selection method
Modify system test to replace metadata toggle label click with select dropdown interaction, ensuring consistent test coverage for the new metadata template selection method
joshsadam
force-pushed
the
metadata-templates/dropdown
branch
from
January 31, 2025 01:42
7cc8fc8
to
3c4f208
Compare
…e selection Implement a system test to verify that selecting different metadata templates dynamically updates the table columns, ensuring proper rendering and responsiveness of the samples table
Clean up unnecessary assertion for metadata toggle label after recent dropdown interaction updates
Enhance system test for samples table by adding explicit scrolling to last column and refactoring sorting assertions within table header context
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do and why?
Describe in detail what your merge request does and why.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other pull requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
[email protected]
and create a new projectuser = User.find_by(email: "[email protected]")
namespace = Project.last.namespace
template = MetadataTemplates::CreateService.new(user, namespace, {name: "template1", fields: ['b', 'c']}).execute
PR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.