mirror of
https://github.com/strapi/strapi.git
synced 2025-11-07 05:38:13 +00:00
Fix PR feedback
This commit is contained in:
parent
e5393acf66
commit
3c108fe555
@ -65,8 +65,7 @@
|
|||||||
"test:unit": "FORCE_COLOR=true lerna run test --parallel",
|
"test:unit": "FORCE_COLOR=true lerna run test --parallel",
|
||||||
"test:e2e": "FORCE_COLOR=true jest --config jest.config.e2e.js --runInBand --verbose --forceExit --detectOpenHandles",
|
"test:e2e": "FORCE_COLOR=true jest --config jest.config.e2e.js --runInBand --verbose --forceExit --detectOpenHandles",
|
||||||
"test:generate-app": "node test/createTestApp.js",
|
"test:generate-app": "node test/createTestApp.js",
|
||||||
"test:start-app": "node test/startTestApp.js",
|
"test:start-app": "node test/startTestApp.js"
|
||||||
"build": "node ./scripts/build.js"
|
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"email": "hi@strapi.io",
|
"email": "hi@strapi.io",
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import messages from './messages.json';
|
|||||||
defineMessages(messages);
|
defineMessages(messages);
|
||||||
|
|
||||||
function LeftMenuFooter({ version, ...rest }) {
|
function LeftMenuFooter({ version, ...rest }) {
|
||||||
// eslint-disable-line react/prefer-stateless-function
|
|
||||||
const staticLinks = [
|
const staticLinks = [
|
||||||
{
|
{
|
||||||
icon: 'book',
|
icon: 'book',
|
||||||
@ -28,6 +27,7 @@ function LeftMenuFooter({ version, ...rest }) {
|
|||||||
destination: 'https://strapi.io/help',
|
destination: 'https://strapi.io/help',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.leftMenuFooter}>
|
<div className={styles.leftMenuFooter}>
|
||||||
<ul className={styles.list}>
|
<ul className={styles.list}>
|
||||||
@ -44,7 +44,8 @@ function LeftMenuFooter({ version, ...rest }) {
|
|||||||
<FormattedMessage {...messages.poweredBy} key="poweredBy" />
|
<FormattedMessage {...messages.poweredBy} key="poweredBy" />
|
||||||
<a key="website" href="https://strapi.io" target="_blank">
|
<a key="website" href="https://strapi.io" target="_blank">
|
||||||
Strapi
|
Strapi
|
||||||
</a>{' '}
|
</a>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
href={`https://github.com/strapi/strapi/releases/tag/v${version}`}
|
href={`https://github.com/strapi/strapi/releases/tag/v${version}`}
|
||||||
key="github"
|
key="github"
|
||||||
|
|||||||
@ -99,17 +99,19 @@ export class Admin extends React.Component {
|
|||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
const {
|
const {
|
||||||
admin: { didGetSecuredData, isLoading, isSecured },
|
admin: { didGetSecuredData, isLoading, isSecured },
|
||||||
|
getHook,
|
||||||
|
getSecuredData,
|
||||||
location: { pathname },
|
location: { pathname },
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (!isLoading && this.state.shouldSecureAfterAllPluginsAreMounted) {
|
if (!isLoading && this.state.shouldSecureAfterAllPluginsAreMounted) {
|
||||||
if (!this.hasApluginNotReady(this.props)) {
|
if (!this.hasApluginNotReady(this.props)) {
|
||||||
this.props.getHook('willSecure');
|
getHook('willSecure');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevProps.location.pathname !== pathname) {
|
if (prevProps.location.pathname !== pathname) {
|
||||||
this.props.getHook('willSecure');
|
getHook('willSecure');
|
||||||
|
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (this.isAcceptingTracking()) {
|
if (this.isAcceptingTracking()) {
|
||||||
@ -120,11 +122,11 @@ export class Admin extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prevProps.admin.isSecured !== isSecured && isSecured) {
|
if (prevProps.admin.isSecured !== isSecured && isSecured) {
|
||||||
this.props.getSecuredData();
|
getSecuredData();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevProps.admin.didGetSecuredData !== didGetSecuredData) {
|
if (prevProps.admin.didGetSecuredData !== didGetSecuredData) {
|
||||||
this.props.getHook('didGetSecuredData');
|
getHook('didGetSecuredData');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ Object {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`getData Saga should dispatch the getInitDataSucceeded action it it requests the data successfully 1`] = `
|
exports[`getData Saga should dispatch the getInitDataSucceeded action if it requests the data successfully 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"@@redux-saga/IO": true,
|
"@@redux-saga/IO": true,
|
||||||
"ALL": Array [
|
"ALL": Array [
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
/* eslint-disable redux-saga/yield-effects */
|
/* eslint-disable redux-saga/yield-effects */
|
||||||
import { all, fork, put, takeLatest } from 'redux-saga/effects';
|
import { all, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
// import { take, call, put, select } from 'redux-saga/effects';
|
|
||||||
import defaultSaga, { emitter, getData, getSecuredData } from '../saga';
|
import defaultSaga, { emitter, getData, getSecuredData } from '../saga';
|
||||||
|
|
||||||
import { getInitDataSucceeded } from '../actions';
|
import { getInitDataSucceeded } from '../actions';
|
||||||
@ -26,7 +25,7 @@ describe('getData Saga', () => {
|
|||||||
expect(callDescriptor).toMatchSnapshot();
|
expect(callDescriptor).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should dispatch the getInitDataSucceeded action it it requests the data successfully', () => {
|
it('should dispatch the getInitDataSucceeded action if it requests the data successfully', () => {
|
||||||
const response = [
|
const response = [
|
||||||
{ uuid: 'uuid' },
|
{ uuid: 'uuid' },
|
||||||
{ strapiVersion: 'beta' },
|
{ strapiVersion: 'beta' },
|
||||||
|
|||||||
@ -18,7 +18,6 @@ import LoadingIndicatorPage from 'components/LoadingIndicatorPage';
|
|||||||
|
|
||||||
import '../../styles/main.scss';
|
import '../../styles/main.scss';
|
||||||
|
|
||||||
// import AdminPage from '../AdminPage';
|
|
||||||
import Admin from '../Admin';
|
import Admin from '../Admin';
|
||||||
import NotFoundPage from '../NotFoundPage';
|
import NotFoundPage from '../NotFoundPage';
|
||||||
import NotificationProvider from '../NotificationProvider';
|
import NotificationProvider from '../NotificationProvider';
|
||||||
@ -39,10 +38,10 @@ function App(props) {
|
|||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route
|
<Route
|
||||||
path='/'
|
path="/"
|
||||||
render={router => <Admin {...props} {...router} />}
|
render={router => <Admin {...props} {...router} />}
|
||||||
/>
|
/>
|
||||||
<Route path='' component={NotFoundPage} />
|
<Route path="" component={NotFoundPage} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -11,7 +11,12 @@ import { createStructuredSelector } from 'reselect';
|
|||||||
import { bindActionCreators, compose } from 'redux';
|
import { bindActionCreators, compose } from 'redux';
|
||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
|
|
||||||
import { ButtonDropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap';
|
import {
|
||||||
|
ButtonDropdown,
|
||||||
|
DropdownItem,
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownToggle,
|
||||||
|
} from 'reactstrap';
|
||||||
|
|
||||||
import makeSelectLocale from '../LanguageProvider/selectors';
|
import makeSelectLocale from '../LanguageProvider/selectors';
|
||||||
import { changeLocale } from '../LanguageProvider/actions';
|
import { changeLocale } from '../LanguageProvider/actions';
|
||||||
@ -20,10 +25,11 @@ import { languages } from '../../i18n';
|
|||||||
import makeSelectLocaleToggle from './selectors';
|
import makeSelectLocaleToggle from './selectors';
|
||||||
import styles from './styles.scss';
|
import styles from './styles.scss';
|
||||||
|
|
||||||
export class LocaleToggle extends React.Component { // eslint-disable-line
|
export class LocaleToggle extends React.Component {
|
||||||
|
// eslint-disable-line
|
||||||
state = { isOpen: false };
|
state = { isOpen: false };
|
||||||
|
|
||||||
getFlagUrl = (locale) => {
|
getFlagUrl = locale => {
|
||||||
switch (locale) {
|
switch (locale) {
|
||||||
case 'en':
|
case 'en':
|
||||||
return 'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/us.svg';
|
return 'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/us.svg';
|
||||||
@ -41,13 +47,16 @@ export class LocaleToggle extends React.Component { // eslint-disable-line
|
|||||||
default:
|
default:
|
||||||
return `https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/${locale}.svg`;
|
return `https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/${locale}.svg`;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
toggle = () => this.setState(prevState => ({ isOpen: !prevState.isOpen }));
|
toggle = () => this.setState(prevState => ({ isOpen: !prevState.isOpen }));
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { currentLocale: { locale }, localeToggle: { className } } = this.props;
|
const {
|
||||||
const style = cn(styles.localeDropdownMenu, styles[className] );
|
currentLocale: { locale },
|
||||||
|
localeToggle: { className },
|
||||||
|
} = this.props;
|
||||||
|
const style = cn(styles.localeDropdownMenu, styles[className]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.localeToggle}>
|
<div className={styles.localeToggle}>
|
||||||
@ -56,10 +65,17 @@ export class LocaleToggle extends React.Component { // eslint-disable-line
|
|||||||
<span>{locale}</span>
|
<span>{locale}</span>
|
||||||
<img src={this.getFlagUrl(locale)} alt={locale} />
|
<img src={this.getFlagUrl(locale)} alt={locale} />
|
||||||
</DropdownToggle>
|
</DropdownToggle>
|
||||||
{/* <DropdownMenu className={cn(styles.localeDropdownMenu, this.props.isLogged ? '' : styles.localeDropdownMenuNotLogged)}> */}
|
|
||||||
<DropdownMenu className={style}>
|
<DropdownMenu className={style}>
|
||||||
{languages.map(language => (
|
{languages.map(language => (
|
||||||
<DropdownItem key={language} onClick={() => this.props.changeLocale(language)} className={cn(styles.localeToggleItem, locale === language ? styles.localeToggleItemActive : '')}>
|
<DropdownItem
|
||||||
|
key={language}
|
||||||
|
onClick={() => this.props.changeLocale(language)}
|
||||||
|
className={cn(
|
||||||
|
styles.localeToggleItem,
|
||||||
|
locale === language ? styles.localeToggleItemActive : '',
|
||||||
|
)}
|
||||||
|
>
|
||||||
{language.toUpperCase()}
|
{language.toUpperCase()}
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
))}
|
))}
|
||||||
@ -70,8 +86,6 @@ export class LocaleToggle extends React.Component { // eslint-disable-line
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LocaleToggle.propTypes = {
|
LocaleToggle.propTypes = {
|
||||||
changeLocale: PropTypes.func.isRequired,
|
changeLocale: PropTypes.func.isRequired,
|
||||||
currentLocale: PropTypes.object.isRequired,
|
currentLocale: PropTypes.object.isRequired,
|
||||||
@ -92,8 +106,9 @@ export function mapDispatchToProps(dispatch) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
const withConnect = connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps,
|
||||||
|
);
|
||||||
|
|
||||||
export default compose(
|
export default compose(withConnect)(LocaleToggle);
|
||||||
withConnect,
|
|
||||||
)(LocaleToggle);
|
|
||||||
|
|||||||
@ -5,10 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { fromJS } from 'immutable';
|
import { fromJS } from 'immutable';
|
||||||
import {
|
import { RESET_DEFAULT_CLASSNAME, SET_CUSTOM_CLASSNAME } from './constants';
|
||||||
RESET_DEFAULT_CLASSNAME,
|
|
||||||
SET_CUSTOM_CLASSNAME,
|
|
||||||
} from './constants';
|
|
||||||
|
|
||||||
const initialState = fromJS({
|
const initialState = fromJS({
|
||||||
className: null,
|
className: null,
|
||||||
@ -17,7 +14,7 @@ const initialState = fromJS({
|
|||||||
function localeToggleReducer(state = initialState, action) {
|
function localeToggleReducer(state = initialState, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case RESET_DEFAULT_CLASSNAME:
|
case RESET_DEFAULT_CLASSNAME:
|
||||||
return state.update('className', () => null);
|
return state.update('className', () => initialState.get('className'));
|
||||||
case SET_CUSTOM_CLASSNAME:
|
case SET_CUSTOM_CLASSNAME:
|
||||||
return state.update('className', () => action.className);
|
return state.update('className', () => action.className);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -26,14 +26,20 @@ export function PluginDispatcher(props) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { mainComponent, name, preventComponentRendering } = pluginToRender;
|
const {
|
||||||
const blockerComponentProps = pluginToRender.blockerComponentProps;
|
blockerComponent,
|
||||||
|
blockerComponentProps,
|
||||||
|
mainComponent,
|
||||||
|
name,
|
||||||
|
preventComponentRendering,
|
||||||
|
} = pluginToRender;
|
||||||
let PluginEntryComponent = preventComponentRendering
|
let PluginEntryComponent = preventComponentRendering
|
||||||
? BlockerComponent
|
? BlockerComponent
|
||||||
: mainComponent;
|
: mainComponent;
|
||||||
|
|
||||||
if (preventComponentRendering && pluginToRender.blockerComponent) {
|
// Change the plugin's blockerComponent if the plugin uses a custom one.
|
||||||
PluginEntryComponent = pluginToRender.blockerComponent;
|
if (preventComponentRendering && blockerComponent) {
|
||||||
|
PluginEntryComponent = blockerComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -47,9 +53,14 @@ export function PluginDispatcher(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PluginDispatcher.defaultProps = {};
|
PluginDispatcher.defaultProps = {};
|
||||||
|
|
||||||
PluginDispatcher.propTypes = {
|
PluginDispatcher.propTypes = {
|
||||||
global: PropTypes.object.isRequired,
|
global: PropTypes.object.isRequired,
|
||||||
match: PropTypes.object.isRequired,
|
match: PropTypes.shape({
|
||||||
|
params: PropTypes.shape({
|
||||||
|
pluginId: PropTypes.string,
|
||||||
|
}),
|
||||||
|
}).isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(PluginDispatcher);
|
export default memo(PluginDispatcher);
|
||||||
|
|||||||
@ -69,11 +69,11 @@ class TableListRow extends React.Component {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
toggleModalWarning = () => this.setState({ showWarning: !this.state.showWarning });
|
toggleModalWarning = () => this.setState(prevState => ({ showWarning: !prevState.showWarning }));
|
||||||
|
|
||||||
handleShowModalWarning = () => {
|
handleShowModalWarning = () => {
|
||||||
if (this.props.canOpenModalAddContentType || this.props.rowItem.isTemporary === true) {
|
if (this.props.canOpenModalAddContentType || this.props.rowItem.isTemporary === true) {
|
||||||
this.setState({ showWarning: !this.state.showWarning });
|
this.setState(prevState => ({ showWarning: !prevState.showWarning }));
|
||||||
} else {
|
} else {
|
||||||
strapi.notification.info(`${pluginId}.notification.info.contentType.creating.notSaved`);
|
strapi.notification.info(`${pluginId}.notification.info.contentType.creating.notSaved`);
|
||||||
}
|
}
|
||||||
@ -97,9 +97,7 @@ class TableListRow extends React.Component {
|
|||||||
) : (
|
) : (
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
const description = isEmpty(this.props.rowItem.description)
|
const description = isEmpty(this.props.rowItem.description) ? '-' : this.props.rowItem.description;
|
||||||
? '-'
|
|
||||||
: this.props.rowItem.description;
|
|
||||||
const spanStyle = this.props.rowItem.isTemporary ? '60%' : '100%';
|
const spanStyle = this.props.rowItem.isTemporary ? '60%' : '100%';
|
||||||
const icons = this.props.rowItem.source
|
const icons = this.props.rowItem.source
|
||||||
? []
|
? []
|
||||||
@ -124,8 +122,8 @@ class TableListRow extends React.Component {
|
|||||||
<div className={`col-md-5 text-center ${styles.descriptionContainer}`}>
|
<div className={`col-md-5 text-center ${styles.descriptionContainer}`}>
|
||||||
<div>{description}</div>
|
<div>{description}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='col-md-2 text-center'>{this.props.rowItem.fields}</div>
|
<div className="col-md-2 text-center">{this.props.rowItem.fields}</div>
|
||||||
<div className='col-md-1'>
|
<div className="col-md-1">
|
||||||
<IcoContainer icons={icons} />
|
<IcoContainer icons={icons} />
|
||||||
</div>
|
</div>
|
||||||
<PopUpWarning
|
<PopUpWarning
|
||||||
|
|||||||
@ -54,7 +54,7 @@ export function* deleteModel({
|
|||||||
const appMenu = get(
|
const appMenu = get(
|
||||||
appPlugins,
|
appPlugins,
|
||||||
['content-manager', 'leftMenuSections'],
|
['content-manager', 'leftMenuSections'],
|
||||||
[],
|
[{ links: [] }],
|
||||||
);
|
);
|
||||||
const updatedMenu = appMenu[0].links.filter(
|
const updatedMenu = appMenu[0].links.filter(
|
||||||
el => el.destination !== modelName,
|
el => el.destination !== modelName,
|
||||||
|
|||||||
@ -37,7 +37,10 @@ class PopUpForm extends React.Component {
|
|||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { values } = nextProps;
|
const { values } = nextProps;
|
||||||
|
|
||||||
if (get(values, 'enabled') && get(values, 'enabled') !== get(this.props.values, 'enabled')) {
|
if (
|
||||||
|
get(values, 'enabled') &&
|
||||||
|
get(values, 'enabled') !== get(this.props.values, 'enabled')
|
||||||
|
) {
|
||||||
this.setState({ enabled: get(values, 'enabled') });
|
this.setState({ enabled: get(values, 'enabled') });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,13 +63,17 @@ class PopUpForm extends React.Component {
|
|||||||
default: {
|
default: {
|
||||||
const value = get(this.props.values, 'callback', '');
|
const value = get(this.props.values, 'callback', '');
|
||||||
|
|
||||||
return startsWith(value, 'http') ? value : `${strapi.backendURL}${value}`;
|
return startsWith(value, 'http')
|
||||||
|
? value
|
||||||
|
: `${strapi.backendURL}${value}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
generateRedirectURL = url => {
|
generateRedirectURL = url => {
|
||||||
return startsWith(url, 'https://') || startsWith(url, 'http://') || this.state.isEditing
|
return startsWith(url, 'https://') ||
|
||||||
|
startsWith(url, 'http://') ||
|
||||||
|
this.state.isEditing
|
||||||
? url
|
? url
|
||||||
: `${strapi.backendURL}${startsWith(url, '/') ? '' : '/'}${url}`;
|
: `${strapi.backendURL}${startsWith(url, '/') ? '' : '/'}${url}`;
|
||||||
};
|
};
|
||||||
@ -92,37 +99,51 @@ class PopUpForm extends React.Component {
|
|||||||
handleFocus = () => this.setState({ isEditing: true });
|
handleFocus = () => this.setState({ isEditing: true });
|
||||||
|
|
||||||
renderForm = () => {
|
renderForm = () => {
|
||||||
const { dataToEdit, settingType, values } = this.props;
|
const {
|
||||||
const form = Object.keys(values.options || values || {}).reduce((acc, current) => {
|
dataToEdit,
|
||||||
const path = settingType === 'email-templates' ? ['options', current] : [current];
|
didCheckErrors,
|
||||||
const name = settingType === 'email-templates' ? 'options.' : '';
|
formErrors,
|
||||||
|
settingType,
|
||||||
|
values,
|
||||||
|
} = this.props;
|
||||||
|
const form = Object.keys(values.options || values || {}).reduce(
|
||||||
|
(acc, current) => {
|
||||||
|
const path =
|
||||||
|
settingType === 'email-templates' ? ['options', current] : [current];
|
||||||
|
const name = settingType === 'email-templates' ? 'options.' : '';
|
||||||
|
|
||||||
if (isObject(get(values, path)) && !isArray(get(values, path))) {
|
if (isObject(get(values, path)) && !isArray(get(values, path))) {
|
||||||
return Object.keys(get(values, path, {}))
|
return Object.keys(get(values, path, {}))
|
||||||
.reduce((acc, curr) => {
|
.reduce((acc, curr) => {
|
||||||
acc.push(`${name}${current}.${curr}`);
|
acc.push(`${name}${current}.${curr}`);
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, [])
|
}, [])
|
||||||
.concat(acc);
|
.concat(acc);
|
||||||
} else if (current !== 'icon' && current !== 'scope') {
|
} else if (current !== 'icon' && current !== 'scope') {
|
||||||
acc.push(`${name}${current}`);
|
acc.push(`${name}${current}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
if (settingType === 'providers') {
|
if (settingType === 'providers') {
|
||||||
return (
|
return (
|
||||||
<div className={`row ${styles.providerDisabled}`}>
|
<div className={`row ${styles.providerDisabled}`}>
|
||||||
<Input
|
<Input
|
||||||
inputDescription={{ id: 'users-permissions.PopUpForm.Providers.enabled.description' }}
|
inputDescription={{
|
||||||
label={{ id: 'users-permissions.PopUpForm.Providers.enabled.label' }}
|
id: 'users-permissions.PopUpForm.Providers.enabled.description',
|
||||||
|
}}
|
||||||
|
label={{
|
||||||
|
id: 'users-permissions.PopUpForm.Providers.enabled.label',
|
||||||
|
}}
|
||||||
name={`${settingType}.${dataToEdit}.enabled`}
|
name={`${settingType}.${dataToEdit}.enabled`}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
type='toggle'
|
type="toggle"
|
||||||
validations={{}}
|
validations={{}}
|
||||||
value={get(this.props.values, 'enabled', this.state.enabled)}
|
value={get(values, 'enabled', this.state.enabled)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{form.length > 1 && <div className={styles.separator} />}
|
{form.length > 1 && <div className={styles.separator} />}
|
||||||
@ -130,11 +151,11 @@ class PopUpForm extends React.Component {
|
|||||||
{map(tail(form), (value, key) => (
|
{map(tail(form), (value, key) => (
|
||||||
<Input
|
<Input
|
||||||
autoFocus={key === 0}
|
autoFocus={key === 0}
|
||||||
customBootstrapClass='col-md-12'
|
customBootstrapClass="col-md-12"
|
||||||
didCheckErrors={this.props.didCheckErrors}
|
didCheckErrors={didCheckErrors}
|
||||||
errors={get(
|
errors={get(
|
||||||
this.props.formErrors,
|
formErrors,
|
||||||
[findIndex(this.props.formErrors, ['name', value]), 'errors'],
|
[findIndex(formErrors, ['name', value]), 'errors'],
|
||||||
[],
|
[],
|
||||||
)}
|
)}
|
||||||
key={value}
|
key={value}
|
||||||
@ -157,7 +178,7 @@ class PopUpForm extends React.Component {
|
|||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
type='text'
|
type="text"
|
||||||
value={
|
value={
|
||||||
includes(value, 'callback') || includes(value, 'redirect_uri')
|
includes(value, 'callback') || includes(value, 'redirect_uri')
|
||||||
? this.generateRedirectURL(get(values, value))
|
? this.generateRedirectURL(get(values, value))
|
||||||
@ -168,13 +189,13 @@ class PopUpForm extends React.Component {
|
|||||||
))}
|
))}
|
||||||
{dataToEdit !== 'email' && (
|
{dataToEdit !== 'email' && (
|
||||||
<Input
|
<Input
|
||||||
customBootstrapClass='col-md-12'
|
customBootstrapClass="col-md-12"
|
||||||
disabled
|
disabled
|
||||||
label={{
|
label={{
|
||||||
id: `users-permissions.PopUpForm.Providers.${dataToEdit}.providerConfig.redirectURL`,
|
id: `users-permissions.PopUpForm.Providers.${dataToEdit}.providerConfig.redirectURL`,
|
||||||
}}
|
}}
|
||||||
name='noName'
|
name="noName"
|
||||||
type='text'
|
type="text"
|
||||||
onChange={() => {}}
|
onChange={() => {}}
|
||||||
value={this.getRedirectURIProviderConf()}
|
value={this.getRedirectURIProviderConf()}
|
||||||
validations={{}}
|
validations={{}}
|
||||||
@ -187,16 +208,16 @@ class PopUpForm extends React.Component {
|
|||||||
const params = {
|
const params = {
|
||||||
link: (
|
link: (
|
||||||
<a
|
<a
|
||||||
href='https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/docs/email-templates.md'
|
href="https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/docs/email-templates.md"
|
||||||
target='_blank'
|
target="_blank"
|
||||||
>
|
>
|
||||||
<FormattedMessage id='users-permissions.PopUpForm.Email.link.documentation' />
|
<FormattedMessage id="users-permissions.PopUpForm.Email.link.documentation" />
|
||||||
</a>
|
</a>
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='row'>
|
<div className="row">
|
||||||
{map(take(form, 3), (value, key) => (
|
{map(take(form, 3), (value, key) => (
|
||||||
<Input
|
<Input
|
||||||
autoFocus={key === 0}
|
autoFocus={key === 0}
|
||||||
@ -213,14 +234,16 @@ class PopUpForm extends React.Component {
|
|||||||
placeholder={`users-permissions.PopUpForm.Email.${value}.placeholder`}
|
placeholder={`users-permissions.PopUpForm.Email.${value}.placeholder`}
|
||||||
type={includes(value, 'email') ? 'email' : 'text'}
|
type={includes(value, 'email') ? 'email' : 'text'}
|
||||||
value={get(values, value)}
|
value={get(values, value)}
|
||||||
validations={value !== 'options.response_email' ? { required: true } : {}}
|
validations={
|
||||||
|
value !== 'options.response_email' ? { required: true } : {}
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<div className='col-md-6' />
|
<div className="col-md-6" />
|
||||||
{map(takeRight(form, 2), value => (
|
{map(takeRight(form, 2), value => (
|
||||||
<Input
|
<Input
|
||||||
key={value}
|
key={value}
|
||||||
customBootstrapClass='col-md-12'
|
customBootstrapClass="col-md-12"
|
||||||
didCheckErrors={this.props.didCheckErrors}
|
didCheckErrors={this.props.didCheckErrors}
|
||||||
errors={get(
|
errors={get(
|
||||||
this.props.formErrors,
|
this.props.formErrors,
|
||||||
@ -275,20 +298,30 @@ class PopUpForm extends React.Component {
|
|||||||
toggle={this.context.unsetDataToEdit}
|
toggle={this.context.unsetDataToEdit}
|
||||||
className={`${styles.modalPosition}`}
|
className={`${styles.modalPosition}`}
|
||||||
>
|
>
|
||||||
<ModalHeader toggle={this.context.unsetDataToEdit} className={styles.modalHeader} />
|
<ModalHeader
|
||||||
|
toggle={this.context.unsetDataToEdit}
|
||||||
|
className={styles.modalHeader}
|
||||||
|
/>
|
||||||
<div className={styles.headerContainer}>
|
<div className={styles.headerContainer}>
|
||||||
<div>{header}</div>
|
<div>{header}</div>
|
||||||
</div>
|
</div>
|
||||||
<form onSubmit={this.props.onSubmit}>
|
<form onSubmit={this.props.onSubmit}>
|
||||||
<ModalBody className={styles.modalBody}>
|
<ModalBody className={styles.modalBody}>
|
||||||
<div className='container-fluid'>{this.renderForm()}</div>
|
<div className="container-fluid">{this.renderForm()}</div>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter className={styles.modalFooter}>
|
<ModalFooter className={styles.modalFooter}>
|
||||||
<Button onClick={() => this.context.unsetDataToEdit()} className={styles.secondary}>
|
<Button
|
||||||
<FormattedMessage id='users-permissions.PopUpForm.button.cancel' />
|
onClick={() => this.context.unsetDataToEdit()}
|
||||||
|
className={styles.secondary}
|
||||||
|
>
|
||||||
|
<FormattedMessage id="users-permissions.PopUpForm.button.cancel" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button type='submit' onClick={this.props.onSubmit} className={styles.primary}>
|
<Button
|
||||||
<FormattedMessage id='users-permissions.PopUpForm.button.save' />
|
type="submit"
|
||||||
|
onClick={this.props.onSubmit}
|
||||||
|
className={styles.primary}
|
||||||
|
>
|
||||||
|
<FormattedMessage id="users-permissions.PopUpForm.button.save" />
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user