Laravel-Backpack / activity-log

MIT License
28 stars 7 forks source link

[Feature Request] And/Or filters over the Causer Model and Subject Model #19

Open promatik opened 1 year ago

promatik commented 1 year ago

Feature Request

When coming for a Model that is both Subject and Causer, should the selected filters be with AND (default) or should it be OR?

image

Should we create that exception?


What if I come from the entry button?

image

Both the causer model and subject model are selected with User::class, and model and subject with Demo User entry. How should the filters behave?

tabacitu commented 1 year ago

We solve this tomorrow, if we have the time. This one, we can push as a non-breaking change.

When coming for a Model that is both Subject and Causer, should the selected filters be with AND (default) or should it be OR?

OR 💯

What if I come from the entry button? Both the causer model and subject model are selected with User::class, and model and subject with Demo User entry. How should the filters behave?

I... don't understand the question/dilemma... could you please rephrase?

promatik commented 1 year ago

Basically, when coming from this button; image

Entry Activity Log It will default to have everything selected; image

Causer Model and Subject Model + Causer and Subject What should be the query?

where (causer_model = X or subject_model = X) AND (causer = Y or subject = Y) or where (causer_model = X or subject_model = X) AND causer = Y AND subject = Y or where (causer_model = X or subject_model = X or causer = Y or subject = Y) ?

My brain is melting now 😂 I'll come back to this in an hour ahaha

promatik commented 1 year ago

Long story short, after asking @pxpm his opinion, in order to do this, we need to do some nasty stuff 😅

If we have the key to combine the results, in order to have it combined, we need to disable the filters and add the queries manually.

Something like this; image

Should we proceed? 😬

tabacitu commented 1 year ago

Ouch! So let me understand...

Is that correct? If so... I'm ok with it. I like it.

If we could also change the title / heading for this filtered view, so that it makes it clear it's a sub-filtration... that would be great.

promatik commented 1 year ago

Most of the work is done at https://github.com/Laravel-Backpack/activity-log/tree/combined-filter. Me and @tabacitu, we decided not to merge/work on it now because we don't have a proper UI/UX to display this filter.