ManageIQ/manageiq-ui-classic

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

Summary

Maintainability
A
45 mins
Test Coverage
A
100%
class ApplicationHelper::Button::ServerDemote < ApplicationHelper::Button::ServerLevelOptions
  needs :@record, :@sb

  def disabled?
    @error_message = if @record.master_supported?
                       if @record.priority == 1 || @record.priority == 2
                         if @view_context.x_node != "root" && @record.server_role.regional_role?
                           _("This role can only be managed at the Region level")
                         end
                       end
                     end
    @error_message.present?
  end
end