avo icon indicating copy to clipboard operation
avo copied to clipboard

Is it possible to send parameters to filters and actions?

Open alansikora opened this issue 3 years ago • 5 comments
trafficstars

Context

I'd like to have a way to send parameters to filters and actions, so I can work on generic actions and filters. Sometimes, when dealing with a lot of tables, building a filter/action for every table becomes way too time consuming and hurts DRY.

For example, something like this:

action ExportToCsv, fields: [:name, :id]
filter LikeFilter, fields: [:name, :description]

System configuration

Avo version: 2.15.3

Rails version: 7.0.3.1

Ruby version: 3.1.2

License type:

  • [ ] Community
  • [x] Pro

alansikora avatar Sep 20 '22 14:09 alansikora

No, it's not currently possible, but that's a great feature to have. Similar to what you can do with cards right now. I'll add it to the roadmap.

Thanks for the recommendation.

adrianthedev avatar Sep 21 '22 05:09 adrianthedev

Is it possible to have a rough estimate on when we going to have this?

alansikora avatar Sep 27 '22 20:09 alansikora

Probably in a few weeks (6-8 weeks). We're trying to finish some work we already started working on.

adrianthedev avatar Sep 27 '22 20:09 adrianthedev

We are open to receiving PRs with this feature if you want to take a shot. I'm happy to help you navigate the codebase.

adrianthedev avatar Sep 27 '22 21:09 adrianthedev

Nice! I'd be very happy to help, but I've been quite busy lately. I will definitely try.

alansikora avatar Sep 27 '22 21:09 alansikora

This issue has been marked as stale because there was no activity for the past 15 days.

github-actions[bot] avatar Oct 13 '22 04:10 github-actions[bot]

sonuds good to me, in my case, I would like to tell a model class to filter, with that, I can populate options with some constant, eg:

class Model
  STATUSES = {pending: "pending", done: "done"}
end

class StatusFilter < Avo::Filters::SelectFilter
  def apply
     ....
  end
  
  def options
    # get options
  end
end

filter StatusFilter, options: Model::STATUSES

it's good because each resource can modify the list of options when add a filter

thiagovsk avatar Oct 18 '22 13:10 thiagovsk