Class: QaServer::MonitorStatus::HistoryUpDownPresenter
- Inherits:
-
Object
- Object
- QaServer::MonitorStatus::HistoryUpDownPresenter
- Defined in:
- app/presenters/qa_server/monitor_status/history_up_down_presenter.rb
Instance Attribute Summary collapse
-
#historical_up_down_data ⇒ Object
readonly
Returns the value of attribute historical_up_down_data.
Instance Method Summary collapse
-
#display_historical_up_down? ⇒ Boolean
True if historical datatable should be visible; otherwise false.
-
#historical_up_down_status_class(status, day) ⇒ String
Name of the css class for the status.
-
#initialize(parent:, historical_up_down_data:) ⇒ HistoryUpDownPresenter
constructor
A new instance of HistoryUpDownPresenter.
- #up_down_end ⇒ Object
- #up_down_end_dt ⇒ Object
-
#up_down_start ⇒ ActiveSupport::TimeWithZone
Return the last date of data represented in the history graph and data table.
Constructor Details
#initialize(parent:, historical_up_down_data:) ⇒ HistoryUpDownPresenter
Returns a new instance of HistoryUpDownPresenter.
20 21 22 23 |
# File 'app/presenters/qa_server/monitor_status/history_up_down_presenter.rb', line 20 def initialize(parent:, historical_up_down_data:) @parent = parent @historical_up_down_data = historical_up_down_data end |
Instance Attribute Details
#historical_up_down_data ⇒ Object (readonly)
Returns the value of attribute historical_up_down_data.
5 6 7 |
# File 'app/presenters/qa_server/monitor_status/history_up_down_presenter.rb', line 5 def historical_up_down_data @historical_up_down_data end |
Instance Method Details
#display_historical_up_down? ⇒ Boolean
Returns true if historical datatable should be visible; otherwise false.
54 55 56 |
# File 'app/presenters/qa_server/monitor_status/history_up_down_presenter.rb', line 54 def display_historical_up_down? QaServer.config.display_historical_datatable? && @historical_up_down_data.present? end |
#historical_up_down_status_class(status, day) ⇒ String
Returns name of the css class for the status.
42 43 44 45 46 47 48 49 50 51 |
# File 'app/presenters/qa_server/monitor_status/history_up_down_presenter.rb', line 42 def historical_up_down_status_class(status, day) # rubocop:disable Metrics/CyclomaticComplexity case status[day] when :no_date then 'connection-no-date' when :fully_up then 'connection-fully-up' when :mostly_up then 'connection-mostly-up' when :timeouts then 'connection-timeouts' when :barely_up then 'connection-barely-up' when :down then 'connection-down' end end |
#up_down_end ⇒ Object
31 32 33 |
# File 'app/presenters/qa_server/monitor_status/history_up_down_presenter.rb', line 31 def up_down_end QaServer::TimeService.pretty_date(up_down_end_dt) end |
#up_down_end_dt ⇒ Object
35 36 37 |
# File 'app/presenters/qa_server/monitor_status/history_up_down_presenter.rb', line 35 def up_down_end_dt @parent.last_updated_dt end |
#up_down_start ⇒ ActiveSupport::TimeWithZone
Return the last date of data represented in the history graph and data table
27 28 29 |
# File 'app/presenters/qa_server/monitor_status/history_up_down_presenter.rb', line 27 def up_down_start QaServer::TimeService.pretty_date(up_down_end_dt - 29.days) end |