From b2c311b61709fd372f87fc55e07352cff2907ad5 Mon Sep 17 00:00:00 2001 From: artemonsh Date: Tue, 20 Dec 2022 17:53:27 +0300 Subject: [PATCH 1/4] fix: export & import chart description and certification details --- superset/charts/schemas.py | 3 +++ superset/models/slice.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/superset/charts/schemas.py b/superset/charts/schemas.py index dee73de17cb6b..7c483daffe910 100644 --- a/superset/charts/schemas.py +++ b/superset/charts/schemas.py @@ -1368,6 +1368,9 @@ class GetFavStarIdsSchema(Schema): class ImportV1ChartSchema(Schema): slice_name = fields.String(required=True) + description = fields.String(allow_none=True, default=False) + certified_by = fields.String(allow_none=True, default=False) + certification_details = fields.String(allow_none=True, default=False) viz_type = fields.String(required=True) params = fields.Dict() query_context = fields.String(allow_none=True, validate=utils.validate_json) diff --git a/superset/models/slice.py b/superset/models/slice.py index 657ff7d38a079..1223fae733b48 100644 --- a/superset/models/slice.py +++ b/superset/models/slice.py @@ -110,6 +110,9 @@ class Slice( # pylint: disable=too-many-public-methods export_fields = [ "slice_name", + "description", + "certified_by", + "certification_details", "datasource_type", "datasource_name", "viz_type", From e0bfdb146c7c3c1ce9225d5ef2a62d156ace2b3a Mon Sep 17 00:00:00 2001 From: artemonsh Date: Tue, 20 Dec 2022 20:25:21 +0300 Subject: [PATCH 2/4] fix(dashboard): export & import chart description and certification details --- superset/charts/schemas.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/superset/charts/schemas.py b/superset/charts/schemas.py index 7c483daffe910..b665c98afa82d 100644 --- a/superset/charts/schemas.py +++ b/superset/charts/schemas.py @@ -1368,9 +1368,9 @@ class GetFavStarIdsSchema(Schema): class ImportV1ChartSchema(Schema): slice_name = fields.String(required=True) - description = fields.String(allow_none=True, default=False) - certified_by = fields.String(allow_none=True, default=False) - certification_details = fields.String(allow_none=True, default=False) + description = fields.String(allow_none=True) + certified_by = fields.String(allow_none=True) + certification_details = fields.String(allow_none=True) viz_type = fields.String(required=True) params = fields.Dict() query_context = fields.String(allow_none=True, validate=utils.validate_json) From 82cf17d2302bea0b3ab03db8d342366b5e716753 Mon Sep 17 00:00:00 2001 From: artemonsh Date: Wed, 25 Jan 2023 10:49:58 +0300 Subject: [PATCH 3/4] adjust tests --- tests/integration_tests/charts/commands_tests.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integration_tests/charts/commands_tests.py b/tests/integration_tests/charts/commands_tests.py index 214b7cbfe7480..cde312b41741c 100644 --- a/tests/integration_tests/charts/commands_tests.py +++ b/tests/integration_tests/charts/commands_tests.py @@ -72,6 +72,9 @@ def test_export_chart_command(self, mock_g): assert metadata == { "slice_name": "Energy Sankey", + "description": None, + "certification_details": None, + "certified_by": None, "viz_type": "sankey", "params": { "collapsed_fieldsets": "", @@ -110,6 +113,9 @@ def test_export_chart_with_query_context(self, mock_g): assert metadata == { "slice_name": "Heatmap", + "description": None, + "certification_details": None, + "certified_by": None, "viz_type": "heatmap", "params": { "all_columns_x": "source", @@ -168,6 +174,9 @@ def test_export_chart_command_key_order(self, mock_g): ) assert list(metadata.keys()) == [ "slice_name", + "description", + "certification_details", + "certified_by", "viz_type", "params", "cache_timeout", From f011ea0268409412b91adc3288c793bf3e9953fe Mon Sep 17 00:00:00 2001 From: artemonsh Date: Wed, 25 Jan 2023 11:27:44 +0300 Subject: [PATCH 4/4] adjust tests --- tests/integration_tests/charts/commands_tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration_tests/charts/commands_tests.py b/tests/integration_tests/charts/commands_tests.py index cde312b41741c..7e3991f375d37 100644 --- a/tests/integration_tests/charts/commands_tests.py +++ b/tests/integration_tests/charts/commands_tests.py @@ -73,8 +73,8 @@ def test_export_chart_command(self, mock_g): assert metadata == { "slice_name": "Energy Sankey", "description": None, - "certification_details": None, "certified_by": None, + "certification_details": None, "viz_type": "sankey", "params": { "collapsed_fieldsets": "", @@ -114,8 +114,8 @@ def test_export_chart_with_query_context(self, mock_g): assert metadata == { "slice_name": "Heatmap", "description": None, - "certification_details": None, "certified_by": None, + "certification_details": None, "viz_type": "heatmap", "params": { "all_columns_x": "source", @@ -175,8 +175,8 @@ def test_export_chart_command_key_order(self, mock_g): assert list(metadata.keys()) == [ "slice_name", "description", - "certification_details", "certified_by", + "certification_details", "viz_type", "params", "cache_timeout",