Skip to content

Commit

Permalink
add pluggability for miq widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
nasark committed Aug 31, 2022
1 parent 0a7431d commit 9be5b46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/miq_widget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions lib/vmdb/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9be5b46

Please sign in to comment.