Class: Superset::Dashboard::Charts::List

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/dashboard/charts/list.rb

Constant Summary

Constants inherited from Request

Request::PAGE_SIZE

Instance Attribute Summary collapse

Attributes inherited from Request

#page_num

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#query_params, #response, #result, #superset_host

Methods included from Superset::Display

#display_headers, #headings, #list, #result, #table

Constructor Details

#initialize(id) ⇒ List

Returns a new instance of List.



11
12
13
# File 'lib/superset/dashboard/charts/list.rb', line 11

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

dashboard id



5
6
7
# File 'lib/superset/dashboard/charts/list.rb', line 5

def id
  @id
end

Class Method Details

.call(id) ⇒ Object



7
8
9
# File 'lib/superset/dashboard/charts/list.rb', line 7

def self.call(id)
  self.new(id).list
end

Instance Method Details

#chart_idsObject



15
16
17
# File 'lib/superset/dashboard/charts/list.rb', line 15

def chart_ids
  result.map { |c| c[:id] }
end

#rowsObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/superset/dashboard/charts/list.rb', line 19

def rows
  result.map do |c|
    [
      c[:id],
      c[:slice_name],
      c[:form_data][:datasource],
      # c[:form_data][:dashboards]  # NOTE: form_data dashboards is not accurate .. looks to be bugs related to copying charts
    ]
  end
end