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 filters #167

Merged
merged 19 commits into from
Feb 21, 2024
Merged

Add filters #167

merged 19 commits into from
Feb 21, 2024

Conversation

vjik
Copy link
Member

@vjik vjik commented Feb 19, 2024

Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️
Fix #159

Copy link

what-the-diff bot commented Feb 19, 2024

PR Summary

  • Addition of DropdownFilter and TextInputFilter classes
    Two new classes - DropdownFilter and TextInputFilter have been introduced for better handling and processing of user inputs.

  • Improvement of BaseListView functionality
    A new method, makeFilters(), was added to the BaseListView class to allow the creation of filters that would aid in data processing and presentation.

  • Creation of FilterContext class
    A FilterContext class was developed and included in various segments of the codebase to define the context or scope for the filtering system.

  • Enhancement to the DataColumn class
    The DataColumn class now has a new property filter enhancing its capabilities and functionality.

  • Addition of FilterableColumnRendererInterface class
    This newly added class provides an interface to customize how different columns would be rendered depending on certain filter conditions.

  • Creation of EqualsFilterFactory, LikeFilterFactory and Filter classes
    To support complex filtering capabilities, classes like EqualsFilterFactory, LikeFilterFactory, and Filter were developed.

  • Introduction of FilterWidget abstract class
    This abstract class sets the base for building multiple filter widgets in the future.

  • Introduction of TextInputFilter class and UrlQueryReader class
    There are new classes, TextInputFilter and UrlQueryReader, to handle text box inputs and the queries from URLs respectively.

  • Changes to the GridView class
    Several methods and properties were added or updated in the GridView class, including the columnsCache property, makeFilters() method, and renderItems() method, for enhanced rendering of filter rows and filter forms.

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: 149 lines in your changes are missing coverage. Please review.

Comparison is base (64b97ba) 70.79% compared to head (fb259d4) 65.96%.
Report is 1 commits behind head on master.

Files Patch % Lines
src/GridView.php 58.65% 43 Missing ⚠️
src/Column/DataColumnRenderer.php 22.44% 38 Missing ⚠️
src/Filter/Widget/DropdownFilter.php 0.00% 22 Missing ⚠️
src/Filter/Widget/TextInputFilter.php 0.00% 16 Missing ⚠️
config/widgets-themes.php 0.00% 9 Missing ⚠️
src/Filter/Widget/FilterWidget.php 0.00% 7 Missing ⚠️
src/Filter/Factory/EqualsFilterFactory.php 0.00% 4 Missing ⚠️
src/Filter/Factory/LikeFilterFactory.php 0.00% 4 Missing ⚠️
src/BaseListView.php 80.00% 2 Missing ⚠️
src/Column/Base/FilterContext.php 50.00% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #167      +/-   ##
============================================
- Coverage     70.79%   65.96%   -4.84%     
- Complexity      481      538      +57     
============================================
  Files            38       46       +8     
  Lines          1606     1807     +201     
============================================
+ Hits           1137     1192      +55     
- Misses          469      615     +146     

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

@vjik vjik marked this pull request as ready for review February 20, 2024 08:08
@vjik vjik added the status:code review The pull request needs review. label Feb 20, 2024
@vjik vjik requested a review from a team February 20, 2024 08:17
{
public function get(string $name): ?string
{
$value = $_GET[$name] ?? null;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we get it from PSR request instead of $_GET?

Copy link
Member Author

Choose a reason for hiding this comment

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

For use request we need somewhere find it.

  1. Pass request to widget via special method. It's very not convenient.

  2. Create RequestProvider and catch request sowewhere. Same implementation we use in Yii Input HTTP: https://github.com/yiisoft/input-http?tab=readme-ov-file#general-usage

But what is problem $_GET usage?

Copy link
Member Author

Choose a reason for hiding this comment

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

Now I remove UrlQueryReader in favor UrlParameterProviderInterface usage.

Copy link
Member

Choose a reason for hiding this comment

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

But what is problem $_GET usage?

It's not available for many runtimes, especially event loop ones.

@vjik vjik merged commit 53b969c into master Feb 21, 2024
16 of 19 checks passed
@vjik vjik deleted the filter branch February 21, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add filters
3 participants