mirror of
https://github.com/apache/superset.git
synced 2026-06-01 21:59:26 +00:00
feat(embedded-sdk): Add resolvePermalinkUrl callback for custom permalink URLs (#36924)
This commit is contained in:
committed by
GitHub
parent
1e8d648f47
commit
53dddf4db2
@@ -204,8 +204,13 @@ export const useExploreAdditionalActionsMenu = (
|
||||
const shareByEmail = useCallback(async () => {
|
||||
try {
|
||||
const subject = t('Superset Chart');
|
||||
const url = await getChartPermalink(latestQueryFormData);
|
||||
const body = encodeURIComponent(t('%s%s', 'Check out this chart: ', url));
|
||||
const result = await getChartPermalink(latestQueryFormData);
|
||||
if (!result?.url) {
|
||||
throw new Error('Failed to generate permalink');
|
||||
}
|
||||
const body = encodeURIComponent(
|
||||
t('%s%s', 'Check out this chart: ', result.url),
|
||||
);
|
||||
window.location.href = `mailto:?Subject=${subject}%20&Body=${body}`;
|
||||
} catch (error) {
|
||||
addDangerToast(t('Sorry, something went wrong. Try again later.'));
|
||||
@@ -315,7 +320,13 @@ export const useExploreAdditionalActionsMenu = (
|
||||
if (!latestQueryFormData) {
|
||||
throw new Error();
|
||||
}
|
||||
await copyTextToClipboard(() => getChartPermalink(latestQueryFormData));
|
||||
await copyTextToClipboard(async () => {
|
||||
const result = await getChartPermalink(latestQueryFormData);
|
||||
if (!result?.url) {
|
||||
throw new Error('Failed to generate permalink');
|
||||
}
|
||||
return result.url;
|
||||
});
|
||||
addSuccessToast(t('Copied to clipboard!'));
|
||||
} catch (error) {
|
||||
addDangerToast(t('Sorry, something went wrong. Try again later.'));
|
||||
|
||||
Reference in New Issue
Block a user