diff --git a/public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx b/public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx index 8739b919099..68e23a8857a 100644 --- a/public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx +++ b/public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx @@ -6,7 +6,10 @@ import { GrafanaTheme2 } from '@grafana/data'; import { selectors as e2eSelectors } from '@grafana/e2e-selectors'; import { SceneComponentProps } from '@grafana/scenes'; import { Button, ClipboardButton, CodeEditor, Label, Spinner, Stack, Switch, useStyles2 } from '@grafana/ui'; +import { notifyApp } from 'app/core/actions'; +import { createSuccessNotification } from 'app/core/copy/appNotification'; import { Trans, t } from 'app/core/internationalization'; +import { dispatch } from 'app/store/store'; import { getDashboardSceneFor } from '../../utils/utils'; import { ShareExportTab } from '../ShareExportTab'; @@ -28,6 +31,12 @@ function ExportAsJsonRenderer({ model }: SceneComponentProps) { return JSON.stringify(json, null, 2); }, [isSharingExternally]); + const onClickDownload = async () => { + await model.onSaveAsFile(); + const message = t('export.json.download-successful_toast_message', 'Your JSON has been downloaded'); + dispatch(notifyApp(createSuccessNotification(message))); + }; + const switchLabel = t('export.json.export-externally-label', 'Export the dashboard to use in another instance'); return ( @@ -71,7 +80,7 @@ function ExportAsJsonRenderer({ model }: SceneComponentProps) { data-testid={selector.saveToFileButton} variant="primary" icon="download-alt" - onClick={model.onSaveAsFile} + onClick={onClickDownload} > Download file diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 811a7fcc893..d9637c637f2 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -790,6 +790,7 @@ "cancel-button": "Cancel", "copy-button": "Copy to clipboard", "download-button": "Download file", + "download-successful_toast_message": "Your JSON has been downloaded", "export-externally-label": "Export the dashboard to use in another instance", "info-text": "Copy or download a JSON file containing the JSON of your dashboard", "title": "Save dashboard JSON" diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index bca9eb62df7..10a4ee051e7 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -790,6 +790,7 @@ "cancel-button": "Cäʼnčęľ", "copy-button": "Cőpy ŧő čľįpþőäřđ", "download-button": "Đőŵʼnľőäđ ƒįľę", + "download-successful_toast_message": "Ÿőūř ĴŜØŃ ĥäş þęęʼn đőŵʼnľőäđęđ", "export-externally-label": "Ēχpőřŧ ŧĥę đäşĥþőäřđ ŧő ūşę įʼn äʼnőŧĥęř įʼnşŧäʼnčę", "info-text": "Cőpy őř đőŵʼnľőäđ ä ĴŜØŃ ƒįľę čőʼnŧäįʼnįʼnģ ŧĥę ĴŜØŃ őƒ yőūř đäşĥþőäřđ", "title": "Ŝävę đäşĥþőäřđ ĴŜØŃ"