class Opsicle::Monitor::Panels::Deployments

Public Class Methods

new(height, width, top, left) click to toggle source
Calls superclass method Opsicle::Monitor::Panel::new
# 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

Public Instance Methods

structure(height) click to toggle source
# 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