ManageIQ/manageiq-ui-classic

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

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class ApplicationHelper::Button::InstanceAssociateFloatingIp < ApplicationHelper::Button::Basic
  def visible?
    @record.class.supports?(:associate_floating_ip)
  end

  def disabled?
    if !@record.supports?(:associate_floating_ip)
      @error_message = @record.unsupported_reason(:associate_floating_ip)
    elsif @record.cloud_tenant.nil? || @record.cloud_tenant.floating_ips.empty?
      @error_message = _('There are no Floating IPs available to this Instance.')
    end
    @error_message.present?
  end
end