Skip to content

Commit

Permalink
Shows toast when recovering
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina committed Feb 9, 2022
1 parent 5cc859b commit ad6781a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ test('Click on "Share dashboard by email" and succeed', async () => {
await waitFor(() => {
expect(props.addDangerToast).toBeCalledTimes(0);
expect(window.location.href).toBe(
'mailto:?Subject=Superset dashboard COVID Vaccine Dashboard%20&Body=Check out this dashboard: http%3A%2F%2Flocalhost%3A8088%2Fr%2F3',
'mailto:?Subject=Superset%20dashboard%20COVID%20Vaccine%20Dashboard%20&Body=Check%20out%20this%20dashboard%3A%20http%3A%2F%2Flocalhost%3A8088%2Fr%2F3',
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ const ShareMenuItems = (props: ShareMenuItemProps) => {

async function onShareByEmail() {
try {
const bodyWithLink = `${emailBody}${encodeURIComponent(
await generateUrl(),
)}`;
window.location.href = `mailto:?Subject=${emailSubject}%20&Body=${bodyWithLink}`;
const encodedBody = encodeURIComponent(
`${emailBody}${await generateUrl()}`,
);
const encodedSubject = encodeURIComponent(emailSubject);
window.location.href = `mailto:?Subject=${encodedSubject}%20&Body=${encodedBody}`;
} catch (error) {
logging.error(error);
addDangerToast(t('Sorry, something went wrong. Try again later.'));
Expand Down
7 changes: 4 additions & 3 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,12 +743,13 @@ def explore(

if not initial_form_data:
slice_id = request.args.get("slice_id")
dataset_id = request.args.get("dataset_id")
if slice_id:
initial_form_data["slice_id"] = slice_id

dataset_id = request.args.get("dataset_id")
if dataset_id:
flash(_("Form data not found in cache, reverting to chart metadata."))
elif dataset_id:
initial_form_data["datasource"] = f"{dataset_id}__table"
flash(_("Form data not found in cache, reverting to dataset metadata."))

form_data, slc = get_form_data(
use_slice_data=True, initial_form_data=initial_form_data
Expand Down

0 comments on commit ad6781a

Please sign in to comment.