You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
This might be a niche problem, but I have a use case where I want to have separate admin panels handling different domains in a Phoenix app. Currently, the ash_admin dashboard displays all domains, which can become problematic when domains have overlapping names or when segregation of domain management is required.
The reason for multiple admin panels is that I want to build 2+ websites/products, but to reuse functionality and have less hosting costs I want to share the same Phoenix app.
Describe the solution you'd like
I propose extending the current implementation to support multiple ash_admin dashboards by introducing group-based filtering. The changes would include:
Extending the AshAdmin.Domain DSL with a field called group, which is an optional atom that defaults to nil.
Updating the ash_admin router macro to accept a new option, for example:
ash_admin("/admin",group: :a_group_name)
Adjusting the LiveView mount function in AshAdmin.PageLive to:
Retrieve the group value from the session.
In domains/1 If a group is provided, filter the list of domains to include only those with a matching group.
Describe alternatives you've considered
An alternative approach might involve using a separate configuration (e.g., an :ash_admin_groups setting) to manage domain grouping. However, leveraging the existing DSL by adding a group attribute seems to be a cleaner and more integrated solution.
Express the feature either with a change to resource syntax, or with a change to the resource interface
For example:
# In the domainadmindoname("MyDomain")show?(true)group(:a_group_name)end# In the router:ash_admin("/admin",group: :a_group_name)# Dashboard filters to display only domains for group :a_group_name
Additional context
I'm considering putting together a PR for this feature. Based on my understanding of the codebase, the required changes include extending the DSL in AshAdmin.Domain, updating the router macro to pass the group option, and filtering domains in the LiveView mount function based on the provided group.
Not sure if there are other issues that can arrise when having mutiple dashboards. Currently I want to have them both in /admin, but separated by host used. E.g. myapp.com/admin and myotherapp.com/admin.
Would you be open to a PR for this setup? And do you see any potential pitfalls or have suggestions on this approach?
The text was updated successfully, but these errors were encountered:
Hey there! I'd accept a PR for adding a group to domains, yes 😄. Ultimately AshAdmin will be rewritten (like not in the next few weeks/months or anything), and part of that will include the ability to easily define multiple admin UIs. But your solution is a good solution for the short term 👍
Thanks for quick reply! I have pushed a pull-request now with the feature :D
Improving on AshAdmin sounds like a fun project. Is there somewhere where I can read up on the roadmap and what features are missing/needs improving? :)
I'm new to open source contributing, and seeing that ash_admin is only around 8000 lines of elixir code makes it feel quite approachable. So I'd be happy to be on the loop on future work!
Is your feature request related to a problem? Please describe.
This might be a niche problem, but I have a use case where I want to have separate admin panels handling different domains in a Phoenix app. Currently, the ash_admin dashboard displays all domains, which can become problematic when domains have overlapping names or when segregation of domain management is required.
The reason for multiple admin panels is that I want to build 2+ websites/products, but to reuse functionality and have less hosting costs I want to share the same Phoenix app.
Describe the solution you'd like
I propose extending the current implementation to support multiple ash_admin dashboards by introducing group-based filtering. The changes would include:
AshAdmin.Domain
DSL with a field calledgroup
, which is an optional atom that defaults tonil
.ash_admin
router macro to accept a new option, for example:domains/1
If a group is provided, filter the list of domains to include only those with a matching group.Describe alternatives you've considered
An alternative approach might involve using a separate configuration (e.g., an
:ash_admin_groups
setting) to manage domain grouping. However, leveraging the existing DSL by adding a group attribute seems to be a cleaner and more integrated solution.Express the feature either with a change to resource syntax, or with a change to the resource interface
For example:
Additional context
I'm considering putting together a PR for this feature. Based on my understanding of the codebase, the required changes include extending the DSL in
AshAdmin.Domain
, updating the router macro to pass the group option, and filtering domains in the LiveView mount function based on the provided group.Not sure if there are other issues that can arrise when having mutiple dashboards. Currently I want to have them both in
/admin
, but separated by host used. E.g.myapp.com/admin
andmyotherapp.com/admin
.Would you be open to a PR for this setup? And do you see any potential pitfalls or have suggestions on this approach?
The text was updated successfully, but these errors were encountered: