react-admin

React-admin component does not use dataprovider to call api

陌路散爱 提交于 2019-12-13 02:05:27
问题 I want to add a custom Card onto one of my pages, which should call the rest api with filters. I wrote a new component for that, but i got error return, that response is not defined. I checked, no calls are reaching my api, so i'm pretty sure response is not defined because the api call is not happening, not executing. here's my component's code: import React, { Component } from 'react'; import { GET_LIST } from 'react-admin'; import dataProviderFactory from '../dataprovider/rest'; import

react-admin exclude “record” from the redux-form

杀马特。学长 韩版系。学妹 提交于 2019-12-12 16:22:22
问题 I have an issue when I send SimpleForm (edit) request with react-admin. The request includes more parameters than I have in the form's fields. For example I have form: <Edit {...props}> <SimpleForm> <TextInput source="title_new" /> <TextInput source="age_new" /> </SimpleForm> </Edit> It includes only 2 fields but when I click "save" the request includes more fields. I understood that those fields are coming from the GET_ONE request which fill the data from the DB. GET_ONE: { title: 'title',

react-admin: changing resource data in store without http request

点点圈 提交于 2019-12-12 10:14:49
问题 i need to modify resource data in store: State->admin->resources->Orders->data but without calling http request, like shown in documentation example: // in src/comment/commentActions.js import { UPDATE } from 'react-admin'; export const COMMENT_APPROVE = 'COMMENT_APPROVE'; export const commentApprove = (id, data, basePath) => ({ type: COMMENT_APPROVE, payload: { id, data: { ...data, is_approved: true } }, meta: { resource: 'comments', fetch: UPDATE }, }); is it possible ? 回答1: Yes, it is

Datagrid for nested endpoints in react-admin

社会主义新天地 提交于 2019-12-11 17:33:02
问题 I am trying to understand what the right approach would be to address nested endpoints, let's assume I have a many to many books and authors relationship, and an API which exposes api/authors , api/books , and api/authors/{id}/books . This is a common design pattern. The CRUD on api/authors works beautifully in react-admin. However, under the authors <Show> I want to show a <Datagrid> of all the books with pagination and sorting, which my api makes available under api/authors/{id}/books .

ReferenceInput just loads one page of reference ids as dropdown. How to have a lazy loading or infinitely paginating selection

蹲街弑〆低调 提交于 2019-12-11 17:18:51
问题 For example i have Product with Image Object as the entity that handles the image . While Creating/Editing I need to select any imageobject that i have created, but i cannot . The dropdown seems to only load the first page results ( based on ItemsperPage ) Product : name: Text Image : ImageObject http://localhost:8080/api/image_objects?order%5Bid%5D=DESC&page=1&perPage=25 as seen on the network inspector in the admin page. 来源: https://stackoverflow.com/questions/57698476/referenceinput-just

ImageInput only works the second time [3.0.0-alpha only]

巧了我就是萌 提交于 2019-12-11 15:33:15
问题 long description but simple issue here! I'm trying to create a basic image input form Drag and drop is cool, but regular OS dialog would be good enough. However in this case they both act the same way. Here's the code: const MediaLibrarieCreate = props => ( <Create {...props}> <SimpleForm defaultValue={defaultValue}> <TextInput source="title" /> <ImageInput source="file" accept="image/*" > <ImageField source="url" title="title"/> </ImageInput> </SimpleForm> </Create> ); And what that displays

React-Admin: How can we dispatch a store action from within the `authProvider` code?

有些话、适合烂在心里 提交于 2019-12-11 07:45:38
问题 In the async fetch of the AUTH_LOGIN we want to dispatch an action after we fetch data from additional endpoints (apart from the login endpoint, for example we call another endpoint to bring data for the account, etc.). We have all in place (action, reducer, used the combineReducers, etc.), but we are not sure how we can "connect" the authClient function in the authClient.js file, as this is not a component in order to use the connect function. How could we dispatch an action then? 回答1: As

Custom path for resource route in react-admin

。_饼干妹妹 提交于 2019-12-11 02:44:29
问题 Is there any way to specify custom paths for resources? Example: <Resource name="User" path="/manageUsers" {...}> If it's not possible "per resource", can we for example have all the CRUD pages be under a same basepath like: /crud/{ /$resource.name } but keep the custom routes without that basepath. Thank you very much. EDIT #1 For context, we are building an admin panel that will have a lot of flows, basically step-by-step creation of resources. So I applaud the react-admin library for what

How to redirect to some other route after successful authentication in react-admin

半城伤御伤魂 提交于 2019-12-10 15:25:35
问题 I have been looking for a solution to redirect to specific url after successful authentication in react-admin, when I paste http://localhost:1234/#/students/sdf2343afs32 on the url if already signed-in then I'm getting the user detail page but if not singed-in and after singing-in it shows home page instead 回答1: You can customize the redirect URL after login inside the authProvider as explained in the Checking Credentials During Navigation part of the documentation: // in authProvider.js

Show server-side validation errors after failed form submit

安稳与你 提交于 2019-12-10 13:36:01
问题 How can I show validation messages after failed form submit? API request returns HTTP 400 'application/problem+json' response and contains violations as a list with field path. https://tools.ietf.org/html/rfc7807#section-3 { "type": "https://example.net/validation-error", "title": "Your request parameters didn't validate.", "invalid-params": [ { "name": "age", "reason": "must be a positive integer" }, { "name": "color", "reason": "must be 'green', 'red' or 'blue'" } ] } 回答1: I have the