| | |
| | | input: { |
| | | file: { |
| | | upload_several: |
| | | 'Drop some files to upload, or click to select one.', |
| | | upload_single: 'Drop a file to upload, or click to select it.', |
| | | '拖放一些要上传的文件,或单击以选择一个', |
| | | upload_single: '拖放要上传的文件,或单击以选择它', |
| | | }, |
| | | image: { |
| | | upload_several: |
| | |
| | | collapse: 'Collapse', |
| | | collapseAll: 'Collapse All', |
| | | scope: 'Assign', |
| | | import: { |
| | | title: 'Import', |
| | | stop: 'Stop import', |
| | | msg: 'Here is a sample CSV file you can use as a template', |
| | | tips: 'The import is running, please do not close this tab.', |
| | | err: 'Failed to import this file, please make sure your provided a valid CSV file.', |
| | | download: 'Download Import Template', |
| | | } |
| | | }, |
| | | }, |
| | | filters: { |
| | |
| | | collapse: '折叠', |
| | | collapseAll: '全部折叠', |
| | | scope: '权限', |
| | | import: { |
| | | title: '导入', |
| | | stop: '停止导入', |
| | | msg: '这是一个可以用作模板的示例 CSV 文件', |
| | | tips: '正在导入中,请不要关闭此窗口', |
| | | err: '无法导入此文件,请确保您提供了有效的 CSV 文件', |
| | | download: '下载导入模板', |
| | | } |
| | | }, |
| | | }, |
| | | filters: { |
| | |
| | | <> |
| | | <Button |
| | | startIcon={<UploadIcon />} |
| | | label="Import" |
| | | label="common.action.import.title" |
| | | onClick={handleOpenModal} |
| | | /> |
| | | |
| | |
| | | Form, |
| | | Toolbar, |
| | | useRefresh, |
| | | useTranslate |
| | | } from 'react-admin'; |
| | | import { Link } from 'react-router-dom'; |
| | | import DialogCloseButton from './DialogCloseButton'; |
| | |
| | | |
| | | const ImportModal = ({ open, onClose, importTemp, useCodeImport, onceBatch = 10 }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | |
| | | const { processBatch } = useCodeImport(); |
| | | const { importer, parseCsv, reset } = usePapaParse({ |
| | |
| | | return ( |
| | | <Dialog open={open} maxWidth="md" fullWidth> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>Import</DialogTitle> |
| | | <DialogTitle>{translate('common.action.import.title')}</DialogTitle> |
| | | <DialogContent> |
| | | <Form> |
| | | <Stack spacing={2}> |
| | |
| | | }, |
| | | }} |
| | | > |
| | | The import is running, please do not close |
| | | this tab. |
| | | {translate('common.action.import.tips')} |
| | | </Alert> |
| | | <Typography variant="body2"> |
| | | Imported{' '} |
| | |
| | | onClick={handleReset} |
| | | color="error" |
| | | > |
| | | Stop import |
| | | {translate('common.action.import.stop')} |
| | | </MuiLink> |
| | | </> |
| | | )} |
| | |
| | | |
| | | {importer.state === 'error' && ( |
| | | <Alert severity="error"> |
| | | Failed to import this file, please make sure |
| | | your provided a valid CSV file. |
| | | {translate('common.action.import.err')} |
| | | </Alert> |
| | | )} |
| | | |
| | |
| | | action={ |
| | | <Button |
| | | component={Link} |
| | | label="Download CSV sample" |
| | | label="common.action.import.download" |
| | | color="info" |
| | | to={importTemp} |
| | | download={'crm_contacts_sample.csv'} |
| | | /> |
| | | } |
| | | > |
| | | Here is a sample CSV file you can use as a |
| | | template |
| | | {translate('common.action.import.msg')} |
| | | </Alert> |
| | | |
| | | <FileInput |
| | |
| | | {importer.state === 'idle' ? ( |
| | | <> |
| | | <Button |
| | | label="Import" |
| | | label="common.action.import.title" |
| | | variant="contained" |
| | | onClick={startImport} |
| | | disabled={!file} |
| | |
| | | </> |
| | | ) : ( |
| | | <Button |
| | | label="Close" |
| | | label="ra.action.close" |
| | | onClick={handleClose} |
| | | disabled={importer.state === 'running'} |
| | | /> |