Module: Morpheus::Cli::OperationsHelper

Included in:
ActivityCommand
Defined in:
lib/morpheus/cli/mixins/operations_helper.rb

Overview

Mixin for Morpheus::Cli command classes Provides common methods for working with Operations. This includes the Dashboard, Activity, and moreā€¦ (coming soon)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



8
9
10
# File 'lib/morpheus/cli/mixins/operations_helper.rb', line 8

def self.included(klass)
  klass.send :include, Morpheus::Cli::PrintHelper
end

Instance Method Details

#format_activity_display_object(item) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/morpheus/cli/mixins/operations_helper.rb', line 27

def format_activity_display_object(item)
  out = ""
  if item['name']
    out << item['name']
  end
  if item['objectType']
    out << " (#{item['objectType']} #{item['objectId']})"
  end
  if item['deleted']
    out << " [deleted]"
  end
  out
end

#format_activity_severity(severity, return_color = cyan) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/morpheus/cli/mixins/operations_helper.rb', line 12

def format_activity_severity(severity, return_color=cyan)
  out = ""
  status_string = severity
  if status_string == 'critical'
    out << "#{red}#{status_string.capitalize}#{return_color}"
  elsif status_string == 'warning'
    out << "#{yellow}#{status_string.capitalize}#{return_color}"
  elsif status_string == 'info'
    out << "#{cyan}#{status_string.capitalize}#{return_color}"
  else
    out << "#{cyan}#{status_string}#{return_color}"
  end
  out
end