Class: RailsServerMonitor::LeftbarComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/rails_server_monitor/leftbar_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ctx:) ⇒ LeftbarComponent

Returns a new instance of LeftbarComponent.



6
7
8
# File 'app/components/rails_server_monitor/leftbar_component.rb', line 6

def initialize(ctx:)
  @ctx = ctx
end

Instance Attribute Details

#ctxObject (readonly)

Returns the value of attribute ctx.



5
6
7
# File 'app/components/rails_server_monitor/leftbar_component.rb', line 5

def ctx
  @ctx
end

Instance Method Details

#groupsObject



10
11
12
# File 'app/components/rails_server_monitor/leftbar_component.rb', line 10

def groups
  @groups ||= RailsServerMonitor::ServerGroup.order(name: :asc).all
end

#serversObject



14
15
16
# File 'app/components/rails_server_monitor/leftbar_component.rb', line 14

def servers
  @servers ||= RailsServerMonitor::Server.all.sort_by(&:display_name)
end