Class: Superset::Dashboard::List
- Defined in:
- lib/superset/dashboard/list.rb
Constant Summary
Constants inherited from Request
Instance Attribute Summary collapse
-
#ids_not_in ⇒ Object
readonly
Returns the value of attribute ids_not_in.
-
#include_filter_dataset_schemas ⇒ Object
readonly
Returns the value of attribute include_filter_dataset_schemas.
-
#tags_equal ⇒ Object
readonly
Returns the value of attribute tags_equal.
-
#title_contains ⇒ Object
readonly
Returns the value of attribute title_contains.
-
#title_equals ⇒ Object
readonly
Returns the value of attribute title_equals.
Attributes inherited from Request
Class Method Summary collapse
Instance Method Summary collapse
- #all ⇒ Object
- #ids ⇒ Object
-
#initialize(page_num: 0, title_contains: '', title_equals: '', tags_equal: [], ids_not_in: [], include_filter_dataset_schemas: false) ⇒ List
constructor
A new instance of List.
- #response ⇒ Object
- #retrieve_embedded_details(id) ⇒ Object
- #retrieve_schemas(id) ⇒ Object
- #rows ⇒ Object
Methods inherited from Request
#query_params, #result, #superset_host
Methods included from Superset::Display
#display_headers, #headings, #list, #result, #table, #title
Constructor Details
#initialize(page_num: 0, title_contains: '', title_equals: '', tags_equal: [], ids_not_in: [], include_filter_dataset_schemas: false) ⇒ List
Returns a new instance of List.
10 11 12 13 14 15 16 17 |
# File 'lib/superset/dashboard/list.rb', line 10 def initialize(page_num: 0, title_contains: '', title_equals: '', tags_equal: [], ids_not_in: [], include_filter_dataset_schemas: false) @title_contains = title_contains @title_equals = title_equals @tags_equal = @ids_not_in = ids_not_in @include_filter_dataset_schemas = include_filter_dataset_schemas super(page_num: page_num) end |
Instance Attribute Details
#ids_not_in ⇒ Object (readonly)
Returns the value of attribute ids_not_in.
8 9 10 |
# File 'lib/superset/dashboard/list.rb', line 8 def ids_not_in @ids_not_in end |
#include_filter_dataset_schemas ⇒ Object (readonly)
Returns the value of attribute include_filter_dataset_schemas.
8 9 10 |
# File 'lib/superset/dashboard/list.rb', line 8 def include_filter_dataset_schemas @include_filter_dataset_schemas end |
#tags_equal ⇒ Object (readonly)
Returns the value of attribute tags_equal.
8 9 10 |
# File 'lib/superset/dashboard/list.rb', line 8 def @tags_equal end |
#title_contains ⇒ Object (readonly)
Returns the value of attribute title_contains.
8 9 10 |
# File 'lib/superset/dashboard/list.rb', line 8 def title_contains @title_contains end |
#title_equals ⇒ Object (readonly)
Returns the value of attribute title_equals.
8 9 10 |
# File 'lib/superset/dashboard/list.rb', line 8 def title_equals @title_equals end |
Class Method Details
.call ⇒ Object
19 20 21 |
# File 'lib/superset/dashboard/list.rb', line 19 def self.call self.new.list end |
Instance Method Details
#all ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/superset/dashboard/list.rb', line 28 def all result.map do |d| OpenStruct.new( list_attributes.map { |la| [la, d[la]] }.to_h. merge(retrieve_schemas(d[:id])). merge((d[:id])) ) end end |
#ids ⇒ Object
60 61 62 |
# File 'lib/superset/dashboard/list.rb', line 60 def ids result.map { |d| d[:id] } end |
#response ⇒ Object
23 24 25 26 |
# File 'lib/superset/dashboard/list.rb', line 23 def response validate_constructor_args super end |
#retrieve_embedded_details(id) ⇒ Object
46 47 48 49 50 |
# File 'lib/superset/dashboard/list.rb', line 46 def (id) = Dashboard::Embedded::Get.new(dashboard_id: id) { allowed_embedded_domains: .allowed_domains, uuid: .uuid,} end |
#retrieve_schemas(id) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/superset/dashboard/list.rb', line 38 def retrieve_schemas(id) { schemas: Datasets::List.new(dashboard_id: id, include_filter_datasets: include_filter_dataset_schemas).schemas } rescue StandardError => e # within Superset, a bug exists around deleting dashboards failing and the corrupting datasets configs, so handle errored datasets gracefully # ref NEP-17532 {} end |
#rows ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/superset/dashboard/list.rb', line 52 def rows result.map do |d| list_attributes.map do |la| la == :url ? "#{superset_host}#{d[la]}" : d[la] end end end |