diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c30d9811ce..214ad5ec1d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -26,3 +26,4 @@ - [ ] MongoDB - [ ] MySQL - [ ] Postgres +- [ ] SQLite diff --git a/docs/3.x.x/guides/authentication.md b/docs/3.x.x/guides/authentication.md index cc956add90..e7c90e4906 100644 --- a/docs/3.x.x/guides/authentication.md +++ b/docs/3.x.x/guides/authentication.md @@ -1,19 +1,48 @@ # Authentication -::: warning -This feature requires the Users & Permissions plugin (installed by default). -::: +This Authentication API requires the Users & Permissions plugin which comes with Strapi, installed by default. + +## Token usage + +A jwt token may be used for making permission-restricted API requests. To make an API request as a user, place the jwt token into an `Authorization` header of the GET request. A request without a token, will assume the `public` role permissions by default. Modify the permissions of each user's role in admin dashboard. Authentication failures return a 401 (unauthorized) error. + +#### Usage + +- The `token` variable is the `data.jwt` received when login in or registering. + +```js +import axios from 'axios'; + +const token = 'YOUR_TOKEN_HERE'; + +// Request API. +axios + .get('http://localhost:1337/posts', { + headers: { + Authorization: `Bearer ${token}` + } + }) + .then(response => { + // Handle success. + console.log('Data: ', response.data); + }) + .catch(error => { + // Handle error. + console.log('An error occurred:', error); + }); +``` ## Registration -This route lets you create new users. +Creates a new user in the database with a default role as 'registered'. #### Usage ```js import axios from 'axios'; -// Request API. +// Request API. +// Add your own code here to customize or restrict how the public can register new users. axios .post('http://localhost:1337/auth/local/register', { username: 'Strapi user', @@ -34,7 +63,7 @@ axios ## Login -This route lets you login your users by getting an authentication token. +Submit the user's identifier and password credentials for authentication. When the authentication is successful, the response data returned will have the users information along with a jwt authentication token. #### Local @@ -76,12 +105,12 @@ Strapi comes with the following providers: --- -To use the providers authentication, set your credentials in the admin interface (Plugin Users & Permissions > Providers). +Set your providers credentials in the admin interface (Plugin Users & Permissions > Providers). Then update and enable the provider you want use. -Redirect your user to: `GET /connect/:provider`. eg: `GET /connect/facebook` +To authenticate the user, use the GET method to request the url, `/connect/:provider`. eg: `GET /connect/facebook` -After his approval, he will be redirected to `/auth/:provider/callback`. The `jwt` and `user` data will be available in the body response. +After authentication, create and customize your own redirect callback at `/auth/:provider/callback`. The `jwt` and `user` data will be available in a .json response. Response payload: @@ -92,36 +121,6 @@ Response payload: } ``` -## Token usage - -By default, each API request is identified as `guest` role (see permissions of `guest`'s role in your admin dashboard). To make a request as a user, you have to set the `Authorization` token in your request headers. You receive a 401 error if you are not authorized to make this request or if your authorization header is not correct. - -#### Usage - -- The `token` variable is the `data.jwt` received when login in or registering. - -```js -import axios from 'axios'; - -const token = 'YOUR_TOKEN_HERE'; - -// Request API. -axios - .get('http://localhost:1337/posts', { - headers: { - Authorization: `Bearer ${token}` - } - }) - .then(response => { - // Handle success. - console.log('Data: ', response.data); - }) - .catch(error => { - // Handle error. - console.log('An error occurred:', error); - }); -``` - ## Forgotten password This action sends an email to a user with the link of you reset password page. This link contains an URL param `code` which is required to reset user password. @@ -220,18 +219,15 @@ packages/strapi-plugin-users-permissions/admin/src/translations/en.json We will go step by step. ### Configure your Provider Request -First, we need to configure our new provider onto `Provider.js` file. +Configure the new provider in the `Provider.js` file at the `getProfile` function. -Jump onto the `getProfile` function, you will see the list of currently available providers in the form of a `switch...case`. - -As you can see, `getProfile` take three params: +The `getProfile` takes three params: 1. provider :: The name of the used provider as a string. 2. query :: The query is the result of the provider callback. 3. callback :: The callback function who will continue the internal Strapi login logic. -Let's take the `discord` one as an example since it's not the easier, it should cover most of the case you -may encounter trying to implement your own provider. +Here is an example that uses the `discord` provider. #### Configure your oauth generic information @@ -259,14 +255,16 @@ may encounter trying to implement your own provider. } ``` -So here, you can see that we use a module called `Purest`. This module gives us with a generic way to interact -with the REST API. +This code creates a `Purest` object that gives us a generic way to interact with the provider's REST API. -To understand each value usage, and the templating syntax, I invite you to read the [Official Purest Documentation](https://github.com/simov/purest/tree/2.x) +For more specs on using the `Purest` module, please refer to the [Official Purest Documentation](https://github.com/simov/purest/tree/2.x) You may also want to take a look onto the numerous already made configurations [here](https://github.com/simov/purest-providers/blob/master/config/providers.json). -#### Retrieve your user informations: +#### Retrieve your user's information: + +For our discord provider it will look like: + ```js discord.query().get('users/@me').auth(access_token).request((err, res, body) => { if (err) { @@ -300,9 +298,9 @@ to retrieve your user from the database and log you in. Now, we need to configure our 'model' for our new provider. That way, our settings can be stored in the database, and managed from the admin panel. -Into: `packages/strapi-plugin-users-permissions/config/functions/bootstrap.js` +Open the file `packages/strapi-plugin-users-permissions/config/functions/bootstrap.js` -Simply add the fields your provider need into the `grantConfig` object. +Add the fields your provider needs into the `grantConfig` object. For our discord provider it will look like: ```js @@ -319,31 +317,29 @@ For our discord provider it will look like: }, ``` -You have already done the hard part, now, we simply need to make our new provider available from the front -side of our application. So let's do it! - ### Configure frontend for your new provider -First, let's edit: `packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js` -As for backend, we have a `switch...case` where we need to put our new provider info. +To make the new provider available on the front end of the application, +edit `packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js` +Add the new provider info. For our discord provider it will look like: ```js case 'discord': return `${strapi.backendURL}/connect/discord/callback`; ``` -Add the corresponding translation into: `packages/strapi-plugin-users-permissions/admin/src/translations/en.json` +### Add language translation + +Add the language translation in `packages/strapi-plugin-users-permissions/admin/src/translations/en.json` ```js 'PopUpForm.Providers.discord.providerConfig.redirectURL': 'The redirect URL to add in your Discord application configurations', ```` -These two change will set up the popup message who appear on the UI when we will configure our new provider. - -That's it, now you should be able to use your new provider. +These two change will set up the popup message that appears in the UI. That's it, now you should be able to use your new provider. ## Email templates diff --git a/packages/strapi-admin/admin/src/app.js b/packages/strapi-admin/admin/src/app.js index 5dacde44bf..754c27534b 100644 --- a/packages/strapi-admin/admin/src/app.js +++ b/packages/strapi-admin/admin/src/app.js @@ -13,7 +13,7 @@ import 'whatwg-fetch'; import { getAppPluginsSucceeded, unsetHasUserPlugin, -} from 'containers/App/actions'; +} from './containers/App/actions'; import { basename, store } from './createStore'; import './intlPolyfill'; import './public-path'; diff --git a/packages/strapi-admin/admin/src/appDev.js b/packages/strapi-admin/admin/src/appDev.js index 14dff854a3..3710ccc341 100644 --- a/packages/strapi-admin/admin/src/appDev.js +++ b/packages/strapi-admin/admin/src/appDev.js @@ -6,12 +6,12 @@ */ import { findIndex } from 'lodash'; +import 'babel-polyfill'; +import 'sanitize.css/sanitize.css'; import { getAppPluginsSucceeded, unsetHasUserPlugin, -} from 'containers/App/actions'; -import 'babel-polyfill'; -import 'sanitize.css/sanitize.css'; +} from './containers/App/actions'; import { store } from './createStore'; import render from './renderApp'; import './intlPolyfill'; diff --git a/packages/strapi-admin/admin/src/components/InstallPluginPopup/index.js b/packages/strapi-admin/admin/src/components/InstallPluginPopup/index.js index 95de1be494..7da80071dc 100644 --- a/packages/strapi-admin/admin/src/components/InstallPluginPopup/index.js +++ b/packages/strapi-admin/admin/src/components/InstallPluginPopup/index.js @@ -11,7 +11,7 @@ import { Modal, ModalHeader, ModalBody } from 'reactstrap'; import { map } from 'lodash'; import cn from 'classnames'; -import Official from 'components/Official'; +import Official from '../Official'; // import StarsContainer from 'components/StarsContainer'; import styles from './styles.scss'; diff --git a/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js b/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js index ec6f44ca77..1a10007fd8 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js +++ b/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js @@ -8,7 +8,7 @@ import React from 'react'; import { defineMessages, FormattedMessage } from 'react-intl'; import { PropTypes } from 'prop-types'; -import LeftMenuLink from 'components/LeftMenuLink'; +import LeftMenuLink from '../LeftMenuLink'; import styles from './styles.scss'; import messages from './messages.json'; diff --git a/packages/strapi-admin/admin/src/components/LeftMenuLink/index.js b/packages/strapi-admin/admin/src/components/LeftMenuLink/index.js index 3ee932c32c..51a577fdf0 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuLink/index.js +++ b/packages/strapi-admin/admin/src/components/LeftMenuLink/index.js @@ -10,7 +10,7 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; -import en from 'translations/en.json'; +import en from '../../translations/en.json'; import styles from './styles.scss'; diff --git a/packages/strapi-admin/admin/src/components/LeftMenuLinkContainer/index.js b/packages/strapi-admin/admin/src/components/LeftMenuLinkContainer/index.js index 8334a3b250..673e4b1940 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuLinkContainer/index.js +++ b/packages/strapi-admin/admin/src/components/LeftMenuLinkContainer/index.js @@ -9,7 +9,7 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { findIndex, get, snakeCase, isEmpty, map, sortBy } from 'lodash'; -import LeftMenuLink from 'components/LeftMenuLink'; +import LeftMenuLink from '../LeftMenuLink'; import styles from './styles.scss'; import messages from './messages.json'; diff --git a/packages/strapi-admin/admin/src/components/ListPlugins/index.js b/packages/strapi-admin/admin/src/components/ListPlugins/index.js index 64a6ead46d..f7d8e6e5d3 100644 --- a/packages/strapi-admin/admin/src/components/ListPlugins/index.js +++ b/packages/strapi-admin/admin/src/components/ListPlugins/index.js @@ -12,7 +12,7 @@ import { map, size } from 'lodash'; // Design import Button from 'components/Button'; -import Row from 'components/Row'; +import Row from '../Row'; import styles from './styles.scss'; diff --git a/packages/strapi-admin/admin/src/components/NotificationsContainer/index.js b/packages/strapi-admin/admin/src/components/NotificationsContainer/index.js index a34208afe6..14302bf858 100644 --- a/packages/strapi-admin/admin/src/components/NotificationsContainer/index.js +++ b/packages/strapi-admin/admin/src/components/NotificationsContainer/index.js @@ -8,7 +8,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { CSSTransition, TransitionGroup } from 'react-transition-group'; -import Notification from 'components/Notification'; +import Notification from '../Notification'; import styles from './styles.scss'; diff --git a/packages/strapi-admin/admin/src/components/Official/index.js b/packages/strapi-admin/admin/src/components/Official/index.js index 22aa25d2fd..2c20399baa 100644 --- a/packages/strapi-admin/admin/src/components/Official/index.js +++ b/packages/strapi-admin/admin/src/components/Official/index.js @@ -10,7 +10,6 @@ import PropTypes from 'prop-types'; import styles from './styles.scss'; function Official(props) { - return ( + + + ); + } +} +Onboarding.contextTypes = { + emitEvent: PropTypes.func, +}; + +Onboarding.defaultProps = { + onClick: () => {}, + removeVideos: () => {}, + setVideoDuration: () => {}, + setVideoEnd: () => {}, + shouldOpenModal: false, + videos: [], + updateVideoStartTime: () => {}, +}; + +Onboarding.propTypes = { + getVideos: PropTypes.func.isRequired, + onClick: PropTypes.func, + removeVideos: PropTypes.func, + setVideoDuration: PropTypes.func, + setVideoEnd: PropTypes.func, + shouldOpenModal: PropTypes.bool, + updateVideoStartTime: PropTypes.func, + videos: PropTypes.array, +}; + +const mapStateToProps = makeSelectOnboarding(); + +function mapDispatchToProps(dispatch) { + return bindActionCreators({ getVideos, onClick, setVideoDuration, updateVideoStartTime, setVideoEnd, removeVideos }, dispatch); +} + +const withConnect = connect( + mapStateToProps, + mapDispatchToProps, +); + +/* Remove this line if the container doesn't have a route and + * check the documentation to see how to create the container's store + */ +const withReducer = injectReducer({ key: 'onboarding', reducer }); + +/* Remove the line below the container doesn't have a route and + * check the documentation to see how to create the container's store + */ +const withSaga = injectSaga({ key: 'onboarding', saga }); + +export default compose( + withReducer, + withSaga, + withConnect, +)(Onboarding); diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/reducer.js b/packages/strapi-admin/admin/src/containers/Onboarding/reducer.js new file mode 100644 index 0000000000..06e15ff8ec --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/reducer.js @@ -0,0 +1,69 @@ +/* + * + * Onboarding reducer + * + */ + +import { fromJS } from 'immutable'; +import { GET_VIDEOS_SUCCEEDED, SHOULD_OPEN_MODAL, ON_CLICK, SET_VIDEOS_DURATION, UPDATE_VIDEO_START_TIME, SET_VIDEO_END, REMOVE_VIDEOS } from './constants'; + +const initialState = fromJS({ + videos: fromJS([]), +}); + +function onboardingReducer(state = initialState, action) { + switch (action.type) { + case GET_VIDEOS_SUCCEEDED: + return state.update('videos', () => fromJS(action.videos)); + case SHOULD_OPEN_MODAL: + return state.update('shouldOpenModal', () => action.opened); + case ON_CLICK: + return state.updateIn(['videos'], list => { + return list.reduce((acc, current, index) => { + + if (index === action.index) { + return acc.updateIn([index, 'isOpen'], v => !v); + } + + return acc.updateIn([index, 'isOpen'], () => false); + }, list); + }); + case SET_VIDEOS_DURATION: + return state.updateIn(['videos', action.index, 'duration'], () => action.duration); + case UPDATE_VIDEO_START_TIME: { + + const storedVideos = JSON.parse(localStorage.getItem('videos')); + const videos = state.updateIn(['videos'], list => { + return list.reduce((acc, current, index) => { + + if (index === action.index) { + storedVideos[index].startTime = action.startTime; + return acc.updateIn([index, 'startTime'], () => action.startTime); + } + + storedVideos[index].startTime = 0; + + return acc.updateIn([index, 'startTime'], () => 0); + }, list); + }); + + localStorage.setItem('videos', JSON.stringify(storedVideos)); + + return videos; + } + case SET_VIDEO_END: { + + const storedVideos = JSON.parse(localStorage.getItem('videos')); + storedVideos[action.index].end = action.end; + localStorage.setItem('videos', JSON.stringify(storedVideos)); + + return state.updateIn(['videos', action.index, 'end'], () => action.end); + } + case REMOVE_VIDEOS: + return initialState; + default: + return state; + } +} + +export default onboardingReducer; diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/saga.js b/packages/strapi-admin/admin/src/containers/Onboarding/saga.js new file mode 100644 index 0000000000..541a9aed58 --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/saga.js @@ -0,0 +1,66 @@ +import request from 'utils/request'; +import { all, call, fork, takeLatest, put } from 'redux-saga/effects'; + +import { GET_VIDEOS } from './constants'; +import { getVideosSucceeded, shouldOpenModal } from './actions'; + +function* getVideos() { + try { + const data = yield call(request, 'https://strapi.io/videos', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }, + false, + true, + { noAuth: true }, + ); + + const storedVideo = JSON.parse(localStorage.getItem('videos')) || null; + + const videos = data.map(video => { + const { end, startTime } = storedVideo ? storedVideo.find(v => v.order === video.order) : { end: false, startTime: 0}; + + return { + ...video, + duration: null, + end, + isOpen: false, + key: video.order, + startTime, + }; + }).sort((a,b) => (a.order - b.order)); + + localStorage.setItem('videos', JSON.stringify(videos)); + + yield put( + getVideosSucceeded(videos), + ); + + const isFirstTime = JSON.parse(localStorage.getItem('onboarding')) || null; + + if (isFirstTime === null) { + yield new Promise(resolve => { + setTimeout(() => { + resolve(); + }, 500); + }); + + yield put( + shouldOpenModal(true), + ); + localStorage.setItem('onboarding', true); + } + + } catch (err) { + console.log(err); // eslint-disable-line no-console + } +} + + +function* defaultSaga() { + yield all([fork(takeLatest, GET_VIDEOS, getVideos)]); +} + +export default defaultSaga; diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/selectors.js b/packages/strapi-admin/admin/src/containers/Onboarding/selectors.js new file mode 100644 index 0000000000..2f5dd23c08 --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/selectors.js @@ -0,0 +1,25 @@ +import { createSelector } from 'reselect'; + +/** + * Direct selector to the onboarding state domain + */ +const selectOnboardingDomain = () => (state) => state.get('onboarding'); + +/** + * Other specific selectors + */ + + +/** + * Default selector used by Onboarding + */ + +const makeSelectOnboarding = () => createSelector( + selectOnboardingDomain(), + (substate) => substate.toJS() +); + +export default makeSelectOnboarding; +export { + selectOnboardingDomain, +}; diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/styles.scss b/packages/strapi-admin/admin/src/containers/Onboarding/styles.scss new file mode 100644 index 0000000000..1d0af4dcd4 --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/styles.scss @@ -0,0 +1,116 @@ +.videosWrapper { + position: fixed; + right: 15px; + bottom: 15px; + button, + button:focus, + a { + cursor: pointer; + outline: 0; + } + p { + margin-bottom: 0; + } + .videosHeader { + padding: 25px 15px 0 15px; + p { + display: inline-block; + vertical-align: top; + width: 50%; + font-family: Lato; + font-weight: bold; + font-size: 11px; + color: #5c5f66; + letter-spacing: 0.5px; + text-transform: uppercase; + &:last-of-type { + color: #5a9e06; + text-align: right; + } + } + } + &.visible { + opacity: 1; + } + &.hidden { + opacity: 0; + } + .videosContent { + min-width: 320px; + margin-bottom: 10px; + margin-right: 15px; + background-color: white; + box-shadow: 0 2px 4px 0 #e3e9f3; + border-radius: 3px; + overflow: hidden; + &.shown { + animation: fadeIn 0.5s forwards; + } + &.hide { + animation: fadeOut 0.5s forwards; + } + + ul { + padding: 10px 0; + margin-bottom: 0; + list-style: none; + } + } + .openBtn { + float: right; + width: 38px; + height: 38px; + button { + width: 100%; + height: 100%; + border-radius: 50%; + color: white; + background: #0e7de7; + box-shadow: 0px 2px 4px 0px rgba(227, 233, 243, 1); + i:last-of-type { + display: none; + } + &.active { + i:first-of-type { + display: none; + } + i:last-of-type { + display: block; + } + } + } + } +} + + +@keyframes fadeIn { + 0% { + width: auto; + height: auto; + opacity: 0; + } + + 5% { + opacity: 0; + } + + 100% { + opacity: 1; + } +} + +@keyframes fadeOut { + 0% { + opacity: 1; + } + + 60% { + opacity: 0; + } + + 100% { + opacity: 0; + width: 0; + height: 0; + } +} \ No newline at end of file diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/tests/actions.test.js b/packages/strapi-admin/admin/src/containers/Onboarding/tests/actions.test.js new file mode 100644 index 0000000000..336c014b91 --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/tests/actions.test.js @@ -0,0 +1,18 @@ + +import { + defaultAction, +} from '../actions'; +import { + DEFAULT_ACTION, +} from '../constants'; + +describe('Onboarding actions', () => { + describe('Default Action', () => { + it('has a type of DEFAULT_ACTION', () => { + const expected = { + type: DEFAULT_ACTION, + }; + expect(defaultAction()).toEqual(expected); + }); + }); +}); diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/tests/index.test.js b/packages/strapi-admin/admin/src/containers/Onboarding/tests/index.test.js new file mode 100644 index 0000000000..dec83b8b24 --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/tests/index.test.js @@ -0,0 +1,10 @@ +// import React from 'react'; +// import { shallow } from 'enzyme'; + +// import { Onboarding } from '../index'; + +describe('', () => { + it('Expect to have unit tests specified', () => { + expect(true).toEqual(true); + }); +}); diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/tests/reducer.test.js b/packages/strapi-admin/admin/src/containers/Onboarding/tests/reducer.test.js new file mode 100644 index 0000000000..dfe1223f3f --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/tests/reducer.test.js @@ -0,0 +1,9 @@ + +import { fromJS } from 'immutable'; +import onboardingReducer from '../reducer'; + +describe('onboardingReducer', () => { + it('returns the initial state', () => { + expect(onboardingReducer(undefined, [])).toEqual(fromJS([])); + }); +}); diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/tests/saga.test.js b/packages/strapi-admin/admin/src/containers/Onboarding/tests/saga.test.js new file mode 100644 index 0000000000..a5d8823023 --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/tests/saga.test.js @@ -0,0 +1,15 @@ +/** + * Test sagas + */ + +/* eslint-disable redux-saga/yield-effects */ +// import { take, call, put, select } from 'redux-saga/effects'; +// import { defaultSaga } from '../saga'; + +// const generator = defaultSaga(); + +describe('defaultSaga Saga', () => { + it('Expect to have unit tests specified', () => { + expect(true).toEqual(true); + }); +}); diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/tests/selectors.test.js b/packages/strapi-admin/admin/src/containers/Onboarding/tests/selectors.test.js new file mode 100644 index 0000000000..2c24a379eb --- /dev/null +++ b/packages/strapi-admin/admin/src/containers/Onboarding/tests/selectors.test.js @@ -0,0 +1,10 @@ +// import { fromJS } from 'immutable'; +// import { makeSelectOnboardingDomain } from '../selectors'; + +// const selector = makeSelectOnboardingDomain(); + +describe('makeSelectOnboardingDomain', () => { + it('Expect to have unit tests specified', () => { + expect(true).toEqual(true); + }); +}); diff --git a/packages/strapi-admin/admin/src/containers/PluginPage/index.js b/packages/strapi-admin/admin/src/containers/PluginPage/index.js index 8ef6a1d2a2..04bad48ef1 100644 --- a/packages/strapi-admin/admin/src/containers/PluginPage/index.js +++ b/packages/strapi-admin/admin/src/containers/PluginPage/index.js @@ -13,7 +13,7 @@ import { createSelector } from 'reselect'; import BlockerComponent from 'components/BlockerComponent'; import ErrorBoundary from 'components/ErrorBoundary'; -import { selectPlugins } from 'containers/App/selectors'; +import { selectPlugins } from '../App/selectors'; export class PluginPage extends React.Component { // eslint-disable-line react/prefer-stateless-function render() { diff --git a/packages/strapi-admin/admin/src/reducers.js b/packages/strapi-admin/admin/src/reducers.js index af77133771..29af47f30c 100644 --- a/packages/strapi-admin/admin/src/reducers.js +++ b/packages/strapi-admin/admin/src/reducers.js @@ -6,9 +6,9 @@ import { fromJS } from 'immutable'; import { combineReducers } from 'redux-immutable'; import { LOCATION_CHANGE } from 'react-router-redux'; -import globalReducer from 'containers/App/reducer'; -import languageProviderReducer from 'containers/LanguageProvider/reducer'; -import notificationProviderReducer from 'containers/NotificationProvider/reducer'; +import globalReducer from './containers/App/reducer'; +import languageProviderReducer from './containers/LanguageProvider/reducer'; +import notificationProviderReducer from './containers/NotificationProvider/reducer'; /* * routeReducer diff --git a/packages/strapi-admin/admin/src/renderApp.js b/packages/strapi-admin/admin/src/renderApp.js index da4ad9eb68..09733ab1cc 100644 --- a/packages/strapi-admin/admin/src/renderApp.js +++ b/packages/strapi-admin/admin/src/renderApp.js @@ -6,8 +6,8 @@ import { Provider } from 'react-redux'; import React from 'react'; import ReactDOM from 'react-dom'; import { ConnectedRouter } from 'react-router-redux'; -import LanguageProvider from 'containers/LanguageProvider'; -import App from 'containers/App'; +import LanguageProvider from './containers/LanguageProvider'; +import App from './containers/App'; import { history, store } from './createStore'; const render = (translatedMessages) => { @@ -23,4 +23,4 @@ const render = (translatedMessages) => { ); }; -export default render; \ No newline at end of file +export default render; diff --git a/packages/strapi-admin/admin/src/strapi.js b/packages/strapi-admin/admin/src/strapi.js index fb2263fa14..f81a894735 100644 --- a/packages/strapi-admin/admin/src/strapi.js +++ b/packages/strapi-admin/admin/src/strapi.js @@ -8,8 +8,8 @@ import { pluginLoaded, unfreezeApp, updatePlugin, -} from 'containers/App/actions'; -import { showNotification } from 'containers/NotificationProvider/actions'; +} from './containers/App/actions'; +import { showNotification } from './containers/NotificationProvider/actions'; import injectReducer from './utils/injectReducer'; import injectSaga from './utils/injectSaga'; import { history, store } from './createStore'; diff --git a/packages/strapi-admin/admin/src/translations/en.json b/packages/strapi-admin/admin/src/translations/en.json index 67dacc1e6c..a8b948af6b 100644 --- a/packages/strapi-admin/admin/src/translations/en.json +++ b/packages/strapi-admin/admin/src/translations/en.json @@ -84,6 +84,8 @@ "app.components.NotFoundPage.back": "Back to homepage", "app.components.NotFoundPage.description": "Not Found", "app.components.Official": "Official", + "app.components.Onboarding.label.completed": "% completed", + "app.components.Onboarding.title": "Get Started Videos", "app.components.PluginCard.Button.label.download": "Download", "app.components.PluginCard.Button.label.install": "Already installed", "app.components.PluginCard.Button.label.support": "Support us", @@ -145,4 +147,4 @@ "notification.error.layout": "Couldn't retrieve the layout", "request.error.model.unknown": "This model doesn't exist", "app.utils.delete": "Delete" -} +} \ No newline at end of file diff --git a/packages/strapi-admin/admin/src/translations/fr.json b/packages/strapi-admin/admin/src/translations/fr.json index ca05153c06..111f504adb 100644 --- a/packages/strapi-admin/admin/src/translations/fr.json +++ b/packages/strapi-admin/admin/src/translations/fr.json @@ -85,6 +85,8 @@ "app.components.NotFoundPage.back": "Retourner à la page d'accueil", "app.components.NotFoundPage.description": "Page introuvable", "app.components.Official": "Officiel", + "app.components.Onboarding.label.completed": "% complétées", + "app.components.Onboarding.title": "Démarrons ensemble", "app.components.PluginCard.Button.label.download": "Télécharger", "app.components.PluginCard.Button.label.install": "Déjà installé", "app.components.PluginCard.Button.label.support": "Nous soutenir", @@ -146,4 +148,4 @@ "notification.error.layout": "Impossible de récupérer le layout de l'admin", "request.error.model.unknown": "Le model n'existe pas", "app.utils.delete": "Supprimer" -} +} \ No newline at end of file diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json index cf271d1c57..ff118fbbb2 100644 --- a/packages/strapi-admin/package.json +++ b/packages/strapi-admin/package.json @@ -27,8 +27,10 @@ "dependencies": { "intl": "^1.2.5", "react-ga": "^2.4.1", + "redux": "^4.0.1", "remove-markdown": "^0.2.2", - "shelljs": "^0.7.8" + "shelljs": "^0.7.8", + "video-react": "^0.13.2" }, "devDependencies": { "cross-env": "^5.0.5", diff --git a/packages/strapi-admin/scripts/preSetup.js b/packages/strapi-admin/scripts/preSetup.js index 52b6f15523..2d71979bea 100644 --- a/packages/strapi-admin/scripts/preSetup.js +++ b/packages/strapi-admin/scripts/preSetup.js @@ -36,4 +36,4 @@ if (isDevelopmentMode) { shell.exec('npm install', {silent}); } -shell.echo('Packaged installed successfully'); +shell.echo('Packages installed successfully'); diff --git a/packages/strapi-generate-api/templates/bookshelf/service.template b/packages/strapi-generate-api/templates/bookshelf/service.template index f20d20582f..a847f40253 100644 --- a/packages/strapi-generate-api/templates/bookshelf/service.template +++ b/packages/strapi-generate-api/templates/bookshelf/service.template @@ -121,7 +121,7 @@ module.exports = { const data = _.omit(values, <%= globalID %>.associations.map(ast => ast.alias)); // Create entry with no-relational data. - const entry = <%= globalID %>.forge(params).save(data); + const entry = await <%= globalID %>.forge(params).save(data); // Create relational data and return the entry. return <%= globalID %>.updateRelations(Object.assign(params, { values: relations })); diff --git a/packages/strapi-generate-new/files/.npmrc b/packages/strapi-generate-new/files/.npmrc new file mode 100644 index 0000000000..43c97e719a --- /dev/null +++ b/packages/strapi-generate-new/files/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/packages/strapi-helper-plugin/lib/internals/scripts/loadAdminConfigurations.js b/packages/strapi-helper-plugin/lib/internals/scripts/loadAdminConfigurations.js index 1e5523f0d0..ed26d3c605 100644 --- a/packages/strapi-helper-plugin/lib/internals/scripts/loadAdminConfigurations.js +++ b/packages/strapi-helper-plugin/lib/internals/scripts/loadAdminConfigurations.js @@ -16,9 +16,13 @@ if (!isSetup) { strapi.log.level = 'silent'; (async () => { - await strapi.load({ - environment: process.env.NODE_ENV, - }); + try { + await strapi.load({ + environment: process.env.NODE_ENV, + }); + } catch (e) { + // console.log(e); + } // Force exit process if an other process doen't exit during Strapi load. process.exit(); diff --git a/packages/strapi-helper-plugin/lib/server/middlewares/frontendMiddleware.js b/packages/strapi-helper-plugin/lib/server/middlewares/frontendMiddleware.js index 19b6228af6..3d9db23d93 100644 --- a/packages/strapi-helper-plugin/lib/server/middlewares/frontendMiddleware.js +++ b/packages/strapi-helper-plugin/lib/server/middlewares/frontendMiddleware.js @@ -47,7 +47,7 @@ const addDevMiddlewares = (app, webpackConfig) => { /** * Front-end middleware */ -module.exports = (app) => { +module.exports = app => { const webpackConfig = require('../../internals/webpack/webpack.dev.babel'); // const webpackConfig = require(path.resolve(process.cwd(), 'node_modules', 'strapi-helper-plugin', 'internals', 'webpack', 'webpack.dev.babel')); diff --git a/packages/strapi-helper-plugin/lib/src/app.js b/packages/strapi-helper-plugin/lib/src/app.js index 860dc141d0..c666f72f38 100644 --- a/packages/strapi-helper-plugin/lib/src/app.js +++ b/packages/strapi-helper-plugin/lib/src/app.js @@ -11,7 +11,7 @@ import './public-path.js'; // eslint-disable-line import/extensions import React from 'react'; import Loadable from 'react-loadable'; -import LoadingIndicatorPage from 'components/LoadingIndicatorPage'; +import LoadingIndicatorPage from './components/LoadingIndicatorPage'; import { translationMessages } from './i18n'; const LoadableApp = Loadable({ diff --git a/packages/strapi-helper-plugin/lib/src/components/EmptyAttributesBlock/index.js b/packages/strapi-helper-plugin/lib/src/components/EmptyAttributesBlock/index.js index c84b9aec02..50aadaf4b8 100644 --- a/packages/strapi-helper-plugin/lib/src/components/EmptyAttributesBlock/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/EmptyAttributesBlock/index.js @@ -7,7 +7,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import Button from 'components/Button'; +import Button from '../Button'; import styles from './styles.scss'; function EmptyAttributesBlock({ description, label, onClick, title, id }) { @@ -49,4 +49,4 @@ EmptyAttributesBlock.propTypes = { title: PropTypes.string, }; -export default EmptyAttributesBlock; \ No newline at end of file +export default EmptyAttributesBlock; diff --git a/packages/strapi-helper-plugin/lib/src/components/HeaderNav/index.js b/packages/strapi-helper-plugin/lib/src/components/HeaderNav/index.js index 8d54627c50..b0c212a115 100644 --- a/packages/strapi-helper-plugin/lib/src/components/HeaderNav/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/HeaderNav/index.js @@ -11,7 +11,7 @@ import { map } from 'lodash'; import PropTypes from 'prop-types'; // Utils -import { darken } from 'utils/colors'; +import { darken } from '../../utils/colors'; // Styles import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/IcoContainer/index.js b/packages/strapi-helper-plugin/lib/src/components/IcoContainer/index.js index a80156a5a4..3cb772ec9d 100644 --- a/packages/strapi-helper-plugin/lib/src/components/IcoContainer/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/IcoContainer/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { map } from 'lodash'; import PropTypes from 'prop-types'; -import Ico from 'components/Ico'; +import Ico from '../Ico'; import styles from './styles.scss'; function IcoContainer({ icons }) { diff --git a/packages/strapi-helper-plugin/lib/src/components/ImgPreview/index.js b/packages/strapi-helper-plugin/lib/src/components/ImgPreview/index.js index ea8972e693..202b557d5f 100644 --- a/packages/strapi-helper-plugin/lib/src/components/ImgPreview/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/ImgPreview/index.js @@ -11,9 +11,9 @@ import PropTypes from 'prop-types'; import { get, has, isArray, isEmpty, startsWith, size } from 'lodash'; import cn from 'classnames'; -import BkgImg from 'assets/icons/icon_upload.svg'; -import ImgPreviewArrow from 'components/ImgPreviewArrow'; -import ImgPreviewHint from 'components/ImgPreviewHint'; +import BkgImg from '../../assets/icons/icon_upload.svg'; +import ImgPreviewArrow from '../ImgPreviewArrow'; +import ImgPreviewHint from '../ImgPreviewHint'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputAddonWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputAddonWithErrors/index.js index 512d7b11c0..01a91ad066 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputAddonWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputAddonWithErrors/index.js @@ -9,15 +9,15 @@ import PropTypes from 'prop-types'; import { isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; -// Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputAddon from 'components/InputAddon'; -import InputSpacer from 'components/InputSpacer'; - // Utils -import validateInput from 'utils/inputsValidations'; +import validateInput from '../../utils/inputsValidations'; + +// Design +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputAddon from '../InputAddon'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputCheckbox/Loadable.js b/packages/strapi-helper-plugin/lib/src/components/InputCheckbox/Loadable.js index caed2adc89..b5d3ec9c3d 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputCheckbox/Loadable.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputCheckbox/Loadable.js @@ -1,6 +1,6 @@ import Loadable from 'react-loadable'; -import LoadingIndicator from 'components/LoadingIndicator'; +import LoadingIndicator from '../LoadingIndicator'; export default Loadable({ loader: () => import('./index'), diff --git a/packages/strapi-helper-plugin/lib/src/components/InputCheckboxWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputCheckboxWithErrors/index.js index d3d0c7ac36..9ada89ad99 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputCheckboxWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputCheckboxWithErrors/index.js @@ -11,10 +11,10 @@ import { isEmpty, isObject, isFunction } from 'lodash'; import cn from 'classnames'; // Design -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputCheckbox from 'components/InputCheckbox'; -import InputSpacer from 'components/InputSpacer'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputCheckbox from '../InputCheckbox'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputDate/Loadable.js b/packages/strapi-helper-plugin/lib/src/components/InputDate/Loadable.js index caed2adc89..b5d3ec9c3d 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputDate/Loadable.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputDate/Loadable.js @@ -1,6 +1,6 @@ import Loadable from 'react-loadable'; -import LoadingIndicator from 'components/LoadingIndicator'; +import LoadingIndicator from '../LoadingIndicator'; export default Loadable({ loader: () => import('./index'), diff --git a/packages/strapi-helper-plugin/lib/src/components/InputDateWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputDateWithErrors/index.js index d2bed6485d..070930eab0 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputDateWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputDateWithErrors/index.js @@ -9,15 +9,15 @@ import PropTypes from 'prop-types'; import { get, isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; -// Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputDate from 'components/InputDate'; -import InputSpacer from 'components/InputSpacer'; - // Utils -import validateInput from 'utils/inputsValidations'; +import validateInput from '../../utils/inputsValidations'; + +// Design +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputDate from '../InputDate'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputEmailWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputEmailWithErrors/index.js index cd6da489fa..6974761caa 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputEmailWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputEmailWithErrors/index.js @@ -9,15 +9,15 @@ import PropTypes from 'prop-types'; import { isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; -// Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputEmail from 'components/InputEmail'; -import InputSpacer from 'components/InputSpacer'; - // Utils -import validateInput from 'utils/inputsValidations'; +import validateInput from '../../utils/inputsValidations'; + +// Design +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputEmail from '../InputEmail'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputFile/index.js b/packages/strapi-helper-plugin/lib/src/components/InputFile/index.js index 5f3ca55f3c..035bfe1e7f 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputFile/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputFile/index.js @@ -11,8 +11,8 @@ import { FormattedMessage } from 'react-intl'; import { cloneDeep, isArray, isObject } from 'lodash'; import cn from 'classnames'; -import ImgPreview from 'components/ImgPreview'; -import InputFileDetails from 'components/InputFileDetails'; +import ImgPreview from '../ImgPreview'; +import InputFileDetails from '../InputFileDetails'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/index.js index aeef4c354a..bcb36bb5fa 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/index.js @@ -10,11 +10,11 @@ import cn from 'classnames'; import { differenceBy, isEmpty } from 'lodash'; // Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputFile from 'components/InputFile'; -import InputSpacer from 'components/InputSpacer'; -import InputErrors from 'components/InputErrors'; +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputFile from '../InputFile'; +import InputSpacer from '../InputSpacer'; +import InputErrors from '../InputErrors'; // Styles import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputNumber/Loadable.js b/packages/strapi-helper-plugin/lib/src/components/InputNumber/Loadable.js index caed2adc89..b5d3ec9c3d 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputNumber/Loadable.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputNumber/Loadable.js @@ -1,6 +1,6 @@ import Loadable from 'react-loadable'; -import LoadingIndicator from 'components/LoadingIndicator'; +import LoadingIndicator from '../LoadingIndicator'; export default Loadable({ loader: () => import('./index'), diff --git a/packages/strapi-helper-plugin/lib/src/components/InputNumberWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputNumberWithErrors/index.js index 56668821b4..3598200ad4 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputNumberWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputNumberWithErrors/index.js @@ -3,15 +3,15 @@ import PropTypes from 'prop-types'; import { isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; -// Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputNumber from 'components/InputNumber'; -import InputSpacer from 'components/InputSpacer'; - // Utils -import validateInput from 'utils/inputsValidations'; +import validateInput from '../../utils/inputsValidations'; + +// Design +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputNumber from '../InputNumber'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputPasswordWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputPasswordWithErrors/index.js index c08ef08490..b55d93b7ad 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputPasswordWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputPasswordWithErrors/index.js @@ -9,15 +9,15 @@ import PropTypes from 'prop-types'; import { isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; -// Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputPassword from 'components/InputPassword'; -import InputSpacer from 'components/InputSpacer'; - // Utils -import validateInput from 'utils/inputsValidations'; +import validateInput from '../../utils/inputsValidations'; + +// Design +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputPassword from '../InputPassword'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputSearchWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputSearchWithErrors/index.js index 12913490f7..3c68d0af38 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputSearchWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputSearchWithErrors/index.js @@ -9,15 +9,15 @@ import PropTypes from 'prop-types'; import { isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; -// Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputSearch from 'components/InputSearch'; -import InputSpacer from 'components/InputSpacer'; - // Utils -import validateInput from 'utils/inputsValidations'; +import validateInput from '../../utils/inputsValidations'; + +// Design +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputSearch from '../InputSearch'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputSelect/Loadable.js b/packages/strapi-helper-plugin/lib/src/components/InputSelect/Loadable.js index caed2adc89..b5d3ec9c3d 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputSelect/Loadable.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputSelect/Loadable.js @@ -1,6 +1,6 @@ import Loadable from 'react-loadable'; -import LoadingIndicator from 'components/LoadingIndicator'; +import LoadingIndicator from '../LoadingIndicator'; export default Loadable({ loader: () => import('./index'), diff --git a/packages/strapi-helper-plugin/lib/src/components/InputSelect/index.js b/packages/strapi-helper-plugin/lib/src/components/InputSelect/index.js index 2fa3b79c96..6577f6061e 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputSelect/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputSelect/index.js @@ -10,7 +10,7 @@ import { isEmpty, isObject, map } from 'lodash'; import cn from 'classnames'; // Design -import SelectOption from 'components/SelectOption'; +import SelectOption from '../SelectOption'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputSelectWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputSelectWithErrors/index.js index 0d27421897..20269e95af 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputSelectWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputSelectWithErrors/index.js @@ -10,10 +10,10 @@ import { get, isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; // Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputSelect from 'components/InputSelect'; +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputSelect from '../InputSelect'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputText/Loadable.js b/packages/strapi-helper-plugin/lib/src/components/InputText/Loadable.js index caed2adc89..b5d3ec9c3d 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputText/Loadable.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputText/Loadable.js @@ -1,6 +1,6 @@ import Loadable from 'react-loadable'; -import LoadingIndicator from 'components/LoadingIndicator'; +import LoadingIndicator from '../LoadingIndicator'; export default Loadable({ loader: () => import('./index'), diff --git a/packages/strapi-helper-plugin/lib/src/components/InputTextAreaWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputTextAreaWithErrors/index.js index 54e8547e61..da72bc0328 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputTextAreaWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputTextAreaWithErrors/index.js @@ -3,15 +3,15 @@ import PropTypes from 'prop-types'; import { isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; -// Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputTextArea from 'components/InputTextArea'; -import InputSpacer from 'components/InputSpacer'; - // Utils -import validateInput from 'utils/inputsValidations'; +import validateInput from '../../utils/inputsValidations'; + +// Design +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputTextArea from '../InputTextArea'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputTextWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputTextWithErrors/index.js index 05b5990397..a4cec4ab42 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputTextWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputTextWithErrors/index.js @@ -3,15 +3,15 @@ import PropTypes from 'prop-types'; import { isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; -// Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputText from 'components/InputText'; -import InputSpacer from 'components/InputSpacer'; - // Utils -import validateInput from 'utils/inputsValidations'; +import validateInput from '../../utils/inputsValidations'; + +// Design +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputText from '../InputText'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputToggleWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputToggleWithErrors/index.js index b8740452f6..1ebe7f5ae3 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputToggleWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputToggleWithErrors/index.js @@ -9,11 +9,11 @@ import PropTypes from 'prop-types'; import cn from 'classnames'; import { isEmpty } from 'lodash'; // Design -import Label from 'components/Label'; -import InputDescription from 'components/InputDescription'; -import InputErrors from 'components/InputErrors'; -import InputToggle from 'components/InputToggle'; -import InputSpacer from 'components/InputSpacer'; +import Label from '../Label'; +import InputDescription from '../InputDescription'; +import InputErrors from '../InputErrors'; +import InputToggle from '../InputToggle'; +import InputSpacer from '../InputSpacer'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js b/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js index 8e7cfdf2c6..6558e1e2f4 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js @@ -9,18 +9,18 @@ import PropTypes from 'prop-types'; import { isEmpty, isObject, merge } from 'lodash'; // Design -import InputAddonWithErrors from 'components/InputAddonWithErrors'; -import InputCheckboxWithErrors from 'components/InputCheckboxWithErrors'; -import InputDateWithErrors from 'components/InputDateWithErrors'; -import InputEmailWithErrors from 'components/InputEmailWithErrors'; -import InputFileWithErrors from 'components/InputFileWithErrors'; -import InputNumberWithErrors from 'components/InputNumberWithErrors'; -import InputSearchWithErrors from 'components/InputSearchWithErrors'; -import InputSelectWithErrors from 'components/InputSelectWithErrors'; -import InputPasswordWithErrors from 'components/InputPasswordWithErrors'; -import InputTextAreaWithErrors from 'components/InputTextAreaWithErrors'; -import InputTextWithErrors from 'components/InputTextWithErrors'; -import InputToggleWithErrors from 'components/InputToggleWithErrors'; +import InputAddonWithErrors from '../InputAddonWithErrors'; +import InputCheckboxWithErrors from '../InputCheckboxWithErrors'; +import InputDateWithErrors from '../InputDateWithErrors'; +import InputEmailWithErrors from '../InputEmailWithErrors'; +import InputFileWithErrors from '../InputFileWithErrors'; +import InputNumberWithErrors from '../InputNumberWithErrors'; +import InputSearchWithErrors from '../InputSearchWithErrors'; +import InputSelectWithErrors from '../InputSelectWithErrors'; +import InputPasswordWithErrors from '../InputPasswordWithErrors'; +import InputTextAreaWithErrors from '../InputTextAreaWithErrors'; +import InputTextWithErrors from '../InputTextWithErrors'; +import InputToggleWithErrors from '../InputToggleWithErrors'; const DefaultInputError = ({ type }) =>
Your input type: {type} does not exist
; diff --git a/packages/strapi-helper-plugin/lib/src/components/NotFound/index.js b/packages/strapi-helper-plugin/lib/src/components/NotFound/index.js index 6c629fca70..acb081e380 100644 --- a/packages/strapi-helper-plugin/lib/src/components/NotFound/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/NotFound/index.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import Button from 'components/Button'; +import Button from '../Button'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/PageFooter/index.js b/packages/strapi-helper-plugin/lib/src/components/PageFooter/index.js index 56053b72a4..56e5df63a1 100644 --- a/packages/strapi-helper-plugin/lib/src/components/PageFooter/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/PageFooter/index.js @@ -10,7 +10,7 @@ import cn from 'classnames'; import { get } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import GlobalPagination from 'components/GlobalPagination'; +import GlobalPagination from '../GlobalPagination'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/PluginHeader/index.js b/packages/strapi-helper-plugin/lib/src/components/PluginHeader/index.js index 96af797042..ef20157df1 100644 --- a/packages/strapi-helper-plugin/lib/src/components/PluginHeader/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/PluginHeader/index.js @@ -8,8 +8,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import cn from 'classnames'; -import PluginHeaderTitle from 'components/PluginHeaderTitle'; -import PluginHeaderActions from 'components/PluginHeaderActions'; +import PluginHeaderTitle from '../PluginHeaderTitle'; +import PluginHeaderActions from '../PluginHeaderActions'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/index.js b/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/index.js index 02f1bc0b06..544638b577 100644 --- a/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/index.js @@ -8,7 +8,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { isArray, isFunction } from 'lodash'; -import Button from 'components/Button'; +import Button from '../Button'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/PluginHeaderTitle/index.js b/packages/strapi-helper-plugin/lib/src/components/PluginHeaderTitle/index.js index 83400fb626..ba373dc033 100644 --- a/packages/strapi-helper-plugin/lib/src/components/PluginHeaderTitle/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/PluginHeaderTitle/index.js @@ -9,7 +9,7 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { isEmpty, isFunction, isObject } from 'lodash'; -import LoadingBar from 'components/LoadingBar'; +import LoadingBar from '../LoadingBar'; import styles from './styles.scss'; diff --git a/packages/strapi-helper-plugin/lib/src/components/PopUpWarning/Loadable.js b/packages/strapi-helper-plugin/lib/src/components/PopUpWarning/Loadable.js index caed2adc89..b5d3ec9c3d 100644 --- a/packages/strapi-helper-plugin/lib/src/components/PopUpWarning/Loadable.js +++ b/packages/strapi-helper-plugin/lib/src/components/PopUpWarning/Loadable.js @@ -1,6 +1,6 @@ import Loadable from 'react-loadable'; -import LoadingIndicator from 'components/LoadingIndicator'; +import LoadingIndicator from '../LoadingIndicator'; export default Loadable({ loader: () => import('./index'), diff --git a/packages/strapi-helper-plugin/lib/src/utils/auth.js b/packages/strapi-helper-plugin/lib/src/utils/auth.js index e2316c2cb0..12afec93b5 100644 --- a/packages/strapi-helper-plugin/lib/src/utils/auth.js +++ b/packages/strapi-helper-plugin/lib/src/utils/auth.js @@ -21,7 +21,12 @@ const auth = { clearAppStorage() { if (localStorage) { + const videos = auth.get('videos'); + const onboarding = auth.get('onboarding'); + localStorage.clear(); + localStorage.setItem('videos', JSON.stringify(videos)); + localStorage.setItem('onboarding', onboarding); } if (sessionStorage) { @@ -73,7 +78,6 @@ const auth = { return null; }, - setToken(value = '', isLocalStorage = false, tokenKey = TOKEN_KEY) { return auth.set(value, tokenKey, isLocalStorage); }, diff --git a/packages/strapi-helper-plugin/lib/src/utils/request.js b/packages/strapi-helper-plugin/lib/src/utils/request.js index a83b1606e5..48bfa6233b 100644 --- a/packages/strapi-helper-plugin/lib/src/utils/request.js +++ b/packages/strapi-helper-plugin/lib/src/utils/request.js @@ -1,5 +1,5 @@ import 'whatwg-fetch'; -import auth from 'utils/auth'; +import auth from './auth'; /** * Parses the JSON returned by a network request @@ -20,7 +20,7 @@ function parseJSON(response) { * @return {object|undefined} Returns either the response, or throws an error */ function checkStatus(response, checkToken = true) { - if (response.status >= 200 && response.status < 300) { + if ((response.status >= 200 && response.status < 300) || response.status === 0) { return response; } @@ -41,21 +41,22 @@ function checkTokenValidity(response) { method: 'GET', headers: { 'Content-Type': 'application/json', - 'Authorization': `Bearer ${auth.getToken()}`, + Authorization: `Bearer ${auth.getToken()}`, }, }; if (auth.getToken()) { - return fetch(`${strapi.backendURL}/user/me`, options) - .then(() => { - if (response.status === 401) { - window.location = `${strapi.remoteURL}/plugins/users-permissions/auth/login`; + return fetch(`${strapi.backendURL}/user/me`, options).then(() => { + if (response.status === 401) { + window.location = `${ + strapi.remoteURL + }/plugins/users-permissions/auth/login`; - auth.clearAppStorage(); - } + auth.clearAppStorage(); + } - return checkStatus(response, false); - }); + return checkStatus(response, false); + }); } } @@ -72,12 +73,12 @@ function formatQueryParams(params) { } /** -* Server restart watcher -* @param response -* @returns {object} the response data -*/ + * Server restart watcher + * @param response + * @returns {object} the response data + */ function serverRestartWatcher(response) { - return new Promise((resolve) => { + return new Promise(resolve => { fetch(`${strapi.backendURL}/_health`, { method: 'HEAD', mode: 'no-cors', @@ -93,8 +94,7 @@ function serverRestartWatcher(response) { }) .catch(() => { setTimeout(() => { - return serverRestartWatcher(response) - .then(resolve); + return serverRestartWatcher(response).then(resolve); }, 100); }); }); @@ -108,22 +108,38 @@ function serverRestartWatcher(response) { * * @return {object} The response data */ -export default function request(url, options = {}, shouldWatchServerRestart = false, stringify = true ) { +export default function request(...args) { + let [url, options = {}, shouldWatchServerRestart, stringify = true, ...rest] = args; + let noAuth; + + try { + [{ noAuth }] = rest; + } catch(err) { + noAuth = false; + } + // Set headers if (!options.headers) { - options.headers = Object.assign({ - 'Content-Type': 'application/json', - }, options.headers, { - 'X-Forwarded-Host': 'strapi', - }); + options.headers = Object.assign( + { + 'Content-Type': 'application/json', + }, + options.headers, + { + 'X-Forwarded-Host': 'strapi', + }, + ); } const token = auth.getToken(); - if (token) { - options.headers = Object.assign({ - 'Authorization': `Bearer ${token}`, - }, options.headers); + if (token && !noAuth) { + options.headers = Object.assign( + { + Authorization: `Bearer ${token}`, + }, + options.headers, + ); } // Add parameters to url @@ -138,11 +154,11 @@ export default function request(url, options = {}, shouldWatchServerRestart = fa if (options && options.body && stringify) { options.body = JSON.stringify(options.body); } - + return fetch(url, options) .then(checkStatus) .then(parseJSON) - .then((response) => { + .then(response => { if (shouldWatchServerRestart) { // Display the global OverlayBlocker strapi.lockApp(shouldWatchServerRestart); diff --git a/packages/strapi-hook-knex/lib/index.js b/packages/strapi-hook-knex/lib/index.js index b71b7ecce6..3c1c05899f 100644 --- a/packages/strapi-hook-knex/lib/index.js +++ b/packages/strapi-hook-knex/lib/index.js @@ -155,6 +155,10 @@ module.exports = strapi => { } catch (err) { fs.mkdirSync(fileDirectory); } + + // Force base directory. + // Note: it removes the warning logs when starting the administration in development mode. + options.connection.filename = path.resolve(strapi.config.appPath, options.connection.filename); // Disable warn log // .returning() is not supported by sqlite3 and will not have any effect. diff --git a/packages/strapi-plugin-content-manager/admin/src/components/AddFilterCTA/index.js b/packages/strapi-plugin-content-manager/admin/src/components/AddFilterCTA/index.js index 59af449773..9ba2517bee 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/AddFilterCTA/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/AddFilterCTA/index.js @@ -9,8 +9,8 @@ import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; // Design -import Button from 'components/CustomButton'; import Logo from '../../assets/images/icon_filter.png'; +import Button from '../CustomButton'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/CustomDragLayer/index.js b/packages/strapi-plugin-content-manager/admin/src/components/CustomDragLayer/index.js index b3955a9168..03d9238e5c 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/CustomDragLayer/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/CustomDragLayer/index.js @@ -7,9 +7,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { DragLayer } from 'react-dnd'; import { flow } from 'lodash'; -import DragBox from 'components/DragBox'; -import SelectManyDraggedItem from 'components/SelectManyDraggedItem'; -import ItemTypes from 'utils/ItemTypes'; + +import ItemTypes from '../../utils/ItemTypes'; + +import DragBox from '../DragBox'; +import SelectManyDraggedItem from '../SelectManyDraggedItem'; + import styles from './styles.scss'; function getItemStyles(props) { @@ -79,4 +82,4 @@ CustomDragLayer.propTypes = { itemType: PropTypes.string, }; -export default flow([withDragLayer])(CustomDragLayer); \ No newline at end of file +export default flow([withDragLayer])(CustomDragLayer); diff --git a/packages/strapi-plugin-content-manager/admin/src/components/DragBox/index.js b/packages/strapi-plugin-content-manager/admin/src/components/DragBox/index.js index 4f4c340ce7..ba5361f11e 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/DragBox/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/DragBox/index.js @@ -5,9 +5,10 @@ import React from 'react'; import PropTypes from 'prop-types'; -import DraggedRemovedIcon from 'components/DraggedRemovedIcon'; -import GrabIcon from 'assets/images/icon_grab_blue.svg'; +import GrabIcon from '../../assets/images/icon_grab_blue.svg'; +import DraggedRemovedIcon from '../DraggedRemovedIcon'; + import styles from './styles.scss'; @@ -30,4 +31,4 @@ DragBox.propTypes = { name: PropTypes.string, }; -export default DragBox; \ No newline at end of file +export default DragBox; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/DraggableAttr/index.js b/packages/strapi-plugin-content-manager/admin/src/components/DraggableAttr/index.js index 8116d5b9bc..18f2250603 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/DraggableAttr/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/DraggableAttr/index.js @@ -14,13 +14,15 @@ import { getEmptyImage } from 'react-dnd-html5-backend'; import { flow } from 'lodash'; import PropTypes from 'prop-types'; import cn from 'classnames'; -import ClickOverHint from 'components/ClickOverHint'; -import DraggedRemovedIcon from 'components/DraggedRemovedIcon'; -import VariableEditIcon from 'components/VariableEditIcon'; -import ItemTypes from 'utils/ItemTypes'; -import GrabIconBlue from 'assets/images/icon_grab_blue.svg'; -import GrabIcon from 'assets/images/icon_grab.svg'; +import ItemTypes from '../../utils/ItemTypes'; + +import GrabIconBlue from '../../assets/images/icon_grab_blue.svg'; +import GrabIcon from '../../assets/images/icon_grab.svg'; + +import ClickOverHint from '../ClickOverHint'; +import DraggedRemovedIcon from '../DraggedRemovedIcon'; +import VariableEditIcon from '../VariableEditIcon'; import styles from './styles.scss'; @@ -207,4 +209,4 @@ const withDragSource = DragSource(ItemTypes.NORMAL, draggableAttrSource, (connec isDragging: monitor.isDragging(), })); -export default flow([withDropTarget, withDragSource])(DraggableAttr); \ No newline at end of file +export default flow([withDropTarget, withDragSource])(DraggableAttr); diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js b/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js index 74d882ced4..7ff1746da6 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js @@ -18,8 +18,9 @@ import { // ./node_modules/strapi-helper-plugin/lib/src // or strapi/packages/strapi-helper-plugin/lib/src import Input from 'components/InputsIndex'; -import InputJSONWithErrors from 'components/InputJSONWithErrors'; -import WysiwygWithErrors from 'components/WysiwygWithErrors'; + +import InputJSONWithErrors from '../InputJSONWithErrors'; +import WysiwygWithErrors from '../WysiwygWithErrors'; import styles from './styles.scss'; const getInputType = (type = '') => { diff --git a/packages/strapi-plugin-content-manager/admin/src/components/EditRelations/index.js b/packages/strapi-plugin-content-manager/admin/src/components/EditRelations/index.js index 814c04f4d0..2bc41b8841 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/EditRelations/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/EditRelations/index.js @@ -9,8 +9,8 @@ import PropTypes from 'prop-types'; import { get } from 'lodash'; // Components. -import SelectOne from 'components/SelectOne'; -import SelectMany from 'components/SelectMany'; +import SelectOne from '../SelectOne'; +import SelectMany from '../SelectMany'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/EmptyAttributesView/index.js b/packages/strapi-plugin-content-manager/admin/src/components/EmptyAttributesView/index.js index 0d111dc046..78bf3eacca 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/EmptyAttributesView/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/EmptyAttributesView/index.js @@ -7,8 +7,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; + import Button from 'components/Button'; import PluginHeader from 'components/PluginHeader'; + import styles from './styles.scss'; function EmptyAttributesView({ currentModelName, history, modelEntries }) { diff --git a/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/Add.js b/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/Add.js index ab79870f4d..205e2baccf 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/Add.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/Add.js @@ -1,4 +1,4 @@ -import FilterOptionsCTA from 'components/FilterOptionsCTA'; +import FilterOptionsCTA from '../FilterOptionsCTA'; const Add = FilterOptionsCTA.extend` &:after { diff --git a/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/Remove.js b/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/Remove.js index 0598f6daff..dacc73bd0f 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/Remove.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/FilterOptions/Remove.js @@ -1,4 +1,4 @@ -import FilterOptionsCTA from 'components/FilterOptionsCTA'; +import FilterOptionsCTA from '../FilterOptionsCTA'; const Remove = FilterOptionsCTA.extend` &:after { diff --git a/packages/strapi-plugin-content-manager/admin/src/components/FiltersPickWrapper/index.js b/packages/strapi-plugin-content-manager/admin/src/components/FiltersPickWrapper/index.js index 4ee0db92d7..046954b0c1 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/FiltersPickWrapper/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/FiltersPickWrapper/index.js @@ -8,13 +8,14 @@ import moment from 'moment'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { isObject, size } from 'lodash'; -import FilterOptions from 'components/FilterOptions/Loadable'; // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src // or strapi/packages/strapi-helper-plugin/lib/src import PluginHeader from 'components/PluginHeader'; +import FilterOptions from '../FilterOptions/Loadable'; + import Div from './Div'; import Flex from './Flex'; import SpanStyled from './SpanStyled'; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/InputJSONWithErrors/index.js b/packages/strapi-plugin-content-manager/admin/src/components/InputJSONWithErrors/index.js index 9a57eb3019..e80a0bd187 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/InputJSONWithErrors/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/InputJSONWithErrors/index.js @@ -14,11 +14,12 @@ import Label from 'components/Label'; import InputDescription from 'components/InputDescription'; import InputErrors from 'components/InputErrors'; import InputSpacer from 'components/InputSpacer'; -import InputJSON from 'components/InputJSON'; // Utils import validateInput from 'utils/inputsValidations'; +import InputJSON from '../InputJSON'; + import styles from './styles.scss'; class InputJSONWithErrors extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Search/index.js b/packages/strapi-plugin-content-manager/admin/src/components/Search/index.js index 4cc5097be4..8a38c669b2 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Search/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Search/index.js @@ -9,7 +9,7 @@ import { isEmpty, upperFirst } from 'lodash'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import Logo from 'assets/images/icon_filter_blue.svg'; +import Logo from '../../assets/images/icon_filter_blue.svg'; import styles from './styles.scss'; const WAIT = 400; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/SelectMany/SortableItem.js b/packages/strapi-plugin-content-manager/admin/src/components/SelectMany/SortableItem.js index 24700fac26..c6b0f69e8d 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/SelectMany/SortableItem.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/SelectMany/SortableItem.js @@ -12,8 +12,11 @@ import { getEmptyImage } from 'react-dnd-html5-backend'; import PropTypes from 'prop-types'; import { flow, get } from 'lodash'; import cn from 'classnames'; -import SelectManyDraggedItem from 'components/SelectManyDraggedItem'; -import ItemTypes from 'utils/ItemTypes'; + +import ItemTypes from '../../utils/ItemTypes'; + +import SelectManyDraggedItem from '../SelectManyDraggedItem'; + import styles from './styles.scss'; const sortableItemSource = { @@ -145,4 +148,4 @@ SortableItem.propTypes = { onRemove: PropTypes.func.isRequired, }; -export default flow([withDropTarget, withDragSource])(SortableItem); \ No newline at end of file +export default flow([withDropTarget, withDragSource])(SortableItem); diff --git a/packages/strapi-plugin-content-manager/admin/src/components/SelectManyDraggedItem/Content.js b/packages/strapi-plugin-content-manager/admin/src/components/SelectManyDraggedItem/Content.js index 33cb2ee859..a629ac1f7d 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/SelectManyDraggedItem/Content.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/SelectManyDraggedItem/Content.js @@ -6,8 +6,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import IconRemove from 'assets/images/icon_remove.svg'; -import styles from 'components/SelectMany/styles.scss'; + +import IconRemove from '../../assets/images/icon_remove.svg'; +import styles from '../SelectMany/styles.scss'; function Content({ index, item, onClick, onRemove }) { return ( @@ -45,4 +46,4 @@ Content.propTypes = { onRemove: PropTypes.func, }; -export default Content; \ No newline at end of file +export default Content; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/SettingsRow/index.js b/packages/strapi-plugin-content-manager/admin/src/components/SettingsRow/index.js index 335f54ed91..071a108b9a 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/SettingsRow/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/SettingsRow/index.js @@ -6,6 +6,7 @@ import React from 'react'; import { upperFirst } from 'lodash'; import PropTypes from 'prop-types'; + import IcoContainer from 'components/IcoContainer'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Table/index.js b/packages/strapi-plugin-content-manager/admin/src/components/Table/index.js index c596fc0580..fbaeb66fd6 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Table/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Table/index.js @@ -8,11 +8,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { toString } from 'lodash'; -import TableDelete from 'components/TableDelete'; -import TableHeader from 'components/TableHeader'; -import TableRow from 'components/TableRow'; -import TableEmpty from 'components/TableEmpty'; -import TableLoading from 'components/TableLoading'; +import TableDelete from '../TableDelete'; +import TableHeader from '../TableHeader'; +import TableRow from '../TableRow'; +import TableEmpty from '../TableEmpty'; +import TableLoading from '../TableLoading'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/TableHeader/index.js b/packages/strapi-plugin-content-manager/admin/src/components/TableHeader/index.js index b8d95174e4..026e3744b2 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/TableHeader/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/TableHeader/index.js @@ -8,7 +8,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import cn from 'classnames'; -import CustomInputCheckbox from 'components/CustomInputCheckbox'; +import CustomInputCheckbox from '../CustomInputCheckbox'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/TableLoading/index.js b/packages/strapi-plugin-content-manager/admin/src/components/TableLoading/index.js index f67d418be4..5f260c0177 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/TableLoading/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/TableLoading/index.js @@ -4,6 +4,7 @@ */ import React from 'react'; import PropTypes from 'prop-types'; + import LoadingIndicator from 'components/LoadingIndicator'; import styles from './styles.scss'; @@ -23,4 +24,4 @@ TableLoading.propTypes = { colspan: PropTypes.number.isRequired, }; -export default TableLoading; \ No newline at end of file +export default TableLoading; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/TableRow/index.js b/packages/strapi-plugin-content-manager/admin/src/components/TableRow/index.js index f3cfae6241..aca98a62cc 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/TableRow/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/TableRow/index.js @@ -10,9 +10,10 @@ import moment from 'moment'; import { isEmpty, isNull, isObject, toLower, toString } from 'lodash'; import cn from 'classnames'; -import CustomInputCheckbox from 'components/CustomInputCheckbox'; import IcoContainer from 'components/IcoContainer'; +import CustomInputCheckbox from '../CustomInputCheckbox'; + import styles from './styles.scss'; class TableRow extends React.Component { diff --git a/packages/strapi-plugin-content-manager/admin/src/components/VariableDraggableAttr/index.js b/packages/strapi-plugin-content-manager/admin/src/components/VariableDraggableAttr/index.js index be42f9ee8c..c9a2a836cb 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/VariableDraggableAttr/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/VariableDraggableAttr/index.js @@ -14,13 +14,15 @@ import { import { getEmptyImage } from 'react-dnd-html5-backend'; import { get, flow } from 'lodash'; import cn from 'classnames'; -import ClickOverHint from 'components/ClickOverHint'; -import DraggedRemovedIcon from 'components/DraggedRemovedIcon'; -import VariableEditIcon from 'components/VariableEditIcon'; -import ItemTypes from 'utils/ItemTypes'; -import GrabIconBlue from 'assets/images/icon_grab_blue.svg'; -import GrabIcon from 'assets/images/icon_grab.svg'; +import GrabIconBlue from '../../assets/images/icon_grab_blue.svg'; +import GrabIcon from '../../assets/images/icon_grab.svg'; + +import ItemTypes from '../../utils/ItemTypes'; + +import ClickOverHint from '../ClickOverHint'; +import DraggedRemovedIcon from '../DraggedRemovedIcon'; +import VariableEditIcon from '../VariableEditIcon'; import Carret from './Carret'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/index.js b/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/index.js index f8344a913b..017eeb2787 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/index.js @@ -16,11 +16,14 @@ import { import PropTypes from 'prop-types'; import { isEmpty, isNaN, replace, words } from 'lodash'; import cn from 'classnames'; -import Controls from 'components/WysiwygInlineControls'; -import Drop from 'components/WysiwygDropUpload'; -import WysiwygBottomControls from 'components/WysiwygBottomControls'; -import WysiwygEditor from 'components/WysiwygEditor'; + import request from 'utils/request'; + +import Controls from '../WysiwygInlineControls'; +import Drop from '../WysiwygDropUpload'; +import WysiwygBottomControls from '../WysiwygBottomControls'; +import WysiwygEditor from '../WysiwygEditor'; + import CustomSelect from './customSelect'; import PreviewControl from './previewControl'; import PreviewWysiwyg from './previewWysiwyg'; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/previewWysiwyg.js b/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/previewWysiwyg.js index 4903788722..018e566e16 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/previewWysiwyg.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Wysiwyg/previewWysiwyg.js @@ -20,7 +20,7 @@ import { List, OrderedSet, Repeat, fromJS } from 'immutable'; import cn from 'classnames'; import { isEmpty, toArray } from 'lodash'; -import WysiwygEditor from 'components/WysiwygEditor'; +import WysiwygEditor from '../WysiwygEditor'; import converter from './converter'; import { findAtomicEntities, diff --git a/packages/strapi-plugin-content-manager/admin/src/components/WysiwygWithErrors/index.js b/packages/strapi-plugin-content-manager/admin/src/components/WysiwygWithErrors/index.js index 66cc8acee9..cd57f3025f 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/WysiwygWithErrors/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/WysiwygWithErrors/index.js @@ -14,11 +14,12 @@ import Label from 'components/Label'; import InputDescription from 'components/InputDescription'; import InputErrors from 'components/InputErrors'; import InputSpacer from 'components/InputSpacer'; -import Wysiwyg from 'components/Wysiwyg'; // Utils import validateInput from 'utils/inputsValidations'; +import Wysiwyg from '../Wysiwyg'; + import styles from './styles.scss'; class WysiwygWithErrors extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/App/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/App/index.js index f31868dba4..f6e547761f 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/App/index.js @@ -16,12 +16,13 @@ import pluginId from 'pluginId'; import getQueryParameters from 'utils/getQueryParameters'; -import EditPage from 'containers/EditPage'; -import ListPage from 'containers/ListPage'; -import SettingsPage from 'containers/SettingsPage'; -import SettingPage from 'containers/SettingPage'; import LoadingIndicatorPage from 'components/LoadingIndicatorPage'; -import EmptyAttributesView from 'components/EmptyAttributesView'; +import EmptyAttributesView from '../../components/EmptyAttributesView'; + +import EditPage from '../EditPage'; +import ListPage from '../ListPage'; +import SettingsPage from '../SettingsPage'; +import SettingPage from '../SettingPage'; import { loadModels, @@ -40,12 +41,13 @@ class App extends React.Component { if (this.props.loading) { return ; } - + const { schema } = this.props; const currentModelName = this.props.location.pathname.split('/')[3]; const source = getQueryParameters(this.props.location.search, 'source'); const attrPath = source === 'content-manager' ? ['models', currentModelName, 'editDisplay', 'availableFields'] : ['models', 'plugins', source, currentModelName, 'editDisplay', 'availableFields']; + const relationsPath = source === 'content-manager' ? ['models', currentModelName, 'editDisplay', 'relations'] : ['models', 'plugins', source, currentModelName, 'editDisplay', 'relations']; - if (currentModelName && source && isEmpty(get(this.props.schema, attrPath))) { + if (currentModelName && source && isEmpty(get(schema, attrPath)) && isEmpty(get(schema, relationsPath))) { return ; } diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/App/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/App/selectors.js index 9a68bd1811..f9dcfdd04c 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/App/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/App/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the list state domain */ diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js index 25a3458f36..ac9f874c40 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js @@ -23,7 +23,7 @@ import { import HTML5Backend from 'react-dnd-html5-backend'; import { DragDropContext } from 'react-dnd'; import cn from 'classnames'; -import pluginId from 'pluginId'; + // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src // or strapi/packages/strapi-helper-plugin/lib/src @@ -33,17 +33,24 @@ import LoadingIndicator from 'components/LoadingIndicator'; import PluginHeader from 'components/PluginHeader'; import PopUpWarning from 'components/PopUpWarning'; import NavLink from 'components/NavLink'; -// Plugin's components -import CustomDragLayer from 'components/CustomDragLayer'; -import Edit from 'components/Edit'; -import EditRelations from 'components/EditRelations'; -// App selectors -import { makeSelectSchema } from 'containers/App/selectors'; + import getQueryParameters from 'utils/getQueryParameters'; -import { bindLayout } from 'utils/bindLayout'; import inputValidations from 'utils/inputsValidations'; -import { generateRedirectURI } from 'containers/ListPage/utils'; -import { checkFormValidity } from 'utils/formValidations'; + +import pluginId from '../../pluginId'; + +// Plugin's components +import CustomDragLayer from '../../components/CustomDragLayer'; +import Edit from '../../components/Edit'; +import EditRelations from '../../components/EditRelations'; + +import { bindLayout } from '../../utils/bindLayout'; +import { checkFormValidity } from '../../utils/formValidations'; + +// App selectors +import { makeSelectSchema } from '../App/selectors'; + +import { generateRedirectURI } from '../ListPage/utils'; import { addRelationItem, changeData, @@ -194,7 +201,7 @@ export class EditPage extends React.Component { const title = get(this.getSchema(), 'editDisplay.displayedField'); const valueToDisplay = get(this.props.editPage, ['initialRecord', title], null); - return isEmpty(valueToDisplay) ? null : truncate(valueToDisplay, { length: '24', separator: '.' }); + return isEmpty(toString(valueToDisplay)) ? null : truncate(valueToDisplay, { length: '24', separator: '.' }); }; /** @@ -557,7 +564,7 @@ export class EditPage extends React.Component { location: { search }, } = this.props; const source = getQueryParameters(search, 'source'); - const basePath = `/plugins/${pluginId}/ctm-configurations`; + const basePath = `/plugins/${pluginId}/ctm-configurations/edit-settings`; const pathname = source !== pluginId ? `${basePath}/plugins/${source}/${this.getModelName()}` diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/saga.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/saga.js index 4e0077a267..8255fedc6f 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/saga.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/saga.js @@ -10,11 +10,12 @@ import { // take, takeLatest, } from 'redux-saga/effects'; -import { makeSelectSchema } from 'containers/App/selectors'; // Utils. import cleanData from 'utils/cleanData'; import request from 'utils/request'; import templateObject from 'utils/templateObject'; + +import { makeSelectSchema } from '../App/selectors'; import { getDataSucceeded, setFormErrors, @@ -95,7 +96,7 @@ export function* submit() { cleanedData = record[current]; break; case 'date': - cleanedData = record[current]._isAMomentObject === true ? record[current].format('YYYY-MM-DD HH:mm:ss') : record[current]; + cleanedData = record[current] && record[current]._isAMomentObject === true ? record[current].format('YYYY-MM-DD HH:mm:ss') : record[current]; break; default: cleanedData = cleanData(record[current], 'value', 'id'); @@ -154,7 +155,7 @@ export function* submit() { yield put(submitSuccess()); } catch(err) { - if (isArray(err.response.payload.message)) { + if (isArray(get(err, 'response.payload.message'))) { const errors = err.response.payload.message.reduce((acc, current) => { const error = current.messages.reduce((acc, current) => { if (includes(current.id, 'Auth')) { diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/selectors.js index 3f0d99c871..5b1dd5c760 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/selectors.js @@ -5,7 +5,7 @@ */ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the listPage state domain diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/index.js index 8fe49fe212..45853dcd3d 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/index.js @@ -9,13 +9,11 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators, compose } from 'redux'; import { createStructuredSelector } from 'reselect'; -import { capitalize, findIndex, get, isUndefined, toInteger, upperFirst } from 'lodash'; +import { capitalize, findIndex, get, isEmpty, isUndefined, toInteger, upperFirst } from 'lodash'; import { ButtonDropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; import { FormattedMessage } from 'react-intl'; import cn from 'classnames'; -import pluginId from 'pluginId'; -// App selectors -import { makeSelectSchema } from 'containers/App/selectors'; + // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src // or strapi/packages/strapi-helper-plugin/lib/src @@ -23,15 +21,21 @@ import PageFooter from 'components/PageFooter'; import PluginHeader from 'components/PluginHeader'; import PopUpWarning from 'components/PopUpWarning'; import InputCheckbox from 'components/InputCheckbox'; -// Components from the plugin itself -import AddFilterCTA from 'components/AddFilterCTA'; -import FiltersPickWrapper from 'components/FiltersPickWrapper/Loadable'; -import Filter from 'components/Filter/Loadable'; -import Search from 'components/Search'; -import Table from 'components/Table'; -// Utils located in `strapi/packages/strapi-helper-plugin/lib/src/utils`; + import getQueryParameters from 'utils/getQueryParameters'; import storeData from 'utils/storeData'; + +import pluginId from '../../pluginId'; +// Components from the plugin itself +import AddFilterCTA from '../../components/AddFilterCTA'; +import FiltersPickWrapper from '../../components/FiltersPickWrapper/Loadable'; +import Filter from '../../components/Filter/Loadable'; +import Search from '../../components/Search'; +import Table from '../../components/Table'; + +// App selectors +import { makeSelectSchema } from '../App/selectors'; + import Div from './Div'; import { addAttr, @@ -365,7 +369,13 @@ export class ListPage extends React.Component { showSearch = () => get(this.getCurrentModel(), ['search']); - showFilters = () => get(this.getCurrentModel(), ['filters']); + showFilters = () => { + if (isEmpty(get(this.getCurrentModel(), ['editDisplay', 'availableFields']))) { + return false; + } + + return get(this.getCurrentModel(), ['filters']); + } showBulkActions = () => get(this.getCurrentModel(), ['bulkActions']); diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/selectors.js index 3738053419..38cd096f66 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/selectors.js @@ -5,7 +5,7 @@ */ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the listPage state domain diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/index.js index e365027b7b..460a36de25 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/index.js @@ -14,7 +14,21 @@ import { DragDropContext } from 'react-dnd'; import { FormattedMessage } from 'react-intl'; import { ButtonDropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; import PropTypes from 'prop-types'; -import pluginId from 'pluginId'; +import BackHeader from 'components/BackHeader'; +import HeaderNav from 'components/HeaderNav'; +import Input from 'components/InputsIndex'; +import InputSelect from 'components/InputSelect'; +import PluginHeader from 'components/PluginHeader'; +import PopUpWarning from 'components/PopUpWarning'; + +import pluginId from '../../pluginId'; + +import Block from '../../components/Block'; +import CustomDragLayer from '../../components/CustomDragLayer'; +import DraggableAttr from '../../components/DraggableAttr'; +import FormTitle from '../../components/FormTitle'; +import VariableDraggableAttr from '../../components/VariableDraggableAttr'; + import { beginMove, endMove, @@ -31,7 +45,7 @@ import { onReset, onSubmit, setLayout, -} from 'containers/App/actions'; +} from '../App/actions'; import { makeSelectAddedField, makeSelectDraggedItemName, @@ -41,19 +55,7 @@ import { makeSelectModifiedSchema, makeSelectShouldResetGrid, makeSelectSubmitSuccess, -} from 'containers/App/selectors'; - -import BackHeader from 'components/BackHeader'; -import Block from 'components/Block'; -import CustomDragLayer from 'components/CustomDragLayer'; -import DraggableAttr from 'components/DraggableAttr'; -import FormTitle from 'components/FormTitle'; -import HeaderNav from 'components/HeaderNav'; -import Input from 'components/InputsIndex'; -import InputSelect from 'components/InputSelect'; -import PluginHeader from 'components/PluginHeader'; -import PopUpWarning from 'components/PopUpWarning'; -import VariableDraggableAttr from 'components/VariableDraggableAttr'; +} from '../App/selectors'; import { onClickEditField, onClickEditListItem, onClickEditRelation } from './actions'; import reducer from './reducer'; diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/selectors.js index b4fd5a8375..71197db9d7 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/selectors.js @@ -4,7 +4,7 @@ */ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the settingPage state domain diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/index.js index 072d29e63b..655210668f 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/index.js @@ -10,14 +10,19 @@ import { createStructuredSelector } from 'reselect'; import cn from 'classnames'; import { get, sortBy } from 'lodash'; import PropTypes from 'prop-types'; -import pluginId from 'pluginId'; -import { onChange, onSubmit, onReset } from 'containers/App/actions'; -import { makeSelectModifiedSchema, makeSelectSubmitSuccess } from 'containers/App/selectors'; + import Input from 'components/InputsIndex'; import PluginHeader from 'components/PluginHeader'; import PopUpWarning from 'components/PopUpWarning'; -import Block from 'components/Block'; -import SettingsRow from 'components/SettingsRow'; + +import Block from '../../components/Block'; +import SettingsRow from '../../components/SettingsRow'; + +import pluginId from '../../pluginId'; + +import { onChange, onSubmit, onReset } from '../App/actions'; +import { makeSelectModifiedSchema, makeSelectSubmitSuccess } from '../App/selectors'; + import reducer from './reducer'; import saga from './saga'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/selectors.js index 9b36503f77..e77bc84df6 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/selectors.js @@ -4,7 +4,7 @@ */ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the settingsPage state domain diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/PluginLeftMenu/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/PluginLeftMenu/index.js index e960430a13..7eadacc0f5 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/PluginLeftMenu/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/PluginLeftMenu/index.js @@ -14,7 +14,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { map } from 'lodash'; -import PluginLeftMenuSection from 'components/PluginLeftMenuSection'; +import PluginLeftMenuSection from '../PluginLeftMenuSection'; import styles from './styles.scss'; class PluginLeftMenu extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/PluginLeftMenuSection/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/PluginLeftMenuSection/index.js index 7f80b6012f..85f8e7210b 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/PluginLeftMenuSection/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/PluginLeftMenuSection/index.js @@ -12,7 +12,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { map } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import PluginLeftMenuLink from 'components/PluginLeftMenuLink'; +import PluginLeftMenuLink from '../PluginLeftMenuLink'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/index.js index 824193d82d..5b110054ed 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/index.js @@ -10,7 +10,7 @@ import { FormattedMessage } from 'react-intl'; import { get, map, includes, split, isEmpty, findIndex } from 'lodash'; import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import Input from 'components/InputsIndex'; -import PopUpHeaderNavLink from 'components/PopUpHeaderNavLink'; +import PopUpHeaderNavLink from '../PopUpHeaderNavLink'; import styles from './styles.scss'; /* eslint-disable react/jsx-wrap-multilines */ diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpRelations/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpRelations/index.js index 48b13a7491..9c79570f15 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpRelations/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpRelations/index.js @@ -12,9 +12,9 @@ import pluralize from 'pluralize'; import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import Input from 'components/InputsIndex'; -import PopUpHeaderNavLink from 'components/PopUpHeaderNavLink'; -import RelationBox from 'components/RelationBox'; -import RelationNaturePicker from 'components/RelationNaturePicker'; +import PopUpHeaderNavLink from '../PopUpHeaderNavLink'; +import RelationBox from '../RelationBox'; +import RelationNaturePicker from '../RelationNaturePicker'; import styles from './styles.scss'; /* eslint-disable jsx-a11y/tabindex-no-positive */ diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/RelationNaturePicker/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/RelationNaturePicker/index.js index ff5b2442ee..0c2f56be58 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/RelationNaturePicker/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/RelationNaturePicker/index.js @@ -10,8 +10,6 @@ import { map, startCase } from 'lodash'; import pluralize from 'pluralize'; import { FormattedMessage } from 'react-intl'; -import RelationIco from 'components/RelationIco'; - import OneWay from '../../assets/images/one_way.svg'; import OneWaySelected from '../../assets/images/one_way_selected.svg'; import ManyToMany from '../../assets/images/many_to_many.svg'; @@ -23,6 +21,8 @@ import OneToManySelected from '../../assets/images/one_to_many_selected.svg'; import OneToOne from '../../assets/images/one_to_one.svg'; import OneToOneSelected from '../../assets/images/one_to_one_selected.svg'; +import RelationIco from '../RelationIco'; + import styles from './styles.scss'; class RelationNaturePicker extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/TableList/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/TableList/index.js index 959d642bec..442aabcde7 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/TableList/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/TableList/index.js @@ -10,7 +10,7 @@ import { map } from 'lodash'; import { FormattedMessage } from 'react-intl'; import Button from 'components/Button'; -import TableListRow from 'components/TableListRow'; +import TableListRow from '../TableListRow'; import styles from './styles.scss'; class TableList extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/TableListRow/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/TableListRow/index.js index 370944d703..1d1f7fd13e 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/TableListRow/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/TableListRow/index.js @@ -11,8 +11,8 @@ import { FormattedMessage } from 'react-intl'; import IcoContainer from 'components/IcoContainer'; import ListRow from 'components/ListRow'; import PopUpWarning from 'components/PopUpWarning'; -import styles from 'components/TableList/styles.scss'; import { router } from 'app'; +import styles from '../TableList/styles.scss'; /* eslint-disable jsx-a11y/no-static-element-interactions */ /* eslint-disable react/jsx-curly-brace-presence */ diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/index.js index e1b45b1234..b44151a33d 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/index.js @@ -12,20 +12,19 @@ import { bindActionCreators, compose } from 'redux'; import { createStructuredSelector } from 'reselect'; import { Switch, Route, withRouter } from 'react-router-dom'; import PropTypes from 'prop-types'; -import pluginId from 'pluginId'; -import HomePage from 'containers/HomePage'; -import ModelPage from 'containers/ModelPage'; -import NotFoundPage from 'containers/NotFoundPage'; -import formSaga from 'containers/Form/sagas'; -import formReducer from 'containers/Form/reducer'; +import pluginId from '../../pluginId'; + +import HomePage from '../HomePage'; +import ModelPage from '../ModelPage'; +import NotFoundPage from '../NotFoundPage'; +import formSaga from '../Form/sagas'; +import formReducer from '../Form/reducer'; // Other containers actions -import { makeSelectShouldRefetchContentType } from 'containers/Form/selectors'; +import { makeSelectShouldRefetchContentType } from '../Form/selectors'; // Utils -// import injectSaga from 'utils/injectSaga'; -// import injectReducer from 'utils/injectReducer'; import { storeData } from '../../utils/storeData'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/selectors.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/selectors.js index cd024bdfd4..91e1622b16 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/selectors.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the list state domain diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js index 4d61e66ddd..7dbfd6e0ef 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js @@ -32,13 +32,13 @@ import PropTypes from 'prop-types'; import moment from 'moment'; import { router } from 'app'; -import { temporaryContentTypeFieldsUpdated, storeTemporaryMenu } from 'containers/App/actions'; -import { addAttributeToContentType, addAttributeRelationToContentType, editContentTypeAttribute, editContentTypeAttributeRelation, updateContentType } from 'containers/ModelPage/actions'; +import { temporaryContentTypeFieldsUpdated, storeTemporaryMenu } from '../App/actions'; +import { addAttributeToContentType, addAttributeRelationToContentType, editContentTypeAttribute, editContentTypeAttributeRelation, updateContentType } from '../ModelPage/actions'; -import AttributeCard from 'components/AttributeCard'; -import InputCheckboxWithNestedInputs from 'components/InputCheckboxWithNestedInputs'; -import PopUpForm from 'components/PopUpForm'; -import PopUpRelations from 'components/PopUpRelations'; +import AttributeCard from '../../components/AttributeCard'; +import InputCheckboxWithNestedInputs from '../../components/InputCheckboxWithNestedInputs'; +import PopUpForm from '../../components/PopUpForm'; +import PopUpRelations from '../../components/PopUpRelations'; // Utils import { checkFormValidity } from '../../utils/formValidations'; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/selectors.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/selectors.js index a24e806659..5aa0f66979 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/selectors.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the form state domain diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/index.js index 021524f6b3..2d11bceac3 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/index.js @@ -12,17 +12,17 @@ import { size } from 'lodash'; import Helmet from 'react-helmet'; import PropTypes from 'prop-types'; import { router } from 'app'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; -import { makeSelectLoading, makeSelectMenu, makeSelectModels } from 'containers/App/selectors'; -import { deleteContentType } from 'containers/App/actions'; +import { makeSelectLoading, makeSelectMenu, makeSelectModels } from '../App/selectors'; +import { deleteContentType } from '../App/actions'; -import Form from 'containers/Form'; +import Form from '../Form'; // Design -import ContentHeader from 'components/ContentHeader'; -import EmptyContentTypeView from 'components/EmptyContentTypeView'; -import TableList from 'components/TableList'; +import ContentHeader from '../../components/ContentHeader'; +import EmptyContentTypeView from '../../components/EmptyContentTypeView'; +import TableList from '../../components/TableList'; // Utils import { storeData } from '../../utils/storeData'; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/selectors.js index 908189c864..04830b5b25 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the homePage state domain diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js index f2beeff899..7ae0050713 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js @@ -13,17 +13,23 @@ import { FormattedMessage } from 'react-intl'; import { NavLink } from 'react-router-dom'; import PropTypes from 'prop-types'; import { router } from 'app'; -import pluginId from 'pluginId'; -// Global selectors -import { makeSelectMenu } from 'containers/App/selectors'; -import { makeSelectContentTypeUpdated } from 'containers/Form/selectors'; -import AttributeRow from 'components/AttributeRow'; -import ContentHeader from 'components/ContentHeader'; + import EmptyAttributesBlock from 'components/EmptyAttributesBlock'; -import Form from 'containers/Form'; -import List from 'components/List'; -import PluginLeftMenu from 'components/PluginLeftMenu'; -import forms from 'containers/Form/forms.json'; + +import pluginId from '../../pluginId'; + +import AttributeRow from '../../components/AttributeRow'; +import ContentHeader from '../../components/ContentHeader'; +import List from '../../components/List'; +import PluginLeftMenu from '../../components/PluginLeftMenu'; +import Form from '../Form'; + +import forms from '../Form/forms.json'; + +// Global selectors +import { makeSelectMenu } from '../App/selectors'; +import { makeSelectContentTypeUpdated } from '../Form/selectors'; + import { storeData } from '../../utils/storeData'; import { cancelChanges, diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/sagas.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/sagas.js index 3f2021a130..cee2a0c40a 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/sagas.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/sagas.js @@ -25,10 +25,10 @@ import { import request from 'utils/request'; -import { temporaryContentTypePosted } from 'containers/App/actions'; - import { storeData } from '../../utils/storeData'; +import { temporaryContentTypePosted } from '../App/actions'; + import { MODEL_FETCH, SUBMIT } from './constants'; import { modelFetchSucceeded, diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/selectors.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/selectors.js index 30941e0238..0980be8207 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/selectors.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the modelPage state domain diff --git a/packages/strapi-plugin-documentation/admin/src/components/Row/ButtonContainer.js b/packages/strapi-plugin-documentation/admin/src/components/Row/ButtonContainer.js index 0bdb656d78..1a5c98c67c 100755 --- a/packages/strapi-plugin-documentation/admin/src/components/Row/ButtonContainer.js +++ b/packages/strapi-plugin-documentation/admin/src/components/Row/ButtonContainer.js @@ -2,8 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import cn from 'classnames'; + import Button from 'components/Button'; -import openWithNewTab from 'utils/openWithNewTab'; +import openWithNewTab from '../../utils/openWithNewTab'; import styles from './styles.scss'; const ButtonContainer = ({ currentDocVersion, isHeader, onClick, onClickDelete, version }) => { @@ -42,4 +43,4 @@ ButtonContainer.propTypes = { version: PropTypes.string, }; -export default ButtonContainer; \ No newline at end of file +export default ButtonContainer; diff --git a/packages/strapi-plugin-documentation/admin/src/containers/App/index.js b/packages/strapi-plugin-documentation/admin/src/containers/App/index.js index 67b7a6dbf3..15f97bd26c 100755 --- a/packages/strapi-plugin-documentation/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-documentation/admin/src/containers/App/index.js @@ -8,10 +8,10 @@ import React from 'react'; import { Switch, Route } from 'react-router-dom'; // Utils -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; // Containers -import HomePage from 'containers/HomePage'; -import NotFoundPage from 'containers/NotFoundPage'; +import HomePage from '../HomePage'; +import NotFoundPage from '../NotFoundPage'; function App() { return ( diff --git a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js index 9124be0809..5015a2044e 100755 --- a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js @@ -12,17 +12,23 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'; import { bindActionCreators, compose } from 'redux'; import { get, isEmpty } from 'lodash'; import cn from 'classnames'; -import pluginId from 'pluginId'; + // Components import PluginHeader from 'components/PluginHeader'; import PopUpWarning from 'components/PopUpWarning'; -import Block from 'components/Block'; -import Row from 'components/Row'; import LoadingIndicatorPage from 'components/LoadingIndicatorPage'; import Input from 'components/InputsIndex'; + // Utils import auth from 'utils/auth'; -import openWithNewTab from 'utils/openWithNewTab'; + +import pluginId from '../../pluginId'; + +import Block from '../../components/Block'; +import Row from '../../components/Row'; + +import openWithNewTab from '../../utils/openWithNewTab'; + // Actions import { getDocInfos, diff --git a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/selectors.js index 7789256c42..08b848bb45 100755 --- a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the homePage state domain diff --git a/packages/strapi-plugin-email/admin/src/containers/App/index.js b/packages/strapi-plugin-email/admin/src/containers/App/index.js index 21fdf79df9..5f3cadd4e9 100644 --- a/packages/strapi-plugin-email/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-email/admin/src/containers/App/index.js @@ -7,10 +7,11 @@ import React from 'react'; import { Switch, Route } from 'react-router-dom'; -import pluginId from 'pluginId'; + +import pluginId from '../../pluginId'; // Containers -import ConfigPage from 'containers/ConfigPage'; +import ConfigPage from '../ConfigPage'; function App() { return ( diff --git a/packages/strapi-plugin-email/admin/src/containers/ConfigPage/index.js b/packages/strapi-plugin-email/admin/src/containers/ConfigPage/index.js index 5e212fada7..c7ca5dbf5d 100644 --- a/packages/strapi-plugin-email/admin/src/containers/ConfigPage/index.js +++ b/packages/strapi-plugin-email/admin/src/containers/ConfigPage/index.js @@ -9,7 +9,6 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators, compose } from 'redux'; import { findIndex, get, isEmpty } from 'lodash'; -import pluginId from 'pluginId'; // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src @@ -18,8 +17,10 @@ import ContainerFluid from 'components/ContainerFluid'; import HeaderNav from 'components/HeaderNav'; import PluginHeader from 'components/PluginHeader'; +import pluginId from '../../pluginId'; + // Plugin's components -import EditForm from 'components/EditForm'; +import EditForm from '../../components/EditForm'; import { getSettings, diff --git a/packages/strapi-plugin-email/admin/src/containers/ConfigPage/selectors.js b/packages/strapi-plugin-email/admin/src/containers/ConfigPage/selectors.js index d80be4e38c..2659d39aa5 100644 --- a/packages/strapi-plugin-email/admin/src/containers/ConfigPage/selectors.js +++ b/packages/strapi-plugin-email/admin/src/containers/ConfigPage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the configPage state domain diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/EditForm/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/EditForm/index.js index 4da4ec28dd..8c050f85e2 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/EditForm/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/EditForm/index.js @@ -8,8 +8,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { map } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import Button from 'components/Button'; -import EditFormSection from 'components/EditFormSection'; +import Button from '../Button'; +import EditFormSection from '../EditFormSection'; import styles from './styles.scss'; /* eslint-disable react/require-default-props */ diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSection/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSection/index.js index e23a14cde4..cbbffa216f 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSection/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSection/index.js @@ -9,9 +9,9 @@ import PropTypes from 'prop-types'; import { map, isEmpty } from 'lodash'; import { FormattedMessage } from 'react-intl'; // HOC Form -import WithFormSection from 'components/WithFormSection'; +import WithFormSection from '../WithFormSection'; // nested form -import EditFormSectionNested from 'components/EditFormSectionNested'; +import EditFormSectionNested from '../EditFormSectionNested'; /* eslint-disable react/require-default-props */ class EditFormSection extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSectionNested/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSectionNested/index.js index 3454b3da21..c9f8bf6c24 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSectionNested/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSectionNested/index.js @@ -9,8 +9,8 @@ import PropTypes from 'prop-types'; import { has, map, forEach } from 'lodash'; // HOC -import EditFormSectionSubNested from 'components/EditFormSectionSubNested'; -import WithFormSection from 'components/WithFormSection'; +import EditFormSectionSubNested from '../EditFormSectionSubNested'; +import WithFormSection from '../WithFormSection'; /* eslint-disable react/require-default-props */ class EditFormSectionNested extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSectionSubNested/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSectionSubNested/index.js index 5693f58a1f..d1d47846d4 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSectionSubNested/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/EditFormSectionSubNested/index.js @@ -7,7 +7,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { map } from 'lodash'; -import WithFormSection from 'components/WithFormSection'; +import WithFormSection from '../WithFormSection'; /* eslint-disable react/require-default-props */ class EditFormSectionSubNested extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/HeaderNav/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/HeaderNav/index.js index 7c7912ca6d..e2065e7f76 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/HeaderNav/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/HeaderNav/index.js @@ -8,9 +8,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { NavLink } from 'react-router-dom'; import { join, map, take } from 'lodash'; -import EditForm from 'components/EditForm'; -import List from 'components/List'; + import { darken } from '../../utils/colors'; + +import EditForm from '../EditForm'; +import List from '../List'; import styles from './styles.scss'; /* eslint-disable react/require-default-props */ diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/InputNumber/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/InputNumber/index.js index ecc2e7cd47..a263c53f83 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/InputNumber/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/InputNumber/index.js @@ -31,7 +31,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { isEmpty, includes, map, mapKeys, isObject, reject, union, uniqBy } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import WithInput from 'components/WithInput'; +import WithInput from '../WithInput'; /* eslint-disable react/require-default-props */ class InputNumber extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/InputPassword/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/InputPassword/index.js index 44b930c844..cfaa6689a4 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/InputPassword/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/InputPassword/index.js @@ -8,7 +8,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { isEmpty, includes, mapKeys, reject, map, isObject, size } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import WithInput from 'components/WithInput'; +import WithInput from '../WithInput'; /* eslint-disable react/require-default-props */ class InputPassword extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/InputText/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/InputText/index.js index 84a18a2f46..a4109884bb 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/InputText/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/InputText/index.js @@ -31,7 +31,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { isEmpty, includes, mapKeys, reject, map, isObject, union, findIndex, uniqBy, size } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import WithInput from 'components/WithInput'; +import WithInput from '../WithInput'; /* eslint-disable react/require-default-props */ class InputText extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/List/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/List/index.js index d1e3ac1b87..098ebc311d 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/List/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/List/index.js @@ -21,8 +21,8 @@ import { map } from 'lodash'; import { FormattedMessage } from 'react-intl'; import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; -import ButtonPrimaryHotline from 'components/Button'; -import PopUpForm from 'components/PopUpForm'; +import ButtonPrimaryHotline from '../Button'; +import PopUpForm from '../PopUpForm'; import styles from './styles.scss'; /* eslint-disable react/require-default-props */ diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/PluginLeftMenu/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/PluginLeftMenu/index.js index 6067240221..b6cdade1be 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/PluginLeftMenu/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/PluginLeftMenu/index.js @@ -7,7 +7,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { map } from 'lodash'; -import PluginLeftMenuSection from 'components/PluginLeftMenuSection'; +import PluginLeftMenuSection from '../PluginLeftMenuSection'; import styles from './styles.scss'; class PluginLeftMenu extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/PluginLeftMenuSection/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/PluginLeftMenuSection/index.js index 32df106f89..8b9a665270 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/PluginLeftMenuSection/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/PluginLeftMenuSection/index.js @@ -8,7 +8,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { map } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import PluginLeftMenuLink from 'components/PluginLeftMenuLink'; +import PluginLeftMenuLink from '../PluginLeftMenuLink'; import styles from './styles.scss'; /* eslint-disable react/require-default-props */ diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/PopUpForm/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/PopUpForm/index.js index e97874cd39..64119720fc 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/PopUpForm/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/PopUpForm/index.js @@ -7,7 +7,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { map } from 'lodash'; -import WithFormSection from 'components/WithFormSection'; +import WithFormSection from '../WithFormSection'; import styles from './styles.scss'; /* eslint-disable react/require-default-props */ diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/RowDatabase/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/RowDatabase/index.js index 6fc724193f..36363783b1 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/RowDatabase/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/RowDatabase/index.js @@ -10,9 +10,10 @@ import { FormattedMessage } from 'react-intl'; // modal import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; -import PopUpForm from 'components/PopUpForm'; import PopUpWarning from 'components/PopUpWarning'; -import styles from 'components/List/styles.scss'; + +import PopUpForm from '../PopUpForm'; +import styles from '../List/styles.scss'; /* eslint-disable react/require-default-props */ class RowDatabase extends React.Component { // eslint-disable-line react/prefer-stateless-function diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/index.js index 1103df5559..e5400484db 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/RowLanguage/index.js @@ -8,10 +8,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { find, get, join, isObject } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import PopUpWarning from 'components/PopUpWarning'; + // utils import getFlag, { formatLanguageLocale } from '../../utils/getFlag'; +import PopUpWarning from 'components/PopUpWarning'; + /* eslint-disable react/require-default-props */ class RowLanguage extends React.Component { // eslint-disable-line react/prefer-stateless-function constructor(props) { diff --git a/packages/strapi-plugin-settings-manager/admin/src/components/WithFormSection/index.js b/packages/strapi-plugin-settings-manager/admin/src/components/WithFormSection/index.js index ba76b82c07..f90e955026 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/components/WithFormSection/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/components/WithFormSection/index.js @@ -8,12 +8,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { findIndex, forEach, has, isObject , join, pullAt, split, includes} from 'lodash'; -import InputNumber from 'components/InputNumber'; -import InputText from 'components/InputText'; -import InputToggle from 'components/InputToggle'; -import InputPassword from 'components/InputPassword'; -import InputSelect from 'components/InputSelect'; -import InputEnum from 'components/InputEnum'; +import InputNumber from '../InputNumber'; +import InputText from '../InputText'; +import InputToggle from '../InputToggle'; +import InputPassword from '../InputPassword'; +import InputSelect from '../InputSelect'; +import InputEnum from '../InputEnum'; import config from './config.json'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/App/index.js b/packages/strapi-plugin-settings-manager/admin/src/containers/App/index.js index c91b323b4e..86538147a1 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/App/index.js @@ -14,9 +14,10 @@ import 'flag-icon-css/css/flag-icon.css'; import 'react-select/dist/react-select.css'; import { Switch, Route } from 'react-router-dom'; import { isEmpty } from 'lodash'; -import pluginId from 'pluginId'; -import HomePage from 'containers/HomePage'; +import pluginId from '../../pluginId'; + +import HomePage from '../HomePage'; import { menuFetch, environmentsFetch } from './actions'; import { makeSelectLoading, makeSelectSections } from './selectors'; diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js b/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js index 9a82a603a9..943115ca07 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the list state domain diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/index.js index 7e43f3c666..801dc6f58b 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/index.js @@ -9,8 +9,6 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators, compose } from 'redux'; import { createStructuredSelector } from 'reselect'; -import pluginId from 'pluginId'; - import { endsWith, find, @@ -31,18 +29,16 @@ import Helmet from 'react-helmet'; import Select from 'react-select'; import { router } from 'app'; +import pluginId from '../../pluginId'; // design -import ContentHeader from 'components/ContentHeader'; -import EditForm from 'components/EditForm'; -import HeaderNav from 'components/HeaderNav'; -import List from 'components/List'; -import RowDatabase from 'components/RowDatabase'; -import SelectOptionLanguage from 'components/SelectOptionLanguage'; -import RowLanguage from 'components/RowLanguage'; -import PluginLeftMenu from 'components/PluginLeftMenu'; - -// App selectors -import { makeSelectSections, makeSelectEnvironments } from 'containers/App/selectors'; +import ContentHeader from '../../components/ContentHeader'; +import EditForm from '../../components/EditForm'; +import HeaderNav from '../../components/HeaderNav'; +import List from '../../components/List'; +import RowDatabase from '../../components/RowDatabase'; +import SelectOptionLanguage from '../../components/SelectOptionLanguage'; +import RowLanguage from '../../components/RowLanguage'; +import PluginLeftMenu from '../../components/PluginLeftMenu'; // utils import unknowFlag from 'assets/images/unknow_flag.png'; @@ -50,6 +46,8 @@ import supportedFlags from 'utils/supportedFlags.json'; import { checkFormValidity, getRequiredInputsDb } from '../../utils/inputValidations'; import getFlag, { formatLanguageLocale } from '../../utils/getFlag'; import sendUpdatedParams from '../../utils/sendUpdatedParams'; +// App selectors +import { makeSelectSections, makeSelectEnvironments } from '../App/selectors'; import selectHomePage from './selectors'; import { cancelChanges, diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/selectors.js index 98e02db874..2a0c25ea98 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the home state domain diff --git a/packages/strapi-plugin-upload/admin/src/components/Li/index.js b/packages/strapi-plugin-upload/admin/src/components/Li/index.js index 3a0f90bc9a..48858f9425 100644 --- a/packages/strapi-plugin-upload/admin/src/components/Li/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/Li/index.js @@ -11,10 +11,11 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'; import cn from 'classnames'; import moment from 'moment'; -import FileIcon from 'components/FileIcon'; import IcoContainer from 'components/IcoContainer'; import PopUpWarning from 'components/PopUpWarning'; +import FileIcon from '../FileIcon'; + import styles from './styles.scss'; /* eslint-disable react/no-string-refs */ diff --git a/packages/strapi-plugin-upload/admin/src/components/List/index.js b/packages/strapi-plugin-upload/admin/src/components/List/index.js index 24cc674fa6..55ae206378 100644 --- a/packages/strapi-plugin-upload/admin/src/components/List/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/List/index.js @@ -9,8 +9,8 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import cn from 'classnames'; -import Li from 'components/Li'; -import ListHeader from 'components/ListHeader'; +import Li from '../Li'; +import ListHeader from '../ListHeader'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-upload/admin/src/containers/App/index.js b/packages/strapi-plugin-upload/admin/src/containers/App/index.js index 38a5a6d9a0..8618e70da1 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/App/index.js @@ -8,12 +8,12 @@ import React from 'react'; import { Switch, Route } from 'react-router-dom'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; // Containers -import ConfigPage from 'containers/ConfigPage'; -import HomePage from 'containers/HomePage'; -import NotFoundPage from 'containers/NotFoundPage'; +import ConfigPage from '../ConfigPage'; +import HomePage from '../HomePage'; +import NotFoundPage from '../NotFoundPage'; function App() { return ( diff --git a/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/index.js b/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/index.js index 1ea14f043c..74c84dece9 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/index.js @@ -9,7 +9,6 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators, compose } from 'redux'; import { findIndex, get, isEmpty } from 'lodash'; -import pluginId from 'pluginId'; // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src @@ -18,8 +17,10 @@ import ContainerFluid from 'components/ContainerFluid'; import HeaderNav from 'components/HeaderNav'; import PluginHeader from 'components/PluginHeader'; +import pluginId from '../../pluginId'; + // Plugin's components -import EditForm from 'components/EditForm'; +import EditForm from '../../components/EditForm'; import { getSettings, diff --git a/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/selectors.js b/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/selectors.js index d80be4e38c..2659d39aa5 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/selectors.js +++ b/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the configPage state domain diff --git a/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js index a2eec0a223..74d2caea9c 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js @@ -11,7 +11,6 @@ import { connect } from 'react-redux'; import { injectIntl } from 'react-intl'; import { bindActionCreators, compose } from 'redux'; import { isEmpty } from 'lodash'; -import pluginId from 'pluginId'; // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src @@ -22,14 +21,16 @@ import InputSearch from 'components/InputSearch'; import PageFooter from 'components/PageFooter'; import PluginHeader from 'components/PluginHeader'; -// Plugin's component -import EntriesNumber from 'components/EntriesNumber'; -import List from 'components/List'; -import PluginInputFile from 'components/PluginInputFile'; - // Utils import getQueryParameters from 'utils/getQueryParameters'; +import pluginId from '../../pluginId'; + +// Plugin's component +import EntriesNumber from '../../components/EntriesNumber'; +import List from '../../components/List'; +import PluginInputFile from '../../components/PluginInputFile'; + // Actions import { changeParams, diff --git a/packages/strapi-plugin-upload/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-upload/admin/src/containers/HomePage/selectors.js index 439d9c9d8d..56d7b4d6b0 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-upload/admin/src/containers/HomePage/selectors.js @@ -1,5 +1,6 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; + /** * Direct selector to the homePage state domain diff --git a/packages/strapi-plugin-users-permissions/admin/src/components/Controller/index.js b/packages/strapi-plugin-users-permissions/admin/src/components/Controller/index.js index 8d8dc7cb64..e8e118b8f3 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/components/Controller/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/components/Controller/index.js @@ -10,7 +10,7 @@ import { get, map, some } from 'lodash'; import cn from 'classnames'; import { FormattedMessage } from 'react-intl'; -import InputCheckbox from 'components/InputCheckboxPlugin'; +import InputCheckbox from '../InputCheckboxPlugin'; import styles from './styles.scss'; class Controller extends React.Component { diff --git a/packages/strapi-plugin-users-permissions/admin/src/components/InputSearchContainer/index.js b/packages/strapi-plugin-users-permissions/admin/src/components/InputSearchContainer/index.js index 32ead2d40e..147e01f76f 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/components/InputSearchContainer/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/components/InputSearchContainer/index.js @@ -11,7 +11,7 @@ import cn from 'classnames'; import PropTypes from 'prop-types'; import Label from 'components/Label'; -import InputSearchLi from 'components/InputSearchLi'; +import InputSearchLi from '../InputSearchLi'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-users-permissions/admin/src/components/List/index.js b/packages/strapi-plugin-users-permissions/admin/src/components/List/index.js index a404d56e7f..88e40084df 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/components/List/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/components/List/index.js @@ -16,7 +16,7 @@ import LoadingIndicator from 'components/LoadingIndicator'; // Design import Button from 'components/Button'; -import ListRow from 'components/ListRow'; +import ListRow from '../ListRow'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-users-permissions/admin/src/components/Plugin/index.js b/packages/strapi-plugin-users-permissions/admin/src/components/Plugin/index.js index 5d2f8fc8f0..f6940a339a 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/components/Plugin/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/components/Plugin/index.js @@ -10,7 +10,7 @@ import { Collapse } from 'reactstrap'; import { capitalize, get, isEmpty, map } from 'lodash'; import { FormattedMessage } from 'react-intl'; -import Controller from 'components/Controller'; +import Controller from '../Controller'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-users-permissions/admin/src/components/Plugins/index.js b/packages/strapi-plugin-users-permissions/admin/src/components/Plugins/index.js index 1fd809986b..b7a524923f 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/components/Plugins/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/components/Plugins/index.js @@ -9,7 +9,8 @@ import { FormattedMessage } from 'react-intl'; import { has, map } from 'lodash'; import PropTypes from 'prop-types'; import cn from 'classnames'; -import Plugin from 'components/Plugin'; + +import Plugin from '../Plugin'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-users-permissions/admin/src/components/Policies/index.js b/packages/strapi-plugin-users-permissions/admin/src/components/Policies/index.js index bb60ed2953..357140ab31 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/components/Policies/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/components/Policies/index.js @@ -10,8 +10,8 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { get, isEmpty, map, takeRight, toLower, without } from 'lodash'; -import BoundRoute from 'components/BoundRoute'; import Input from 'components/InputsIndex'; +import BoundRoute from '../BoundRoute'; import styles from './styles.scss'; diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/App/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/App/index.js index c60f43ab6b..766f36fd31 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/App/index.js @@ -8,13 +8,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Switch, Route } from 'react-router-dom'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; // Containers -import AuthPage from 'containers/AuthPage'; -import EditPage from 'containers/EditPage'; -import HomePage from 'containers/HomePage'; -import NotFoundPage from 'containers/NotFoundPage'; +import AuthPage from '../AuthPage'; +import EditPage from '../EditPage'; +import HomePage from '../HomePage'; +import NotFoundPage from '../NotFoundPage'; class App extends React.Component { componentDidMount() { diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/index.js index b88aea1ddf..4eef86c52a 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/index.js @@ -12,10 +12,6 @@ import { Link } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import { findIndex, get, isBoolean, isEmpty, map, replace } from 'lodash'; import cn from 'classnames'; -import pluginId from 'pluginId'; - -// Logo -import LogoStrapi from 'assets/images/logo_strapi.png'; // Design import Button from 'components/Button'; @@ -24,6 +20,11 @@ import Input from 'components/InputsIndex'; // Utils import auth from 'utils/auth'; +import pluginId from '../../pluginId'; + +// Logo +import LogoStrapi from '../../assets/images/logo_strapi.png'; + import { hideLoginErrorsInput, onChangeInput, diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/selectors.js b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/selectors.js index 6af2bbce2a..570ceefc3d 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/selectors.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the authPage state domain diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js index 44a257a764..024a44ec0b 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js @@ -12,17 +12,18 @@ import { bindActionCreators, compose } from 'redux'; import { FormattedMessage } from 'react-intl'; import { findIndex, get, isEmpty, isEqual, size } from 'lodash'; import cn from 'classnames'; -import pluginId from 'pluginId'; // Design import BackHeader from 'components/BackHeader'; import Input from 'components/InputsIndex'; -import InputSearch from 'components/InputSearchContainer'; import LoadingIndicator from 'components/LoadingIndicator'; import LoadingIndicatorPage from 'components/LoadingIndicatorPage'; import PluginHeader from 'components/PluginHeader'; -import Plugins from 'components/Plugins'; -import Policies from 'components/Policies'; + +import InputSearch from '../../components/InputSearchContainer'; +import Plugins from '../../components/Plugins'; +import Policies from '../../components/Policies'; +import pluginId from '../../pluginId'; // Actions import { diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/selectors.js b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/selectors.js index 91b81600a3..5a6b175669 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/selectors.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the editPage state domain diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js index 37097316d8..b965c52062 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js @@ -11,14 +11,16 @@ import { injectIntl } from 'react-intl'; import { bindActionCreators, compose } from 'redux'; import cn from 'classnames'; import { clone, get, includes, isEqual, isEmpty } from 'lodash'; -import pluginId from 'pluginId'; + +import HeaderNav from 'components/HeaderNav'; +import PluginHeader from 'components/PluginHeader'; + +import pluginId from '../../pluginId'; // Design -import EditForm from 'components/EditForm'; -import HeaderNav from 'components/HeaderNav'; -import List from 'components/List'; -import PluginHeader from 'components/PluginHeader'; -import PopUpForm from 'components/PopUpForm'; +import EditForm from '../../components/EditForm'; +import List from '../../components/List'; +import PopUpForm from '../../components/PopUpForm'; // Selectors import selectHomePage from './selectors'; diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/selectors.js index e4194b7588..69379663a6 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/selectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import pluginId from 'pluginId'; +import pluginId from '../../pluginId'; /** * Direct selector to the homePage state domain diff --git a/packages/strapi-plugin-users-permissions/config/policies/permissions.js b/packages/strapi-plugin-users-permissions/config/policies/permissions.js index a0af4f8b69..2f81c03fa1 100644 --- a/packages/strapi-plugin-users-permissions/config/policies/permissions.js +++ b/packages/strapi-plugin-users-permissions/config/policies/permissions.js @@ -32,11 +32,11 @@ module.exports = async (ctx, next) => { name: 'users-permissions' }); - if (_.get(await store.get({key: 'advanced'}), 'email_confirmation') && ctx.state.user.confirmed !== true) { + if (_.get(await store.get({key: 'advanced'}), 'email_confirmation') && !ctx.state.user.confirmed) { return handleErrors(ctx, 'Your account email is not confirmed.', 'unauthorized'); } - if (ctx.state.user.blocked === true) { + if (ctx.state.user.blocked) { return handleErrors(ctx, 'Your account has been blocked by the administrator.', 'unauthorized'); } } @@ -74,4 +74,4 @@ const handleErrors = (ctx, err = undefined, type) => { } return ctx[type](err); -}; \ No newline at end of file +}; diff --git a/packages/strapi-plugin-users-permissions/config/queries/mongoose.js b/packages/strapi-plugin-users-permissions/config/queries/mongoose.js index 8c74435b9b..2d28c570fe 100644 --- a/packages/strapi-plugin-users-permissions/config/queries/mongoose.js +++ b/packages/strapi-plugin-users-permissions/config/queries/mongoose.js @@ -11,9 +11,10 @@ module.exports = { .lean(); }, - count: async function (params = {}) { + count: async function (params = {where: {}}) { return Number(await this - .countDocuments(params)); + .countDocuments() + .where(params.where)); }, findOne: async function (params, populate) { diff --git a/packages/strapi-plugin-users-permissions/controllers/Auth.js b/packages/strapi-plugin-users-permissions/controllers/Auth.js index 64cb49459f..9053eadc59 100644 --- a/packages/strapi-plugin-users-permissions/controllers/Auth.js +++ b/packages/strapi-plugin-users-permissions/controllers/Auth.js @@ -57,11 +57,11 @@ module.exports = { return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.invalid' }] }] : 'Identifier or password invalid.'); } - if (_.get(await store.get({key: 'advanced'}), 'email_confirmation') && user.confirmed !== true) { + if (_.get(await store.get({key: 'advanced'}), 'email_confirmation') && !user.confirmed) { return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.confirmed' }] }] : 'Your account email is not confirmed.'); } - if (user.blocked === true) { + if (user.blocked) { return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.blocked' }] }] : 'Your account has been blocked by the administrator.'); } diff --git a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js index d3b4d6ec1d..3762db7cd7 100644 --- a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js @@ -182,7 +182,8 @@ module.exports = { for (let i = 0; i < roles.length; ++i) { roles[i].id = roles[i].id || roles[i]._id; - roles[i].nb_users = await strapi.query('user', 'users-permissions').count({ role: roles[i].id }); + + roles[i].nb_users = await strapi.query('user', 'users-permissions').count(strapi.utils.models.convertParams('user', { role: roles[i].id })); } return roles; diff --git a/packages/strapi-provider-email-mailgun/lib/index.js b/packages/strapi-provider-email-mailgun/lib/index.js index 51cce55d9b..c76dc64b96 100644 --- a/packages/strapi-provider-email-mailgun/lib/index.js +++ b/packages/strapi-provider-email-mailgun/lib/index.js @@ -55,7 +55,8 @@ module.exports = { to: options.to, subject: options.subject, text: options.text, - html: options.html + html: options.html, + ...(options.attachment && { attachment: options.attachment }) }; msg['h:Reply-To'] = options.replyTo; diff --git a/packages/strapi/bin/strapi-new.js b/packages/strapi/bin/strapi-new.js index 379be95f0f..f335ef51b1 100644 --- a/packages/strapi/bin/strapi-new.js +++ b/packages/strapi/bin/strapi-new.js @@ -31,7 +31,7 @@ const packageJSON = require('../package.json'); */ module.exports = function (name, cliArguments) { - console.log('🚀 Start creating your Strapi application.'); + console.log('🚀 Starting to create your Strapi application.'); const developerMode = cliArguments.dev !== undefined;