ManageIQ/manageiq-ui-classic

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

Summary

Maintainability
A
0 mins
Test Coverage
class ApplicationHelper::Button::NetworkServiceNew < ApplicationHelper::Button::ButtonNewDiscover
  def supports_button_action?
    ::EmsNetwork.all.any? { |ems| NetworkService.class_by_ems(ems)&.supports?(:create) }
  end

  def role_allows_feature?
    super && role_allows?(:feature => 'ems_network_show_list') && role_allows?(:feature => 'network_service_show_list')
  end

  def disabled?
    @error_message = _("No cloud providers support creating network services.") unless supports_button_action?
    super || @error_message.present?
  end
end