diff --git a/app/models/miq_widget.rb b/app/models/miq_widget.rb index 3a0cb045058d..cadc7780462f 100644 --- a/app/models/miq_widget.rb +++ b/app/models/miq_widget.rb @@ -458,7 +458,7 @@ def self.get_group(group) end def self.sync_from_dir - Dir.glob(File.join(WIDGET_DIR, "*.yaml")).sort.each { |f| sync_from_file(f) } + Vmdb::Plugins.miq_widgets_content.sort.each { |f| sync_from_file(f) } end def self.sync_from_file(filename) diff --git a/lib/vmdb/plugins.rb b/lib/vmdb/plugins.rb index f5d4e40229b1..f279bd71eec5 100644 --- a/lib/vmdb/plugins.rb +++ b/lib/vmdb/plugins.rb @@ -30,8 +30,8 @@ def init end def details - each_with_object({}) do |engine, hash| - hash[engine] = { + index_with do |engine| + { :name => engine.name, :version => version(engine), :path => engine.root.to_s @@ -80,6 +80,10 @@ def automate_domains end end + def miq_widgets_content + @miq_widgets_content ||= Dir.glob(Rails.root.join("product/dashboard/widgets", "*")) + flat_map { |engine| content_directories(engine, "dashboard/widgets") } + end + def provider_plugins @provider_plugins ||= select { |engine| engine.name.start_with?("ManageIQ::Providers::") } end