Class: WavefrontDisplay::Dashboard

Inherits:
Base
  • Object
show all
Defined in:
lib/wavefront-cli/display/dashboard.rb

Overview

Format human-readable output for dashboards.

Constant Summary

Constants included from WavefrontCli::Constants

WavefrontCli::Constants::ALL_PAGE_SIZE, WavefrontCli::Constants::DEFAULT_CONFIG, WavefrontCli::Constants::DEFAULT_OPTS, WavefrontCli::Constants::EVENT_STATE_DIR, WavefrontCli::Constants::HUMAN_TIME_FORMAT, WavefrontCli::Constants::HUMAN_TIME_FORMAT_MS, WavefrontCli::Constants::SEARCH_SPLIT

Instance Attribute Summary

Attributes inherited from Base

#data, #options, #raw

Instance Method Summary collapse

Methods inherited from Base

#_prioritize_keys, #display_brief_freetext_results, #do_delete, #do_import, #do_list_brief, #do_list_fields, #do_search, #do_search_brief, #do_search_fields, #do_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_pathsearch, #do_tag_set, #do_tags, #do_undelete, #drop_fields, #filter_data, #filter_fields_as_arr, #freetext_keys, #friendly_name, #human_time, #index_of_final_item, #initialize, #key_width, #long_output, #multicolumn, #pagination_line, #prioritize_keys, #priority_keys, #quoted, #readable_time, #readable_time_arr, #run, #run_error, #run_list, #run_search, #search_display_keys, #search_identifier_key, #time_formats

Constructor Details

This class inherits a constructor from WavefrontDisplay::Base

Instance Method Details

#do_aclsObject Also known as: do_acl_grant, do_acl_revoke, do_acl_clear



41
42
43
44
45
46
# File 'lib/wavefront-cli/display/dashboard.rb', line 41

def do_acls
  data.each do |dash|
    display_acl('view and modify', dash[:modifyAcl])
    display_acl('view', dash[:viewAcl])
  end
end

#do_describeObject



14
15
16
17
18
19
# File 'lib/wavefront-cli/display/dashboard.rb', line 14

def do_describe
  drop_fields(:parameterDetails)
  readable_time(:createdEpochMillis, :updatedEpochMillis)
  data[:sections] = data[:sections].map { |s| s[:name] }
  long_output
end

#do_favsObject Also known as: do_fav, do_unfav



30
31
32
33
34
35
36
# File 'lib/wavefront-cli/display/dashboard.rb', line 30

def do_favs
  if data.empty?
    puts 'No favourites.'
  else
    multicolumn(:id)
  end
end

#do_listObject



10
11
12
# File 'lib/wavefront-cli/display/dashboard.rb', line 10

def do_list
  long_output
end

#do_queriesObject



21
22
23
24
25
26
27
28
# File 'lib/wavefront-cli/display/dashboard.rb', line 21

def do_queries
  if options[:brief]
    @data = data.to_h.values.flatten.map { |q| { query: q } }
    multicolumn(:query)
  else
    long_output
  end
end