Skip to content

Conversation

@pxpm
Copy link
Contributor

@pxpm pxpm commented Nov 6, 2024

WHY

BEFORE - What was wrong? What was happening before this PR?

Filters were tightly coupled with the datatable making it impossible to use in a page that didn't had the datatable.

AFTER - What is happening after this PR?

Filters can be used in any page, and developer can configure the actions to perform when they are enabled/disabled.

image

HOW

How did you achieve that, in technical terms?

transformed the filters_navbar into a component that can be reused.
refactored the filters to emit events when they are changed.

Is it a breaking change?

If you have filters_navbar.blade.php overwritten yes it is.

@pxpm pxpm assigned tabacitu and pxpm Nov 6, 2024
@pxpm pxpm added the v7 label Nov 6, 2024
@susanu
Copy link
Contributor

susanu commented Nov 27, 2024

Off topic: Would you consider adding support for global filters?
Example: A filter that will be displayed on all pages, lets say a date range filter.
On the cruds that have a date range filter, just take the values from the global one (if you set it this way).
Use case: You want to see statistics about last week on multiple cruds and don't want to set the date range every time you navigate to the crud.

Cheers!

@tabacitu
Copy link
Member

Hi @susanu - I think that's an interesting idea, but a very niche one. I see how it would be useful (I have a company select in one project too). But I don't think Backpack needs to help with it... it's ok for the dev to do it custom, since it's IS very custom, and particular to that project. We're not looking to add any "could-have" features, only "must-have" and "should-have". But it would make for a very interesting article - I'll give you that! Wanna write it?

@susanu
Copy link
Contributor

susanu commented Nov 28, 2024

Hi @tabacitu,

I'm better at writing code than articles.
After v7 is released and filters can be reused in other places, i will submit a pull request, when time allows it, for this feature.

Cheers!

@pxpm
Copy link
Contributor Author

pxpm commented Dec 2, 2024

@susanu "theoretically" that's already possible.

