tfwright / live_admin

Low-config admin UI for Phoenix apps, built on LiveView
MIT License
251 stars 22 forks source link

support configuring via the router rather than app config #33

Closed mayel closed 1 year ago

mayel commented 1 year ago

This avoids having to put something in app config, bringing it more in line with how other libraries are configured.

tfwright commented 1 year ago

Hi Mayel, I'm wondering if there's a particular use case that LiveAdmin config isn't solving for you currently, or if this is just a matter of preference? My impression is that for the most part LiveAdmin is following the guidelines since most of the app config is "truly global" since it can always be overwritten in the individual resource configs, or by introspecting on the session. Even the repo can be overridden, by overriding the functions that handle querying (:create_with, :update_with), so I think it should be possible at least to support multiple instances of LiveAdmin, although I haven't tried it myself. Regardless, I do think the approach to configuration could certainly use a revamp, I know at least some users do not like to include a lot of config right in the router, but that particular issue isn't addressed by these changes.

tfwright commented 1 year ago

I created an issue for further discussion, feel free to comment there with your thoughts: https://github.com/tfwright/live_admin/issues/34

I think what you've started here might be compatible with some combination of those solutions

tfwright commented 1 year ago

Closing in favor of https://github.com/tfwright/live_admin/pull/38

Let me know if that change does not fully meet your needs

mayel commented 1 year ago

@tfwright thanks for that refactor, but the new requirement to use LiveAdmin.Resource in every schema makes it difficult to use in cases where you have schemas coming from libraries.

tfwright commented 1 year ago

@mayel difficult because you need to define a new schema to handle the config?