joshmn / ahoy_captain

A full-featured, mountable analytics dashboard for your Rails app, powered by the Ahoy gem.
MIT License
356 stars 18 forks source link

config.disabled_widgets is not writable #32

Closed ILiuz closed 9 months ago

ILiuz commented 11 months ago

I wanted to use config.disabled_widgets in the provided initializer to remove some (to me) unnecessary widgets, but I get an error:

undefined method `disabled_widgets='

Looking at line 6 of configuration.rb it is apparent that :disabled_widgets is only readable, not writable. Changing it to be writable removes the error, but in the actual dashboard I then get a 'content missing' turbo frame error for each of the disabled widgets, instead of the widget being removed, as I would expect.

joshmn commented 11 months ago

Hi! Fixed this in latest :)

Were you expecting these widgets to not work? If no, what widgets, and what's your setup?

ILiuz commented 11 months ago

Hello again.

My understanding from ahoy_captain.rb was that I could uncomment line 54 and add one or more widgets to the array, e.g: config.disabled_widgets = ["top_pages"] Having added the top_pages widget to disabled_widgets, I would then expect it to not appear in the dashboard.

The error I am getting now with ahoy_captain 1.0.2 and Rails 7.1.1 is: Missing template ahoy_captain/shared/widget_disabled with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :vtt, :png, :jpeg, :gif, :bmp, :tiff, :svg, :webp, :mpeg, :mp3, :ogg, :m4a, :webm, :mp4, :otf, :ttf, :woff, :woff2, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip, :gzip, :turbo_stream], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}.

Is this not the intended use case of config.disabled_widgets?

joshmn commented 11 months ago

Ah no, you are absolutely correct. Try pulling down 1.1.0, just ripped it and tested it. :)

ILiuz commented 11 months ago

It works now! Thank you. :)