You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/01/29 14:25:45 UTC

[superset] 07/18: fix: Added message flash when chart with missing dataset is accessed. (#12468)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3b1a84c34a973dff8ce629edc9d73f8ac2068243
Author: Kasia Kucharczyk <25...@users.noreply.github.com>
AuthorDate: Tue Jan 19 07:42:03 2021 +0100

    fix: Added message flash when chart with missing dataset is accessed. (#12468)
---
 superset/views/core.py             | 9 ++++++++-
 superset/views/utils.py            | 2 +-
 tests/core_tests.py                | 2 +-
 tests/tasks/async_queries_tests.py | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index 5769cf8..a6cdad9 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -706,7 +706,14 @@ class Superset(BaseSupersetView):  # pylint: disable=too-many-public-methods
             datasource_id, datasource_type = get_datasource_info(
                 datasource_id, datasource_type, form_data
             )
-        except SupersetException:
+        except SupersetException as ex:
+            flash(
+                _(
+                    "Error occurred when opening the chart: %(error)s",
+                    error=utils.error_msg_from_exception(ex),
+                ),
+                "danger",
+            )
             return redirect(error_redirect)
 
         datasource = ConnectorRegistry.get_datasource(
diff --git a/superset/views/utils.py b/superset/views/utils.py
index 3162e14..c01b750 100644
--- a/superset/views/utils.py
+++ b/superset/views/utils.py
@@ -228,7 +228,7 @@ def get_datasource_info(
 
     if not datasource_id:
         raise SupersetException(
-            "The datasource associated with this chart no longer exists"
+            "The dataset associated with this chart no longer exists"
         )
 
     datasource_id = int(datasource_id)
diff --git a/tests/core_tests.py b/tests/core_tests.py
index 2363ab0..bcf5061 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -863,7 +863,7 @@ class TestCore(SupersetTestCase):
 
         self.assertEqual(
             data["errors"][0]["message"],
-            "The datasource associated with this chart no longer exists",
+            "The dataset associated with this chart no longer exists",
         )
 
     @pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
diff --git a/tests/tasks/async_queries_tests.py b/tests/tasks/async_queries_tests.py
index e44a515..5a7b86a 100644
--- a/tests/tasks/async_queries_tests.py
+++ b/tests/tasks/async_queries_tests.py
@@ -124,5 +124,5 @@ class TestAsyncQueries(SupersetTestCase):
         with pytest.raises(SupersetException):
             load_explore_json_into_cache(job_metadata, form_data)
 
-        errors = ["The datasource associated with this chart no longer exists"]
+        errors = ["The dataset associated with this chart no longer exists"]
         mock_update_job.assert_called_with(job_metadata, "error", errors=errors)