Allow importing csv files
Change-Id: I8f4c417c1762ba6dbc0fa929ecf8262e6e8a2e42
This commit is contained in:
parent
2240559f74
commit
a2807fe281
@ -25,7 +25,8 @@
|
|||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-admin": "^3.4.0",
|
"react-admin": "^3.4.0",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"react-scripts": "^3.4.1"
|
"react-scripts": "^3.4.1",
|
||||||
|
"react-admin-import-csv": "^0.2.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
|
@ -21,10 +21,14 @@ import {
|
|||||||
TextField,
|
TextField,
|
||||||
TextInput,
|
TextInput,
|
||||||
ReferenceField,
|
ReferenceField,
|
||||||
|
Toolbar,
|
||||||
|
TopToolbar,
|
||||||
SelectInput,
|
SelectInput,
|
||||||
regex,
|
regex,
|
||||||
Pagination,
|
Pagination,
|
||||||
} from "react-admin";
|
} from "react-admin";
|
||||||
|
import { ImportButton } from "react-admin-import-csv";
|
||||||
|
import { CreateButton, ExportButton } from "ra-ui-materialui";
|
||||||
|
|
||||||
const UserPagination = props => (
|
const UserPagination = props => (
|
||||||
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
<Pagination {...props} rowsPerPageOptions={[10, 25, 50, 100, 500, 1000]} />
|
||||||
@ -41,6 +45,31 @@ const UserFilter = props => (
|
|||||||
</Filter>
|
</Filter>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const ListActions = props => {
|
||||||
|
const {
|
||||||
|
className,
|
||||||
|
basePath,
|
||||||
|
total,
|
||||||
|
resource,
|
||||||
|
currentSort,
|
||||||
|
filterValues,
|
||||||
|
exporter
|
||||||
|
} = props;
|
||||||
|
return (
|
||||||
|
<TopToolbar className={className}>
|
||||||
|
<CreateButton basePath={basePath} />
|
||||||
|
<ImportButton {...props} />
|
||||||
|
<ExportButton
|
||||||
|
disabled={total === 0}
|
||||||
|
resource={resource}
|
||||||
|
sort={currentSort}
|
||||||
|
filter={filterValues}
|
||||||
|
exporter={exporter}
|
||||||
|
/>
|
||||||
|
</TopToolbar>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const UserList = props => (
|
export const UserList = props => (
|
||||||
<List
|
<List
|
||||||
{...props}
|
{...props}
|
||||||
@ -48,6 +77,7 @@ export const UserList = props => (
|
|||||||
filterDefaultValues={{ guests: true, deactivated: false }}
|
filterDefaultValues={{ guests: true, deactivated: false }}
|
||||||
bulkActionButtons={false}
|
bulkActionButtons={false}
|
||||||
pagination={<UserPagination />}
|
pagination={<UserPagination />}
|
||||||
|
actions={<ListActions />}
|
||||||
>
|
>
|
||||||
<Datagrid rowClick="edit">
|
<Datagrid rowClick="edit">
|
||||||
<ReferenceField
|
<ReferenceField
|
||||||
|
Loading…
Reference in New Issue
Block a user