Class: Superset::Chart::List
- Defined in:
- lib/superset/chart/list.rb
Constant Summary
Constants inherited from Request
Instance Attribute Summary collapse
-
#dashboard_id_eq ⇒ Object
readonly
Returns the value of attribute dashboard_id_eq.
-
#dataset_id_eq ⇒ Object
readonly
Returns the value of attribute dataset_id_eq.
-
#title_contains ⇒ Object
readonly
Returns the value of attribute title_contains.
Attributes inherited from Request
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title_contains: '', dashboard_id_eq: '', dataset_id_eq: '', **kwargs) ⇒ List
constructor
A new instance of List.
- #list_with_dashboards ⇒ Object
- #rows_with_dashboards ⇒ Object
Methods inherited from Request
#query_params, #response, #result, #superset_host
Methods included from Display
#ids, #list, #result, #rows, #table, #title, #to_h
Constructor Details
#initialize(title_contains: '', dashboard_id_eq: '', dataset_id_eq: '', **kwargs) ⇒ List
Returns a new instance of List.
7 8 9 10 11 12 |
# File 'lib/superset/chart/list.rb', line 7 def initialize(title_contains: '', dashboard_id_eq: '', dataset_id_eq: '', **kwargs) @title_contains = title_contains @dashboard_id_eq = dashboard_id_eq @dataset_id_eq = dataset_id_eq super(**kwargs) end |
Instance Attribute Details
#dashboard_id_eq ⇒ Object (readonly)
Returns the value of attribute dashboard_id_eq.
5 6 7 |
# File 'lib/superset/chart/list.rb', line 5 def dashboard_id_eq @dashboard_id_eq end |
#dataset_id_eq ⇒ Object (readonly)
Returns the value of attribute dataset_id_eq.
5 6 7 |
# File 'lib/superset/chart/list.rb', line 5 def dataset_id_eq @dataset_id_eq end |
#title_contains ⇒ Object (readonly)
Returns the value of attribute title_contains.
5 6 7 |
# File 'lib/superset/chart/list.rb', line 5 def title_contains @title_contains end |
Class Method Details
.call ⇒ Object
14 15 16 |
# File 'lib/superset/chart/list.rb', line 14 def self.call self.new.list end |
Instance Method Details
#list_with_dashboards ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/superset/chart/list.rb', line 18 def list_with_dashboards puts Terminal::Table.new( title: title, headings: list_dashboard_attributes.map(&:to_s).map(&:humanize), rows: rows_with_dashboards ) end |
#rows_with_dashboards ⇒ Object
26 27 28 29 30 |
# File 'lib/superset/chart/list.rb', line 26 def rows_with_dashboards result.map do |d| list_dashboard_attributes.map { |la| d[la].to_s } end end |