Sharing Redesign: Export as JSON add toast message (#90021)

* add successful toast message and autoclose drawer

* i18n

* remove autoclose
pull/88735/head^2
Lucy Chen 10 months ago committed by GitHub
parent ce70cf18b9
commit 98c197e6cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx
  2. 1
      public/locales/en-US/grafana.json
  3. 1
      public/locales/pseudo-LOCALE/grafana.json

@ -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<ExportAsJson>) {
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<ExportAsJson>) {
data-testid={selector.saveToFileButton}
variant="primary"
icon="download-alt"
onClick={model.onSaveAsFile}
onClick={onClickDownload}
>
<Trans i18nKey="export.json.download-button">Download file</Trans>
</Button>

@ -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"

@ -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ę đäşĥþőäřđ ĴŜØŃ"

Loading…
Cancel
Save