Skip to content

Commit

Permalink
Merge pull request #581 from skateman/provider-region-options
Browse files Browse the repository at this point in the history
Include the regions if they're supported with OPTIONS /api/providers
  • Loading branch information
abellotti authored Apr 30, 2019
2 parents 4a63f71 + 01ca75e commit 1ce0850
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/controllers/api/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,16 @@ def options
end

supported_providers = ExtManagementSystem.supported_types_for_create.map do |klass|
if klass.supports_regions?
regions = klass.parent::Regions.all.sort_by { |r| r[:description] }.map { |r| r.slice(:name, :description) }
end

{
:title => klass.description,
:type => klass.to_s,
:kind => klass.to_s.demodulize.sub(/Manager$/, '').underscore
}
:title => klass.description,
:type => klass.to_s,
:kind => klass.to_s.demodulize.sub(/Manager$/, '').underscore,
:regions => regions
}.compact
end

render_options(:providers, "provider_settings" => providers_options, "supported_providers" => supported_providers)
Expand Down

0 comments on commit 1ce0850

Please sign in to comment.