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

[Admin] Add filter toolbar for enhanced search functionality #5296

Merged
merged 2 commits into from
Aug 3, 2023

Conversation

rainerdema
Copy link
Contributor

@rainerdema rainerdema commented Aug 2, 2023

Summary

This PR introduces a temporary filter toolbar.
This addition is necessary due to the transition from the old admin product page, and to maintain continuity of certain features, specifically the 'With Deleted' option.
This filter toolbar will be further updated in the future to accommodate more sophisticated UI/UX.

Screenshot 2023-08-02 at 18 05 27 Screenshot 2023-08-02 at 18 05 37 Screenshot 2023-08-02 at 18 05 45

Here's an example of how you can add a new filter to see only 'promotionable' products:

  1. First, include 'promotionable' in the ransackable attributes in the Spree::Product model.
  2. Then, add a filter in the filters composition in the product index:
def filters
  [ 
  .
  .
    {
      name: 'q[promotionable_eq]',
      value: true,
      label: "Only promotionable",
    },
  ]
end

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Merging #5296 (fd896c7) into nebulab/admin (226ea39) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head fd896c7 differs from pull request most recent head c3e90b8. Consider uploading reports for the commit c3e90b8 to get more accurate results

@@              Coverage Diff               @@
##           nebulab/admin    #5296   +/-   ##
==============================================
  Coverage          88.56%   88.57%           
==============================================
  Files                599      599           
  Lines              14573    14579    +6     
==============================================
+ Hits               12907    12913    +6     
  Misses              1666     1666           
Files Changed Coverage Δ
...mponents/solidus_admin/products/index/component.rb 92.50% <100.00%> (+0.39%) ⬆️
...app/components/solidus_admin/ui/table/component.rb 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rainerdema rainerdema marked this pull request as ready for review August 2, 2023 16:19
@rainerdema rainerdema requested a review from a team as a code owner August 2, 2023 16:19
@rainerdema rainerdema requested review from elia and the-krg August 2, 2023 16:19
@rainerdema rainerdema changed the title Addition of filter toolbar for enhanced search functionality [Admin] Addition of filter toolbar for enhanced search functionality Aug 2, 2023
@rainerdema rainerdema changed the title [Admin] Addition of filter toolbar for enhanced search functionality [Admin] Add filter toolbar for enhanced search functionality Aug 3, 2023
@rainerdema rainerdema force-pushed the elia+rainer/admin/deleted-filter branch from fd896c7 to b17fef6 Compare August 3, 2023 08:52
rainerdema and others added 2 commits August 3, 2023 10:54
This alpha-stage version introduces a filter toolbar to the table component.
Please note that this is an initial representation of the filter architecture,
and it doesn't represent the final version.

Specific changes include:
- Addition of a 'filters' method in the products index component, which takes a
  list of filters.
- Addition of a 'filters' prop in the table component, which takes the list of
  filters and renders them in the filter toolbar.

The goal of this initial implementation is to provide a similar level of features
in the new product index table as the old one, laying the groundwork for
future improvements and updates.

Co-Authored-By: Elia Schito <elia@schito.me>
Changes include:
- Addition of new filter in `filters` method in the products index component,
  now includes an additional filter for 'with_discarded' products.

Please note that this is a special case of filters in the context of
transitioning from the old to the new products index page.
This change ensures that the feature set between the old and new product index
page remains consistent.

Co-Authored-By: Elia Schito <elia@schito.me>
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

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

🚀 🚀 🚀 🚀

@rainerdema rainerdema merged commit b321127 into nebulab/admin Aug 3, 2023
11 checks passed
@rainerdema rainerdema deleted the elia+rainer/admin/deleted-filter branch August 3, 2023 14:01
@rainerdema rainerdema restored the elia+rainer/admin/deleted-filter branch August 3, 2023 14:38
@rainerdema rainerdema deleted the elia+rainer/admin/deleted-filter branch August 3, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants