avo-hq / avo

Build Ruby on Rails apps 10x faster
https://avohq.io
Other
1.47k stars 229 forks source link

Implement dynamic filters group management (and, or) #2981

Open Paul-Bob opened 1 month ago

Paul-Bob commented 1 month ago

This feature will let users create groups of filters and choose between "AND" or "OR" operators to refine their search criteria.

### Tasks
- [ ] https://github.com/avo-hq/avo/issues/2987
- [ ] search through dynamic filters (can become a big list)
- [ ] https://github.com/avo-hq/avo/issues/2988

One API could be this one:

# this reads like so:
# first_name or last name or group_1 (age and sex and group 2 (hair or height))
{
  "filters" => {
    "first_name" => {"is" => ["11", "22"], "is_not" => ["22"]},
    "last_name" => {
      "operator" => "or",
      "is_not" => ["22"]
    },
    "group_1" => {
      "operator" => "or"
      "filters" => {
        "age" => {"is_not" => ["22"]},
        "sex" => {"is_not" => ["22"]},
        "group_2" => {
          "filters" => {
            "hair" => {"is_not" => ["22"]}
            "height" => {"operator" => "or", "is_not" => ["22"]}
          }
        }
      }
    }
  }
  ,"controller" => "avo/projects", "action" => "index"
}

https://avodemo.com/avo/resources/projects?filters[stage][is][]=discovery&filters[country][is][]=AF&filters[country][_operator][]=and|or

TobiasKampAdmin commented 1 month ago

This would be a GREAT addition to the dynamic filtering!

Maybe the filtering in Directus can be an inspiration? It is one of the best designed and thought through filtering systems we saw in CRMs: https://docs.directus.io/user-guide/content-module/filters.html

When thinking about UX, I suggest to also provide a search on the fields because it can become a long list.

pjmuller commented 1 week ago

@Paul-Bob , why is this closed? because #3013 is closed as well, and https://github.com/avo-hq/avo/issues/3114 (mentioned in the last comment of #3013) doesn't contain anything about AND/OR groups...

Paul-Bob commented 1 week ago

@Paul-Bob , why is this closed?

Hey @pjmuller this one is not closed and it's tracking the dynamic filters grouping management, which will allow to change the AND , OR conditions between filter groups

#

because #3013 is closed as well

3013 is closed because is_within for number filters was already released, check it on our demo app and docs

(By mistake it was not included on the release notes and on the release video)

Is there anything that isn't addressed from #3013? Feel free to comment or reopen it if you feel that the original request was not implemented. #

and https://github.com/avo-hq/avo/issues/3114 (mentioned in the last comment of #3013) doesn't contain anything about AND/OR groups...

https://github.com/avo-hq/avo/issues/3114 is tracking conditions improvements that Adrian suggested here, is unrelated to is_within and grouping.