Skip to content

Commit 4c48e07

Browse files
committed
[NEP-19106]: Fix embedding logic in superset client
1 parent f3c6481 commit 4c48e07

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Change Log
22

3+
## 0.2.4 - 2025-01-29
4+
* modifies the `Superset::Dashboard::Datasets::List.new(id).schemas` to optionally include filter datasets as well.
5+
* modifies the `Superset::Dashboard::Embedded::Get.new` to accept dashboard_id as named parameter
6+
* modifies the `Superset::Dashboard::List.new().retrieve_schemas` to call `Datasets::List.new(dashboard_id: id, include_filter_datasets: true).schemas` with `include_filter_datasets` to validate the filter dataset schemas during dashboard embedding.
7+
8+
39
## 0.2.3 - 2024-11-15
410

511
* modifies the `Superset::Dashboard::Datasets::List.new(id).dataset_details` and `Superset::Dashboard::Datasets::List.new(id).list` to optionally include filter datasets as well to duplicate those during the dashboard duplication process. It also add a new column "Filter only" in the result which shows if a dataset is used only on filters

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ GIT
1414
PATH
1515
remote: .
1616
specs:
17-
superset (0.2.3)
17+
superset (0.2.4)
1818
dotenv (~> 2.7)
1919
enumerate_it (~> 1.7.0)
2020
faraday (~> 1.0)

lib/superset/dashboard/datasets/list.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def perform
2525

2626
def schemas
2727
@schemas ||= begin
28-
all_dashboard_schemas = result.map {|d| d[:schema] }.uniq
28+
all_dashboard_schemas = datasets_details.map {|d| d[:schema] }.uniq
2929

3030
# For the current superset setup we will assume a dashboard datasets will point to EXACTLY one schema, their own.
3131
# if not .. we need to know about it. Potentially we could override this check if others do not consider it a problem.

lib/superset/dashboard/embedded/get.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def self.call(id)
88
self.new(id).list
99
end
1010

11-
def initialize(id)
12-
@id = id
11+
def initialize(dashboard_id:)
12+
@id = dashboard_id
1313
end
1414

1515
def response

lib/superset/dashboard/list.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ def all
3535
end
3636

3737
def retrieve_schemas(id)
38-
{ schemas: Datasets::List.new(id).schemas }
38+
{ schemas: Datasets::List.new(dashboard_id: id, include_filter_datasets: true).schemas }
3939
rescue StandardError => e
4040
# within Superset, a bug exists around deleting dashboards failing and the corrupting datasets configs, so handle errored datasets gracefully
4141
# ref NEP-17532
4242
{}
4343
end
4444

4545
def retrieve_embedded_details(id)
46-
embedded_dashboard = Dashboard::Embedded::Get.new(id)
46+
embedded_dashboard = Dashboard::Embedded::Get.new(dashboard_id: id)
4747
{ allowed_embedded_domains: embedded_dashboard.allowed_domains,
4848
uuid: embedded_dashboard.uuid,}
4949
end

lib/superset/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Superset
4-
VERSION = "0.2.3"
4+
VERSION = "0.2.4"
55
end

spec/superset/dashboard/embedded/get_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
RSpec.describe Superset::Dashboard::Embedded::Get, type: :service do
4-
subject { described_class.new(dashboard_id) }
4+
subject { described_class.new(dashboard_id: dashboard_id) }
55
let(:dashboard_id) { 1 }
66

77
describe 'with a dashboard that has embedded settings, ie has a result' do

0 commit comments

Comments
 (0)