Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for cssbundling-rails? #164

Closed
olinelson opened this issue Sep 23, 2024 · 9 comments
Closed

Support for cssbundling-rails? #164

olinelson opened this issue Sep 23, 2024 · 9 comments

Comments

@olinelson
Copy link

olinelson commented Sep 23, 2024

I'm currently trying to use mission_control-jobs with a setup utilising cssbundling-rails.

Whilst Sprockets seems to compile Mission Control's assets perfectly fine they aren't provided as stylesheet links to the application layout by default. I've tried adding stylesheet links to my layout manually but that seems to only partially fix the problem.

application.html.erb

      <%= stylesheet_link_tag "mission_control/jobs/application", "data-turbo-track": "reload" %>
      <%= stylesheet_link_tag "mission_control/jobs/forms", "data-turbo-track": "reload" %>
      <%= stylesheet_link_tag "mission_control/jobs/jobs", "data-turbo-track": "reload" %>

Somewhat adding to my confusion is the fact that the view renders only the queues table not the tabs or navbar:

Screenshot 2024-09-23 at 7 14 25 PM

Is there an existing way for things to play nicely with cssbundling-rails?

@HamptonMakes
Copy link

Hmm, I have to ask what your goal is? Why are you including anything Mission Control related in your main application layout?

Mission Control is a Rails Engine that is supposed to have full control and management of it's own assets and layout.

Generally, you install the Gem, and then when you mount it into your Routes, you use that path and everything is taken care of for you! No need to modify anything in your application.

@olinelson
Copy link
Author

Hi @HamptonMakes, thanks for your response.
My goal is to simply display Mission Control at my application's /jobs path.
I started going down the path of experimenting with assets as the default behaviour of Mission Control (with my css-bundling-rails setup) seems to not work...

I assume it's something to do with css-bundling-rails as Mission Control works fine on another project of mine with a no-build css setup.

Any pointers or theories greatly appreciated.

Cheers!

@rosa
Copy link
Member

rosa commented Nov 8, 2024

Hey @olinelson, sorry for the delay! I also don't quite understand very well what's happening here 😕 What happens if you simply mount Mission Control on /jobs in your routes? What kind of error do you get?

@kivanio
Copy link

kivanio commented Nov 15, 2024

If you have content_security_policy enabled in your app.

You will need to add the css 'bulma', used by mission_control to the style_src ,
otherwise it will not work.

Rails.application.configure do
  config.content_security_policy do |policy|
      policy.style_src       :self, 'https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css'
 end
end

It should be documented.
Or added by default when loading mission_control.

@rosa
Copy link
Member

rosa commented Nov 15, 2024

@kivanio good point. I'm going to vendor https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css instead, so that you don't need to set your CSP to allow it.

@rosa
Copy link
Member

rosa commented Nov 15, 2024

#206

@rosa
Copy link
Member

rosa commented Nov 15, 2024

I released 0.6.0 with that change and other changes I had pending. @olinelson do you think the CSP was your problem?

@kivanio
Copy link

kivanio commented Nov 15, 2024

ohh that was fast 🚀
good work @rosa 👍🏻

I confirm it working now

@olinelson
Copy link
Author

Hi all, after lots of digging I've found the issue and indeed it has NOTHING to do with mission_control-jobs.

I was extending the render method in ApplicationController and this was essentially causing mission control jobs to render but without it's required layout.

Sorry for the faff!

Onwards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants