admin-on-rest

Mount react-admin under /admin

孤人 提交于 2021-02-19 03:37:28
问题 I simply want all of my admin pages to be under /admin . <Admin title="Admin" dashboard={Dashboard} dataProvider={restClient} history={history} > <Resource name="users" list={UserList} /> </Admin> My main page is at /admin but when I click Users in the sidebar, it changes the path to /users and not /admin/users . I'm using react-admin 2.0.0. 回答1: The key is actually in the history prop passed to the Admin component: import createHistory from 'history/createBrowserHistory'; const history =

React-admin | How to concat source inside ReferenceField

有些话、适合烂在心里 提交于 2020-01-15 09:39:47
问题 I have a table "fos_user" and "version", I would like to display "9.0.1.A" instead of "/ version / 1". =>fos_user https://i.imgur.com/C8f0qor.png =>version https://i.imgur.com/HFSKIdz.png Is it possible to concatenate the fields of the "version" table to display it in the source, like this? https://i.imgur.com/rxJBmtp.png Because it will prevent me from creating a new field in the "version" table. Best regards, 回答1: React-admin | How to concat source inside ReferenceField ? Answer:

admin-on-rest: Access row's column data within a Datagrid component

北城余情 提交于 2020-01-15 09:37:32
问题 I have a List view where I want to render a ReferenceField field based on the value of the current row being rendered in the table that the Datagrid component creates. How can I access the current row's data? (the values of the columns of the current row). I tried record.processed but I get an error saying that the record object doesn't exist ( processed is a column in the record that I want to check in order to format the field). I also tried resource.processed , this.props.processed , and

Update ImageField on change of TextInput

二次信任 提交于 2020-01-05 17:18:31
问题 Given a SimpleForm : <SimpleForm> <TextInput source="imageUrl" label="Image URL" /> <ImageField source="imageUrl" label="Image" /> </SimpleForm> I'd like to have the ImageField update as the user types in the TextInput . Is this somehow possible out of the box, or will I have to wire it up myself? 回答1: You should probably build a custom input like the one we built for image upload. Instead of the file input, just use a text input and handle the image visualization inside it. 来源: https:/

How to access record's internals in Show/Edit/Create

孤街醉人 提交于 2020-01-05 12:57:11
问题 Similar to admin-on-rest: Access row's column data within a Datagrid component although I think it doesn't apply to my cases: export const PlantShow = (props) => { return (<Show {...props}> <TabbedShowLayout> <Tab label="Analytics"> { record.oneId && <MetricsCharts {...props} manufacturer="one" /> } { record.otherId && <MetricsCharts {...props} manufacturer="other" /> } { record.anotherId && <MetricsCharts {...props} manufacturer="another" /> } </Tab> </TabbedShowLayout> </Show>) } There

Admin-on-Rest ReferenceField not rendering properly

泪湿孤枕 提交于 2019-12-24 09:30:21
问题 I don't get ReferenceField to work properly as it only shows the progress bar "spinning" for the 'firstName' field. I can successfully use the examples with data from https://jsonplaceholder.typicode.com/ to work with the simpleRest client but not with my own API end points. I see the GET_LIST request - response and then the related GET_MANY response with the Owner data but the reference field labeled 'User' doesn't render. One of the differences in structure of API endpoints is that the

How can all CRUD actions of a resource by linked to a particular foreign key?

做~自己de王妃 提交于 2019-12-24 08:56:46
问题 Version: Next (react-admin) Resources Classes and Students . "Students" has a foreign key to "Classes": class_id . So, in the List of Classes we have for each row (class) a button "View/Edit Students of Class". When we click on this button, we have this code: <Button label={'View/Edit Students of Class'} onClick={(e) => { localStorage.setItem('classId', record.id); history.push({ pathname: 'students', search: stringify({ page: 1, perPage: 25, sort: 'createdOn', order: 'DESC', classId: record