diff --git a/.travis.yml b/.travis.yml index 6678f29e51..f39693ef60 100755 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_install: - rm -rf node_modules/ install: - - npm run setup + - npm run setup --debug script: - npm run doc diff --git a/README.md b/README.md index 12d7164b79..25f2ce20f3 100755 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ This is the production-ready version of Strapi (v1). You should also consider th npm install strapi -g ``` -Read the [Getting started](http://strapi.io/documentation/getting-started/quick-start.html) page to create your first project using Strapi. +Read the [Getting started](https://strapi.io/getting-started) page to create your first project using Strapi. ## Features @@ -56,7 +56,7 @@ Read the [Getting started](http://strapi.io/documentation/getting-started/quick- ## Philosophy ? -> At [Strapi](http://strapi.io), everything we do we believe in changing the status quo of web development. Our products are simple to use, user friendly and production-ready. +> At [Strapi](https://strapi.io), everything we do we believe in changing the status quo of web development. Our products are simple to use, user friendly and production-ready. Web and mobile applications needed a powerful, simple to use and production-ready API-driven solution. That's why we created Strapi, an open-source Content Management Framework (CMF) for exposing your content (data, media) accross multi-devices. @@ -78,8 +78,12 @@ For general help using Strapi, please refer to [the official Strapi documentatio ### Professional support -[Strapi Solutions](http://strapi.io), the company behind Strapi, provides a full range of solutions to get better results, faster. We're always looking for the next challenge: coaching, consulting, training, customization, etc. [Drop us an email](mailto:support@strapi.io) to see how we can help you. +[Strapi Solutions](https://strapi.io), the company behind Strapi, provides a full range of solutions to get better results, faster. We're always looking for the next challenge: coaching, consulting, training, customization, etc. [Drop us an email](mailto:support@strapi.io) to see how we can help you. + +### Migration + +Follow our [migration guides](https://strapi.io/documentation/migration/migration-guide.html) on the website to keep your Strapi projects updated. ## License -[MIT License](LICENSE.md) Copyright (c) 2015-2018 [Strapi Solutions](http://strapi.io/). +[MIT License](LICENSE.md) Copyright (c) 2015-2018 [Strapi Solutions](https://strapi.io/). diff --git a/docs/3.x.x/en/README.md b/docs/3.x.x/en/README.md index 8b17e2ae75..dab7d7d2ed 100644 --- a/docs/3.x.x/en/README.md +++ b/docs/3.x.x/en/README.md @@ -12,10 +12,10 @@ The most advanced open-source Content Management Framework to build powerful API {% endcenter %} -## v3@alpha.7 is available! +## v3@alpha.8 is available! We've been working on a major update for Strapi during the past months, rewriting the core framework and the dashboard. -This documentation is only related to Strapi v3@alpha.7 ([v1 documentation is still available](http://strapi.io/documentation/1.x.x)). +This documentation is only related to Strapi v3@alpha.8 ([v1 documentation is still available](http://strapi.io/documentation/1.x.x)). **[Get Started](getting-started/installation.md)**
Learn how to install Strapi and start developing your API. @@ -36,4 +36,3 @@ Understand how to develop your own plugin. Learn about Strapi's API, the `strapi` object that is available in your backend. **[Migration guide](migration/migration-guide.md)**
-Migrate from v1 to v3@alpha.7. diff --git a/docs/3.x.x/en/SUMMARY.md b/docs/3.x.x/en/SUMMARY.md index 240c6098dc..3e989ef5bb 100644 --- a/docs/3.x.x/en/SUMMARY.md +++ b/docs/3.x.x/en/SUMMARY.md @@ -16,7 +16,7 @@ * [Table of contents](concepts/concepts.md) ### Guides -* [Authentification](guides/authentification.md) +* [Authentication](guides/authentication.md) * [Configurations](configurations/configurations.md) * [Controllers](guides/controllers.md) * [Deployment](guides/deployment.md) @@ -53,3 +53,4 @@ ### Migration * [Migrating from v1 to v3](migration/migration-guide.md) +* [Migrating from 3.0.0-alpha.7.4 to 3.0.0-alpha.8](migration/migration-guide-alpha-7-4-to-alpha-8.md) diff --git a/docs/3.x.x/en/advanced/middlewares.md b/docs/3.x.x/en/advanced/middlewares.md index 5ab502e0ea..787ed7a683 100644 --- a/docs/3.x.x/en/advanced/middlewares.md +++ b/docs/3.x.x/en/advanced/middlewares.md @@ -176,7 +176,7 @@ The `gzip` middleware will be loaded after the `p3p` middleware. All the others ], "order": [], "after": [ - "parser" + "parser", "router" ] } @@ -216,7 +216,7 @@ We assume that we set the `./config/middleware.json` file like this: "gzip" ], "after": [ - "parser" + "parser", "router" ] } diff --git a/docs/3.x.x/en/guides/authentication.md b/docs/3.x.x/en/guides/authentication.md index 11a1397be0..51566a8adc 100644 --- a/docs/3.x.x/en/guides/authentication.md +++ b/docs/3.x.x/en/guides/authentication.md @@ -11,7 +11,7 @@ $.ajax({ type: 'POST', url: 'http://localhost:1337/auth/local/register', data: { - username: 'Strapi user' + username: 'Strapi user', email: 'user@strapi.io', password: 'strapiPassword' }, @@ -30,7 +30,7 @@ $.ajax({ This route lets you log your users in by getting an authentication token. -#### Usage +#### Local - The `identifier` param can either be an email or a username. @@ -53,6 +53,32 @@ $.ajax({ }); ``` +## Providers + +Thanks to [Grant](https://github.com/simov/grant) and [Purest](https://github.com/simov/purest), you can easily use OAuth and OAuth2 +providers to enable authentication in your application. By default, +Strapi comes with four providers: +- Facebook +- Google +- Github +- Linkedin2 (Oauth2 Provider for Linkedin) + +To use the providers authentication, set your credentials in +`./plugins/users-permissions/config/environments/development/grant.json`. + +Redirect your user to: `GET /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. + +Response payload: + +```js +{ + "user": {}, + "jwt": "" +} +``` + ## Use your token to be identified as a user. 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. @@ -91,7 +117,7 @@ $.ajax({ type: 'POST', url: 'http://localhost:1337/auth/forgot-password', data: { - email: 'user@strapi.io' + email: 'user@strapi.io', url: 'http://mon-site.com/rest-password' }, done: function() { @@ -118,8 +144,8 @@ $.ajax({ type: 'POST', url: 'http://localhost:1337/auth/reset-password', data: { - code: 'privateCode' - password: 'myNewPassword' + code: 'privateCode', + password: 'myNewPassword', passwordConfirmation: 'myNewPassword' }, done: function() { diff --git a/docs/3.x.x/en/guides/i18n.md b/docs/3.x.x/en/guides/i18n.md index d7bdf0d0ce..19998eaf00 100644 --- a/docs/3.x.x/en/guides/i18n.md +++ b/docs/3.x.x/en/guides/i18n.md @@ -48,14 +48,14 @@ You need to define the english and french translation for this key. **Path —** `./config/locales/en_US.json`. ```json { - "Hello %s": "Hello %s" + "Hello %s": "Hello %s" } ``` **Path —** `./config/locales/fr_FR.json`. ```json { - "Hello %s": "Bonjour %s" + "Hello %s": "Bonjour %s" } ``` diff --git a/docs/3.x.x/en/guides/requests.md b/docs/3.x.x/en/guides/requests.md index c62f34bb3a..408b195383 100644 --- a/docs/3.x.x/en/guides/requests.md +++ b/docs/3.x.x/en/guides/requests.md @@ -137,8 +137,8 @@ For example "color=blue&size=small": ```js { -color: 'blue', -size: 'small' + color: 'blue', + size: 'small' } ``` @@ -163,8 +163,8 @@ ctx.set('ETag', '123'); // cache is ok if (ctx.fresh) { -ctx.status = 304; -return; + ctx.status = 304; + return; } // cache is stale @@ -238,7 +238,7 @@ only images are sent to a given route: if (ctx.is('image/*')) { // process } else { -ctx.throw(415, 'images only!'); + ctx.throw(415, 'images only!'); } ``` @@ -300,10 +300,10 @@ or use a switch: ```js switch (ctx.accepts('json', 'html', 'text')) { -case 'json': break; -case 'html': break; -case 'text': break; -default: ctx.throw(406, 'json, html, or text only'); + case 'json': break; + case 'html': break; + case 'text': break; + default: ctx.throw(406, 'json, html, or text only'); } ``` diff --git a/docs/3.x.x/en/guides/responses.md b/docs/3.x.x/en/guides/responses.md index 52a265689f..ce1afab894 100644 --- a/docs/3.x.x/en/guides/responses.md +++ b/docs/3.x.x/en/guides/responses.md @@ -155,7 +155,7 @@ Here's an example of stream error handling without automatically destroying the const PassThrough = require('stream').PassThrough; app.use(async ctx => { -ctx.body = someHTTPStream.on('error', ctx.onerror).pipe(PassThrough()); + ctx.body = someHTTPStream.on('error', ctx.onerror).pipe(PassThrough()); }); ``` @@ -192,8 +192,8 @@ Set several response header `fields` with an object: ```js ctx.set({ -'Etag': '1234', -'Last-Modified': date + 'Etag': '1234', + 'Last-Modified': date }); ``` @@ -247,7 +247,7 @@ let body = ctx.body; if (!body || body.pipe) return; if (Buffer.isBuffer(body)) body = body.toString(); -ctx.body = minify(body); + ctx.body = minify(body); }); ``` @@ -468,7 +468,7 @@ Here's an example of stream error handling without automatically destroying the const PassThrough = require('stream').PassThrough; app.use(async ctx => { -ctx.body = someHTTPStream.on('error', ctx.onerror).pipe(PassThrough()); + ctx.body = someHTTPStream.on('error', ctx.onerror).pipe(PassThrough()); }); ``` @@ -505,8 +505,8 @@ Set several response header `fields` with an object: ```js ctx.set({ -'Etag': '1234', -'Last-Modified': date + 'Etag': '1234', + 'Last-Modified': date }); ``` @@ -560,7 +560,7 @@ let body = ctx.body; if (!body || body.pipe) return; if (Buffer.isBuffer(body)) body = body.toString(); -ctx.body = minify(body); + ctx.body = minify(body); }); ``` @@ -693,9 +693,9 @@ Generates the following response payload: ```json { - "statusCode": 400, - "error": "Bad Request", - "message": "invalid query" + "statusCode": 400, + "error": "Bad Request", + "message": "invalid query" } ``` @@ -723,9 +723,9 @@ Generates the following response: ```json "payload": { - "statusCode": 401, - "error": "Unauthorized", - "message": "invalid password" + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password" }, "headers" {} ``` @@ -738,12 +738,12 @@ Generates the following response: ```json "payload": { - "statusCode": 401, - "error": "Unauthorized", - "message": "invalid password", - "attributes": { - "error": "invalid password" - } + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password", + "attributes": { + "error": "invalid password" + } }, "headers" { "WWW-Authenticate": "sample error=\"invalid password\"" @@ -758,9 +758,9 @@ Generates the following response: ```json "payload": { - "statusCode": 401, - "error": "Unauthorized", - "attributes": "VGhpcyBpcyBhIHRlc3QgdG9rZW4=" + "statusCode": 401, + "error": "Unauthorized", + "attributes": "VGhpcyBpcyBhIHRlc3QgdG9rZW4=" }, "headers" { "WWW-Authenticate": "Negotiate VGhpcyBpcyBhIHRlc3QgdG9rZW4=" @@ -775,15 +775,15 @@ Generates the following response: ```json "payload": { - "statusCode": 401, - "error": "Unauthorized", - "message": "invalid password", - "attributes": { - "error": "invalid password", - "ttl": 0, - "cache": "", - "foo": "bar" - } + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password", + "attributes": { + "error": "invalid password", + "ttl": 0, + "cache": "", + "foo": "bar" + } }, "headers" { "WWW-Authenticate": "sample ttl=\"0\", cache=\"\", foo=\"bar\", error=\"invalid password\"" @@ -804,9 +804,9 @@ Generates the following response payload: ```json { - "statusCode": 402, - "error": "Payment Required", - "message": "bandwidth used" + "statusCode": 402, + "error": "Payment Required", + "message": "bandwidth used" } ``` @@ -824,9 +824,9 @@ Generates the following response payload: ```json { - "statusCode": 403, - "error": "Forbidden", - "message": "try again some time" + "statusCode": 403, + "error": "Forbidden", + "message": "try again some time" } ``` @@ -844,9 +844,9 @@ Generates the following response payload: ```json { - "statusCode": 404, - "error": "Not Found", - "message": "missing" + "statusCode": 404, + "error": "Not Found", + "message": "missing" } ``` @@ -865,9 +865,9 @@ Generates the following response payload: ```json { - "statusCode": 405, - "error": "Method Not Allowed", - "message": "that method is not allowed" + "statusCode": 405, + "error": "Method Not Allowed", + "message": "that method is not allowed" } ``` @@ -885,9 +885,9 @@ Generates the following response payload: ```json { - "statusCode": 406, - "error": "Not Acceptable", - "message": "unacceptable" + "statusCode": 406, + "error": "Not Acceptable", + "message": "unacceptable" } ``` @@ -905,9 +905,9 @@ Generates the following response payload: ```json { - "statusCode": 407, - "error": "Proxy Authentication Required", - "message": "auth missing" + "statusCode": 407, + "error": "Proxy Authentication Required", + "message": "auth missing" } ``` @@ -925,9 +925,9 @@ Generates the following response payload: ```json { - "statusCode": 408, - "error": "Request Time-out", - "message": "timed out" + "statusCode": 408, + "error": "Request Time-out", + "message": "timed out" } ``` @@ -945,9 +945,9 @@ Generates the following response payload: ```json { - "statusCode": 409, - "error": "Conflict", - "message": "there was a conflict" + "statusCode": 409, + "error": "Conflict", + "message": "there was a conflict" } ``` @@ -965,9 +965,9 @@ Generates the following response payload: ```json { - "statusCode": 410, - "error": "Gone", - "message": "it is gone" + "statusCode": 410, + "error": "Gone", + "message": "it is gone" } ``` @@ -985,9 +985,9 @@ Generates the following response payload: ```json { - "statusCode": 411, - "error": "Length Required", - "message": "length needed" + "statusCode": 411, + "error": "Length Required", + "message": "length needed" } ``` @@ -1005,8 +1005,8 @@ Generates the following response payload: ```json { - "statusCode": 412, - "error": "Precondition Failed" + "statusCode": 412, + "error": "Precondition Failed" } ``` @@ -1024,9 +1024,9 @@ Generates the following response payload: ```json { - "statusCode": 413, - "error": "Request Entity Too Large", - "message": "too big" + "statusCode": 413, + "error": "Request Entity Too Large", + "message": "too big" } ``` @@ -1044,9 +1044,9 @@ Generates the following response payload: ```json { - "statusCode": 414, - "error": "Request-URI Too Large", - "message": "uri is too long" + "statusCode": 414, + "error": "Request-URI Too Large", + "message": "uri is too long" } ``` @@ -1064,9 +1064,9 @@ Generates the following response payload: ```json { - "statusCode": 415, - "error": "Unsupported Media Type", - "message": "that media is not supported" + "statusCode": 415, + "error": "Unsupported Media Type", + "message": "that media is not supported" } ``` @@ -1084,8 +1084,8 @@ Generates the following response payload: ```json { - "statusCode": 416, - "error": "Requested Range Not Satisfiable" + "statusCode": 416, + "error": "Requested Range Not Satisfiable" } ``` @@ -1103,9 +1103,9 @@ Generates the following response payload: ```json { - "statusCode": 417, - "error": "Expectation Failed", - "message": "expected this to work" + "statusCode": 417, + "error": "Expectation Failed", + "message": "expected this to work" } ``` @@ -1123,9 +1123,9 @@ Generates the following response payload: ```json { - "statusCode": 418, - "error": "I'm a Teapot", - "message": "Sorry, no coffee..." + "statusCode": 418, + "error": "I'm a Teapot", + "message": "Sorry, no coffee..." } ``` @@ -1143,9 +1143,9 @@ Generates the following response payload: ```json { - "statusCode": 422, - "error": "Unprocessable Entity", - "message": "your data is bad and you should feel bad" + "statusCode": 422, + "error": "Unprocessable Entity", + "message": "your data is bad and you should feel bad" } ``` @@ -1163,9 +1163,9 @@ Generates the following response payload: ```json { - "statusCode": 423, - "error": "Locked", - "message": "this resource has been locked" + "statusCode": 423, + "error": "Locked", + "message": "this resource has been locked" } ``` @@ -1183,9 +1183,9 @@ Generates the following response payload: ```json { - "statusCode": 428, - "error": "Precondition Required", - "message": "you must supply an If-Match header" + "statusCode": 428, + "error": "Precondition Required", + "message": "you must supply an If-Match header" } ``` @@ -1203,9 +1203,9 @@ Generates the following response payload: ```json { - "statusCode": 429, - "error": "Too Many Requests", - "message": "you have exceeded your request limit" + "statusCode": 429, + "error": "Too Many Requests", + "message": "you have exceeded your request limit" } ``` @@ -1223,9 +1223,9 @@ Generates the following response payload: ```json { - "statusCode": 451, - "error": "Unavailable For Legal Reasons", - "message": "you are not permitted to view this resource for legal reasons" + "statusCode": 451, + "error": "Unavailable For Legal Reasons", + "message": "you are not permitted to view this resource for legal reasons" } ``` @@ -1247,9 +1247,9 @@ Generates the following response payload: ```json { - "statusCode": 500, - "error": "Internal Server Error", - "message": "An internal server error occurred" + "statusCode": 500, + "error": "Internal Server Error", + "message": "An internal server error occurred" } ``` @@ -1267,9 +1267,9 @@ Generates the following response payload: ```json { - "statusCode": 501, - "error": "Not Implemented", - "message": "method not implemented" + "statusCode": 501, + "error": "Not Implemented", + "message": "method not implemented" } ``` @@ -1287,9 +1287,9 @@ Generates the following response payload: ```json { - "statusCode": 502, - "error": "Bad Gateway", - "message": "that is a bad gateway" + "statusCode": 502, + "error": "Bad Gateway", + "message": "that is a bad gateway" } ``` @@ -1307,9 +1307,9 @@ Generates the following response payload: ```json { - "statusCode": 503, - "error": "Service Unavailable", - "message": "unavailable" + "statusCode": 503, + "error": "Service Unavailable", + "message": "unavailable" } ``` @@ -1327,7 +1327,7 @@ Generates the following response payload: ```json { - "statusCode": 504, - "error": "Gateway Time-out" + "statusCode": 504, + "error": "Gateway Time-out" } ``` diff --git a/docs/3.x.x/en/migration/migration-guide-alpha-7-4-to-alpha-8.md b/docs/3.x.x/en/migration/migration-guide-alpha-7-4-to-alpha-8.md new file mode 100644 index 0000000000..a228c0573d --- /dev/null +++ b/docs/3.x.x/en/migration/migration-guide-alpha-7-4-to-alpha-8.md @@ -0,0 +1,57 @@ +# Migrating from 3.0.0-alpha.7.3 to 3.0.0-alpha.8 + +**Here are the major changes:** + +- Fix deployment process +- Setup database connection on project creation +- Helper for table creation for SQL database + +> Feel free to [join us on Slack](http://slack.strapi.io) and ask questions about the migration process. + +## Getting started + +Install Strapi `alpha.8` globally on your computer. To do so run `npm install strapi@3.0.0-alpha.8 -g`. + +When it's done, generate a new empty project `strapi new myNewProject` (don't pay attention to the database configuration). + +## Configurations + +You will have to update just 1 file: `package.json` + +- Edit the scripts section: (only the `setup` line has changed) + +```json +{ + "scripts": { + "setup": "cd admin && npm run setup", + "start": "node server.js", + "strapi": "node_modules/strapi/bin/strapi.js", + "lint": "node_modules/.bin/eslint api/**/*.js config/**/*.js plugins/**/*.js", + "postinstall": "node node_modules/strapi/lib/utils/post-install.js" + } +} +``` + +- Edit the Strapi's dependencies version: (move Strapi's dependencies to `3.0.0-alpha.8` version) + +```json +{ + "dependencies": { + "lodash": "4.x.x", + "strapi": "3.0.0-alpha.8", + "strapi-mongoose": "3.0.0-alpha.8" + } +} +``` + +## Update the Admin + +Delete your old admin folder and replace by the new one. + +## Update the Plugins + +Copy these 3 files `/plugins/users-permissions/config/jwt.json`, `/plugins/users-permissions/config/roles.json` and `/plugins/users-permissions/models/User.settings.json` **from your old project** and paste them in the corresponding ones in your new project. It is important to save these files. + +Then, delete your old `plugins` folder and replace it by the new one. + +That's all, you have now upgraded to Strapi `alpha.8`. diff --git a/docs/3.x.x/en/plugin-development/ui-components.md b/docs/3.x.x/en/plugin-development/ui-components.md index 85a904a897..605f9fa1eb 100644 --- a/docs/3.x.x/en/plugin-development/ui-components.md +++ b/docs/3.x.x/en/plugin-development/ui-components.md @@ -330,7 +330,7 @@ export default FooPage; ## OverlayBlocker -The OverlayBlocker is a React component that is very useful to block user interactions when the strapi server is restarting in order to avoid front-end errors. +The OverlayBlocker is a React component that is very useful to block user interactions when the strapi server is restarting in order to avoid front-end errors. This component is automatically displayed when the server needs to restart. You need to disable it in order to override the current design (once disabled it won't show on the other plugins so it's really important to enable it back when the component is unmounting). ### Usage @@ -341,7 +341,7 @@ The OverlayBlocker is a React component that is very useful to block user intera ### Example -In this example we'll have a button that when clicked it will display the OverlayBlocker for 5 seconds thus 'freezes' the admin so the user can't navigate (it simulates a very long server restart). +In this example we'll have a button that when clicked will display the OverlayBlocker for 5 seconds thus 'freezes' the admin so the user can't navigate (it simulates a very long server restart). **Path -** `./plugins/my-plugin/admin/src/containers/FooPage/constants.js`. ```js @@ -373,6 +373,12 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators, compose } from 'redux'; +// Actions required for disabling and enabling the OverlayBlocker +import { + disableGlobalOverlayBlocker, + enableGlobalOverlayBlocker, +} from 'actions/overlayBlocker'; + // Design import Button from 'components/Button'; import OverlayBlocker from 'components/OverlayBlocker'; @@ -395,6 +401,16 @@ import makeSelectFooPage from './selectors'; export class FooPage extends React.Component { + componentDidMount() { + // Disable the AdminPage OverlayBlocker in order to give it a custom design (children) + this.props.disableGlobalOverlayBlocker(); + } + + componentWillUnmount() { + // Enable the AdminPage OverlayBlocker so it is displayed when the server is restarting in the other plugins + this.props.enableGlobalOverlayBlocker(); + } + render() { return (
@@ -410,6 +426,8 @@ export class FooPage extends React.Component { } FooPage.propTypes = { + disableGlobalOverlayBlocker: PropTypes.func.isRequired, + enableGlobalOverlayBlocker: PropTypes.func.isRequired, onButtonClick: PropTypes.func.isRequired, showOverlayBlocker: PropTypes.bool.isRequired, }; @@ -419,6 +437,8 @@ const mapStateToProps = makeSelectFooPage(); function mapDispatchToProps(dispatch) { return bindActionCreators( { + disableGlobalOverlayBlocker, + enableGlobalOverlayBlocker, onButtonClick, }, dispatch, diff --git a/docs/3.x.x/en/plugin-development/utils.md b/docs/3.x.x/en/plugin-development/utils.md index ed2903421e..23bc3ab99c 100644 --- a/docs/3.x.x/en/plugin-development/utils.md +++ b/docs/3.x.x/en/plugin-development/utils.md @@ -2,6 +2,63 @@ Strapi provides helpers so you don't have to develop again and again the same generic functions. +## Auth + +`auth.js` lets you get, set and delete data in either the browser's `localStorage` or `sessionStorage`. + +### Methods + +| Name | Description | +| ---- | ----------- | +| clear(key) | Remove the data in either `localStorage` or `sessionStorage` | +| clearAppStorage() | Remove all data from both storage | +| clearToken() | Remove the user's `jwt Token` in the appropriate browser's storage | +| clearUserInfo() | Remove the user's info from storage | +| get(key) | Get the item in the browser's storage | +| getToken() | Get the user's `jwtToken` | +| getUserInfo() | Get the user's infos | +| set(value, key, isLocalStorage) | Set an item in the `sessionStorage`. If `true` is passed as the 3rd parameter it sets the value in the `localStorage` | +| setToken(value, isLocalStorage) | Set the user's `jwtToken` in the `sessionStorage`. If `true` is passed as the 2nd parameter it sets the value in the `localStorage` | +| setUserInfo(value, isLocalStorage) | Set the user's info in the `sessionStorage`. If `true` is passed as the 2nd parameter it sets the value in the `localStorage` | + + +```js +import auth from 'utils/auth'; + +// ... +// +auth.setToken('12345', true); // This will set 1234 in the browser's localStorage associated with the key: jwtToken +``` + +## Colors + +This function allows to darken a color. + +### Usage + +```js +import { darken } from 'utils/colors'; + +const linkColor = darken('#f5f5f5', 1.5); // Will darken #F5F5F5 by 1.5% which gives #f2f2f2. +``` + +## Get URL Query Parameters + +The helpers allows to retrieve the query parameters in the URL. + +### Example + +```js +import getQueryParameters from 'utils/getQueryParameters'; + +const URL = '/create?source=users-permissions'; +const source = getQueryParameters(URL, 'source'); + +console.log(source); // users-permissions + +``` + + ## Request helper A request helper is available to handle all requests inside a plugin. @@ -368,7 +425,6 @@ function* defaultSaga() { export default defaultSaga; ``` -*** *** ### Example with server autoReload watcher diff --git a/package.json b/package.json index 8857a1c4a5..dd9e0906d2 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "devDependencies": { "assert": "~1.3.0", "babel-eslint": "^6.1.2", diff --git a/packages/strapi-admin/.gitignore b/packages/strapi-admin/.gitignore index afe256bf30..e8ce0a0883 100644 --- a/packages/strapi-admin/.gitignore +++ b/packages/strapi-admin/.gitignore @@ -8,3 +8,4 @@ package-lock.json .DS_Store npm-debug.log .idea +manifest.json diff --git a/packages/strapi-admin/admin/.gitignore b/packages/strapi-admin/admin/.gitignore index 8f9cf76d0b..e7039d8a78 100644 --- a/packages/strapi-admin/admin/.gitignore +++ b/packages/strapi-admin/admin/.gitignore @@ -1,7 +1,6 @@ # Don't check auto-generated stuff into git coverage node_modules -build plugins.json stats.json package-lock.json diff --git a/packages/strapi-admin/admin/src/app.js b/packages/strapi-admin/admin/src/app.js index 8be1784c5d..e7731ac01b 100755 --- a/packages/strapi-admin/admin/src/app.js +++ b/packages/strapi-admin/admin/src/app.js @@ -23,7 +23,14 @@ import LanguageProvider from 'containers/LanguageProvider'; import App from 'containers/App'; import { showNotification } from 'containers/NotificationProvider/actions'; -import { pluginLoaded, updatePlugin, unsetHasUserPlugin } from 'containers/App/actions'; +import { + freezeApp, + pluginLoaded, + unfreezeApp, + unsetHasUserPlugin, + updatePlugin, +} from 'containers/App/actions'; + import auth from 'utils/auth'; import configureStore from './store'; import { translationMessages, languages } from './i18n'; @@ -175,6 +182,13 @@ const displayNotification = (message, status) => { store.dispatch(showNotification(message, status)); }; +const lockApp = () => { + store.dispatch(freezeApp()); +}; + +const unlockApp = () => { + store.dispatch(unfreezeApp()); +}; /** * Public Strapi object exposed to the `window` object @@ -208,6 +222,8 @@ window.strapi = Object.assign(window.strapi || {}, { router: history, languages, currentLanguage: window.localStorage.getItem('strapi-admin-language') || window.navigator.language || window.navigator.userLanguage || 'en', + lockApp, + unlockApp, }); const dispatch = store.dispatch; diff --git a/packages/strapi-admin/admin/src/components/Row/styles.scss b/packages/strapi-admin/admin/src/components/Row/styles.scss index 99b6bf3862..7da9479530 100644 --- a/packages/strapi-admin/admin/src/components/Row/styles.scss +++ b/packages/strapi-admin/admin/src/components/Row/styles.scss @@ -5,12 +5,25 @@ .icoContainer { width: 70px; height: 36px; + position: relative; margin: auto 0; - line-height: 36px; text-align: center; border: 1px solid rgba(28,93,231,0.1); border-radius: 3px; font-size: 20px; + + > img { + max-width: 100%; + max-height: 100%; + width: auto; + height: auto; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + } } .pluginContent { diff --git a/packages/strapi-admin/admin/src/config/manifest.json b/packages/strapi-admin/admin/src/config/manifest.json new file mode 100644 index 0000000000..9fec71a004 --- /dev/null +++ b/packages/strapi-admin/admin/src/config/manifest.json @@ -0,0 +1 @@ +{"name":"vendor_lib","content":{"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_export.js":{"id":0,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_an-object.js":{"id":1,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_global.js":{"id":2,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_fails.js":{"id":3,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_is-object.js":{"id":4,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_wks.js":{"id":5,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_descriptors.js":{"id":6,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-dp.js":{"id":7,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_to-length.js":{"id":8,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_to-object.js":{"id":9,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_a-function.js":{"id":10,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_has.js":{"id":11,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_hide.js":{"id":12,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_redefine.js":{"id":13,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_string-html.js":{"id":14,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react/index.js":{"id":15,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_to-iobject.js":{"id":16,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-gopd.js":{"id":17,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-gpo.js":{"id":18,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_ctx.js":{"id":19,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_cof.js":{"id":20,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_strict-method.js":{"id":21,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/prop-types/index.js":{"id":22,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_core.js":{"id":23,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_to-primitive.js":{"id":24,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_defined.js":{"id":25,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_to-integer.js":{"id":26,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-sap.js":{"id":27,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_array-methods.js":{"id":28,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_typed-array.js":{"id":29,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_metadata.js":{"id":30,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_meta.js":{"id":31,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_add-to-unscopables.js":{"id":32,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_property-desc.js":{"id":33,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_uid.js":{"id":34,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_library.js":{"id":35,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-keys.js":{"id":36,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_to-absolute-index.js":{"id":37,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-create.js":{"id":38,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-gopn.js":{"id":39,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_set-species.js":{"id":40,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_an-instance.js":{"id":41,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_for-of.js":{"id":42,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_redefine-all.js":{"id":43,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_set-to-string-tag.js":{"id":44,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_string-trim.js":{"id":45,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_iterators.js":{"id":46,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_validate-collection.js":{"id":47,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_iobject.js":{"id":48,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-pie.js":{"id":49,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_classof.js":{"id":50,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/emptyFunction.js":{"id":51,"meta":{}},"./strapi-helper-plugin/node_modules/webpack/buildin/global.js":{"id":52,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_shared.js":{"id":53,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_array-includes.js":{"id":54,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-gops.js":{"id":55,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_is-array.js":{"id":56,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_is-regexp.js":{"id":57,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_iter-detect.js":{"id":58,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_flags.js":{"id":59,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_fix-re-wks.js":{"id":60,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_species-constructor.js":{"id":61,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_collection.js":{"id":62,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_typed.js":{"id":63,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-forced-pam.js":{"id":64,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_set-collection-of.js":{"id":65,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_set-collection-from.js":{"id":66,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-dom/index.js":{"id":67,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_dom-create.js":{"id":68,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_wks-define.js":{"id":69,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_shared-key.js":{"id":70,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_enum-bug-keys.js":{"id":71,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_html.js":{"id":72,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_set-proto.js":{"id":73,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_string-ws.js":{"id":74,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_inherit-if-required.js":{"id":75,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_string-repeat.js":{"id":76,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_math-sign.js":{"id":77,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_math-expm1.js":{"id":78,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_string-at.js":{"id":79,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_iter-define.js":{"id":80,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_iter-create.js":{"id":81,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_string-context.js":{"id":82,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_fails-is-regexp.js":{"id":83,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_is-array-iter.js":{"id":84,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_create-property.js":{"id":85,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/core.get-iterator-method.js":{"id":86,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_array-species-create.js":{"id":87,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_array-fill.js":{"id":88,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.iterator.js":{"id":89,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_task.js":{"id":90,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_microtask.js":{"id":91,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_new-promise-capability.js":{"id":92,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_typed-buffer.js":{"id":93,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_user-agent.js":{"id":94,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/object-assign/index.js":{"id":95,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/emptyObject.js":{"id":96,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-messageformat/src/main.js":{"id":97,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-messageformat/src/utils.js":{"id":98,"meta":{"harmonyModule":true},"exports":["hop","extend"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-transition-group/Transition.js":{"id":99,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-transition-group/utils/PropTypes.js":{"id":100,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_ie8-dom-define.js":{"id":101,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_wks-ext.js":{"id":102,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-keys-internal.js":{"id":103,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-dps.js":{"id":104,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-gopn-ext.js":{"id":105,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-assign.js":{"id":106,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_bind.js":{"id":107,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_invoke.js":{"id":108,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_parse-int.js":{"id":109,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_parse-float.js":{"id":110,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_a-number-value.js":{"id":111,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_is-integer.js":{"id":112,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_math-log1p.js":{"id":113,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_math-fround.js":{"id":114,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_iter-call.js":{"id":115,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_array-reduce.js":{"id":116,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_array-copy-within.js":{"id":117,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_iter-step.js":{"id":118,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.regexp.flags.js":{"id":119,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_perform.js":{"id":120,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_promise-resolve.js":{"id":121,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.map.js":{"id":122,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_collection-strong.js":{"id":123,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.set.js":{"id":124,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.weak-map.js":{"id":125,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_collection-weak.js":{"id":126,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_to-index.js":{"id":127,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_own-keys.js":{"id":128,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_flatten-into-array.js":{"id":129,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_string-pad.js":{"id":130,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_object-to-array.js":{"id":131,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_collection-to-json.js":{"id":132,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_array-from-iterable.js":{"id":133,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_math-scale.js":{"id":134,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react/cjs/react.production.min.js":{"id":136,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-dom/cjs/react-dom.production.min.js":{"id":137,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/ExecutionEnvironment.js":{"id":138,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/EventListener.js":{"id":139,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/getActiveElement.js":{"id":140,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/shallowEqual.js":{"id":141,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/containsNode.js":{"id":142,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/isTextNode.js":{"id":143,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/isNode.js":{"id":144,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/focusNode.js":{"id":145,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-intl/lib/index.es.js":{"id":146,"meta":{"harmonyModule":true},"exports":["addLocaleData","intlShape","injectIntl","defineMessages","IntlProvider","FormattedDate","FormattedTime","FormattedRelative","FormattedNumber","FormattedPlural","FormattedMessage","FormattedHTMLMessage"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-messageformat/src/core.js":{"id":148,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-messageformat/src/es5.js":{"id":149,"meta":{"harmonyModule":true},"exports":["defineProperty","objCreate"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-messageformat/src/compiler.js":{"id":150,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-messageformat-parser/src/parser.js":{"id":151,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-messageformat/src/en.js":{"id":152,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-relativeformat/src/main.js":{"id":153,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-relativeformat/src/core.js":{"id":154,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-relativeformat/src/diff.js":{"id":155,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-relativeformat/src/es5.js":{"id":156,"meta":{"harmonyModule":true},"exports":["defineProperty","objCreate","arrIndexOf","isArray","dateNow"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-relativeformat/src/en.js":{"id":157,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/prop-types/factoryWithThrowingShims.js":{"id":158,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/fbjs/lib/invariant.js":{"id":159,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/prop-types/lib/ReactPropTypesSecret.js":{"id":160,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/invariant/browser.js":{"id":161,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-format-cache/src/memoizer.js":{"id":162,"meta":{"harmonyModule":true},"exports":["default"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/intl-format-cache/src/es5.js":{"id":163,"meta":{"harmonyModule":true},"exports":["bind","defineProperty","objCreate"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/reactstrap/dist/reactstrap.es.js":{"id":164,"meta":{"harmonyModule":true},"exports":["Alert","Container","Row","Col","Navbar","NavbarBrand","NavbarToggler","Nav","NavItem","NavDropdown","NavLink","Breadcrumb","BreadcrumbItem","Button","ButtonDropdown","ButtonGroup","ButtonToolbar","Dropdown","DropdownItem","DropdownMenu","DropdownToggle","Fade","Badge","Card","CardLink","CardGroup","CardDeck","CardColumns","CardBody","CardBlock","CardFooter","CardHeader","CardImg","CardImgOverlay","Carousel","UncontrolledCarousel","CarouselControl","CarouselItem","CarouselIndicators","CarouselCaption","CardSubtitle","CardText","CardTitle","Popover","PopoverContent","PopoverBody","PopoverTitle","PopoverHeader","Progress","Modal","ModalHeader","ModalBody","ModalFooter","PopperContent","PopperTargetHelper","Tooltip","Table","ListGroup","Form","FormFeedback","FormGroup","FormText","Input","InputGroup","InputGroupAddon","InputGroupButton","Label","Media","Pagination","PaginationItem","PaginationLink","TabContent","TabPane","Jumbotron","Collapse","ListGroupItem","ListGroupItemText","ListGroupItemHeading","UncontrolledAlert","UncontrolledButtonDropdown","UncontrolledDropdown","UncontrolledNavDropdown","UncontrolledTooltip"]},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/classnames/index.js":{"id":165,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/lodash.isfunction/index.js":{"id":166,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/lodash.isobject/index.js":{"id":167,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-popper/lib/react-popper.js":{"id":168,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-popper/lib/Manager.js":{"id":169,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-popper/lib/Target.js":{"id":170,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-popper/lib/Popper.js":{"id":171,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/popper.js/dist/umd/popper.js":{"id":172,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-popper/lib/Arrow.js":{"id":173,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/lodash.tonumber/index.js":{"id":174,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-transition-group/index.js":{"id":175,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-transition-group/CSSTransition.js":{"id":176,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/dom-helpers/class/addClass.js":{"id":177,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/dom-helpers/class/hasClass.js":{"id":178,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/dom-helpers/class/removeClass.js":{"id":179,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-transition-group/TransitionGroup.js":{"id":180,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/react-transition-group/utils/ChildMapping.js":{"id":181,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/immutable/dist/immutable.js":{"id":182,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/lodash/lodash.js":{"id":183,"meta":{}},"./strapi-helper-plugin/node_modules/webpack/buildin/module.js":{"id":184,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/babel-polyfill/lib/index.js":{"id":185,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/shim.js":{"id":186,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.symbol.js":{"id":187,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_enum-keys.js":{"id":188,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.create.js":{"id":189,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.define-property.js":{"id":190,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.define-properties.js":{"id":191,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.get-own-property-descriptor.js":{"id":192,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.get-prototype-of.js":{"id":193,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.keys.js":{"id":194,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.get-own-property-names.js":{"id":195,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.freeze.js":{"id":196,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.seal.js":{"id":197,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.prevent-extensions.js":{"id":198,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.is-frozen.js":{"id":199,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.is-sealed.js":{"id":200,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.is-extensible.js":{"id":201,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.assign.js":{"id":202,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.is.js":{"id":203,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_same-value.js":{"id":204,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.set-prototype-of.js":{"id":205,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.object.to-string.js":{"id":206,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.function.bind.js":{"id":207,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.function.name.js":{"id":208,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.function.has-instance.js":{"id":209,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.parse-int.js":{"id":210,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.parse-float.js":{"id":211,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.constructor.js":{"id":212,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.to-fixed.js":{"id":213,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.to-precision.js":{"id":214,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.epsilon.js":{"id":215,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.is-finite.js":{"id":216,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.is-integer.js":{"id":217,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.is-nan.js":{"id":218,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.is-safe-integer.js":{"id":219,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.max-safe-integer.js":{"id":220,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.min-safe-integer.js":{"id":221,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.parse-float.js":{"id":222,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.number.parse-int.js":{"id":223,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.acosh.js":{"id":224,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.asinh.js":{"id":225,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.atanh.js":{"id":226,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.cbrt.js":{"id":227,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.clz32.js":{"id":228,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.cosh.js":{"id":229,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.expm1.js":{"id":230,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.fround.js":{"id":231,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.hypot.js":{"id":232,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.imul.js":{"id":233,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.log10.js":{"id":234,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.log1p.js":{"id":235,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.log2.js":{"id":236,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.sign.js":{"id":237,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.sinh.js":{"id":238,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.tanh.js":{"id":239,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.math.trunc.js":{"id":240,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.from-code-point.js":{"id":241,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.raw.js":{"id":242,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.trim.js":{"id":243,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.iterator.js":{"id":244,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.code-point-at.js":{"id":245,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.ends-with.js":{"id":246,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.includes.js":{"id":247,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.repeat.js":{"id":248,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.starts-with.js":{"id":249,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.anchor.js":{"id":250,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.big.js":{"id":251,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.blink.js":{"id":252,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.bold.js":{"id":253,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.fixed.js":{"id":254,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.fontcolor.js":{"id":255,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.fontsize.js":{"id":256,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.italics.js":{"id":257,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.link.js":{"id":258,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.small.js":{"id":259,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.strike.js":{"id":260,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.sub.js":{"id":261,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.string.sup.js":{"id":262,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.date.now.js":{"id":263,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.date.to-json.js":{"id":264,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.date.to-iso-string.js":{"id":265,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_date-to-iso-string.js":{"id":266,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.date.to-string.js":{"id":267,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.date.to-primitive.js":{"id":268,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_date-to-primitive.js":{"id":269,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.is-array.js":{"id":270,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.from.js":{"id":271,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.of.js":{"id":272,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.join.js":{"id":273,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.slice.js":{"id":274,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.sort.js":{"id":275,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.for-each.js":{"id":276,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_array-species-constructor.js":{"id":277,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.map.js":{"id":278,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.filter.js":{"id":279,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.some.js":{"id":280,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.every.js":{"id":281,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.reduce.js":{"id":282,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.reduce-right.js":{"id":283,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.index-of.js":{"id":284,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.last-index-of.js":{"id":285,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.copy-within.js":{"id":286,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.fill.js":{"id":287,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.find.js":{"id":288,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.find-index.js":{"id":289,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.array.species.js":{"id":290,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.regexp.constructor.js":{"id":291,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.regexp.to-string.js":{"id":292,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.regexp.match.js":{"id":293,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.regexp.replace.js":{"id":294,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.regexp.search.js":{"id":295,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.regexp.split.js":{"id":296,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.promise.js":{"id":297,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.weak-set.js":{"id":298,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.array-buffer.js":{"id":299,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.data-view.js":{"id":300,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.int8-array.js":{"id":301,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.uint8-array.js":{"id":302,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.uint8-clamped-array.js":{"id":303,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.int16-array.js":{"id":304,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.uint16-array.js":{"id":305,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.int32-array.js":{"id":306,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.uint32-array.js":{"id":307,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.float32-array.js":{"id":308,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.typed.float64-array.js":{"id":309,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.apply.js":{"id":310,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.construct.js":{"id":311,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.define-property.js":{"id":312,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.delete-property.js":{"id":313,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.enumerate.js":{"id":314,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.get.js":{"id":315,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.get-own-property-descriptor.js":{"id":316,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.get-prototype-of.js":{"id":317,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.has.js":{"id":318,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.is-extensible.js":{"id":319,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.own-keys.js":{"id":320,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.prevent-extensions.js":{"id":321,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.set.js":{"id":322,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es6.reflect.set-prototype-of.js":{"id":323,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.array.includes.js":{"id":324,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.array.flat-map.js":{"id":325,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.array.flatten.js":{"id":326,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.string.at.js":{"id":327,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.string.pad-start.js":{"id":328,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.string.pad-end.js":{"id":329,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.string.trim-left.js":{"id":330,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.string.trim-right.js":{"id":331,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.string.match-all.js":{"id":332,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.symbol.async-iterator.js":{"id":333,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.symbol.observable.js":{"id":334,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.object.get-own-property-descriptors.js":{"id":335,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.object.values.js":{"id":336,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.object.entries.js":{"id":337,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.object.define-getter.js":{"id":338,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.object.define-setter.js":{"id":339,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.object.lookup-getter.js":{"id":340,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.object.lookup-setter.js":{"id":341,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.map.to-json.js":{"id":342,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.set.to-json.js":{"id":343,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.map.of.js":{"id":344,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.set.of.js":{"id":345,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.weak-map.of.js":{"id":346,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.weak-set.of.js":{"id":347,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.map.from.js":{"id":348,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.set.from.js":{"id":349,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.weak-map.from.js":{"id":350,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.weak-set.from.js":{"id":351,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.global.js":{"id":352,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.system.global.js":{"id":353,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.error.is-error.js":{"id":354,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.clamp.js":{"id":355,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.deg-per-rad.js":{"id":356,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.degrees.js":{"id":357,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.fscale.js":{"id":358,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.iaddh.js":{"id":359,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.isubh.js":{"id":360,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.imulh.js":{"id":361,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.rad-per-deg.js":{"id":362,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.radians.js":{"id":363,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.scale.js":{"id":364,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.umulh.js":{"id":365,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.math.signbit.js":{"id":366,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.promise.finally.js":{"id":367,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.promise.try.js":{"id":368,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.define-metadata.js":{"id":369,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.delete-metadata.js":{"id":370,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.get-metadata.js":{"id":371,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.get-metadata-keys.js":{"id":372,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.get-own-metadata.js":{"id":373,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.get-own-metadata-keys.js":{"id":374,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.has-metadata.js":{"id":375,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.has-own-metadata.js":{"id":376,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.reflect.metadata.js":{"id":377,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.asap.js":{"id":378,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/es7.observable.js":{"id":379,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/web.timers.js":{"id":380,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/web.immediate.js":{"id":381,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/web.dom.iterable.js":{"id":382,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js":{"id":383,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/fn/regexp/escape.js":{"id":384,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/core.regexp.escape.js":{"id":385,"meta":{}},"./strapi-admin/node_modules/strapi-helper-plugin/node_modules/core-js/modules/_replacer.js":{"id":386,"meta":{}}}} \ No newline at end of file diff --git a/packages/strapi-admin/admin/src/containers/AdminPage/index.js b/packages/strapi-admin/admin/src/containers/AdminPage/index.js index d49065e07d..849f118814 100644 --- a/packages/strapi-admin/admin/src/containers/AdminPage/index.js +++ b/packages/strapi-admin/admin/src/containers/AdminPage/index.js @@ -17,7 +17,13 @@ import { Switch, Route } from 'react-router-dom'; import { get, includes, isFunction, map, omit } from 'lodash'; import { pluginLoaded, updatePlugin } from 'containers/App/actions'; -import { selectHasUserPlugin, selectPlugins } from 'containers/App/selectors'; +import { + makeSelectBlockApp, + makeSelectShowGlobalAppBlocker, + selectHasUserPlugin, + selectPlugins, +} from 'containers/App/selectors'; + import { hideNotification } from 'containers/NotificationProvider/actions'; // Design @@ -30,6 +36,7 @@ import LeftMenu from 'containers/LeftMenu'; import ListPluginsPage from 'containers/ListPluginsPage'; import Logout from 'components/Logout'; import NotFoundPage from 'containers/NotFoundPage'; +import OverlayBlocker from 'components/OverlayBlocker'; import PluginPage from 'containers/PluginPage'; import auth from 'utils/auth'; @@ -130,6 +137,7 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
+ ); } @@ -149,17 +157,21 @@ AdminPage.defaultProps = { }; AdminPage.propTypes = { + blockApp: PropTypes.bool.isRequired, hasUserPlugin: PropTypes.bool, history: PropTypes.object.isRequired, location: PropTypes.object.isRequired, pluginLoaded: PropTypes.func.isRequired, plugins: PropTypes.object.isRequired, + showGlobalAppBlocker: PropTypes.bool.isRequired, updatePlugin: PropTypes.func.isRequired, }; const mapStateToProps = createStructuredSelector({ + blockApp: makeSelectBlockApp(), hasUserPlugin: selectHasUserPlugin(), plugins: selectPlugins(), + showGlobalAppBlocker: makeSelectShowGlobalAppBlocker(), }); function mapDispatchToProps(dispatch) { diff --git a/packages/strapi-admin/admin/src/containers/App/actions.js b/packages/strapi-admin/admin/src/containers/App/actions.js index 6b35df17c8..ebb9411621 100755 --- a/packages/strapi-admin/admin/src/containers/App/actions.js +++ b/packages/strapi-admin/admin/src/containers/App/actions.js @@ -5,13 +5,21 @@ */ import { + FREEZE_APP, LOAD_PLUGIN, - UPDATE_PLUGIN, - PLUGIN_LOADED, PLUGIN_DELETED, + PLUGIN_LOADED, + UNFREEZE_APP, UNSET_HAS_USERS_PLUGIN, + UPDATE_PLUGIN, } from './constants'; +export function freezeApp() { + return { + type: FREEZE_APP, + }; +} + export function loadPlugin(newPlugin) { return { type: LOAD_PLUGIN, @@ -19,22 +27,6 @@ export function loadPlugin(newPlugin) { }; } -export function updatePlugin(pluginId, updatedKey, updatedValue) { - return { - type: UPDATE_PLUGIN, - pluginId, - updatedKey, - updatedValue, - }; -} - -export function pluginLoaded(newPlugin) { - return { - type: PLUGIN_LOADED, - plugin: newPlugin, - }; -} - export function pluginDeleted(plugin) { return { type: PLUGIN_DELETED, @@ -42,8 +34,30 @@ export function pluginDeleted(plugin) { }; } +export function pluginLoaded(newPlugin) { + return { + type: PLUGIN_LOADED, + plugin: newPlugin, + }; +} + +export function unfreezeApp() { + return { + type: UNFREEZE_APP, + }; +} + export function unsetHasUserPlugin() { return { type: UNSET_HAS_USERS_PLUGIN, }; } + +export function updatePlugin(pluginId, updatedKey, updatedValue) { + return { + type: UPDATE_PLUGIN, + pluginId, + updatedKey, + updatedValue, + }; +} diff --git a/packages/strapi-admin/admin/src/containers/App/constants.js b/packages/strapi-admin/admin/src/containers/App/constants.js index ca9553e768..80c3ddfd2f 100755 --- a/packages/strapi-admin/admin/src/containers/App/constants.js +++ b/packages/strapi-admin/admin/src/containers/App/constants.js @@ -4,8 +4,10 @@ * */ -export const UNSET_HAS_USERS_PLUGIN = 'app/App/UNSET_HAS_USERS_PLUGIN'; +export const FREEZE_APP = 'app/App/FREEZE_APP'; export const LOAD_PLUGIN = 'app/App/LOAD_PLUGIN'; -export const UPDATE_PLUGIN = 'app/App/UPDATE_PLUGIN'; export const PLUGIN_LOADED = 'app/App/PLUGIN_LOADED'; export const PLUGIN_DELETED = 'app/App/PLUGIN_DELETED'; +export const UNFREEZE_APP = 'app/App/UNFREEZE_APP'; +export const UNSET_HAS_USERS_PLUGIN = 'app/App/UNSET_HAS_USERS_PLUGIN'; +export const UPDATE_PLUGIN = 'app/App/UPDATE_PLUGIN'; diff --git a/packages/strapi-admin/admin/src/containers/App/reducer.js b/packages/strapi-admin/admin/src/containers/App/reducer.js index 39c19a9391..43358c898f 100755 --- a/packages/strapi-admin/admin/src/containers/App/reducer.js +++ b/packages/strapi-admin/admin/src/containers/App/reducer.js @@ -1,24 +1,43 @@ -import { fromJS } from 'immutable'; +// Shared constants import { - UPDATE_PLUGIN, + DISABLE_GLOBAL_OVERLAY_BLOCKER, + ENABLE_GLOBAL_OVERLAY_BLOCKER, +} from 'constants/overlayBlocker'; + +import { fromJS } from 'immutable'; + +import { + FREEZE_APP, PLUGIN_DELETED, PLUGIN_LOADED, + UNFREEZE_APP, UNSET_HAS_USERS_PLUGIN, + UPDATE_PLUGIN, } from './constants'; const initialState = fromJS({ - plugins: {}, + blockApp: false, hasUserPlugin: true, + plugins: {}, + showGlobalAppBlocker: true, }); function appReducer(state = initialState, action) { switch (action.type) { + case DISABLE_GLOBAL_OVERLAY_BLOCKER: + return state.set('showGlobalAppBlocker', false); + case ENABLE_GLOBAL_OVERLAY_BLOCKER: + return state.set('showGlobalAppBlocker', true); + case FREEZE_APP: + return state.set('blockApp', true); case PLUGIN_LOADED: return state.setIn(['plugins', action.plugin.id], fromJS(action.plugin)); case UPDATE_PLUGIN: return state.setIn(['plugins', action.pluginId, action.updatedKey], fromJS(action.updatedValue)); case PLUGIN_DELETED: return state.deleteIn(['plugins', action.plugin]); + case UNFREEZE_APP: + return state.set('blockApp', false); case UNSET_HAS_USERS_PLUGIN: return state.set('hasUserPlugin', false); default: diff --git a/packages/strapi-admin/admin/src/containers/App/selectors.js b/packages/strapi-admin/admin/src/containers/App/selectors.js index cd4ac3c647..db4e8913e4 100644 --- a/packages/strapi-admin/admin/src/containers/App/selectors.js +++ b/packages/strapi-admin/admin/src/containers/App/selectors.js @@ -19,8 +19,20 @@ const selectHasUserPlugin = () => createSelector( (appState) => appState.get('hasUserPlugin'), ); +const makeSelectShowGlobalAppBlocker = () => createSelector( + selectApp(), + (appState) => appState.get('showGlobalAppBlocker'), +); + +const makeSelectBlockApp = () => createSelector( + selectApp(), + (appState) => appState.get('blockApp'), +); + export { selectApp, selectHasUserPlugin, selectPlugins, + makeSelectBlockApp, + makeSelectShowGlobalAppBlocker, }; diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js index cfb7895c3c..58209024e4 100644 --- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js +++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js @@ -13,6 +13,11 @@ import { bindActionCreators, compose } from 'redux'; import cn from 'classnames'; import { get, isUndefined, map } from 'lodash'; +import { + disableGlobalOverlayBlocker, + enableGlobalOverlayBlocker, +} from 'actions/overlayBlocker'; + // Design // import Input from 'components/Input'; import DownloadInfo from 'components/DownloadInfo'; @@ -43,12 +48,20 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line ); componentDidMount() { + // Disable the AdminPage OverlayBlocker in order to give it a custom design (children) + this.props.disableGlobalOverlayBlocker(); + // Don't fetch the available plugins if it has already been done if (!this.props.didFetchPlugins) { this.props.getPlugins(); } } + componentWillUnmount() { + // Enable the AdminPage OverlayBlocker so it is displayed when the server is restarting + this.props.enableGlobalOverlayBlocker(); + } + render() { return (
@@ -118,7 +131,9 @@ InstallPluginPage.propTypes = { availablePlugins: PropTypes.array.isRequired, blockApp: PropTypes.bool.isRequired, didFetchPlugins: PropTypes.bool.isRequired, + disableGlobalOverlayBlocker: PropTypes.func.isRequired, downloadPlugin: PropTypes.func.isRequired, + enableGlobalOverlayBlocker: PropTypes.func.isRequired, getPlugins: PropTypes.func.isRequired, history: PropTypes.object.isRequired, // onChange: PropTypes.func.isRequired, @@ -130,7 +145,9 @@ const mapStateToProps = makeSelectInstallPluginPage(); function mapDispatchToProps(dispatch) { return bindActionCreators( { + disableGlobalOverlayBlocker, downloadPlugin, + enableGlobalOverlayBlocker, getPlugins, onChange, }, diff --git a/packages/strapi-admin/admin/src/containers/PluginPage/index.js b/packages/strapi-admin/admin/src/containers/PluginPage/index.js index 21f1ac44b9..8ef6a1d2a2 100755 --- a/packages/strapi-admin/admin/src/containers/PluginPage/index.js +++ b/packages/strapi-admin/admin/src/containers/PluginPage/index.js @@ -37,7 +37,7 @@ export class PluginPage extends React.Component { // eslint-disable-line react/p } return ( - + ); diff --git a/packages/strapi-admin/admin/src/translations/en.json b/packages/strapi-admin/admin/src/translations/en.json index 4182b2a794..ec0b96bff7 100755 --- a/packages/strapi-admin/admin/src/translations/en.json +++ b/packages/strapi-admin/admin/src/translations/en.json @@ -60,6 +60,9 @@ "components.ErrorBoundary.title": "Something wen't wrong...", + "components.OverlayBlocker.title": "Waiting for restart...", + "components.OverlayBlocker.description": "You're using a feature that needs the server to restart. Please wait until the server is up.", + "components.ProductionBlocker.header": "This plugin is only available in development.", "components.ProductionBlocker.description": "For safety we have to disable this plugin in other environments.", diff --git a/packages/strapi-admin/admin/src/translations/fr.json b/packages/strapi-admin/admin/src/translations/fr.json index 6d7fa2c743..c3566bd48c 100755 --- a/packages/strapi-admin/admin/src/translations/fr.json +++ b/packages/strapi-admin/admin/src/translations/fr.json @@ -58,6 +58,9 @@ "components.AutoReloadBlocker.header": "L'autoReload doit être activé pour ce plugin.", "components.AutoReloadBlocker.description": "Ouvrez le fichier suivant pour activer cette fonctionnalité.", + "components.OverlayBlocker.title": "Le serveur est en train de redémarrer", + "components.OverlayBlocker.description": "Vous utilisez une fonctionnalité qui nécessite le redémarrage du server. Merci d'attendre que celui-ci ait redémarré.", + "components.ErrorBoundary.title": "Une erreur est survenue...", "components.ProductionBlocker.header": "Ce plugin est disponible uniquement en développement.", diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json index 04ce12d68a..2f8dcbc9dc 100755 --- a/packages/strapi-admin/package.json +++ b/packages/strapi-admin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-admin", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Strapi Admin", "repository": { "type": "git", @@ -16,10 +16,9 @@ "build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build", "start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PORT=4000 IS_ADMIN=true node ./node_modules/strapi-helper-plugin/lib/server", "generate": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js", - "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path ./admin/.gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", - "pretest": "npm run lint", + "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path ./admin/.gitignore --ignore-pattern build --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", "prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"", - "test": "echo Tests are not implemented.", + "test": "npm run lint", "prepublishOnly": "npm run build", "setup": "node ./scripts/setup.js" }, @@ -28,8 +27,8 @@ }, "devDependencies": { "sanitize.css": "^4.1.0", - "strapi-helper-plugin": "3.0.0-alpha.7.3", - "strapi-utils": "3.0.0-alpha.7.3" + "strapi-helper-plugin": "3.0.0-alpha.8.3", + "strapi-utils": "3.0.0-alpha.8.3" }, "author": { "name": "Strapi", diff --git a/packages/strapi-admin/scripts/setup.js b/packages/strapi-admin/scripts/setup.js index 273de88628..c60587a03c 100644 --- a/packages/strapi-admin/scripts/setup.js +++ b/packages/strapi-admin/scripts/setup.js @@ -61,12 +61,20 @@ if (process.env.npm_config_plugins === 'true') { shell.exec(`cd ${path.resolve(plugins, plugin)} && npm install`, { silent }); - shell.exec(`cd ${path.resolve(plugins, plugin, 'node_modules', 'strapi-helper-plugin')} && npm install`, { - silent - }); + + if (isDevelopmentMode) { + shell.exec(`cd ${path.resolve(plugins, plugin)} && npm link strapi-helper-plugin`, { + silent + }); + } else { + shell.exec(`cd ${path.resolve(plugins, plugin, 'node_modules', 'strapi-helper-plugin')} && npm install`, { + silent + }); + } + shell.echo('🏗 Building...'); - const build = shell.exec(`cd ${path.resolve(plugins, plugin)} && APP_PATH=${appPath} npm run build`, { + const build = shell.exec(`cd ${path.resolve(plugins, plugin)} && APP_PATH=${appPath} npm run build`, { silent }); diff --git a/packages/strapi-bookshelf/package.json b/packages/strapi-bookshelf/package.json index 26c2ea11f0..dc107668b0 100755 --- a/packages/strapi-bookshelf/package.json +++ b/packages/strapi-bookshelf/package.json @@ -1,6 +1,6 @@ { "name": "strapi-bookshelf", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Bookshelf hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -19,8 +19,8 @@ "bookshelf": "^0.10.3", "lodash": "^4.17.4", "pluralize": "^6.0.0", - "strapi-knex": "3.0.0-alpha.7.3", - "strapi-utils": "3.0.0-alpha.7.3" + "strapi-knex": "3.0.0-alpha.8.3", + "strapi-utils": "3.0.0-alpha.8.3" }, "strapi": { "isHook": true, @@ -55,4 +55,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-ejs/package.json b/packages/strapi-ejs/package.json index 814c265555..8221d0f30d 100755 --- a/packages/strapi-ejs/package.json +++ b/packages/strapi-ejs/package.json @@ -1,6 +1,6 @@ { "name": "strapi-ejs", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "EJS hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -46,4 +46,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-generate-admin/package.json b/packages/strapi-generate-admin/package.json index b54a26cc5f..8864226cc2 100755 --- a/packages/strapi-generate-admin/package.json +++ b/packages/strapi-generate-admin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-admin", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Generate the default admin panel for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -15,7 +15,7 @@ "dependencies": { "fs-extra": "^4.0.1", "lodash": "^4.17.4", - "strapi-admin": "3.0.0-alpha.7.3" + "strapi-admin": "3.0.0-alpha.8.3" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-generate-api/package.json b/packages/strapi-generate-api/package.json index 2c9b991edb..0bbaa2a21f 100755 --- a/packages/strapi-generate-api/package.json +++ b/packages/strapi-generate-api/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-api", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Generate an API for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-generate-controller/package.json b/packages/strapi-generate-controller/package.json index 4fc8537942..6f38e7de43 100755 --- a/packages/strapi-generate-controller/package.json +++ b/packages/strapi-generate-controller/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-controller", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Generate a controller for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-generate-model/package.json b/packages/strapi-generate-model/package.json index aecac3593e..5c098933e9 100755 --- a/packages/strapi-generate-model/package.json +++ b/packages/strapi-generate-model/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-model", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Generate a model for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-generate-new/files/config/environments/development/request.json b/packages/strapi-generate-new/files/config/environments/development/request.json index 2c18a3099b..b826f5ac0d 100755 --- a/packages/strapi-generate-new/files/config/environments/development/request.json +++ b/packages/strapi-generate-new/files/config/environments/development/request.json @@ -1,6 +1,6 @@ { "session": { - "enabled": false, + "enabled": true, "client": "cookie", "key": "strapi.sid", "prefix": "strapi:sess:", diff --git a/packages/strapi-generate-new/files/config/environments/production/database.json b/packages/strapi-generate-new/files/config/environments/production/database.json index 3e9a8edcd2..6b283d6ebd 100755 --- a/packages/strapi-generate-new/files/config/environments/production/database.json +++ b/packages/strapi-generate-new/files/config/environments/production/database.json @@ -8,8 +8,8 @@ "host": "${process.env.DATABASE_HOST || 'localhost'}", "port": "${process.env.DATABASE_PORT || 27017}", "database": "${process.env.DATABASE_NAME || 'production'}", - "username": "", - "password": "" + "username": "${process.env.DATABASE_USERNAME || ''}", + "password": "${process.env.DATABASE_PASSWORD || ''}" }, "options": {} } diff --git a/packages/strapi-generate-new/lib/before.js b/packages/strapi-generate-new/lib/before.js index cd76b000e3..9989091348 100755 --- a/packages/strapi-generate-new/lib/before.js +++ b/packages/strapi-generate-new/lib/before.js @@ -13,6 +13,7 @@ const execSync = require('child_process').execSync; const _ = require('lodash'); const fs = require('fs-extra'); const inquirer = require('inquirer'); +const shell = require('shelljs'); // Logger. const logger = require('strapi-utils').logger; @@ -186,14 +187,14 @@ module.exports = (scope, cb) => { }); }), new Promise(resolve => { - let cmd = `npm install --prefix ${scope.rootPath} ${scope.client.connector}@alpha`; + let cmd = `npm install --prefix "${scope.rootPath}" ${scope.client.connector}@alpha`; if (scope.client.module) { cmd += ` ${scope.client.module}`; } exec(cmd, () => { if (scope.client.module) { - const lock = require(`${scope.rootPath}/node_modules/${scope.client.module}/package.json`); + const lock = require(path.join(`${scope.rootPath}`,`/node_modules/`,`${scope.client.module}/package.json`)); scope.client.version = lock.version; } @@ -205,12 +206,10 @@ module.exports = (scope, cb) => { Promise.all(asyncFn) .then(() => { try { - require(path.resolve(`${scope.rootPath}/node_modules/${scope.client.connector}/lib/utils/connectivity.js`))(scope, cb.success, connectionValidation); + require(path.join(`${scope.rootPath}`,`/node_modules/`,`${scope.client.connector}/lib/utils/connectivity.js`))(scope, cb.success, connectionValidation); } catch(err) { - execSync(`rm -r ${scope.rootPath}`); - + shell.rm('-r', scope.rootPath); logger.info('Copying the dashboard...'); - cb.success(); } }); diff --git a/packages/strapi-generate-new/package.json b/packages/strapi-generate-new/package.json index 36eef5dc3b..b84b986c04 100755 --- a/packages/strapi-generate-new/package.json +++ b/packages/strapi-generate-new/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-new", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Generate a new Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -18,7 +18,7 @@ "get-installed-path": "^3.0.1", "inquirer": "^4.0.2", "lodash": "^4.17.4", - "strapi-utils": "3.0.0-alpha.7.3", + "strapi-utils": "3.0.0-alpha.8.3", "uuid": "^3.1.0" }, "scripts": { @@ -48,4 +48,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-generate-plugin/json/package.json.js b/packages/strapi-generate-plugin/json/package.json.js index 82eb92b5f1..f2b16f94e7 100755 --- a/packages/strapi-generate-plugin/json/package.json.js +++ b/packages/strapi-generate-plugin/json/package.json.js @@ -35,10 +35,9 @@ module.exports = scope => { 'build:clean': 'node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build', 'start': 'node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server', 'generate': 'node ./node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js', - 'lint': 'node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin', - 'pretest': 'npm run lint', + 'lint': 'node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern \'/admin/build/\' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin', 'prettier': 'node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write "{admin,__{tests,mocks}__}/**/*.js"', - 'test': 'echo Tests are not implemented.', + 'test': 'npm run lint', 'prepublishOnly': 'npm run build' }, 'dependencies': {}, diff --git a/packages/strapi-generate-plugin/package.json b/packages/strapi-generate-plugin/package.json index 4d88678b9a..0588cc1024 100755 --- a/packages/strapi-generate-plugin/package.json +++ b/packages/strapi-generate-plugin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-plugin", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Generate an plugin for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -44,4 +44,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-generate-plugin/templates/gitignore b/packages/strapi-generate-plugin/templates/gitignore index 76c6eb04d9..afe256bf30 100644 --- a/packages/strapi-generate-plugin/templates/gitignore +++ b/packages/strapi-generate-plugin/templates/gitignore @@ -1,6 +1,5 @@ # Don't check auto-generated stuff into git coverage -build node_modules stats.json package-lock.json diff --git a/packages/strapi-generate-policy/package.json b/packages/strapi-generate-policy/package.json index de08e9f1fc..33fa26b59f 100755 --- a/packages/strapi-generate-policy/package.json +++ b/packages/strapi-generate-policy/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-policy", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Generate a policy for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-generate-service/package.json b/packages/strapi-generate-service/package.json index 64bf12f389..005be9e8cd 100755 --- a/packages/strapi-generate-service/package.json +++ b/packages/strapi-generate-service/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-service", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Generate a service for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-generate/package.json b/packages/strapi-generate/package.json index e914ea3467..4a9ec72b6a 100755 --- a/packages/strapi-generate/package.json +++ b/packages/strapi-generate/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Master of ceremonies for the Strapi generators.", "homepage": "http://strapi.io", "keywords": [ @@ -17,7 +17,7 @@ "fs-extra": "^4.0.0", "lodash": "^4.17.4", "reportback": "^2.0.1", - "strapi-utils": "3.0.0-alpha.7.3" + "strapi-utils": "3.0.0-alpha.8.3" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.base.babel.js b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.base.babel.js index f93d17a415..48ca3d94ca 100755 --- a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.base.babel.js +++ b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.base.babel.js @@ -20,11 +20,11 @@ const appPath = (() => { })(); const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD); const adminPath = (() => { - if (isSetup) { - return isAdmin ? path.resolve(appPath, 'strapi-admin') : path.resolve(process.env.PWD); + if (isAdmin && isSetup) { + return path.resolve(appPath, 'strapi-admin'); } - return path.resolve(appPath, 'admin'); + return path.resolve(process.env.PWD); })(); if (!isSetup) { diff --git a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.dev.babel.js b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.dev.babel.js index 68dc81192e..89bc6bce2a 100755 --- a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.dev.babel.js +++ b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.dev.babel.js @@ -15,6 +15,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); const isAdmin = process.env.IS_ADMIN === 'true'; +const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD); const appPath = (() => { if (process.env.APP_PATH) { return process.env.APP_PATH; @@ -22,7 +23,13 @@ const appPath = (() => { return isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..'); })(); -const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD); + +const rootAdminpath = (() => { + if (isSetup) { + return isAdmin ? path.resolve(appPath, 'strapi-admin') : path.resolve(appPath, 'packages', 'strapi-admin'); + } + return path.resolve(appPath, 'admin'); +})(); // Load plugins into the same build in development mode. const plugins = { @@ -117,30 +124,14 @@ module.exports = require('./webpack.base.babel')({ ], alias: { moment: 'moment/moment.js', - 'babel-polyfill': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'babel-polyfill'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'babel-polyfill'), - 'lodash': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'), - 'immutable': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'), - 'react-intl': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'), - 'react': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'), - 'react-dom': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'), - 'react-transition-group': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'), - 'reactstrap': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap') + 'babel-polyfill': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'babel-polyfill'), + 'lodash': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'), + 'immutable': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'), + 'react-intl': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'), + 'react': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'), + 'react-dom': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'), + 'react-transition-group': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'), + 'reactstrap': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap') }, // Emit a source map for easier debugging diff --git a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js index 7740ac1c9a..9c5e688595 100755 --- a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js +++ b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js @@ -21,6 +21,14 @@ const appPath = (() => { })(); const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD); +const rootAdminpath = (() => { + if (isSetup) { + return isAdmin ? path.resolve(appPath, 'strapi-admin') : path.resolve(appPath, 'packages', 'strapi-admin'); + } + + return path.resolve(appPath, 'admin'); +})(); + module.exports = { context: appPath, entry: { @@ -29,9 +37,7 @@ module.exports = { devtool: 'cheap-module-source-map', output: { filename: '[name].dll.js', - path: isSetup ? - path.join(__dirname, 'dist'): - path.join(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'dist'), + path: path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'dist'), // The name of the global variable which the library's // require() function will be assigned to @@ -40,9 +46,7 @@ module.exports = { plugins: [ new webpack.DllPlugin({ name: '[name]_lib', - path: isSetup ? - path.join(__dirname, 'manifest.json'): - path.join(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'manifest.json'), + path: path.resolve(rootAdminpath, 'admin', 'src', 'config', 'manifest.json'), }) ], resolve: { @@ -54,30 +58,14 @@ module.exports = { ], alias: { moment: 'moment/moment.js', - 'babel-polyfill': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'babel-polyfill'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'babel-polyfill'), - 'lodash': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'), - 'immutable': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'), - 'react-intl': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'), - 'react': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'), - 'react-dom': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'), - 'react-transition-group': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'), - 'reactstrap': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap') + 'babel-polyfill': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'babel-polyfill'), + 'lodash': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'), + 'immutable': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'), + 'react-intl': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'), + 'react': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'), + 'react-dom': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'), + 'react-transition-group': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'), + 'reactstrap': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap') }, symlinks: false, extensions: [ diff --git a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js index 410f2d2e0c..b3d811e9dc 100755 --- a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js +++ b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js @@ -35,12 +35,16 @@ const adminPath = (() => { return path.resolve(appPath, 'admin'); })(); +const rootAdminpath = (() => { + if (isSetup) { + return isAdmin ? path.resolve(appPath, 'strapi-admin') : path.resolve(appPath, 'packages', 'strapi-admin'); + } + return path.resolve(appPath, 'admin'); +})(); + const plugins = [ new webpack.DllReferencePlugin({ - manifest: require(isSetup ? - path.join(__dirname, 'manifest.json'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'manifest.json') - ), + manifest: require(path.resolve(rootAdminpath, 'admin', 'src', 'config', 'manifest.json')) }), // Minify and optimize the JavaScript new webpack.optimize.UglifyJsPlugin({ @@ -79,13 +83,6 @@ if (isAdmin && !isSetup) { } catch (e) { throw new Error(`Impossible to access to ${serverConfig}`); } - - // Note: Travis failed with it. - plugins.push(new CopyWebpackPlugin([{ - from: 'config/plugins.json', - context: path.resolve(adminPath, 'admin', 'src'), - to: 'config/plugins.json' - }])); } // Build the `index.html file` @@ -112,6 +109,11 @@ if (isAdmin) { plugins.push(new AddAssetHtmlPlugin({ filepath: path.resolve(__dirname, 'dist/*.dll.js') })); + plugins.push(new CopyWebpackPlugin([{ + from: 'config/plugins.json', + context: path.resolve(adminPath, 'admin', 'src'), + to: 'config/plugins.json' + }])); } const main = (() => { @@ -167,30 +169,14 @@ module.exports = base({ alias: { moment: 'moment/moment.js', - 'babel-polyfill': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'babel-polyfill'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'babel-polyfill'), - 'lodash': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'), - 'immutable': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'), - 'react-intl': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'), - 'react': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'), - 'react-dom': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'), - 'react-transition-group': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'), - 'reactstrap': isSetup ? - path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'): - path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap') + 'babel-polyfill': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'babel-polyfill'), + 'lodash': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'), + 'immutable': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'), + 'react-intl': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'), + 'react': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'), + 'react-dom': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'), + 'react-transition-group': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'), + 'reactstrap': path.resolve(rootAdminpath, 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap') }, devtool: 'cheap-module-source-map', diff --git a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.test.babel.js b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.test.babel.js index 9e51519e60..2bd10c0e44 100755 --- a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.test.babel.js +++ b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.test.babel.js @@ -24,6 +24,7 @@ module.exports = { // Some libraries don't like being run through babel. // If they gripe, put them here. noParse: [ + /build/, /node_modules(\\|\/)sinon/, /node_modules(\\|\/)acorn/, ], diff --git a/packages/strapi-helper-plugin/lib/src/actions/overlayBlocker.js b/packages/strapi-helper-plugin/lib/src/actions/overlayBlocker.js new file mode 100644 index 0000000000..f9b22fe71f --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/actions/overlayBlocker.js @@ -0,0 +1,23 @@ +/* +* +* Shared OverlayBlocker actions +* + */ + + +import { + DISABLE_GLOBAL_OVERLAY_BLOCKER, + ENABLE_GLOBAL_OVERLAY_BLOCKER, +} from '../constants/overlayBlocker'; + +export function disableGlobalOverlayBlocker() { + return { + type: DISABLE_GLOBAL_OVERLAY_BLOCKER, + }; +} + +export function enableGlobalOverlayBlocker() { + return { + type: ENABLE_GLOBAL_OVERLAY_BLOCKER, + }; +} diff --git a/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss b/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss index 787be8cfea..d045a43b46 100644 --- a/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss +++ b/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss @@ -4,7 +4,7 @@ height: 6rem; width: 6.5rem; line-height: 6rem; - z-index: 999999; + z-index: 999; text-align: center; background-color: #FFFFFF; color: #81848A; diff --git a/packages/strapi-helper-plugin/lib/src/components/OverlayBlocker/index.js b/packages/strapi-helper-plugin/lib/src/components/OverlayBlocker/index.js index 6fa4f0d5d0..ea507dad36 100644 --- a/packages/strapi-helper-plugin/lib/src/components/OverlayBlocker/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/OverlayBlocker/index.js @@ -7,6 +7,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; +import cn from 'classnames'; import styles from './styles.scss'; @@ -22,11 +24,32 @@ class OverlayBlocker extends React.Component { } render() { + const content = this.props.children ? ( + this.props.children + ) : ( +
+
+ +
+
+

+ +

+

+ +

+ +
+
+ ); + if (this.props.isOpen) { return ReactDOM.createPortal(
- {this.props.children} + {content}
, this.overlayContainer diff --git a/packages/strapi-helper-plugin/lib/src/components/OverlayBlocker/styles.scss b/packages/strapi-helper-plugin/lib/src/components/OverlayBlocker/styles.scss index 7db766be8d..e365f100cf 100644 --- a/packages/strapi-helper-plugin/lib/src/components/OverlayBlocker/styles.scss +++ b/packages/strapi-helper-plugin/lib/src/components/OverlayBlocker/styles.scss @@ -1,3 +1,35 @@ +.container { + display: flex; + justify-content: center; + > div { + padding-top: 2.5rem; + > h4 { + font-size: 24px; + font-weight: 700; + line-height: 24px; + margin-bottom: 0; + } + > p { + margin-top: -1px; + font-size: 14px; + color: #919BAE; + } + } +} + +.icoContainer { + padding-top: 0 !important; + font-size: 4.2rem; + color: #323740; + margin-right: 20px; + line-height: 9.3rem; + > i { + -webkit-animation:spin 4s linear infinite; + -moz-animation:spin 4s linear infinite; + animation:spin 4s linear infinite; + } +} + .overlay { position: fixed; top: 0; @@ -5,12 +37,86 @@ bottom: 0; left: 0; z-index: 1040; - background-color: rgba(0, 0, 0, 0.5); + &:before { + position: fixed; + content: ''; + top: 6rem; + right: 0; + bottom: 0; + left: 0; + background: linear-gradient(rgba(0,0,0, 15) 0%, rgba(0,0,0,0) 100%); + opacity: 0.5; + } + + &:after { + content:''; + position: fixed; + top: 6rem; + right: 0; + bottom: 0; + left: 24rem; + background: linear-gradient(#FBFBFB 20%, rgba(0, 0, 100, 0) 100%); + box-shadow: inset 0px 2px 4px rgba(0,0,0,0.1); + box-shadow: inset 0 1px 2px 0 rgba(40, 42, 49, 0.16); + } > div { position: fixed; - top: 17.5rem; + top: 11.5rem; left: 50%; - margin-left: -24rem; + margin-left: -17.5rem; + z-index: 1100; } } + +.buttonContainer { + padding-top: 3.9rem; + > a { + height: 30px; + font-size: 13px; + } +} + +.primary { + min-width: 15rem; + padding-top: 4px; + padding-left: 1.6rem; + padding-right: 1.6rem; + border-radius: 0.3rem; + border: none; + background: linear-gradient(315deg, #0097F6 0%, #005EEA 100%); + color: white; + font-family: Lato; + font-weight: 600; + -webkit-font-smoothing: antialiased; + cursor: pointer; + + > i { + margin-right: 1.3rem; + font-weight: 600; + padding-top: 1px; + } + &:before { + content: '\f02d'; + font-family: 'FontAwesome'; + font-weight: 600; + font-size: 1.3rem; + margin-right: 13px; + } + + &:active { + box-shadow: inset 1px 1px 3px rgba(0,0,0,.15); + } + + &:focus { + outline: 0; + } + + &:hover { + color: white; + } +} + +@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } +@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } +@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } diff --git a/packages/strapi-helper-plugin/lib/src/constants/overlayBlocker.js b/packages/strapi-helper-plugin/lib/src/constants/overlayBlocker.js new file mode 100644 index 0000000000..044e5ae4e6 --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/constants/overlayBlocker.js @@ -0,0 +1,8 @@ +/* +* +* Shared OverlayBlocker constants +* + */ + +export const DISABLE_GLOBAL_OVERLAY_BLOCKER = 'strapiHelperPlugin/OverlayBlocker/DISABLE_GLOBAL_OVERLAY_BLOCKER'; +export const ENABLE_GLOBAL_OVERLAY_BLOCKER = 'strapiHelperPlugin/OverlayBlocker/ENABLE_GLOBAL_OVERLAY_BLOCKER'; diff --git a/packages/strapi-helper-plugin/lib/src/utils/request.js b/packages/strapi-helper-plugin/lib/src/utils/request.js index b055ebbafd..2e8354092d 100755 --- a/packages/strapi-helper-plugin/lib/src/utils/request.js +++ b/packages/strapi-helper-plugin/lib/src/utils/request.js @@ -1,5 +1,6 @@ import 'whatwg-fetch'; import auth from 'utils/auth'; + /** * Parses the JSON returned by a network request * @@ -86,6 +87,8 @@ function serverRestartWatcher(response) { } }) .then(() => { + // Hide the global OverlayBlocker + strapi.unlockApp(); resolve(response); }) .catch(err => { @@ -141,6 +144,8 @@ export default function request(url, options = {}, shouldWatchServerRestart = fa .then(parseJSON) .then((response) => { if (shouldWatchServerRestart) { + // Display the global OverlayBlocker + strapi.lockApp(); return serverRestartWatcher(response); } diff --git a/packages/strapi-helper-plugin/package.json b/packages/strapi-helper-plugin/package.json index 33e7db4125..123d604cff 100755 --- a/packages/strapi-helper-plugin/package.json +++ b/packages/strapi-helper-plugin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-helper-plugin", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Helper for Strapi plugins development", "engines": { "node": ">= 8.0.0", @@ -21,9 +21,8 @@ "license": "MIT", "scripts": { "lint": "cross-env IS_HELPER=true ./node_modules/eslint/bin/eslint.js --ignore-path .gitignore --config ./lib/internals/eslint/eslint-config.js .", - "pretest": "npm run lint", "prettier": "prettier --single-quote --trailing-comma es5 --write \"{lib,__{tests,mocks}__}/**/*.js\"", - "test": "echo Tests are not implemented." + "test": "npm run lint" }, "pre-commit": [ "lint:admin" diff --git a/packages/strapi-knex/package.json b/packages/strapi-knex/package.json index 2fcce9ebfc..72f001c722 100755 --- a/packages/strapi-knex/package.json +++ b/packages/strapi-knex/package.json @@ -1,6 +1,6 @@ { "name": "strapi-knex", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Knex hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-middleware-views/package.json b/packages/strapi-middleware-views/package.json index ba311928f6..3381ee0cd2 100755 --- a/packages/strapi-middleware-views/package.json +++ b/packages/strapi-middleware-views/package.json @@ -1,6 +1,6 @@ { "name": "strapi-middleware-views", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Views hook to enable server-side rendering for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-mongoose/lib/index.js b/packages/strapi-mongoose/lib/index.js index 31f83b0c29..41a1cd2bb0 100755 --- a/packages/strapi-mongoose/lib/index.js +++ b/packages/strapi-mongoose/lib/index.js @@ -43,11 +43,14 @@ module.exports = function (strapi) { const { host, port, username, password, database } = _.defaults(connection.settings, strapi.config.hook.settings.mongoose); // Connect to mongo database - if (_.isEmpty(username) || _.isEmpty(password)) { - instance.connect(`mongodb://${host}:${port}/${database}`); - } else { - instance.connect(`mongodb://${username}:${password}@${host}:${port}/${database}`); + const connectOptions = {} + if (!_.isEmpty(username)) { + connectOptions.user = username + if (!_.isEmpty(password)) { + connectOptions.pass = password + } } + instance.connect(`mongodb://${host}:${port}/${database}`, connectOptions); // Handle error instance.connection.on('error', error => { diff --git a/packages/strapi-mongoose/lib/utils/connectivity.js b/packages/strapi-mongoose/lib/utils/connectivity.js index cedafdf697..3fd6e6592b 100644 --- a/packages/strapi-mongoose/lib/utils/connectivity.js +++ b/packages/strapi-mongoose/lib/utils/connectivity.js @@ -9,8 +9,16 @@ const logger = require('strapi-utils').logger; module.exports = (scope, success, error) => { const Mongoose = require(path.resolve(`${scope.rootPath}/node_modules/mongoose`)); - - Mongoose.connect(`mongodb://${ (scope.database.settings.username && scope.database.settings.password) ? `${scope.database.settings.username}:${scope.database.settings.password}@` : '' }${scope.database.settings.host}:${scope.database.settings.port}/${scope.database.settings.database}`, function (err) { + + const { username, password } = scope.database.settings + const connectOptions = {} + if (username) { + connectOptions.user = username + if (password) { + connectOptions.pass = password + } + } + Mongoose.connect(`mongodb://${scope.database.settings.host}:${scope.database.settings.port}/${scope.database.settings.database}`, connectOptions, function (err) { if (err) { logger.warn('Database connection has failed! Make sure your database is running.'); return error(); diff --git a/packages/strapi-mongoose/package.json b/packages/strapi-mongoose/package.json index f74ab912a0..b918361543 100755 --- a/packages/strapi-mongoose/package.json +++ b/packages/strapi-mongoose/package.json @@ -1,6 +1,6 @@ { "name": "strapi-mongoose", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Mongoose hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -19,7 +19,7 @@ "mongoose": "^5.0.0-rc1", "mongoose-float": "^1.0.2", "pluralize": "^6.0.0", - "strapi-utils": "3.0.0-alpha.7.3" + "strapi-utils": "3.0.0-alpha.8.3" }, "strapi": { "isHook": true diff --git a/packages/strapi-plugin-content-manager/.gitignore b/packages/strapi-plugin-content-manager/.gitignore index 76c6eb04d9..afe256bf30 100755 --- a/packages/strapi-plugin-content-manager/.gitignore +++ b/packages/strapi-plugin-content-manager/.gitignore @@ -1,6 +1,5 @@ # Don't check auto-generated stuff into git coverage -build node_modules stats.json package-lock.json diff --git a/packages/strapi-plugin-content-manager/package.json b/packages/strapi-plugin-content-manager/package.json index 8f2b962c50..242c3e61d7 100755 --- a/packages/strapi-plugin-content-manager/package.json +++ b/packages/strapi-plugin-content-manager/package.json @@ -1,28 +1,7 @@ { "name": "strapi-plugin-content-manager", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "A powerful UI to easily manage your data.", - "engines": { - "node": ">= 8.0.0", - "npm": ">= 5.3.0" - }, - "author": { - "email": "hi@strapi.io", - "name": "Strapi team", - "url": "http://strapi.io" - }, - "maintainers": [ - { - "name": "Strapi team", - "email": "hi@strapi.io", - "url": "http://strapi.io" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/strapi/strapi.git" - }, - "license": "MIT", "strapi": { "name": "Content Manager", "icon": "plug", @@ -38,14 +17,34 @@ "build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build", "start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PLUGIN=true node ./node_modules/strapi-helper-plugin/lib/server", "generate": "node ./node_modules/plop/plop.js --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js", - "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", - "pretest": "npm run lint", + "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", "prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"", - "test": "echo Tests are not implemented.", + "test": "npm run lint", "prepublishOnly": "npm run build" }, "devDependencies": { "react-select": "^1.0.0-rc.5", - "strapi-helper-plugin": "3.0.0-alpha.7.3" - } -} \ No newline at end of file + "strapi-helper-plugin": "3.0.0-alpha.8.3" + }, + "author": { + "name": "Strapi team", + "email": "hi@strapi.io", + "url": "http://strapi.io" + }, + "maintainers": [ + { + "name": "Strapi team", + "email": "hi@strapi.io", + "url": "http://strapi.io" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/strapi/strapi.git" + }, + "engines": { + "node": ">= 8.0.0", + "npm": ">= 3.0.0" + }, + "license": "MIT" +} diff --git a/packages/strapi-plugin-content-type-builder/.gitignore b/packages/strapi-plugin-content-type-builder/.gitignore index 6a37080b59..e41314d2e9 100755 --- a/packages/strapi-plugin-content-type-builder/.gitignore +++ b/packages/strapi-plugin-content-type-builder/.gitignore @@ -1,6 +1,5 @@ # Don’t check auto-generated stuff into git coverage -build node_modules stats.json 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 b72a07c1da..3c33b1227f 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 @@ -45,7 +45,11 @@ class TableList extends React.Component { // eslint-disable-line react/prefer-st
{map(this.props.rowItems, (rowItem, key) => ( - + ))} 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 042511b6e7..af53dc9825 100755 --- 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 @@ -20,6 +20,7 @@ import NotFoundPage from 'containers/NotFoundPage'; import formSaga from 'containers/Form/sagas'; import formReducer from 'containers/Form/reducer'; +// Other containers actions import { makeSelectShouldRefetchContentType } from 'containers/Form/selectors'; // Utils diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/sagas.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/sagas.js index 1bbc9a890e..150fff761a 100755 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/sagas.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/sagas.js @@ -7,15 +7,13 @@ export function* deleteContentType(action) { try { if (action.sendRequest) { const requestUrl = `/content-type-builder/models/${action.itemToDelete}`; + const response = yield call(request, requestUrl, { method: 'DELETE' }, true); - yield call(request, requestUrl, { method: 'DELETE' }); - - if (action.updateLeftMenu) { + if (response.ok && action.updateLeftMenu) { action.updatePlugin('content-manager', 'leftMenuSections', action.leftMenuContentTypes); + strapi.notification.success('content-type-builder.notification.success.contentTypeDeleted'); } - strapi.notification.success('content-type-builder.notification.success.contentTypeDeleted'); } - } catch(error) { strapi.notification.error('content-type-builder.notification.error.message'); } 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 e8b3ce3ce9..f9b6cb77a8 100755 --- 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 @@ -41,6 +41,6 @@ const selectLocationState = () => { export { selectLocationState, makeSelectLoading, - makeSelectModels, makeSelectMenu, + makeSelectModels, }; 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 9b5f5e8348..d1bb3174fe 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 @@ -254,6 +254,7 @@ export class Form extends React.Component { // eslint-disable-line react/prefer- this.props.contentTypeCreate(contentType); } + this.setState({ showModal: false }); return this.props.contentTypeEdit(this.context); } 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 2e494b9a6b..24f8de6ed1 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 @@ -69,8 +69,8 @@ export class HomePage extends React.Component { // eslint-disable-line react/pre title={title} buttonLabel={'content-type-builder.button.contentType.add'} onButtonClick={this.handleButtonClick} - rowItems={this.props.models} onHandleDelete={this.handleDelete} + rowItems={this.props.models} /> ); } 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 f6fba9d323..ae493b014c 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 @@ -76,8 +76,6 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr if (this.props.updatedContentType !== nextProps.updatedContentType) { if (this.state.contentTypeTemporary && storeData.getContentType()) { this.props.modelFetchSucceeded({ model: storeData.getContentType() }); - } else { - this.fetchModel(nextProps); } } @@ -86,24 +84,24 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr } } - componentWillUpdate(nextProps) { - if (!isEmpty(nextProps.menu)) { - const allowedPaths = nextProps.menu.reduce((acc, current) => { - const models = current.items.reduce((acc, current) => { - acc.push(current.name); - - return acc; - }, []); - return acc.concat(models); - }, []); - - const shouldRedirect = allowedPaths.filter(el => el === this.props.match.params.modelName.split('&')[0]).length === 0; - - if (shouldRedirect) { - this.props.history.push('/404'); - } - } - } + // componentWillUpdate(nextProps) { + // if (!isEmpty(nextProps.menu)) { + // const allowedPaths = nextProps.menu.reduce((acc, current) => { + // const models = current.items.reduce((acc, current) => { + // acc.push(current.name); + // + // return acc; + // }, []); + // return acc.concat(models); + // }, []); + // + // const shouldRedirect = allowedPaths.filter(el => el === this.props.match.params.modelName.split('&')[0]).length === 0; + // + // if (shouldRedirect) { + // this.props.history.push('/404'); + // } + // } + // } componentDidUpdate(prevProps) { if (prevProps.match.params.modelName !== this.props.match.params.modelName) { @@ -347,7 +345,7 @@ ModelPage.propTypes = { cancelChanges: PropTypes.func.isRequired, checkIfTableExists: PropTypes.func.isRequired, deleteAttribute: PropTypes.func.isRequired, - history: PropTypes.object.isRequired, + // history: PropTypes.object.isRequired, location: PropTypes.object.isRequired, match: PropTypes.object.isRequired, menu: PropTypes.array.isRequired, 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 a6c4d9bc81..ad405597f7 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 @@ -140,7 +140,6 @@ export function* submitChanges(action) { } yield put(submitActionSucceeded()); - yield put(resetShowButtonsProps()); // Remove loader yield put(unsetButtonLoader()); diff --git a/packages/strapi-plugin-content-type-builder/admin/src/requirements.js b/packages/strapi-plugin-content-type-builder/admin/src/requirements.js index c4078c45d0..4959964937 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/requirements.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/requirements.js @@ -3,7 +3,7 @@ import request from 'utils/request'; const shouldRenderCompo = (plugin) => new Promise((resolve, reject) => { request(`${strapi.backendURL}/content-type-builder/autoReload`) .then(response => { - plugin.preventComponentRendering = !response.autoReload; + plugin.preventComponentRendering = !response.autoReload.enabled; plugin.blockerComponentProps = { blockerComponentTitle: 'components.AutoReloadBlocker.header', blockerComponentDescription: 'components.AutoReloadBlocker.description', diff --git a/packages/strapi-plugin-content-type-builder/package.json b/packages/strapi-plugin-content-type-builder/package.json index 0efeda6297..bdfc43ca9d 100755 --- a/packages/strapi-plugin-content-type-builder/package.json +++ b/packages/strapi-plugin-content-type-builder/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-content-type-builder", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Strapi plugin to create content type (API).", "strapi": { "name": "Content Type Builder", @@ -17,19 +17,18 @@ "build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build", "start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server", "generate": "node ./node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js", - "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", - "pretest": "npm run lint", + "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", "prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"", - "test": "echo Tests are not implemented.", + "test": "npm run lint", "prepublishOnly": "npm run build" }, "dependencies": { "pluralize": "^7.0.0", - "strapi-generate": "3.0.0-alpha.7.3", - "strapi-generate-api": "3.0.0-alpha.7.3" + "strapi-generate": "3.0.0-alpha.8.3", + "strapi-generate-api": "3.0.0-alpha.8.3" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.7.3" + "strapi-helper-plugin": "3.0.0-alpha.8.3" }, "author": { "name": "Strapi team", @@ -43,6 +42,10 @@ "url": "http://strapi.io" } ], + "repository": { + "type": "git", + "url": "git://github.com/strapi/strapi.git" + }, "engines": { "node": ">= 8.0.0", "npm": ">= 3.0.0" diff --git a/packages/strapi-plugin-email/.gitignore b/packages/strapi-plugin-email/.gitignore index 5d06c054ed..ee5654a215 100755 --- a/packages/strapi-plugin-email/.gitignore +++ b/packages/strapi-plugin-email/.gitignore @@ -1,6 +1,5 @@ # Don't check auto-generated stuff into git coverage -build node_modules stats.json diff --git a/packages/strapi-plugin-email/package.json b/packages/strapi-plugin-email/package.json index 02994be080..4cbdac0053 100644 --- a/packages/strapi-plugin-email/package.json +++ b/packages/strapi-plugin-email/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-email", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "This is the description of the plugin.", "strapi": { "name": "Email", @@ -8,42 +8,45 @@ "description": "email.plugin.description" }, "scripts": { - "analyze:clean": "node node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json", + "analyze:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf stats.json", "preanalyze": "npm run analyze:clean", - "analyze": "node node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js", + "analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js", "prebuild": "npm run build:clean && npm run test", - "build:dev": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress", - "build": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress", - "build:clean": "node node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build", - "start": "node node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node node_modules/strapi-helper-plugin/lib/server", - "generate": "node node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js", - "lint": "node node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", - "pretest": "npm run lint", - "prettier": "node node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"", - "test": "echo Tests are not implemented.", + "build:dev": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress", + "build": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production node node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress", + "build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build", + "start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server", + "generate": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js", + "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", + "prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"", + "test": "npm run lint", "prepublishOnly": "npm run build" }, "dependencies": { "sendmail": "^1.2.0" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.7.3" + "strapi-helper-plugin": "3.0.0-alpha.8.3" }, "author": { - "name": "A Strapi developer", - "email": "", - "url": "" + "name": "Strapi team", + "email": "hi@strapi.io", + "url": "http://strapi.io" }, "maintainers": [ { - "name": "A Strapi developer", - "email": "", - "url": "" + "name": "Strapi team", + "email": "hi@strapi.io", + "url": "http://strapi.io" } ], + "repository": { + "type": "git", + "url": "git://github.com/strapi/strapi.git" + }, "engines": { "node": ">= 7.0.0", "npm": ">= 3.0.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/App/actions.js b/packages/strapi-plugin-settings-manager/admin/src/containers/App/actions.js index 192122218e..bd7cdc3d89 100755 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/App/actions.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/App/actions.js @@ -5,26 +5,12 @@ */ import { - MENU_FETCH, ENVIRONMENTS_FETCH, - MENU_FETCH_SUCCEEDED, ENVIRONMENTS_FETCH_SUCCEEDED, + MENU_FETCH_SUCCEEDED, + MENU_FETCH, } from './constants'; - -export function menuFetch() { - return { - type: MENU_FETCH, - }; -} - -export function fetchMenuSucceeded(menu) { - return { - type: MENU_FETCH_SUCCEEDED, - menu, - }; -} - export function environmentsFetch() { return { type: ENVIRONMENTS_FETCH, @@ -37,3 +23,16 @@ export function environmentsFetchSucceeded(environments) { environments, }; } + +export function fetchMenuSucceeded(menu) { + return { + type: MENU_FETCH_SUCCEEDED, + menu, + }; +} + +export function menuFetch() { + return { + type: MENU_FETCH, + }; +} diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/App/constants.js b/packages/strapi-plugin-settings-manager/admin/src/containers/App/constants.js index 9af5e8ea19..38c18f4b7e 100755 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/App/constants.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/App/constants.js @@ -4,7 +4,7 @@ * */ -export const MENU_FETCH = 'SettingsManager/App/MENU_FETCH'; export const ENVIRONMENTS_FETCH = 'SettingsManager/App/ENVIRONMENTS_FETCH'; -export const MENU_FETCH_SUCCEEDED = 'SettingsManager/App/MENU_FETCH_SUCCEEDED'; export const ENVIRONMENTS_FETCH_SUCCEEDED = 'SettingsManager/App/ENVIRONMENTS_FETCH_SUCCEEDED'; +export const MENU_FETCH = 'SettingsManager/App/MENU_FETCH'; +export const MENU_FETCH_SUCCEEDED = 'SettingsManager/App/MENU_FETCH_SUCCEEDED'; diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/App/reducer.js b/packages/strapi-plugin-settings-manager/admin/src/containers/App/reducer.js index 7a2e4b4eed..c37e943f3f 100755 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/App/reducer.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/App/reducer.js @@ -6,24 +6,23 @@ import { fromJS, List } from 'immutable'; import { - MENU_FETCH_SUCCEEDED, ENVIRONMENTS_FETCH_SUCCEEDED, + MENU_FETCH_SUCCEEDED, } from './constants'; -/* eslint-disable new-cap */ const initialState = fromJS({ - sections: List(), // eslint-disable-line new-cap - environments: List(), + sections: List([]), + environments: List([]), loading: true, }); function appReducer(state = initialState, action) { switch (action.type) { - case MENU_FETCH_SUCCEEDED: - return state.set('sections', List(action.menu.sections)).set('loading', false); case ENVIRONMENTS_FETCH_SUCCEEDED: return state .set('environments', List(action.environments.environments)); + case MENU_FETCH_SUCCEEDED: + return state.set('sections', List(action.menu.sections)).set('loading', false); default: return state; } 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 832273de5c..d254d456c6 100755 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js @@ -37,5 +37,10 @@ const makeSelectLoading = () => createSelector( (globalSate) => globalSate.get('loading'), ); -export { selectLocationState, makeSelectSections, makeSelectEnvironments, makeSelectLoading }; +export { + makeSelectEnvironments, + makeSelectLoading, + makeSelectSections, + selectLocationState, +}; export default selectGlobalDomain; diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/sagas.js b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/sagas.js index 6c2155133d..f43cec42df 100755 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/sagas.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/sagas.js @@ -1,5 +1,4 @@ import { LOCATION_CHANGE } from 'react-router-redux'; - import { forEach, set, map, replace } from 'lodash'; import { call, take, put, fork, cancel, select, takeLatest } from 'redux-saga/effects'; import request from 'utils/request'; @@ -86,7 +85,6 @@ export function* deleteLanguage(action) { method: 'DELETE', }; const requestUrl = `/settings-manager/configurations/languages/${action.languageToDelete}`; - const resp = yield call(request, requestUrl, opts, true); if (resp.ok) { @@ -152,7 +150,6 @@ export function* fetchLanguages() { export function* postLanguage() { try { const newLanguage = yield select(makeSelectModifiedData()); - const body = { name: newLanguage['language.defaultLocale'], }; @@ -161,12 +158,11 @@ export function* postLanguage() { method: 'POST', }; const requestUrl = '/settings-manager/configurations/languages'; - const resp = yield call(request, requestUrl, opts, true); if (resp.ok) { - strapi.notification.success('settings-manager.strapi.notification.success.languageAdd'); yield put(languageActionSucceeded()); + strapi.notification.success('settings-manager.strapi.notification.success.languageAdd'); } } catch(error) { yield put(languageActionError()); @@ -187,7 +183,6 @@ export function* postDatabase(action) { body, }; const requestUrl = `/settings-manager/configurations/databases/${action.endPoint}`; - const resp = yield call(request, requestUrl, opts, true); if (resp.ok) { @@ -203,7 +198,6 @@ export function* postDatabase(action) { }); yield put(databaseActionError(formErrors)); - strapi.notification.error('settings-manager.strapi.notification.error'); } } @@ -221,13 +215,13 @@ export function* settingsEdit(action) { const resp = yield call(request, requestUrl, opts, true); if (resp.ok) { - strapi.notification.success('settings-manager.strapi.notification.success.settingsEdit'); yield put(editSettingsSucceeded()); yield put(unsetLoader()); + strapi.notification.success('settings-manager.strapi.notification.success.settingsEdit'); } } catch(error) { - strapi.notification.error('settings-manager.strapi.notification.error'); yield put(unsetLoader()); + strapi.notification.error('settings-manager.strapi.notification.error'); } } @@ -237,7 +231,6 @@ export function* fetchSpecificDatabase(action) { method: 'GET', }; const requestUrl = `/settings-manager/configurations/databases/${action.databaseName}/${action.endPoint}`; - const data = yield call(request, requestUrl, opts); yield put(specificDatabaseFetchSucceeded(data)); diff --git a/packages/strapi-plugin-settings-manager/admin/src/utils/request.js b/packages/strapi-plugin-settings-manager/admin/src/utils/request.js deleted file mode 100755 index f539e1b20f..0000000000 --- a/packages/strapi-plugin-settings-manager/admin/src/utils/request.js +++ /dev/null @@ -1,126 +0,0 @@ -import 'whatwg-fetch'; -import { startsWith } from 'lodash'; -import auth from 'utils/auth'; - -/** - * Parses the JSON returned by a network request - * - * @param {object} response A response from a network request - * - * @return {object} The parsed JSON from the request - */ -function parseJSON(response) { - return response.json(); -} - -/** - * Checks if a network request came back fine, and throws an error if not - * - * @param {object} response A response from a network request - * - * @return {object|undefined} Returns either the response, or throws an error - */ -function checkStatus(response) { - - if (response.status >= 200 && response.status < 300) { - return response; - } - - return parseJSON(response).then(responseFormatted => { - const error = new Error(response.statusText); - error.response = response; - error.response.payload = responseFormatted; - throw error; - }); -} - -/** - * Format query params - * - * @param params - * @returns {string} - */ -function formatQueryParams(params) { - return Object.keys(params) - .map(k => `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`) - .join('&'); -} - -/** -* Server restart watcher -* @param response -* @returns {object} the response data -*/ -function serverRestartWatcher(response) { - return new Promise((resolve) => { - fetch(`${strapi.backendURL}/_health`, { - method: 'HEAD', - mode: 'no-cors', - headers: { - 'Content-Type': 'application/json', - 'Keep-Alive': false, - }, - }) - .then(() => { - resolve(response); - }) - .catch(() => { - setTimeout(() => { - return serverRestartWatcher(response) - .then(resolve); - }, 100); - }); - }); -} - -/** - * Requests a URL, returning a promise - * - * @param {string} url The URL we want to request - * @param {object} [options] The options we want to pass to "fetch" - * - * @return {object} The response data - */ -export default function request(url, options, shouldWatchServerRestart = false) { - const optionsObj = options || {}; - - // Set headers - optionsObj.headers = { - 'Content-Type': 'application/json', - 'X-Forwarded-Host': 'strapi', - }; - - const token = auth.getToken(); - - if (token) { - optionsObj.headers = Object.assign({ - 'Authorization': `Bearer ${token}`, - }, optionsObj.headers); - } - - // Add parameters to url - let urlFormatted = startsWith(url, '/') - ? `${strapi.backendURL}${url}` - : url; - - if (optionsObj && optionsObj.params) { - const params = formatQueryParams(optionsObj.params); - urlFormatted = `${url}?${params}`; - } - - // Stringify body object - if (optionsObj && optionsObj.body) { - optionsObj.body = JSON.stringify(optionsObj.body); - } - - return fetch(urlFormatted, optionsObj) - .then(checkStatus) - .then(parseJSON) - .then((response) => { - if (shouldWatchServerRestart) { - return serverRestartWatcher(response); - } - - return response; - }); -} diff --git a/packages/strapi-plugin-settings-manager/package.json b/packages/strapi-plugin-settings-manager/package.json index 92805a489b..bd50a4be09 100755 --- a/packages/strapi-plugin-settings-manager/package.json +++ b/packages/strapi-plugin-settings-manager/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-settings-manager", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Strapi plugin to manage settings.", "strapi": { "name": "Settings Manager", @@ -17,16 +17,15 @@ "build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build", "start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server", "generate": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js", - "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", - "pretest": "npm run lint", + "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", "prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"", - "test": "echo Tests are not implemented.", + "test": "npm run lint", "prepublishOnly": "npm run build" }, "devDependencies": { "flag-icon-css": "^2.8.0", "react-select": "^1.0.0-rc.5", - "strapi-helper-plugin": "3.0.0-alpha.7.3" + "strapi-helper-plugin": "3.0.0-alpha.8.3" }, "author": { "name": "Strapi team", @@ -40,9 +39,13 @@ "url": "http://strapi.io" } ], + "repository": { + "type": "git", + "url": "git://github.com/strapi/strapi.git" + }, "engines": { "node": ">= 8.0.0", "npm": ">= 3.0.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-plugin-users-permissions/.gitignore b/packages/strapi-plugin-users-permissions/.gitignore index 8e4fe6e310..7ea1136652 100755 --- a/packages/strapi-plugin-users-permissions/.gitignore +++ b/packages/strapi-plugin-users-permissions/.gitignore @@ -5,6 +5,7 @@ node_modules stats.json roles.json jwt.json +grant.json # Cruft .DS_Store 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 948e1d35b9..fb7191e4b4 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 @@ -48,7 +48,7 @@ const generateListTitle = (data, settingType) => { } }; -function List({ data, deleteActionSucceeded, deleteData, noButton, onButtonClick, settingType }) { +function List({ data, deleteData, noButton, onButtonClick, settingType }) { return (
@@ -69,7 +69,6 @@ function List({ data, deleteActionSucceeded, deleteData, noButton, onButtonClick
    {map(data, item => ( { switch (this.props.settingType) { case 'roles': { - if (!includes(this.protectedRoleIDs, get(this.props.item, 'id').toString())) { + if (!includes(this.protectedRoleIDs, get(this.props.item, 'type').toString())) { return router.push(`${router.location.pathname}/edit/${this.props.item.id}`); } return; @@ -148,7 +142,10 @@ class ListRow extends React.Component { // eslint-disable-line react/prefer-stat } } - handleDelete = () => this.props.deleteData(this.props.item, this.props.settingType); + handleDelete = () => { + this.props.deleteData(this.props.item, this.props.settingType); + this.setState({ showModalDelete: false }); + } render() { return ( @@ -176,7 +173,6 @@ ListRow.defaultProps = { }; ListRow.propTypes = { - deleteActionSucceeded: PropTypes.bool.isRequired, deleteData: PropTypes.func.isRequired, item: PropTypes.object, settingType: PropTypes.string, 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 5d67e2e0e5..946e1e048d 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 @@ -117,7 +117,7 @@ Plugin.propTypes = { plugin: PropTypes.shape({ description: PropTypes.string, information: PropTypes.shape({ - logo: PropTypes.string.isRequired, + logo: PropTypes.string, }), }), pluginSelected: PropTypes.string.isRequired, diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/App/selectors.js b/packages/strapi-plugin-users-permissions/admin/src/containers/App/selectors.js index 2393a073cd..59c3cfbba0 100755 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/App/selectors.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/App/selectors.js @@ -5,5 +5,3 @@ */ // const selectGlobalDomain = () => state => state.get('global'); - -export {}; diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/saga.js b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/saga.js index b3f8289b26..4fb5774655 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/saga.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/saga.js @@ -8,6 +8,7 @@ import { take, takeLatest, } from 'redux-saga/effects'; + import request from 'utils/request'; import { @@ -98,7 +99,7 @@ export function* submit() { }; const requestURL = actionType === 'POST' ? '/users-permissions/roles' : `/users-permissions/roles/${roleId}`; - const response = yield call(request, requestURL, opts); + const response = yield call(request, requestURL, opts, true); if (response.ok) { yield put(submitSucceeded()); 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 1f579509be..10ee81114f 100755 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js @@ -116,7 +116,6 @@ export class HomePage extends React.Component { : ( list.splice(action.indexDataToDelete, 1)) .set('deleteEndPoint', '') - .set('dataToDelete', Map({})) - .set('deleteActionSucceeded', !state.get('deleteActionSucceeded')); + .set('dataToDelete', Map({})); case FETCH_DATA_SUCCEEDED: return state.set('data', List(action.data)); case ON_CHANGE: diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/saga.js b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/saga.js index 63f0bf88c1..cd109009e8 100755 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/saga.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/saga.js @@ -1,6 +1,7 @@ import { LOCATION_CHANGE } from 'react-router-redux'; import { findIndex } from 'lodash'; import { takeLatest, put, fork, take, cancel, select, call } from 'redux-saga/effects'; + import request from 'utils/request'; import { @@ -8,6 +9,7 @@ import { fetchDataSucceeded, setForm, } from './actions'; + import { DELETE_DATA, FETCH_DATA, @@ -32,8 +34,7 @@ export function* dataDelete() { if (indexDataToDelete !== -1) { const id = dataToDelete.id; const requestURL = `/users-permissions/${endPointAPI}/${id}`; - // TODO watchServerRestart - const response = yield call(request, requestURL, { method: 'DELETE' }); + const response = yield call(request, requestURL, { method: 'DELETE' }, true); if (response.ok) { yield put(deleteDataSucceeded(indexDataToDelete)); diff --git a/packages/strapi-plugin-users-permissions/config/functions/bootstrap.js b/packages/strapi-plugin-users-permissions/config/functions/bootstrap.js index f1fcb4c285..988650e96e 100644 --- a/packages/strapi-plugin-users-permissions/config/functions/bootstrap.js +++ b/packages/strapi-plugin-users-permissions/config/functions/bootstrap.js @@ -28,6 +28,47 @@ module.exports = cb => { } } + if (!_.get(strapi.plugins['users-permissions'], 'config.grant')) { + try { + const grant = { + facebook: { + key: '', + secret: '', + callback: '/auth/facebook/callback', + scope: ['email'] + }, + google: { + key: '', + secret: '', + callback: '/auth/google/callback', + scope: ['email'] + }, + github: { + key: '', + secret: '', + redirect_uri: '/auth/google/callback', + scope: [ + 'user', + 'user:email' + ] + }, + twitter: { + key: '', + secret: '', + callback: '/auth/twitter/callback' + } + }; + + fs.writeFileSync(path.join(strapi.config.appPath, 'plugins', 'users-permissions', 'config', 'grant.json'), JSON.stringify({ + grant + }, null, 2), 'utf8'); + + _.set(strapi.plugins['users-permissions'], 'config.grant', grant); + } catch(err) { + strapi.log.error(err); + } + } + strapi.plugins['users-permissions'].services.userspermissions.syncSchema(() => { strapi.plugins['users-permissions'].services.userspermissions.initialize(cb); }); diff --git a/packages/strapi-plugin-users-permissions/config/policies/permissions.js b/packages/strapi-plugin-users-permissions/config/policies/permissions.js index f389669ead..ff74408130 100644 --- a/packages/strapi-plugin-users-permissions/config/policies/permissions.js +++ b/packages/strapi-plugin-users-permissions/config/policies/permissions.js @@ -25,7 +25,7 @@ module.exports = async (ctx, next) => { if (!role) { role = await strapi.query('role', 'users-permissions').findOne({ type: 'guest' }, []); } - + const route = ctx.request.route; const permission = await strapi.query('permission', 'users-permissions').findOne({ role: role._id || role.id, diff --git a/packages/strapi-plugin-users-permissions/config/routes.json b/packages/strapi-plugin-users-permissions/config/routes.json index 47f79bbffd..95b5c0e1ee 100644 --- a/packages/strapi-plugin-users-permissions/config/routes.json +++ b/packages/strapi-plugin-users-permissions/config/routes.json @@ -116,6 +116,15 @@ "prefix": "" } }, + { + "method": "GET", + "path": "/auth/:provider/callback", + "handler": "Auth.callback", + "config": { + "policies": [], + "prefix": "" + } + }, { "method": "POST", "path": "/auth/forgot-password", diff --git a/packages/strapi-plugin-users-permissions/controllers/Auth.js b/packages/strapi-plugin-users-permissions/controllers/Auth.js index c050eac21f..5ceb218b25 100644 --- a/packages/strapi-plugin-users-permissions/controllers/Auth.js +++ b/packages/strapi-plugin-users-permissions/controllers/Auth.js @@ -8,12 +8,12 @@ const _ = require('lodash'); const crypto = require('crypto'); +const emailRegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; module.exports = { callback: async (ctx) => { const provider = ctx.params.provider || 'local'; const params = ctx.request.body; - const access_token = ctx.query.access_token; if (provider === 'local') { // The identifier is required. @@ -29,11 +29,11 @@ module.exports = { const query = {}; // Check if the provided identifier is an email or not. - const isEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(params.identifier); + const isEmail = emailRegExp.test(params.identifier); // Set the identifier to the appropriate query field. if (isEmail) { - query.email = params.identifier; + query.email = params.identifier.toLowerCase(); } else { query.username = params.identifier; } @@ -66,9 +66,12 @@ module.exports = { } } else { // Connect the user thanks to the third-party provider. - const user = await strapi.api.user.services.grant.connect(provider, access_token); + const user = await strapi.plugins['users-permissions'].services.providers.connect(provider, ctx.query); - ctx.redirect(strapi.config.frontendUrl || strapi.config.url + '?jwt=' + strapi.api.user.services.jwt.issue(user) + '&user=' + JSON.stringify(user)); + ctx.send({ + jwt: strapi.plugins['users-permissions'].services.jwt.issue(user), + user: _.omit(user.toJSON ? user.toJSON() : user, ['password', 'resetPasswordToken']) + }); } }, @@ -175,6 +178,13 @@ module.exports = { return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.role.notFound' }] }] : 'Impossible to find the root role.'); } + // Check if the provided identifier is an email or not. + const isEmail = emailRegExp.test(params.identifier); + + if (isEmail) { + params.identifier = params.identifier.toLowerCase(); + } + params.role = role._id || role.id; params.password = await strapi.plugins['users-permissions'].services.user.hashPassword(params); diff --git a/packages/strapi-plugin-users-permissions/controllers/UsersPermissions.js b/packages/strapi-plugin-users-permissions/controllers/UsersPermissions.js index 015ad07b29..5979966bea 100644 --- a/packages/strapi-plugin-users-permissions/controllers/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/controllers/UsersPermissions.js @@ -20,10 +20,14 @@ module.exports = { return ctx.badRequest(null, [{ messages: [{ id: 'Cannot be empty' }] }]); } + strapi.reload.isWatching = false; + try { await strapi.plugins['users-permissions'].services.userspermissions.createRole(ctx.request.body); ctx.send({ ok: true }); + + strapi.reload(); } catch(err) { ctx.badRequest(null, [{ messages: [{ id: 'An error occured' }] }]); } diff --git a/packages/strapi-plugin-users-permissions/middlewares/provider/defaults.json b/packages/strapi-plugin-users-permissions/middlewares/provider/defaults.json new file mode 100644 index 0000000000..621bacef88 --- /dev/null +++ b/packages/strapi-plugin-users-permissions/middlewares/provider/defaults.json @@ -0,0 +1,5 @@ +{ + "provider": { + "enabled": true + } +} diff --git a/packages/strapi-plugin-users-permissions/middlewares/provider/index.js b/packages/strapi-plugin-users-permissions/middlewares/provider/index.js new file mode 100644 index 0000000000..66f755db3f --- /dev/null +++ b/packages/strapi-plugin-users-permissions/middlewares/provider/index.js @@ -0,0 +1,32 @@ +'use strict'; + +/** + * Module dependencies + */ + +// Public node modules. +const _ = require('lodash'); +const Grant = require('grant-koa'); + +module.exports = strapi => { + return { + beforeInitialize: function() { + strapi.config.middleware.load.after.push('provider'); + }, + + initialize: function(cb) { + _.defaultsDeep(strapi.plugins['users-permissions'].config.grant, { + server: { + protocol: 'http', + host: 'localhost:1337' + } + }); + + const grant = new Grant(strapi.plugins['users-permissions'].config.grant); + + strapi.app.use(strapi.koaMiddlewares.compose(grant.middleware)); + + cb(); + } + }; +}; diff --git a/packages/strapi-plugin-users-permissions/middlewares/users-permissions/index.js b/packages/strapi-plugin-users-permissions/middlewares/users-permissions/index.js index 3bf420b536..7e9d41dd19 100644 --- a/packages/strapi-plugin-users-permissions/middlewares/users-permissions/index.js +++ b/packages/strapi-plugin-users-permissions/middlewares/users-permissions/index.js @@ -1,3 +1,10 @@ +'use strict'; + +/** + * Module dependencies + */ + +// Public node modules. const _ = require('lodash'); module.exports = strapi => { diff --git a/packages/strapi-plugin-users-permissions/models/User.settings.json b/packages/strapi-plugin-users-permissions/models/User.settings.json index d5aaa66e6c..aad0ab62ec 100644 --- a/packages/strapi-plugin-users-permissions/models/User.settings.json +++ b/packages/strapi-plugin-users-permissions/models/User.settings.json @@ -26,8 +26,7 @@ "password": { "type": "password", "minLength": 6, - "configurable": false, - "required": true + "configurable": false }, "resetPasswordToken": { "type": "string", diff --git a/packages/strapi-plugin-users-permissions/package.json b/packages/strapi-plugin-users-permissions/package.json index 4fc8ead557..31e5b9a735 100644 --- a/packages/strapi-plugin-users-permissions/package.json +++ b/packages/strapi-plugin-users-permissions/package.json @@ -1,7 +1,7 @@ { "name": "strapi-plugin-users-permissions", - "version": "3.0.0-alpha.7.3", - "description": "This is the description of the plugin.", + "version": "3.0.0-alpha.8", + "description": "Protect your API with a full-authentication process based on JWT", "strapi": { "name": "Auth & Permissions", "icon": "users", @@ -17,20 +17,22 @@ "build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build", "start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development node ./node_modules/strapi-helper-plugin/lib/server", "generate": "node ./node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js", - "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", - "pretest": "npm run lint", + "lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", "prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"", - "test": "echo Tests are not implemented.", + "test": "npm run lint", "prepublishOnly": "npm run build" }, "dependencies": { "bcryptjs": "^2.4.3", + "grant-koa": "^3.8.1", "jsonwebtoken": "^8.1.0", + "koa": "^2.1.0", + "purest": "^2.0.1", "request": "^2.83.0", "uuid": "^3.1.0" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.7.3" + "strapi-helper-plugin": "3.0.0-alpha.8.3" }, "author": { "name": "Strapi team", @@ -44,9 +46,13 @@ "url": "http://strapi.io" } ], + "repository": { + "type": "git", + "url": "git://github.com/strapi/strapi.git" + }, "engines": { "node": ">= 7.0.0", "npm": ">= 3.0.0" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/packages/strapi-plugin-users-permissions/services/Providers.js b/packages/strapi-plugin-users-permissions/services/Providers.js new file mode 100644 index 0000000000..a8a7dcd022 --- /dev/null +++ b/packages/strapi-plugin-users-permissions/services/Providers.js @@ -0,0 +1,168 @@ +'use strict'; + +/** + * Module dependencies. + */ + +// Public node modules. +const _ = require('lodash'); +const request = require('request'); + +// Purest strategies. +const Purest = require('purest'); + +const facebook = new Purest({ + provider: 'facebook' +}); + +const github = new Purest({ + provider: 'github', + defaults: { + headers: { + 'user-agent': 'strapi' + } + } +}); + +const google = new Purest({ + provider: 'google' +}); + +const twitter = new Purest({ + provider: 'twitter' +}); + +/** + * Connect thanks to a third-party provider. + * + * + * @param {String} provider + * @param {String} access_token + * + * @return {*} + */ + +exports.connect = (provider, query) => { + const access_token = query.access_token || query.code || query.oauth_token; + + return new Promise((resolve, reject) => { + if (!access_token) { + reject({ + message: 'No access_token.' + }); + } else { + // Get the profile. + getProfile(provider, query, (err, profile) => { + if (err) { + reject(err); + } else { + // We need at least the mail. + if (!profile.email) { + reject({ + message: 'Email was not available.' + }); + } else { + strapi.query('user', 'users-permissions').findOne({email: profile.email}) + .then(user => { + if (!user) { + // Create the new user. + const params = _.assign(profile, { + provider: provider + }); + + strapi.query('user', 'users-permissions').create(params) + .then(user => { + resolve(user); + }) + .catch(err => { + reject(err); + }); + } else { + resolve(user); + } + }) + .catch(err => { + reject(err); + }); + } + } + }); + } + }); +}; + +/** + * Helper to get profiles + * + * @param {String} provider + * @param {Function} callback + */ + +const getProfile = (provider, query, callback) => { + const access_token = query.access_token || query.code || query.oauth_token; + + switch (provider) { + case 'facebook': + facebook.query().get('me?fields=name,email').auth(access_token).request((err, res, body) => { + if (err) { + callback(err); + } else { + callback(null, { + username: body.name, + email: body.email + }); + } + }); + break; + case 'google': + google.query('plus').get('people/me').auth(access_token).request((err, res, body) => { + if (err) { + callback(err); + } else { + callback(null, { + username: body.displayName, + email: body.emails[0].value + }); + } + }); + break; + case 'github': + request.post({ + url: 'https://github.com/login/oauth/access_token', + form: { + client_id: strapi.plugins['users-permissions'].config.grant.github.key, + client_secret: strapi.plugins['users-permissions'].config.grant.github.secret, + code: access_token + } + }, (err, res, body) => { + github.query().get('user').auth(body.split('&')[0].split('=')[1]).request((err, res, body) => { + if (err) { + callback(err); + } else { + callback(null, { + username: body.login, + email: body.email + }); + } + }); + }); + break; + case 'twitter': + twitter.query().get('account/verify_credentials').auth(access_token, query.access_secret).qs({screen_name: query['raw[screen_name]']}).qs({include_email: 'true'}).request((err, res, body) => { + if (err) { + callback(err); + } else { + callback(null, { + username: body.screen_name, + email: body.email + }); + } + }); + break; + default: + callback({ + message: 'Unknown provider.' + }); + break; + } +} diff --git a/packages/strapi-redis/package.json b/packages/strapi-redis/package.json index c08e3f2444..4081698a66 100755 --- a/packages/strapi-redis/package.json +++ b/packages/strapi-redis/package.json @@ -1,6 +1,6 @@ { "name": "strapi-redis", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Redis hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -18,7 +18,7 @@ "ioredis": "^3.1.2", "lodash": "^4.17.4", "stack-trace": "0.0.10", - "strapi-utils": "3.0.0-alpha.7.3" + "strapi-utils": "3.0.0-alpha.8.3" }, "strapi": { "isHook": true diff --git a/packages/strapi-utils/package.json b/packages/strapi-utils/package.json index bffb7cc9c0..c6440f409b 100755 --- a/packages/strapi-utils/package.json +++ b/packages/strapi-utils/package.json @@ -1,6 +1,6 @@ { "name": "strapi-utils", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "Shared utilities for the Strapi packages", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi/lib/core/middlewares.js b/packages/strapi/lib/core/middlewares.js index e9fa4ac7e3..e21fd4daba 100755 --- a/packages/strapi/lib/core/middlewares.js +++ b/packages/strapi/lib/core/middlewares.js @@ -110,7 +110,7 @@ module.exports = function() { return reject(err); } - mountMiddlewares.call(this, files, cwd)(resolve, reject); + mountMiddlewares.call(this, files, cwd, true)(resolve, reject); } ); }) @@ -154,12 +154,13 @@ const requireMiddlewares = function (files, cwd) { ); }; -const mountMiddlewares = function (files, cwd) { +const mountMiddlewares = function (files, cwd, isPlugin) { return (resolve, reject) => parallel( files.map(p => cb => { - const name = p.replace(/^.\/node_modules\/strapi-middleware-/, './') - .split('/')[1]; + const folders = p.replace(/^.\/node_modules\/strapi-middleware-/, './') + .split('/'); + const name = isPlugin ? folders[folders.length - 2] : folders[1]; this.middleware[name] = this.middleware[name] || { loaded: false diff --git a/packages/strapi/lib/utils/post-install.js b/packages/strapi/lib/utils/post-install.js index 0b9fb49f7f..ebc8548135 100644 --- a/packages/strapi/lib/utils/post-install.js +++ b/packages/strapi/lib/utils/post-install.js @@ -17,36 +17,46 @@ const pluginsDirPath = path.join(process.cwd(), 'plugins'); const adminDirPath = path.join(process.cwd(), 'admin'); const plugins = fs.readdirSync(pluginsDirPath).filter(x => x[0] !== '.'); -// Install dependencies for each plugins -_.forEach(plugins, plugin => { - const pluginPath = path.join(pluginsDirPath, plugin); - - console.log(`📦 Installing ${_.upperFirst(plugin)} (plugin) packages...`); - - try { - const install = exec(`cd ${pluginPath} && npm install --prod --ignore-scripts`, { - silent: true - }); - - if (install.stderr) { - console.error(install.stderr); - } - } catch (err) { - console.log(err); - } -}); - // Install admin dependencies -console.log(`📦 Installing admin packages...`); +console.log(`🔸 Administration Panel`); +console.log('📦 Installing packages...'); try { const install = exec(`cd ${adminDirPath} && npm install --prod --ignore-scripts`, { silent: true }); - if (install.stderr) { - console.error(build.stderr); + if (install.stderr && install.code !== 0) { + console.error(install.stderr); + process.exit(1); } + + console.log('✅ Success'); + console.log(''); } catch (err) { console.log(err); } + +// Install dependencies for each plugins +_.forEach(plugins, plugin => { + const pluginPath = path.join(pluginsDirPath, plugin); + + console.log(`🔸 Plugin - ${_.upperFirst(plugin)}`); + console.log('📦 Installing packages...'); + + try { + const install = exec(`cd ${pluginPath} && npm install --prod --ignore-scripts`, { + silent: true + }); + + if (install.stderr && install.code !== 0) { + console.error(install.stderr); + process.exit(1); + } + + console.log('✅ Success'); + console.log(''); + } catch (err) { + console.log(err); + } +}); diff --git a/packages/strapi/package.json b/packages/strapi/package.json index b0b5ed0b24..e14701564b 100755 --- a/packages/strapi/package.json +++ b/packages/strapi/package.json @@ -1,6 +1,6 @@ { "name": "strapi", - "version": "3.0.0-alpha.7.3", + "version": "3.0.0-alpha.8.3", "description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.", "homepage": "http://strapi.io", "keywords": [ @@ -55,14 +55,14 @@ "rimraf": "^2.6.2", "semver": "^5.4.1", "stack-trace": "0.0.10", - "strapi-generate": "3.0.0-alpha.7.3", - "strapi-generate-admin": "3.0.0-alpha.7.3", - "strapi-generate-api": "3.0.0-alpha.7.3", - "strapi-generate-new": "3.0.0-alpha.7.3", - "strapi-generate-plugin": "3.0.0-alpha.7.3", - "strapi-generate-policy": "3.0.0-alpha.7.3", - "strapi-generate-service": "3.0.0-alpha.7.3", - "strapi-utils": "3.0.0-alpha.7.3" + "strapi-generate": "3.0.0-alpha.8.3", + "strapi-generate-admin": "3.0.0-alpha.8.3", + "strapi-generate-api": "3.0.0-alpha.8.3", + "strapi-generate-new": "3.0.0-alpha.8.3", + "strapi-generate-plugin": "3.0.0-alpha.8.3", + "strapi-generate-policy": "3.0.0-alpha.8.3", + "strapi-generate-service": "3.0.0-alpha.8.3", + "strapi-utils": "3.0.0-alpha.8.3" }, "author": { "email": "hi@strapi.io", diff --git a/scripts/setup.js b/scripts/setup.js index aecb18753e..b465f045c4 100755 --- a/scripts/setup.js +++ b/scripts/setup.js @@ -1,14 +1,15 @@ const shell = require('shelljs'); // Store installation start date. +const silent = process.env.npm_config_debug !== 'true'; const installationStartDate = new Date(); const watcher = (label, cmd, withSuccess = true) => { if (label.length > 0) { - shell.echo(`📦 ${label}`); + shell.echo(label); } const data = shell.exec(cmd, { - silent: true + silent }); if (data.stderr && data.code !== 0) { @@ -30,75 +31,84 @@ shell.echo(''); shell.rm('-f', '/usr/local/bin/strapi.js'); shell.cd('packages/strapi-utils'); -watcher('Linking strapi-utils...', 'npm link'); +watcher('📦 Linking strapi-utils...', 'npm link'); shell.cd('../strapi-generate'); watcher('', 'npm install ../strapi-utils'); -watcher('Linking strapi-generate...', 'npm link'); +watcher('📦 Linking strapi-generate...', 'npm link'); shell.cd('../strapi-generate-api'); -watcher('Linking strapi-generate-api...', 'npm link'); +watcher('📦 Linking strapi-generate-api...', 'npm link'); shell.cd('../strapi-helper-plugin'); -watcher('Linking strapi-helper-plugin...', 'npm link'); +watcher('📦 Linking strapi-helper-plugin...', 'npm link'); shell.cd('../strapi-admin'); watcher('', 'npm install ../strapi-helper-plugin --no-optional'); watcher('', 'npm install ../strapi-utils --no-optional'); shell.rm('-f', 'package-lock.json'); -watcher('Linking strapi-admin', 'npm link --no-optional', false); -watcher('Building...', 'npm run build'); + +// Without these line Travis failed. +if (shell.test('-e', 'admin/src/config/plugins.json') === false) { + shell.config.silent = silent; + shell.cd('admin/src/config/'); + shell.ShellString('[]').to('plugins.json'); + shell.cd('../../../'); +} + +watcher('📦 Linking strapi-admin', 'npm link --no-optional', false); +watcher('🏗 Building...', 'npm run build'); shell.cd('../strapi-generate-admin'); watcher('', 'npm install ../strapi-admin'); -watcher('Linking strapi-generate-admin...', 'npm link'); +watcher('📦 Linking strapi-generate-admin...', 'npm link'); shell.cd('../strapi-generate-new'); watcher('', 'npm install ../strapi-utils'); -watcher('Linking strapi-generate-new', 'npm link'); +watcher('📦 Linking strapi-generate-new', 'npm link'); shell.cd('../strapi-mongoose'); watcher('', 'npm install ../strapi-utils'); -watcher('Linking strapi-mongoose...', 'npm link'); +watcher('📦 Linking strapi-mongoose...', 'npm link'); shell.cd('../strapi'); watcher('', 'npm install ../strapi-generate ../strapi-generate-admin ../strapi-generate-api ../strapi-generate-new ../strapi-generate-plugin ../strapi-generate-policy ../strapi-generate-service ../strapi-utils'); -watcher('Linking strapi...', 'npm link'); +watcher('📦 Linking strapi...', 'npm link'); shell.cd('../strapi-plugin-email'); watcher('', 'npm install ../strapi-helper-plugin --no-optional'); shell.rm('-f', 'package-lock.json'); -watcher('Linking strapi-plugin-email...', 'npm link --no-optional', false); -watcher('Building...', 'npm run build'); +watcher('📦 Linking strapi-plugin-email...', 'npm link --no-optional', false); +watcher('🏗 Building...', 'npm run build'); shell.cd('../strapi-plugin-users-permissions'); watcher('', 'npm install ../strapi-helper-plugin --no-optional'); shell.rm('-f', 'package-lock.json'); -watcher('Linking strapi-plugin-users-permissions...', 'npm link --no-optional', false); -watcher('Building...', 'npm run build'); +watcher('📦 Linking strapi-plugin-users-permissions...', 'npm link --no-optional', false); +watcher('🏗 Building...', 'npm run build'); shell.cd('../strapi-plugin-content-manager'); watcher('', 'npm install ../strapi-helper-plugin --no-optional'); shell.rm('-f', 'package-lock.json'); -watcher('Linking strapi-plugin-content-manager...', 'npm link --no-optional', false); -watcher('Building...', 'npm run build'); +watcher('📦 Linking strapi-plugin-content-manager...', 'npm link --no-optional', false); +watcher('🏗 Building...', 'npm run build'); shell.cd('../strapi-plugin-settings-manager'); watcher('', 'npm install ../strapi-helper-plugin --no-optional'); shell.rm('-f', 'package-lock.json'); -watcher('Linking strapi-plugin-settings-manager...', 'npm link --no-optional', false); -watcher('Building...', 'npm run build'); +watcher('📦 Linking strapi-plugin-settings-manager...', 'npm link --no-optional', false); +watcher('🏗 Building...', 'npm run build'); shell.cd('../strapi-plugin-content-type-builder'); watcher('', 'npm install ../strapi-helper-plugin --no-optional'); watcher('', 'npm install ../strapi-generate --no-optional'); watcher('', 'npm install ../strapi-generate-api --no-optional'); shell.rm('-f', 'package-lock.json'); -watcher('Linking strapi-plugin-content-type-builder...', 'npm link --no-optional', false); -watcher('Building...', 'npm run build'); +watcher('📦 Linking strapi-plugin-content-type-builder...', 'npm link --no-optional', false); +watcher('🏗 Building...', 'npm run build'); // Log installation duration. const installationEndDate = new Date(); const duration = (installationEndDate.getTime() - installationStartDate.getTime()) / 1000; -shell.echo('Strapi has been succesfully installed.'); -shell.echo(`Installation took ${Math.floor(duration / 60) > 0 ? `${Math.floor(duration / 60)} minutes and ` : ''}${Math.floor(duration % 60)} seconds.`); +shell.echo('✅ Strapi has been succesfully installed.'); +shell.echo(`⏳ The installation took ${Math.floor(duration / 60) > 0 ? `${Math.floor(duration / 60)} minutes and ` : ''}${Math.floor(duration % 60)} seconds.`);