aesmail / kaffy

Powerfully simple admin package for phoenix applications
https://kaffy.fly.dev/admin/
MIT License
1.3k stars 153 forks source link

[FEATURE-REQUEST] allow to modify auto-detected resources #281

Closed KristerV closed 10 months ago

KristerV commented 11 months ago

Describe the problem you're proposing to solve

The auto-detected resources get me 99% there, but I really need to change two things about it (and auto-update new resources added in the future). There is no obvious way to get the resources automatically and modify them.

Describe the solution you'd like

I want to fetch the auto-detected resources and modify it in MyApp.KaffyConf.create_resources.

Describe alternatives you've considered

I read the code and it seems def full_resources(conn) is what i need, but it goes into an infinite loop, because it ends up calling create_resources() again. So really it seems that defp setup_resources does what i need without the infinite loop, but that's private.

Additional context

I've already created a fork and made the function public to test it out and it works great. Diff here.

My question is should I open the PR or is there something I'm missing? If I do open a PR then I think the name setup_resources should probably be changed to auto_detect_resources or something.

aesmail commented 10 months ago

Thank you @KristerV for the suggestion. A new function auto_detect_resources/0 has been added to Utils which currently only calls setup_resources().

def auto_detect_resources(), do: setup_resources()

This will be available in the next release 👍🏻