You can store the "global" filter (you can't use the native filters (yet!)) in a session variable, and add a middleware, or similar approach, that reads from that session variable and redirects the user to say admin/invoices?date=2024-01-01. If the date filter exist on the invoice crud, it will be automatically applied.

Thanks for the suggestion, eagerly waiting for the PR 👍

Base automatically changed from allow-datatables-url-configuration to next December 5, 2024 11:07
Copy link
Member

@tabacitu tabacitu left a comment

Choose a reason for hiding this comment

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

I agree with making it a component. I agree with the naming. Please redo the event names so it's backpack:filters:clear like I said in https://github.com/Laravel-Backpack/PRO/pull/296 too, merge next into this, test it, and give it back.

@tabacitu tabacitu assigned pxpm and unassigned tabacitu Dec 5, 2024
@pxpm pxpm force-pushed the agnostic-filters branch from 6e40e3a to a719f19 Compare December 6, 2024 11:45
@pxpm pxpm changed the title [POC] "Agnostic" filters "Agnostic" filters - decouple filters from datatables Dec 13, 2024
@pxpm pxpm assigned tabacitu and unassigned pxpm Dec 13, 2024
@pxpm pxpm force-pushed the next branch 2 times, most recently from 1253d3b to 7019815 Compare January 23, 2025 10:31
@tabacitu tabacitu mentioned this pull request Jan 27, 2025
2 tasks
@pxpm pxpm force-pushed the agnostic-filters branch from 49d8f33 to 1d88043 Compare January 27, 2025 13:16
Copy link
Member

@tabacitu tabacitu left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this Pedro - I have a few notes.

Btw I agree with you with keeping the "filters framework" inside CRUD (not PRO). Good catch!

@include('crud::inc.export_buttons')

<script type="text/javascript">
// TODO: this needs to be agnostic per filter navbar as in the future hopefully we can have more than one
Copy link
Member

Choose a reason for hiding this comment

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

VERY good catch! Do we need to do this now, or can we do it later, as a non-breaking change? Cause it's a pretty big thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can do it later as non-breaking

@tabacitu tabacitu removed their assignment Feb 4, 2025
pxpm and others added 3 commits February 5, 2025 12:15
@pxpm pxpm force-pushed the agnostic-filters branch from 86266b1 to fb3a80c Compare February 5, 2025 12:15
@pxpm pxpm assigned tabacitu and unassigned pxpm Feb 5, 2025
@tabacitu tabacitu merged commit 2c9bea6 into next Feb 7, 2025
17 checks passed
@tabacitu tabacitu deleted the agnostic-filters branch February 7, 2025 08:56
pxpm added a commit that referenced this pull request Feb 19, 2025
* wip

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove filters navbar component

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
pxpm added a commit that referenced this pull request Feb 25, 2025
* wip

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove filters navbar component

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
pxpm added a commit that referenced this pull request Mar 5, 2025
* wip

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove filters navbar component

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
pxpm added a commit that referenced this pull request Mar 24, 2025
* wip

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove filters navbar component

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
pxpm added a commit that referenced this pull request Nov 21, 2025
* wip

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove filters navbar component

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
pxpm added a commit that referenced this pull request Nov 21, 2025
* wip

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove filters navbar component

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
tabacitu added a commit that referenced this pull request Nov 21, 2025
* Uploaders - Refactor and fixes (#5478)

* add method to get ajax uploaders

* Apply fixes from StyleCI

[ci skip] [skip ci]

* use an abstract class

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* refactor uploaders

* Apply fixes from StyleCI

[ci skip] [skip ci]

* refactor rules

* Apply fixes from StyleCI

[ci skip] [skip ci]

* move ajax to PRO, cleanup

* Apply fixes from StyleCI

[ci skip] [skip ci]

* make attributes available for all subfields

* fix tests

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* upload multiple and upload properly working 🙏

* fixes

* Apply fixes from StyleCI

[ci skip] [skip ci]

* allow the configuration of valueWithoutPath call.

* fix valid upload inside repeatables

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix condition

* cleanup

* fix

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix use case for enabling validation after entry is created

* Apply fixes from StyleCI

[ci skip] [skip ci]

* dont save array keys

* fix ajax validation

* fix validation messages

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fixes ValidUpload

* Apply fixes from StyleCI

[ci skip] [skip ci]

* dont json encode if casted in the model

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix previous file identification in repeatable

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix getting values

* Apply fixes from StyleCI

[ci skip] [skip ci]

* add fake fields support

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip add uploaders tests

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* add pro columns

* fix test suite

* fix tests

* ffix tests

* remove unused test views

* add uploaders to test coverage

* Apply fixes from StyleCI

[ci skip] [skip ci]

* add coverage folder to gitignore

* make tests run faster by not reloading db when not necessary

* add coverage to validation tests

* add fake tests to uploaders

* Apply fixes from StyleCI

[ci skip] [skip ci]

* add more tests

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* add more upload assets

* fixes

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix single file

* Apply fixes from StyleCI

[ci skip] [skip ci]

* add image column

* fix tests

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove hardcoded macro names

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove double loop, fix single file uploader

* Apply fixes from StyleCI

[ci skip] [skip ci]

* use a big increments and unsigned for primary key

* handle pivot file deletion

* Apply fixes from StyleCI

[ci skip] [skip ci]

* register events for relation models

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix typo

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix relationship uploaders

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* update temporary time key

* save objects in the macro

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>

* trigger testing forkflow on PR

* Clean up uploaders (#5725)

* wip

* clean up

* add get uploadedFilesFromRequest to clean up uploaders

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix type cast

* add summernote uploader

* update summernote

* add summernote

* add more test assets

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>

* allow datatable url configuration (#5713)

* use next branch for basset

* require alpha version

* bump basset version

* Lifecycle hooks for CRUD operations (#5687)

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* tidy up

* Apply fixes from StyleCI

[ci skip] [skip ci]

* panel hooks

* Apply fixes from StyleCI

[ci skip] [skip ci]

* refactoring :broom

* finish implementing hooks

* Apply fixes from StyleCI

[ci skip] [skip ci]

* refactoring hooks

* Apply fixes from StyleCI

[ci skip] [skip ci]

* add hook to delete

* allow empty parameters

* wip

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>

* "Agnostic" filters - decouple filters from datatables (#5714)

* wip

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* wip

* Apply fixes from StyleCI

[ci skip] [skip ci]

* remove filters navbar component

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>

* bump basset version

* Update composer.json

* Apply fixes from StyleCI

[ci skip] [skip ci]

* datatable component (#5688)

Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Cristian Tabacitu <cristian.tabacitu@digitallyhappy.com>

* move the list heading to the datatable component (#5808)

* add Datagrid and Datalist components (#5810)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* Form component (no ajax form) (#5814)

Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Cristian Tabacitu <cristian.tabacitu@digitallyhappy.com>

* dataform component fixes (#5816)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* Added general chip blade file and chip widget (#5815)

* Fix Form issues, Add *name* argument to forms (#5817)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* Drop support for Laravel 10 and 11 (#5819)

* Fix hooks at setup level (#5818)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* install dev-next version of generators

* require basset beta version (#5821)

* fix scripts on table

* fix the keyboard shortcuts on forms

* ensure proper crud identification

* fix hooks

* fix crud field javacript issue

* pass the form id to form content

* add error page translations

* fix export buttons

* wip

* wip

* wip

* map the ui files

* fix table without export buttons

* always focus on error field

* delete button redirect

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Fix padding in name

* Fix checkbox padding

* Background of select2

* multiple fixes

* fix form error highlight

* wip

* Add toggle to JSON

* allow user to choose locale and timezone

* fixes bulk actions

* fix the filter navbar

* fix line buttons dropdown

* wip

* wip

* wip

* wip

* wip

* DataFormModal component (#5863)

Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Cristian Tabacitu <cristian.tabacitu@digitallyhappy.com>
Co-authored-by: Cristian Tăbăcitu <cristitabacitu@gmail.com>

* wip

* wip

* wip

* Save action classes (#5878)

Enable the usage of classes to describe the save actions. This allow more flexibility and easy to extend and/or configure behaviour.

* add cancel button option to modal form (#5881)

* fix problem with checklist_dependency field in Update operation

* fix indentation

* Update src/app/Console/Commands/Install.php

* Update composer.json

---------

Co-authored-by: Pedro Martins <pxpm88@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: jcastroa87 <jcastroa87@gmail.com>
Co-authored-by: zachweix <zachweix@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants