ManageIQ/manageiq-ui-classic

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

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class ApplicationHelper::Button::ReportOnly < ApplicationHelper::Button::RenderReport
  def disabled?
    return super if @record.nil?
    if @record.class == MiqReportResult
      @error_message = _('No records found for this report') unless report_records?
    end
    @error_message.present?
  end

  private

  def report_records?
    @report.present? && @report_result_id.present? &&
      MiqReportResult.find(@report_result_id).try(:miq_report_result_details).try(:exists?)
  end
end