mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 06:22:13 +08:00
Sharing Redesign: Export as JSON add toast message (#90021)
* add successful toast message and autoclose drawer * i18n * remove autoclose
This commit is contained in:
@ -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ę đäşĥþőäřđ ĴŜØŃ"
|
||||
|
Reference in New Issue
Block a user