Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Added message flash when chart with missing dataset is accessed. #12468

Merged
merged 4 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,14 @@ def explore( # pylint: disable=too-many-locals,too-many-return-statements
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(
Expand Down
2 changes: 1 addition & 1 deletion superset/views/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,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)
Expand Down
2 changes: 1 addition & 1 deletion tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def test_slice_payload_no_datasource(self):

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")
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/async_queries_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ def test_load_explore_json_into_cache_error(self, mock_update_job):
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)