ExAdmin in umbrella apps

Anyone know the configuration for using ExAdmin when your Repo is in a separate application?

I’ve traced my issue to the register_resource macro in ExAdmin.Register. The struct in this macro is never updated when I add my model with mix admin.gen.resource and therefore the match in ExAdmin.get_all_registered/0 fails when it tries to match on %{resource_model: _rm}. I’ve been scratching my head for hours on this, any ideas?

Example of ExAdmin working in an umbrella config (albiet with an issue):

Thanks for the update, I was curious what was going on. :slight_smile:

1 Like

Ya my cryptic post in an 8 month old thread didn’t cut it :joy:

1 Like

I figured it out. You can easily set up ExAdmin in a separate application from your Repo.

In your app where ExAdmin is a dependency, you register each resource you intend to use either by using mix admin.gen.resource [YourModel] or adding a file manually to apps/[YourExAdminApp]/web/admin/. You then must add the name of that module to the config.exs file of [YourExAdminApp].

Correct way :grinning:

config :ex_admin,
  repo: Storage.Repo,
  module: Admin,
  modules: [
    Admin.ExAdmin.Dashboard,
    Admin.ExAdmin.Institution <-
  ]

Incorrect way :confounded:

config :ex_admin,
  repo: Storage.Repo,
  module: Admin,
  modules: [
    Admin.ExAdmin.Dashboard,
    Storage.Schema.Institution <-
  ]

You specify the model you wish to use in the register_resource/2 function of the apps/[YourExAdminApp]/web/admin/[YourModel].ex file.

I was doing things the incorrect way, and thus getting bizarre errors.

2 Likes