ManageIQ/manageiq-ui-classic

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

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class ApplicationHelper::Button::InstanceDetach < ApplicationHelper::Button::Basic
  def visible?
    # FIXME: feature for attach/detach is missing, testing class for now
    @record.kind_of?(ManageIQ::Providers::Openstack::CloudManager::Vm)
  end

  def disabled?
    if @record.number_of(:cloud_volumes).zero?
      @error_message = _("This Instance has no attached Cloud Volumes.")
    end
    @error_message.present?
  end
end