Class: Opsicle::Monitor::Panels::Header

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

Instance Attribute Summary collapse

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) ⇒ Header

Returns a new instance of Header.



12
13
14
15
16
# File 'lib/opsicle/monitor/panels/header.rb', line 12

def initialize(height, width, top, left)
  @stack = Opsicle::Stack.new(App.client)

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

Instance Attribute Details

#panel_mainObject

Returns the value of attribute panel_main.



10
11
12
# File 'lib/opsicle/monitor/panels/header.rb', line 10

def panel_main
  @panel_main
end

Instance Method Details

#structureObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/opsicle/monitor/panels/header.rb', line 18

def structure
  @panel_main = nil # set by Display::Screen#main_panel=

  # [
  #   [relative_column_width, data_left, data_right]
  # ]
  [
    [
      [2, translate[:program], nil],
      [2, -> {
        [:deployments, :instances, :help].map do |e|
          translate[:menu][(e == @panel_main ? :active : :inactive)][e]
        end.join("  ")
      }, nil],
      [1, nil, -> { Time.now.strftime("%T %z") }],
    ],
    [
      [1, nil, nil],
    ],
    [
      [1, "Stack name:", @stack.name],
      [1, nil, nil],
      [1, nil, nil]
    ]
  ]
end