app/helpers/application_helper/button/network_router_new.rb
class ApplicationHelper::Button::NetworkRouterNew < ApplicationHelper::Button::ButtonNewDiscover
def calculate_properties
super
if disabled?
self[:title] = _("No cloud providers support creating network routers.")
end
end
def role_allows_feature?
super && role_allows?(:feature => 'ems_network_show_list') && role_allows?(:feature => 'cloud_tenant_show_list')
end
# disable button if no active providers support create action
def disabled?
::EmsNetwork.all.none? { |ems| NetworkRouter.class_by_ems(ems)&.supports?(:create) }
end
end