ManageIQ/manageiq-ui-classic

View on GitHub
app/helpers/application_helper/button/security_group_new.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class ApplicationHelper::Button::SecurityGroupNew < ApplicationHelper::Button::ButtonNewDiscover
  def calculate_properties
    super
    if disabled?
      self[:title] = _("No cloud providers support creating security groups.")
    end
  end

  # disable button if no active providers support create action
  def disabled?
    ::EmsNetwork.all.none? { |ems| SecurityGroup.class_by_ems(ems)&.supports?(:create) }
  end
end