Class: Tnw::DashboardController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Tnw::DashboardController
- Defined in:
- app/controllers/tnw/dashboard_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/tnw/dashboard_controller.rb', line 3 def index servers = Tnw::Server.order(:name, :identifier) latest_samples = Tnw::MetricSample .where(id: Tnw::MetricSample.select("MAX(id)").group(:server_id)) .index_by(&:server_id) @server_metrics = servers.map do |server| Tnw::ServerMetricStatus.new(server: server, sample: latest_samples[server.id]) end end |