Class: Superset::Dashboard::List
- Inherits:
-
Request
- Object
- Request
- Superset::Dashboard::List
show all
- Defined in:
- lib/superset/dashboard/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, #result, #superset_host
#display_headers, #headings, #list, #result, #table, #title
Constructor Details
#initialize(page_num: 0, title_contains: '', tags_equal: [], ids_not_in: []) ⇒ List
Returns a new instance of List.
10
11
12
13
14
15
|
# File 'lib/superset/dashboard/list.rb', line 10
def initialize(page_num: 0, title_contains: '', tags_equal: [], ids_not_in: [])
@title_contains = title_contains
@tags_equal = tags_equal
@ids_not_in = ids_not_in
super(page_num: page_num)
end
|
Instance Attribute Details
#ids_not_in ⇒ Object
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
|
Returns the value of attribute tags_equal.
8
9
10
|
# File 'lib/superset/dashboard/list.rb', line 8
def tags_equal
@tags_equal
end
|
#title_contains ⇒ Object
Returns the value of attribute title_contains.
8
9
10
|
# File 'lib/superset/dashboard/list.rb', line 8
def title_contains
@title_contains
end
|
Class Method Details
.call ⇒ Object
17
18
19
|
# File 'lib/superset/dashboard/list.rb', line 17
def self.call
self.new.list
end
|
Instance Method Details
#all ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/superset/dashboard/list.rb', line 26
def all
result.map do |d|
OpenStruct.new(
list_attributes.map { |la| [la, d[la]] }.to_h.
merge(retrieve_schemas(d[:id])).
merge(retrieve_embedded_details(d[:id]))
)
end
end
|
#ids ⇒ Object
58
59
60
|
# File 'lib/superset/dashboard/list.rb', line 58
def ids
result.map { |d| d[:id] }
end
|
#response ⇒ Object
21
22
23
24
|
# File 'lib/superset/dashboard/list.rb', line 21
def response
validate_constructor_args
super
end
|
#retrieve_embedded_details(id) ⇒ Object
44
45
46
47
48
|
# File 'lib/superset/dashboard/list.rb', line 44
def retrieve_embedded_details(id)
embedded_dashboard = Dashboard::Embedded::Get.new(id)
{ allowed_embedded_domains: embedded_dashboard.allowed_domains,
uuid: embedded_dashboard.uuid,}
end
|
#retrieve_schemas(id) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/superset/dashboard/list.rb', line 36
def retrieve_schemas(id)
{ schemas: Datasets::List.new(id).schemas }
rescue StandardError => e
{}
end
|
#rows ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/superset/dashboard/list.rb', line 50
def rows
result.map do |d|
list_attributes.map do |la|
la == :url ? "#{superset_host}#{d[la]}" : d[la]
end
end
end
|