react-admin

How do I import react-admin in a React Typescript appplication?

假如想象 提交于 2020-07-18 03:56:51
问题 I'm trying to set up a react-admin app in typescript and I can't quite figure out how to import react-admin. It gives me the (simple) error saying "Could not find a declaration file for module 'react-admin'. '.../node_modules/react-admin/lib/index.js' implicitly has an 'any' type. Try `npm install @types/react-admin` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-admin';`" @types/react-admin is not a valid package but I couldn't find anyone else

How to not change the url on list filtering with react-admin?

邮差的信 提交于 2020-05-16 04:08:34
问题 Assume I have a route /customers where a List of customers is being rendered. On that same route there's also a side drawer present. That drawer contains a List with a Filter of help topics . When I start typing in the Filter in the side drawer, the url changes. That's according to how react-admin's list filter is working. The problem is that the customers list is noticing the route changes. In effect it starts querying and reloading customers based on a search term that is related to help

How to embed one React-Admin component inside another; multiple Admin components

这一生的挚爱 提交于 2020-04-16 06:07:29
问题 Is this possible? I'd like to use one <Admin to display other imported <Admin components. I'm hoping to do something like this where MyTool is an imported <Admin component: <Admin layout={MyLayout} dataProvider={myDataProvider} customRoutes={[ <Route exact path="/tools" component={(props) => <MyTool {...props} />}/> ]}> </Admin> 回答1: I did try wrapping each <Admin in my own Provider without any success so I'm considering Francois Z. answer to be definitive. react-admin maintainer here: this

How do you conditionally show fields in “Show” component in react-admin?

自作多情 提交于 2020-03-19 08:10:22
问题 Some fields I want to only show if they have a value. I would expect to do this like so: <Show {...props} > <SimpleShowLayout> { props.record.id ? <TextField source="id" />: null } </SimpleShowLayout> </Show> But that doesn't work. I can make it somewhat work by making each field a higher order component, but I wanted to do something cleaner. Here's the HOC method I have: const exists = WrappedComponent => props => props.record[props.source] ? <WrappedComponent {...props} />: null; const

How do you conditionally show fields in “Show” component in react-admin?

杀马特。学长 韩版系。学妹 提交于 2020-03-19 08:06:28
问题 Some fields I want to only show if they have a value. I would expect to do this like so: <Show {...props} > <SimpleShowLayout> { props.record.id ? <TextField source="id" />: null } </SimpleShowLayout> </Show> But that doesn't work. I can make it somewhat work by making each field a higher order component, but I wanted to do something cleaner. Here's the HOC method I have: const exists = WrappedComponent => props => props.record[props.source] ? <WrappedComponent {...props} />: null; const

前端开发框架React-Admin

假装没事ソ 提交于 2020-03-02 11:38:15
前言 React-Admin是基于React16.x、Ant Design3.x的管理系统架构。 采用前后端分离,内置了许多管理系统常用功能,通过一些脚本、封装帮助开发人员快速开发管理系统,集中精力处理业务逻辑。 背景 一般的互联网公司内部或者对外都会有大量的管理系统,传统公司一般有后端开发人员进行管理系统开发,所用技术大多都是jsp、模版语言等。 随着公司的发展,管理系统数量和复杂度不端增加,开发人员耗费大量的精力在开发和维护管理系统上。 由于管理系统大多是公司内部使用,很多公司、团队并不重视,导致可用性差、bug多、页面丑陋。使用者怨声载道,开发者苦不堪言。。。 技术迭代 随着前端的技术发展迭代,传统的基于后端模版语言、jQuery的开发方式已经过时,难以应对复杂的需求、快速的项目迭代。 近几年随着React、Es6等技术的兴起,让前端可以与后端分离、可以组件化模块化,拥有了构建大型复杂项目的能力。 困难 WebPack开发五分钟,配置两小时,各种解决方案要结合:React、组件库、Redux、Router、ajax、国际化、主题、Less、CSS Module。。。 社区上有很多好的工具、组件,但是整合起来形成系统的解决方案的寥寥无几。要自己做一个?基础代码才刚刚写的溜,还要加班改bug,哪儿有时间搞框架~ React-Admin介绍 React

随行付微服务前端开发框架React Admin

会有一股神秘感。 提交于 2020-03-02 11:03:52
前言 React-Admin是基于 React16.x 、 Ant Design3.x 的管理系统架构。 采用前后端分离,内置了许多管理系统常用功能,通过一些脚本、封装帮助开发人员快速开发管理系统,集中精力处理业务逻辑。 背景 一般的互联网公司内部或者对外都会有大量的管理系统,传统公司一般有后端开发人员进行管理系统开发,所用技术大多都是jsp、模版语言等。 随着公司的发展,管理系统数量和复杂度不端增加,开发人员耗费大量的精力在开发和维护管理系统上。 由于管理系统大多是公司内部使用,很多公司、团队并不重视,导致可用性差、bug多、页面丑陋。使用者怨声载道,开发者苦不堪言。。。 技术迭代 随着前端的技术发展迭代,传统的基于后端模版语言、jQuery的开发方式已经过时,难以应对复杂的需求、快速的项目迭代。 近几年随着React、Es6等技术的兴起,让前端可以与后端分离、可以组件化模块化,拥有了构建大型复杂项目的能力。 困难 WebPack开发五分钟,配置两小时,各种解决方案要结合:React、组件库、Redux、Router、ajax、国际化、主题、Less、CSS Module。。。 社区上有很多好的工具、组件,但是整合起来形成系统的解决方案的寥寥无几。要自己做一个?基础代码才刚刚写的溜,还要加班改bug,哪儿有时间搞框架~ React-Admin介绍 React

Use server-side validation response in react-admin

北城余情 提交于 2020-02-28 07:13:06
问题 In my app using react-admin I have a few forms where the validation must be performed on the server side. My API (implemented with api-platform) returns a 400 response with a key in its body that contains an array of the constraint violations, keyed to the field names, so the information is there to provide field-by-field error messages. This issue is the same explored in this old question. However, since react-admin moved from redux-form to react-final-form, solutions based on an error saga

How can I use an asynchronous javascript function like fetch inside a FormDataConsumer

丶灬走出姿态 提交于 2020-02-24 04:35:11
问题 I need to use a fetch inside the FormDataConsumer tag but it seems FormDataConsumer does not support async functions. This code didn't work for me: <FormDataConsumer> { async ({ formData, scopedFormData, getSource, ...rest }) => { return await fetch('/api/v1/attributes/'+scopedFormData.single_attributes_label) .then(res => res.json()) .then(data => { console.log(JSON.stringify(data)); //return JSON.stringify(data); resolve(JSON.stringify(data)); }); return JSON.stringify(scopedFormData); } }

How can I use an asynchronous javascript function like fetch inside a FormDataConsumer

╄→гoц情女王★ 提交于 2020-02-24 04:35:10
问题 I need to use a fetch inside the FormDataConsumer tag but it seems FormDataConsumer does not support async functions. This code didn't work for me: <FormDataConsumer> { async ({ formData, scopedFormData, getSource, ...rest }) => { return await fetch('/api/v1/attributes/'+scopedFormData.single_attributes_label) .then(res => res.json()) .then(data => { console.log(JSON.stringify(data)); //return JSON.stringify(data); resolve(JSON.stringify(data)); }); return JSON.stringify(scopedFormData); } }