mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
Fix UX on inputchange for database name
This commit is contained in:
parent
09f1563275
commit
66a1f3a6ba
@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { isEmpty, includes, mapKeys, reject, map, isObject, union, findIndex, uniqBy } from 'lodash';
|
import { isEmpty, includes, mapKeys, reject, map, isObject, union, findIndex, uniqBy, remove } from 'lodash';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import WithInput from 'components/WithInput';
|
import WithInput from 'components/WithInput';
|
||||||
|
|
||||||
@ -50,6 +50,8 @@ class InputText extends React.Component { // eslint-disable-line react/prefer-st
|
|||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (this.props.errors !== nextProps.errors) {
|
if (this.props.errors !== nextProps.errors) {
|
||||||
const errors = uniqBy(union(this.state.errors, nextProps.errors), 'id');
|
const errors = uniqBy(union(this.state.errors, nextProps.errors), 'id');
|
||||||
|
|
||||||
|
if (isEmpty(nextProps.errors)) remove(errors, (error) => error.id === 'settings-manager.request.error.database.exist');
|
||||||
this.setState({ errors });
|
this.setState({ errors });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +154,7 @@ class InputText extends React.Component { // eslint-disable-line react/prefer-st
|
|||||||
|
|
||||||
const label = this.props.name ? <label htmlFor={this.props.name}><FormattedMessage id={`settings-manager.${this.props.name}`} /></label> : '';
|
const label = this.props.name ? <label htmlFor={this.props.name}><FormattedMessage id={`settings-manager.${this.props.name}`} /></label> : '';
|
||||||
const spacer = !this.props.name ? {marginTop: '2.4rem'} : {marginTop: ''};
|
const spacer = !this.props.name ? {marginTop: '2.4rem'} : {marginTop: ''};
|
||||||
|
|
||||||
const input = placeholder ? this.renderFormattedInput(handleBlur, inputValue, placeholder)
|
const input = placeholder ? this.renderFormattedInput(handleBlur, inputValue, placeholder)
|
||||||
: <input
|
: <input
|
||||||
name={this.props.target}
|
name={this.props.target}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user