Class: InsightsClientReportStatus

Inherits:
HostStatus::Status
  • Object
show all
Defined in:
app/models/insights_client_report_status.rb

Constant Summary collapse

REPORT_INTERVAL =
48.hours
REPORTING =
0
NO_REPORT =
1

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.status_nameObject



10
11
12
# File 'app/models/insights_client_report_status.rb', line 10

def self.status_name
  N_('Insights')
end

Instance Method Details

#relevant?(_options = {}) ⇒ Boolean

prevent creation of the status on global refresh, but show it if the record already exists

Returns:

  • (Boolean)


37
38
39
# File 'app/models/insights_client_report_status.rb', line 37

def relevant?(_options = {})
  persisted?
end

#to_global(_options = {}) ⇒ Object



23
24
25
26
27
28
29
30
# File 'app/models/insights_client_report_status.rb', line 23

def to_global(_options = {})
  case status
    when REPORTING
      ::HostStatus::Global::OK
    when NO_REPORT
      ::HostStatus::Global::ERROR
  end
end

#to_label(_options = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'app/models/insights_client_report_status.rb', line 14

def to_label(_options = {})
  case status
    when REPORTING
      N_('Reporting')
    when NO_REPORT
      N_('Not reporting')
  end
end

#to_statusObject



32
33
34
# File 'app/models/insights_client_report_status.rb', line 32

def to_status
  in_interval? ? REPORTING : NO_REPORT
end