admin-on-rest

Admin-on-rest, Edit Page - Incorrect Element Error

大兔子大兔子 提交于 2019-12-23 05:32:18
问题 I'm using admin-on-rest in my frontend side. But when I click Edit button in the list page, it orients to Edit page successfully but there is always an error like "INCORRECT ELEMENT". Do you know why? Thank you enter image description here enter image description here App.js import { DataTypeList } from './Components/DataType/DataTypeList'; import { FeatureList } from './Components/FeatureList'; import { DataPointTypeList } from './Components/DataPointTypeList'; import DashBoard from '.

How to dynamically change the “title” of “app”, based on login info (i.e. after login succeeds or logout)?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 02:32:41
问题 I have this code, please see the title prop: const App = () => ( <Admin theme={theme} customRoutes={customRoutes} menu={Menu} dataProvider={loopbackRestClient(window.apiUrl)} authProvider={authClient()} dashboard={Dashboard} locale="en" i18nProvider={i18nProvider} title={`Dashboard - ${window.accountData ? window.accountData.accommodation.name : ''}`} > // more code here... This tries to change the rendered title when login succeeds and therefore we get different accommodation.name value from

How to exclude fields from SimpleForm

别来无恙 提交于 2019-12-13 18:57:04
问题 I know <SimpleForm> is using redux-form. I want to exclude specific fields from being sent when I submit the form. When I edit my entity "User" the RestClient send a GET_ONE request and my API response this: { name: "Lior", age: "100", type: "Manager", } The <SimpleForm> is like this: <SimpleForm> <TextInput source="name"/> <TextInput source="age"/> </SimpleForm> When I send the form, the fields I see in the request are: name, age and type even when there is no "input" or "field" for type .

Is there a way to “simulate” pressing the refresh button to refresh a List?

假如想象 提交于 2019-12-12 05:25:35
问题 Is there a way to "simulate" pressing the refresh button to refresh a List? I have a list that I want it to update every 10 seconds. Is there a way to "press" the refresh button every 10 seconds? My list name is ActiveJobsList. This is what I have at the moment: export function autoRefresh() { var counter = 10; var id; if(location.href.includes("activejobs")) { id = setInterval(function() { counter--; if(counter < 0 && location.href.includes("activejobs")) { // What should go here?

Admin-on-rest - how to sync other components with query filtered from List?

扶醉桌前 提交于 2019-12-12 04:00:03
问题 I want to implement this structure in the page: 1. Cards with summary (revenue, users, etc.) 2. Map from google maps 3. List element Inside List element there is filtering. I am stuck how to user filter options when filtering list to represent filtered information in the map and cards. As @trixn recommended I am using this structure: // app.js <Admin restClient={jsonServerRestClient('http://jsonplaceholder.typicode.com')}> <Resource name="posts" list={MyCustomPostList} /* other views */ /> <

Error on Creating custom ReferenceInput with separate component

冷暖自知 提交于 2019-12-11 17:13:29
问题 I'm trying to creating my ReferenceInput which contains SelectInput inside of it. The code below is works perfectly (Please focus at ReferenceInput) However, I would like to separate it into another component and pass data as props. I made it like this. When I run it, this error occurs in this file https://github.com/marmelab/admin-on-rest/blob/49a616c93d1ee5ea0bfa3c5f7abea0bb29c8d01c/src/mui/input/ReferenceInput.js#L243 What wrong did I do ? Thanks 回答1: Input components are using Redux-Form

Is there any examples of how to create a custom login page?

ぃ、小莉子 提交于 2019-12-11 07:57:29
问题 Creating your own custom login page is mentioned in the authentication section of the documentation but I cannot find any resources instructing you on how to do so. Essentially I'd just like to use an email instead of a username. I tried to copy the default Login component from https://github.com/marmelab/admin-on-rest/blob/master/src/mui/auth/Login.js and just change username to email but I'm seeing an error to do with use of compose.js in the enhance function. 回答1: I did it. Please check

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

how to create an entity inside another in the same form using admin-on-rest?

倖福魔咒の 提交于 2019-12-11 07:06:00
问题 I have Plants that have many Infos each.. I want to be able to edit/create a Plant and create adhoc an Info attached to it.. Here is how I have built the PlantEdit and PlantCreate: export const PlantEdit = (props) => ( <Edit title={<PlantTitle />} {...props}> <SimpleForm> <TextInput source="name"/> </SimpleForm> </List> </Edit> ); export const PlantCreate = (props) => ( <Create {...props}> <SimpleForm> <TextInput source="name"/> </SimpleForm> </Create> ); here is the InfoCreate function - it

Admin on REST how to set path for list elements

谁说胖子不能爱 提交于 2019-12-11 06:13:17
问题 I am new in Admin on REST. my response for /users is like on this: { "status": 200, "response": { "data": [ { "id": 298487355, "login": "000000000053" }, ... ] } "error": "text error" } how can I set path for response : data : [...] to get list of users? Thanks 回答1: you can customize your restClient. for example I choose to work with jsonServer so I have this in app.js : import customRestClient from './customRestClient' const App = () => ( <Admin restClient={customRestClient('http://path.to