-
Notifications
You must be signed in to change notification settings - Fork 356
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
move AvailabilityMixin over to SupportsFeatureMixin #8266
Conversation
kbrock
commented
May 19, 2022
- convert is_available? to supports?
- convert supports_#{feature} to supports?(:feature)
- convert is_available? to supports? - convert supports_#{feature} to supports?(:feature)
Array.wrap(records).all? do |record| | ||
if record.respond_to?("supports_#{feature}?") | ||
record.supports?(feature) | ||
else # TODO: remove with deleting AvailabilityMixin module | ||
record.is_available?(feature) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
unless @feature.nil? || @record.nil? | ||
if @record.kind_of?(ManageIQ::Providers::Openstack::InfraManager) | ||
return true if %w[start stop].include?(@feature.to_s) | ||
return false | ||
end | ||
|
||
return @record.is_available?(@feature) if @record.kind_of?(ManageIQ::Providers::Openstack::InfraManager::Host) | ||
return @record.supports?(@feature) if @record.kind_of?(ManageIQ::Providers::Openstack::InfraManager::Host) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this change, but really want to get rid of this I'm very confused why this is in a seemingly generic "host_feature_button"
Some comments on commit kbrock@5c7d144 spec/controllers/storage_controller_spec.rb
|
Checked commit kbrock@5c7d144 with ruby 2.6.9, rubocop 1.19.1, haml-lint 0.35.0, and yamllint app/helpers/application_helper/button/generic_feature_button_with_disable.rb
app/helpers/application_helper/button/host_feature_button.rb
app/helpers/application_helper/button/host_feature_button_with_disable.rb
|