Class: Superset::Services::DashboardLoader

Inherits:
Object
  • Object
show all
Includes:
FileUtilities
Defined in:
lib/superset/services/dashboard_loader.rb

Defined Under Namespace

Classes: DashboardConfig

Constant Summary collapse

TMP_PATH =
'/tmp/superset_dashboard_imports'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileUtilities

#unzip_file

Constructor Details

#initialize(dashboard_export_zip:) ⇒ DashboardLoader

Returns a new instance of DashboardLoader.



15
16
17
# File 'lib/superset/services/dashboard_loader.rb', line 15

def initialize(dashboard_export_zip:)
  @dashboard_export_zip = dashboard_export_zip
end

Instance Attribute Details

#dashboard_export_zipObject (readonly)

Returns the value of attribute dashboard_export_zip.



13
14
15
# File 'lib/superset/services/dashboard_loader.rb', line 13

def dashboard_export_zip
  @dashboard_export_zip
end

Instance Method Details

#dashboard_configObject



24
25
26
27
28
# File 'lib/superset/services/dashboard_loader.rb', line 24

def dashboard_config
  @dashboard_config ||= DashboardConfig.new(
                          dashboard_export_zip:    dashboard_export_zip, 
                          tmp_uniq_dashboard_path: tmp_uniq_dashboard_path).config
end

#performObject



19
20
21
22
# File 'lib/superset/services/dashboard_loader.rb', line 19

def perform
  unzip_source_file
  dashboard_config
end