Class: Opsicle::Monitor::Panels::Deployments

Inherits:
Opsicle::Monitor::Panel show all
Defined in:
lib/opsicle/monitor/panels/deployments.rb

Instance Attribute Summary

Attributes inherited from Opsicle::Monitor::Panel

#divider_length, #dividers, #height, #left, #top, #width

Instance Method Summary collapse

Methods inherited from Opsicle::Monitor::Panel

#close, #refresh, #refresh_spies

Methods included from Translatable

#translate

Constructor Details

#initialize(height, width, top, left) ⇒ Deployments

Returns a new instance of Deployments.



6
7
8
9
10
# File 'lib/opsicle/monitor/panels/deployments.rb', line 6

def initialize(height, width, top, left)
  super(height, width, top, left, structure(height), :divider_r => " ")

  @spies[:deployments] = Monitor::Spy::Deployments.new
end

Instance Method Details

#structure(height) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/opsicle/monitor/panels/deployments.rb', line 12

def structure(height)
  # [
  #   [relative_column_width, data_left, data_right]
  # ]
  s = [
    [ # table header slots
      [1, translate[:heading][:status], nil],
      [1, translate[:heading][:created_at], nil],
      [1, translate[:heading][:completed_at], nil],
      [1, translate[:heading][:user], nil],
      [1, translate[:heading][:command], nil],
      [3, translate[:heading][:command_args], nil]
    ],
  ]

  (0...(height - 1)).each do |i|
    s << [ # table row slots
      [1, -> { @spies[:deployments][i][:status] },  nil],
      [1, -> { @spies[:deployments][i][:created_at] },  nil],
      [1, -> { @spies[:deployments][i][:completed_at] },  nil],
      [1, -> { @spies[:deployments][i][:user] }, nil],
      [1, -> { @spies[:deployments][i][:command] }, nil],
      [3, -> { @spies[:deployments][i][:command_args] }, nil]
    ]
  end

  s
end