rails / mission_control-jobs

Dashboard and Active Job extensions to operate and troubleshoot background jobs
MIT License
611 stars 71 forks source link

Separate importmap from the application #163

Closed henrikbjorn closed 3 weeks ago

henrikbjorn commented 2 months ago

This is based upon the importmap usage seen in ActiveAdmin.

This gem essentially provides a complete Application and as such it makes sense to have the importmap separate from the application it is embedded into.

There is a 0% chance of the javascript included here to be used outside of the gem itself.

It is still possible to extend the importmap if that is needed.

MissionControl::Jobs.importmap.draw do
  pin "something"
end
henrikbjorn commented 2 months ago

Fixes #132

Possibly fixes #140

henrikbjorn commented 1 month ago

@rosa What do you think about this?

manuelmeurer commented 1 month ago

I think this might be fixed by #175.

henrikbjorn commented 1 month ago

I think this might be fixed by #175.

It is not. The assets will still be part of you normal application included in the importmap.

There is no reason that they should be, since MissionControl::Jobs are an "embedded application" into your main one.

manuelmeurer commented 1 month ago

Ah ok, got it. How/where would you store the assets then?

With #175, the assets are still included in the importmap, but only loaded (and preloaded) in the Mission Control views.

henrikbjorn commented 1 month ago

Ah ok, got it. How/where would you store the assets then?

With #175, the assets are still included in the importmap, but only loaded (and preloaded) in the Mission Control views.

The same way, they are just part of a separate importmap which is configured like shown in the PR description.

Same way as ActiveAdmin.

Then it wont show up in your applications own importmap and maybe break things.

manuelmeurer commented 1 month ago

Oh ok, I finally understood what this PR does. 😆 It's a better solution than what I did in #175, so let's go with this (if @rosa agrees).

rosa commented 3 weeks ago

Sorry for the delay here! I've been busy with other stuff and neglecting this gem, but I'm back now and in full focus, so I'll be catching up with all PRs and issues. This looks great to me, going to do a couple of tests to be completely sure, but it makes perfect sense. Thank you so much, @henrikbjorn 🙏