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

Make MIQ widgets pluggable #22087

Merged
merged 1 commit into from
Aug 31, 2022
Merged

Conversation

nasark
Copy link
Member

@nasark nasark commented Aug 31, 2022

  • allows widgets to be seeded from providers in addition to core
  • widgets in provider are seeded from i.e. <manageiq-provider>/content/dashboard/widgets

@miq-bot assign @agrare
@miq-bot add_label enhancement

Comment on lines 84 to 86
@miq_widgets_content ||= begin
Dir.glob(Rails.root.join("product/dashboard/widgets", "*")) + flat_map { |engine| content_directories(engine, "dashboard/widgets") }
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

begin/end isn't needed here since the contents are a single line.

@Fryguy
Copy link
Member

Fryguy commented Aug 31, 2022

Technically, after this PR, we can now probably move all of the dashboard widgets out of core and into either manageiq-ui-classic or manageiq-content. Then we don't need to have the Dir.glob(Rails.root... anymore.

@Fryguy
Copy link
Member

Fryguy commented Aug 31, 2022

❤️ Love this change!

We probably should add this to the checklist in #19440 also

@nasark nasark force-pushed the miq_widgets_pluggability branch 2 times, most recently from 9be5b46 to 069121d Compare August 31, 2022 19:52
Comment on lines 6 to 12
let(:core_widget_dir) { File.expand_path(File.join(Rails.root, "product/dashboard/widgets")) }

before do
EvmSpecHelper.local_miq_server

MiqReport.seed_report("Vendor and Guest OS")
MiqWidget.seed_widget("chart_vendor_and_guest_os")
MiqWidget.sync_from_file(Dir.glob(File.join(core_widget_dir, "*chart_vendor_and_guest_os*")).first)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a single widget and we know the name I think you can just use the full path and drop the glob

let(:widget_path) { Rails.root.join("product/dashboard/widgets/chart_vendor_and_guest_os.yaml") }

MiqWidget.sync_from_file(widget_path)

@nasark nasark force-pushed the miq_widgets_pluggability branch from 069121d to 2c8a973 Compare August 31, 2022 20:26
@agrare agrare merged commit e0864db into ManageIQ:master Aug 31, 2022
@agrare agrare mentioned this pull request Aug 31, 2022
48 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants