diff --git a/.gitignore b/.gitignore index 051c482f881..7b30bfecbbd 100755 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ Icon .Spotlight-V100 .Trashes ._* +.vscode ############################ @@ -116,3 +117,9 @@ _book packages/strapi-generate-new/files/public/ packages/*/yarn.lock + +############################ +# Other +############################ +layout.json +manifest.json diff --git a/package.json b/package.json index 4e3df4082c1..74878556eb1 100755 --- a/package.json +++ b/package.json @@ -1,27 +1,27 @@ { "private": true, - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "dependencies": {}, "devDependencies": { - "assert": "~1.3.0", - "axios": "^0.18.0", - "babel-eslint": "^6.1.2", - "chalk": "^2.4.1", - "eslint": "^3.12.2", - "eslint-plugin-babel": "^4.0.0", - "eslint-plugin-react": "^6.8.0", - "eslint-plugin-redux-saga": "^0.3.0", - "gitbook-cli": "^2.3.2", - "istanbul": "~0.4.2", - "jest": "^22.4.3", - "jest-cli": "^22.4.4", - "lerna": "^2.0.0", - "lodash": "^4.17.5", - "mocha": "~2.4.5", - "pre-commit": "~1.1.2", - "redux-saga": "^0.14.3", - "request": "^2.87.0", - "shelljs": "^0.7.7", + "assert": "1.3.0", + "axios": "0.18.0", + "babel-eslint": "6.1.2", + "chalk": "2.4.1", + "eslint": "3.19.1", + "eslint-plugin-babel": "4.1.2", + "eslint-plugin-react": "6.10.3", + "eslint-plugin-redux-saga": "0.3.0", + "gitbook-cli": "2.3.2", + "istanbul": "0.4.5", + "jest": "22.4.4", + "jest-cli": "22.4.4", + "lerna": "2.11.0", + "lodash": "4.17.10", + "mocha": "2.4.5", + "pre-commit": "1.1.3", + "redux-saga": "0.14.8", + "request": "2.88.0", + "shelljs": "0.7.8", "strapi-lint": "file:packages/strapi-lint" }, "scripts": { @@ -33,7 +33,6 @@ "removesymlinkdependencies": "node ./scripts/removeSymlinkDependencies.js", "setup:build": "npm run setup --build", "setup": "npm run clean:all && npm install ./packages/strapi-lint --save-dev && npm install && node ./scripts/setup.js && npm run clean", - "lint": "node ./scripts/lint.js", "test": "node ./test/start.js", "prettier": "node ./packages/strapi-lint/lib/internals/prettier/index.js" }, @@ -50,8 +49,7 @@ } ], "pre-commit": [ - "clean", - "lint" + "clean" ], "repository": { "type": "git", diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json index 402f1cb8bba..a7276ce9ad3 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Strapi Admin", "repository": { "type": "git", @@ -25,14 +25,14 @@ "presetup": "node ./scripts/preSetup.js" }, "dependencies": { - "react-ga": "^2.4.1", - "remove-markdown": "^0.2.2", - "shelljs": "^0.7.8" + "react-ga": "2.4.1", + "remove-markdown": "0.2.2", + "shelljs": "0.7.8" }, "devDependencies": { - "sanitize.css": "^4.1.0", - "strapi-helper-plugin": "3.0.0-alpha.12.5", - "strapi-utils": "3.0.0-alpha.12.5" + "sanitize.css": "4.1.0", + "strapi-helper-plugin": "3.0.0-alpha.12.6", + "strapi-utils": "3.0.0-alpha.12.6" }, "author": { "name": "Strapi", diff --git a/packages/strapi-bookshelf/package.json b/packages/strapi-bookshelf/package.json index ee79562b866..7947de28744 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Bookshelf hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -16,12 +16,12 @@ }, "main": "./lib", "dependencies": { - "bookshelf": "^0.12.1", - "inquirer": "^5.2.0", - "lodash": "^4.17.4", - "pluralize": "^6.0.0", - "strapi-knex": "3.0.0-alpha.12.5", - "strapi-utils": "3.0.0-alpha.12.5" + "bookshelf": "0.12.1", + "inquirer": "5.2.0", + "lodash": "4.17.4", + "pluralize": "6.0.0", + "strapi-knex": "3.0.0-alpha.12.6", + "strapi-utils": "3.0.0-alpha.12.6" }, "strapi": { "isHook": true, diff --git a/packages/strapi-ejs/package.json b/packages/strapi-ejs/package.json index 77d45591435..33c942b7f32 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "EJS hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -13,8 +13,8 @@ }, "main": "./lib", "dependencies": { - "co": "^4.6.0", - "koa-ejs": "^4.1.0" + "co": "4.6.0", + "koa-ejs": "4.1.0" }, "strapi": { "isHook": true diff --git a/packages/strapi-email-mailgun/package.json b/packages/strapi-email-mailgun/package.json index c7aea6e3017..54f0a2fe1dc 100644 --- a/packages/strapi-email-mailgun/package.json +++ b/packages/strapi-email-mailgun/package.json @@ -1,6 +1,6 @@ { "name": "strapi-email-mailgun", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "Mailgun provider for strapi email plugin", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-email-sendgrid/package.json b/packages/strapi-email-sendgrid/package.json index acd5ba90ec5..acfd858b6d9 100644 --- a/packages/strapi-email-sendgrid/package.json +++ b/packages/strapi-email-sendgrid/package.json @@ -1,6 +1,6 @@ { "name": "strapi-email-sendgrid", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "Sendgrid provider for strapi email", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-email-sendmail/package.json b/packages/strapi-email-sendmail/package.json index 0f9f8e795be..f98f4ffa3f9 100644 --- a/packages/strapi-email-sendmail/package.json +++ b/packages/strapi-email-sendmail/package.json @@ -1,6 +1,6 @@ { "name": "strapi-email-sendmail", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "Sendmail provider for strapi email", "homepage": "http://strapi.io", "keywords": [ @@ -12,7 +12,7 @@ }, "main": "./lib", "dependencies": { - "sendmail": "^1.2.0" + "sendmail": "1.2.0" }, "strapi": { "isProvider": true diff --git a/packages/strapi-generate-admin/package.json b/packages/strapi-generate-admin/package.json index 491850aab8c..2dfef94aa98 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Generate the default admin panel for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -13,9 +13,9 @@ "lib": "./lib" }, "dependencies": { - "fs-extra": "^4.0.1", - "lodash": "^4.17.4", - "strapi-admin": "3.0.0-alpha.12.5" + "fs-extra": "4.0.1", + "lodash": "4.17.4", + "strapi-admin": "3.0.0-alpha.12.6" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-generate-api/package.json b/packages/strapi-generate-api/package.json index 14043810294..1902ac1ec3b 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Generate an API for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -13,8 +13,8 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.4", - "pluralize": "^6.0.0" + "lodash": "4.17.4", + "pluralize": "6.0.0" }, "scripts": { "prepublishOnly": "npm prune" diff --git a/packages/strapi-generate-controller/package.json b/packages/strapi-generate-controller/package.json index 9dee4e4a63a..13f3cae1803 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Generate a controller for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -14,7 +14,7 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.4" + "lodash": "4.17.4" }, "scripts": { "prepublish": "npm prune" diff --git a/packages/strapi-generate-model/package.json b/packages/strapi-generate-model/package.json index 4d8d76498d2..50c5ca4296b 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Generate a model for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -14,7 +14,7 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.4" + "lodash": "4.17.4" }, "scripts": { "prepublish": "npm prune" diff --git a/packages/strapi-generate-new/package.json b/packages/strapi-generate-new/package.json index 6e1731cfe9c..6f243ba7d32 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Generate a new Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -13,12 +13,12 @@ "lib": "./lib" }, "dependencies": { - "enpeem": "^2.2.0", - "fs-extra": "^4.0.0", - "inquirer": "^4.0.2", - "lodash": "^4.17.4", - "strapi-utils": "3.0.0-alpha.12.5", - "uuid": "^3.1.0" + "enpeem": "2.2.0", + "fs-extra": "4.0.0", + "inquirer": "4.0.2", + "lodash": "4.17.4", + "strapi-utils": "3.0.0-alpha.12.6", + "uuid": "3.1.0" }, "scripts": { "prepublishOnly": "npm prune" diff --git a/packages/strapi-generate-plugin/package.json b/packages/strapi-generate-plugin/package.json index 914e9359947..3603188eda1 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Generate an plugin for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -13,9 +13,9 @@ "lib": "./lib" }, "dependencies": { - "fs-extra": "^4.0.0", - "lodash": "^4.17.4", - "pluralize": "^6.0.0" + "fs-extra": "4.0.0", + "lodash": "4.17.4", + "pluralize": "6.0.0" }, "scripts": { "prepublishOnly": "npm prune" diff --git a/packages/strapi-generate-policy/package.json b/packages/strapi-generate-policy/package.json index fd8619d9f6b..8164109f8e9 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Generate a policy for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -14,7 +14,7 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.4" + "lodash": "4.17.4" }, "scripts": { "prepublishOnly": "npm prune" diff --git a/packages/strapi-generate-service/package.json b/packages/strapi-generate-service/package.json index 1dd6329cedb..272ccd570fe 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Generate a service for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -14,7 +14,7 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.4" + "lodash": "4.17.4" }, "scripts": { "prepublishOnly": "npm prune" diff --git a/packages/strapi-generate/package.json b/packages/strapi-generate/package.json index e01317cc498..d53ee1116fa 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Master of ceremonies for the Strapi generators.", "homepage": "http://strapi.io", "keywords": [ @@ -13,11 +13,11 @@ "lib": "./lib" }, "dependencies": { - "async": "^2.5.0", - "fs-extra": "^4.0.0", - "lodash": "^4.17.4", - "reportback": "^2.0.1", - "strapi-utils": "3.0.0-alpha.12.5" + "async": "2.5.0", + "fs-extra": "4.0.0", + "lodash": "4.17.4", + "reportback": "2.0.1", + "strapi-utils": "3.0.0-alpha.12.6" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-helper-plugin/lib/src/components/Dropdown/index.js b/packages/strapi-helper-plugin/lib/src/components/Dropdown/index.js new file mode 100644 index 00000000000..d1a86315f97 --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/components/Dropdown/index.js @@ -0,0 +1,49 @@ +import React from 'react'; +import Select from 'react-select'; +import PropTypes from 'prop-types'; +import { groupBy } from 'lodash'; + +class Dropdown extends React.Component { + + getOptions(options) { + return options.map(o => ({ + value: o.id, + label: o.title, + type: o.type, + })); + } + + render() { + const { onChange, options, groupByProp } = this.props; + let finalOptions = this.getOptions(options); + + if(groupByProp) { + const grouped = groupBy(options, groupByProp); + finalOptions = Object.entries(grouped).map(([type, result]) => ({ + label: type, + options: this.getOptions(result) + })); + } + + return ( + - )} - + + + {(message) => ( + + )} + + {colorPreview} + ); } diff --git a/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js b/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js index ef8e995a99e..b72ea6b1684 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js @@ -21,6 +21,7 @@ import InputPasswordWithErrors from 'components/InputPasswordWithErrors'; import InputTextAreaWithErrors from 'components/InputTextAreaWithErrors'; import InputTextWithErrors from 'components/InputTextWithErrors'; import InputToggleWithErrors from 'components/InputToggleWithErrors'; +import InputRefs from 'components/InputRefs'; import WysiwygWithErrors from 'components/WysiwygWithErrors'; import InputJSONWithErrors from 'components/InputJSONWithErrors'; @@ -41,6 +42,7 @@ const inputs = { text: InputTextWithErrors, textarea: InputTextAreaWithErrors, toggle: InputToggleWithErrors, + refs: InputRefs, wysiwyg: WysiwygWithErrors, }; @@ -66,7 +68,7 @@ function InputsIndex(props) { } merge(inputs, props.customInputs); - + const Input = inputs[type] ? inputs[type] : DefaultInputError; return ; @@ -87,6 +89,7 @@ InputsIndex.propTypes = { PropTypes.string, ]), customInputs: PropTypes.object, + modelName: PropTypes.string, type: PropTypes.string.isRequired, value: PropTypes.any, }; diff --git a/packages/strapi-helper-plugin/lib/src/components/SelectWithSort/index.js b/packages/strapi-helper-plugin/lib/src/components/SelectWithSort/index.js new file mode 100644 index 00000000000..5fe2b760b48 --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/components/SelectWithSort/index.js @@ -0,0 +1,99 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import Dropdown from 'components/Dropdown'; +import SortList from 'components/SortList'; +import request from 'utils/request'; + +const style = { + marginTop: '0.9rem', +}; + +class SelectWithSort extends React.Component { + + state = { + loading: true, + options: [], + } + + componentDidMount() { + this.getOptions(); + } + + onSelectChange = (id) => { + const { value, onChange } = this.props; + + onChange([...value, id]); + } + + onSortChange = (items) => { + const newValue = items.map(i => i.id); + + this.props.onChange(newValue); + } + + onRemove = (item) => { + const { value, onChange } = this.props; + onChange(value.filter(id => id !== item.id)); + } + + getOptions = () => { + const { modelName, name } = this.props; + let requestUrl = '/content-manager/explorer/refs'; + + if(modelName && name) { + requestUrl += `?model=${modelName}&name=${name}`; + } + + request(requestUrl, { + method: 'GET', + }) + .then(options => { + this.setState({ + options: options, + loading: false, + }); + }) + .catch(() => { + strapi.notification.error('content-manager.notification.error.relationship.fetch'); + this.setState({ + loading: false, + }); + }); + } + + render() { + const { value } = this.props; + const { options, loading } = this.state; + const selectOptions = options.filter(op => !value.includes(op.id)); + const items = value.map(id => options.find(op => op.id === id)).filter(Boolean); + + if(loading) return 'Loading...'; + + + return ( + +
+ +
+
+ +
+
+ ); + } +} + +SelectWithSort.defaultProps = { + value: undefined, + modelName: undefined, +}; + +SelectWithSort.propTypes = { + name: PropTypes.string.isRequired, + modelName: PropTypes.string, + onChange: PropTypes.func.isRequired, + value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.string]), +}; + + +export default SelectWithSort; \ No newline at end of file diff --git a/packages/strapi-helper-plugin/lib/src/components/SortList/index.js b/packages/strapi-helper-plugin/lib/src/components/SortList/index.js new file mode 100644 index 00000000000..db8eaefe125 --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/components/SortList/index.js @@ -0,0 +1,99 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd'; +import Ico from 'components/Ico'; +import styles from './styles.scss'; + + +// a little function to help us with reordering the result +const reorder = (list, startIndex, endIndex) => { + const result = Array.from(list); + const [removed] = result.splice(startIndex, 1); + result.splice(endIndex, 0, removed); + + return result; +}; + +const getItemStyle = (isDragging, draggableStyle) => ({ + opacity: isDragging ? 0.7 : 1, + + // styles we need to apply on draggables + ...draggableStyle, +}); + +const getListStyle = isDraggingOver => ({ + background: isDraggingOver ? 'white' : 'white', + maxHeight: '50vh', + overflow: 'auto', +}); + +class SortList extends React.Component { + onDragEnd = (result) => { + // dropped outside the list + if (!result.destination) { + return; + } + const { items, onChange } = this.props; + const ordered = reorder( + items, + result.source.index, + result.destination.index, + ); + onChange(ordered); + } + render() { + const { items, onRemove } = this.props; + + return ( + + + {(droppableProvided, droppableSnapshot) => ( +
+ {items.map((item, index) => ( + + {(draggableProvided, draggableSnapshot) => ( +
+ {item.title} + {item.type} + window.open(`/admin/plugins/content-manager/${item.type}/${item.id}?source=content-manager`)} /> + onRemove(item)} /> +
+ )} +
+ ))} + {droppableProvided.placeholder} +
+ )} +
+
+ ); + } +} + +SortList.defaultProps = { + items: [], +}; + +SortList.propTypes = { + items: PropTypes.arrayOf(PropTypes.shape({ + type: PropTypes.string, + id: PropTypes.string, + title: PropTypes.string, + })), + onChange: PropTypes.func.isRequired, + onRemove: PropTypes.func.isRequired, +}; + +export default SortList; \ No newline at end of file diff --git a/packages/strapi-helper-plugin/lib/src/components/SortList/styles.scss b/packages/strapi-helper-plugin/lib/src/components/SortList/styles.scss new file mode 100644 index 00000000000..45ca7acc704 --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/components/SortList/styles.scss @@ -0,0 +1,29 @@ +.item { + padding: 8px 15px; + margin-bottom: 10px; + display: flex; + position: relative; + border: 1px solid #d3dce0; + -webkit-border-radius: 1px; + border-radius: 1px; + background-color: rgba(255, 255, 255, 0.95); + -webkit-box-shadow: 0 1.5px 1.5px #e5ebed; + box-shadow: 0 1.5px 1.5px #e5ebed; + align-items: center; + font-size: 15px; + } + + .clear { + margin-left: 15px; + cursor: pointer; +} + +.trash { + + cursor: pointer; +} + +.type { + color: #6d7173; + margin-left: auto; +} \ No newline at end of file diff --git a/packages/strapi-helper-plugin/package.json b/packages/strapi-helper-plugin/package.json index fb54e76d1c4..60f52b0ea98 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Helper for Strapi plugins development", "engines": { "node": ">= 9.0.0", @@ -27,32 +27,32 @@ "lint:admin" ], "dependencies": { - "add-asset-html-webpack-plugin": "^2.1.2", - "babel-cli": "^6.26.0", - "babel-core": "^6.26.0", - "babel-eslint": "^7.2.3", - "babel-loader": "^7.1.1", - "babel-plugin-istanbul": "^4.1.5", - "babel-plugin-styled-components": "^1.5.1", - "babel-plugin-transform-es2015-destructuring": "^6.23.0", - "babel-plugin-transform-es2015-parameters": "^6.24.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-plugin-transform-react-constant-elements": "^6.23.0", - "babel-plugin-transform-react-inline-elements": "^6.22.0", - "babel-plugin-transform-react-remove-prop-types": "^0.4.8", - "babel-polyfill": "^6.26.0", - "babel-preset-env": "^1.6.1", - "babel-preset-react": "^6.24.1", - "babel-preset-react-hmre": "^1.1.1", - "babel-preset-stage-0": "^6.24.1", - "bootstrap": "^4.0.0-alpha.6", - "chalk": "^2.1.0", - "classnames": "^2.2.5", - "codemirror": "^5.38.0", - "copy-webpack-plugin": "^4.3.1", - "cross-env": "^5.0.5", - "css-loader": "^0.28.5", - "draft-js": "^0.10.5", + "add-asset-html-webpack-plugin": "2.1.3", + "babel-cli": "6.26.0", + "babel-core": "6.26.3", + "babel-eslint": "7.2.3", + "babel-loader": "7.1.5", + "babel-plugin-istanbul": "4.1.6", + "babel-plugin-styled-components": "1.5.1", + "babel-plugin-transform-es2015-destructuring": "6.23.0", + "babel-plugin-transform-es2015-parameters": "6.24.1", + "babel-plugin-transform-object-rest-spread": "6.26.0", + "babel-plugin-transform-react-constant-elements": "6.23.0", + "babel-plugin-transform-react-inline-elements": "6.22.0", + "babel-plugin-transform-react-remove-prop-types": "0.4.14", + "babel-polyfill": "6.26.0", + "babel-preset-env": "1.7.0", + "babel-preset-react": "6.24.1", + "babel-preset-react-hmre": "1.1.1", + "babel-preset-stage-0": "6.24.1", + "bootstrap": "4.1.3", + "chalk": "2.4.1", + "classnames": "2.2.6", + "codemirror": "5.39.0", + "copy-webpack-plugin": "4.5.2", + "cross-env": "5.2.0", + "css-loader": "0.28.11", + "draft-js": "0.10.5", "eslint": "4.4.1", "eslint-config-airbnb": "15.1.0", "eslint-config-airbnb-base": "11.3.1", @@ -62,60 +62,62 @@ "eslint-plugin-jsx-a11y": "6.0.2", "eslint-plugin-react": "7.2.1", "eslint-plugin-redux-saga": "0.4.0", - "exports-loader": "^0.6.4", - "express": "^4.15.4", - "extract-text-webpack-plugin": "^3.0.0", - "file-loader": "^0.11.2", - "history": "^4.6.3", - "html-loader": "^0.5.1", - "html-webpack-plugin": "^2.30.1", - "image-webpack-loader": "^3.3.1", - "immutable": "^3.8.1", - "imports-loader": "^0.7.1", - "intl": "^1.2.5", + "exports-loader": "0.6.4", + "express": "4.16.3", + "extract-text-webpack-plugin": "3.0.2", + "file-loader": "0.11.2", + "history": "4.7.2", + "html-loader": "0.5.5", + "html-webpack-plugin": "2.30.1", + "image-webpack-loader": "3.6.0", + "immutable": "3.8.2", + "imports-loader": "0.7.1", + "intl": "1.2.5", "invariant": "2.2.1", - "json-loader": "^0.5.7", - "lodash": "^4.17.4", - "lodash-webpack-plugin": "^0.11.4", + "json-loader": "0.5.7", + "lodash": "4.17.10", + "lodash-webpack-plugin": "0.11.5", "mocha": "3.1.2", - "moment": "^2.16.0", - "node-sass": "^4.5.3", - "null-loader": "^0.1.1", - "plop": "^1.8.0", - "postcss-cssnext": "^2.11.0", - "postcss-focus": "^2.0.0", - "postcss-loader": "^2.0.6", - "postcss-reporter": "^5.0.0", - "postcss-smart-import": "^0.7.5", - "precss": "^2.0.0", - "prettier": "^1.5.3", - "prop-types": "^15.5.10", - "react": "^16.0.0", - "react-datetime": "^2.8.6", - "react-dom": "^16.0.0", - "react-helmet": "^5.1.3", - "react-intl": "^2.3.0", - "react-loadable": "^5.3.1", - "react-redux": "^5.0.6", - "react-router-dom": "^4.1.2", - "react-router-redux": "^5.0.0-alpha.6", - "react-transition-group": "^2.2.0", - "reactstrap": "^5.0.0-alpha.3", - "redux": "^3.7.2", - "redux-immutable": "^4.0.0", - "redux-saga": "^0.15.6", - "reselect": "^3.0.1", - "rimraf": "^2.6.1", - "sass-loader": "^6.0.6", - "shelljs": "^0.7.8", - "showdown": "^1.8.6", - "style-loader": "^0.18.2", - "styled-components": "^3.2.6", - "url-loader": "^0.5.9", - "webpack": "^3.5.5", - "webpack-bundle-analyzer": "^2.9.0", - "webpack-dev-middleware": "^1.12.0", - "webpack-hot-middleware": "^2.18.2", - "whatwg-fetch": "^2.0.3" + "moment": "2.22.2", + "node-sass": "4.9.3", + "null-loader": "0.1.1", + "plop": "1.9.1", + "postcss-cssnext": "2.11.0", + "postcss-focus": "2.0.0", + "postcss-loader": "2.1.6", + "postcss-reporter": "5.0.0", + "postcss-smart-import": "0.7.6", + "precss": "2.0.0", + "prettier": "1.14.2", + "prop-types": "15.6.2", + "react": "16.4.2", + "react-beautiful-dnd": "7.1.3", + "react-datetime": "2.15.0", + "react-dom": "16.4.2", + "react-helmet": "5.2.0", + "react-intl": "2.4.0", + "react-loadable": "5.5.0", + "react-redux": "5.0.7", + "react-router-dom": "4.3.1", + "react-router-redux": "5.0.0-alpha.9", + "react-select": "2.0.0", + "react-transition-group": "2.4.0", + "reactstrap": "5.0.0", + "redux": "3.7.2", + "redux-immutable": "4.0.0", + "redux-saga": "0.15.6", + "reselect": "3.0.1", + "rimraf": "2.6.2", + "sass-loader": "6.0.7", + "shelljs": "0.7.8", + "showdown": "1.8.6", + "style-loader": "0.18.2", + "styled-components": "3.4.4", + "url-loader": "0.5.9", + "webpack": "3.12.0", + "webpack-bundle-analyzer": "2.13.1", + "webpack-dev-middleware": "1.12.2", + "webpack-hot-middleware": "2.22.3", + "whatwg-fetch": "2.0.4" } } \ No newline at end of file diff --git a/packages/strapi-knex/package.json b/packages/strapi-knex/package.json index 6e06e5522d2..3470f7ed117 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Knex hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -16,8 +16,8 @@ }, "main": "./lib", "dependencies": { - "knex": "^0.13.0", - "lodash": "^4.17.4" + "knex": "0.13.0", + "lodash": "4.17.4" }, "strapi": { "isHook": true diff --git a/packages/strapi-lint/package.json b/packages/strapi-lint/package.json index 2cdc5c346c3..70ba2058f07 100644 --- a/packages/strapi-lint/package.json +++ b/packages/strapi-lint/package.json @@ -1,6 +1,6 @@ { "name": "strapi-lint", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "Strapi eslint and prettier configurations", "directories": { "lib": "lib" @@ -26,19 +26,19 @@ ], "license": "MIT", "devDependencies": { - "eslint": "^4.19.1", - "eslint-config-airbnb": "^16.1.0", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-config-prettier": "^2.9.0", - "eslint-import-resolver-webpack": "^0.9.0", - "eslint-plugin-import": "^2.11.0", - "eslint-plugin-jsx-a11y": "^6.0.3", - "eslint-plugin-react": "^7.7.0", - "eslint-plugin-redux-saga": "^0.8.0", - "webpack": "^4.6.0" + "eslint": "4.19.1", + "eslint-config-airbnb": "16.1.0", + "eslint-config-airbnb-base": "12.1.0", + "eslint-config-prettier": "2.9.0", + "eslint-import-resolver-webpack": "0.9.0", + "eslint-plugin-import": "2.11.0", + "eslint-plugin-jsx-a11y": "6.0.3", + "eslint-plugin-react": "7.7.0", + "eslint-plugin-redux-saga": "0.8.0", + "webpack": "4.6.0" }, "dependencies": { - "babel-eslint": "^8.2.3", - "prettier": "^1.12.1" + "babel-eslint": "8.2.3", + "prettier": "1.12.1" } } \ No newline at end of file diff --git a/packages/strapi-middleware-views/package.json b/packages/strapi-middleware-views/package.json index c4368e0bb4f..579a6ff25eb 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Views hook to enable server-side rendering for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -15,9 +15,9 @@ }, "main": "./lib", "dependencies": { - "consolidate": "^0.14.5", - "koa-views": "^6.1.1", - "lodash": "^4.17.4" + "consolidate": "0.14.5", + "koa-views": "6.1.1", + "lodash": "4.17.4" }, "strapi": { "isHook": true diff --git a/packages/strapi-mongoose/lib/utils/index.js b/packages/strapi-mongoose/lib/utils/index.js index f36bf888adb..ae0e1d39ee9 100755 --- a/packages/strapi-mongoose/lib/utils/index.js +++ b/packages/strapi-mongoose/lib/utils/index.js @@ -11,7 +11,9 @@ module.exports = mongoose => { convertType: mongooseType => { switch (mongooseType.toLowerCase()) { case 'array': - return Array; + return 'Array'; + case 'refs': + return [mongoose.Schema.Types.Mixed]; case 'boolean': return 'Boolean'; case 'binary': diff --git a/packages/strapi-mongoose/package.json b/packages/strapi-mongoose/package.json index 2f3dc93b395..2ccbdaeda66 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Mongoose hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -15,11 +15,11 @@ }, "main": "./lib", "dependencies": { - "lodash": "^4.17.4", - "mongoose": "^5.0.16", - "mongoose-float": "^1.0.2", - "pluralize": "^6.0.0", - "strapi-utils": "3.0.0-alpha.12.5" + "lodash": "4.17.4", + "mongoose": "5.0.18", + "mongoose-float": "1.0.2", + "pluralize": "6.0.0", + "strapi-utils": "3.0.0-alpha.12.6" }, "strapi": { "isHook": true diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js b/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js index cbc76c9427c..672e179905e 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js @@ -49,6 +49,8 @@ const getInputType = (type = '') => { case 'file': case 'files': return 'file'; + case 'refs': + return 'refs'; case 'json': return 'json'; default: @@ -131,7 +133,22 @@ class Edit extends React.PureComponent { // orderAttributes = (displayedFields) => Object.keys(displayedFields).sort(name => Object.keys(this.getUploadRelations(this.props)).includes(name)); orderAttributes = (displayedFields) => Object.keys(displayedFields); + transformLabel(label, orignalLabel) { + if(!label) { + return orignalLabel.replace('_sv', ' πŸ‡ΈπŸ‡ͺ').replace('_en', ' πŸ‡¬πŸ‡§'); + } + if(orignalLabel.includes("_sv")) { + return `${label} πŸ‡ΈπŸ‡ͺ` + } + else if(orignalLabel.includes("_en")) { + return `${label} πŸ‡¬πŸ‡§` + } + + return label; + } + render(){ + return (
@@ -141,15 +158,18 @@ class Edit extends React.PureComponent { const layout = this.getInputLayout(attr); const appearance = get(layout, 'appearance'); const type = !isEmpty(appearance) ? appearance.toLowerCase() : get(layout, 'type', getInputType(details.type)); + const attributes = this.props.attributes[attr]; + const orignalLabel = get(layout, 'label') || details.label || ''; + const label = this.transformLabel(attributes.label, orignalLabel) - return ( + return ( ); })} @@ -179,6 +201,7 @@ Edit.defaultProps = { record: {}, resetProps: false, schema: {}, + modelName: null, }; Edit.propTypes = { @@ -187,6 +210,7 @@ Edit.propTypes = { formErrors: PropTypes.array, formValidations: PropTypes.array, layout: PropTypes.object, + modelName: PropTypes.string, onBlur: PropTypes.func, onChange: PropTypes.func, record: PropTypes.object, diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js index 798ea607e6a..4deb6765b00 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js @@ -267,7 +267,7 @@ export class EditPage extends React.Component { render() { const { editPage } = this.props; - + return (
diff --git a/packages/strapi-plugin-content-manager/config/layout.js b/packages/strapi-plugin-content-manager/config/layout.js new file mode 100644 index 00000000000..7c6d6c73d3d --- /dev/null +++ b/packages/strapi-plugin-content-manager/config/layout.js @@ -0,0 +1 @@ +module.exports = {} \ No newline at end of file diff --git a/packages/strapi-plugin-content-manager/config/routes.json b/packages/strapi-plugin-content-manager/config/routes.json index 9b057fa5a56..cc3633e640f 100755 --- a/packages/strapi-plugin-content-manager/config/routes.json +++ b/packages/strapi-plugin-content-manager/config/routes.json @@ -16,6 +16,14 @@ "policies": [] } }, + { + "method": "GET", + "path": "/explorer/refs", + "handler": "ContentManager.getRefs", + "config": { + "policies": [] + } + }, { "method": "GET", "path": "/explorer/:model", diff --git a/packages/strapi-plugin-content-manager/controllers/ContentManager.js b/packages/strapi-plugin-content-manager/controllers/ContentManager.js index 3bb5684dd7a..8f773d8e387 100755 --- a/packages/strapi-plugin-content-manager/controllers/ContentManager.js +++ b/packages/strapi-plugin-content-manager/controllers/ContentManager.js @@ -5,7 +5,6 @@ const _ = require('lodash'); /** * A set of functions called "actions" for `ContentManager` */ - module.exports = { layout: async (ctx) => { const {source} = ctx.query; @@ -109,6 +108,10 @@ module.exports = { ctx.body = await strapi.plugins['content-manager'].services['contentmanager'].delete(ctx.params, ctx.request.query); }, + getRefs: async ctx => { + ctx.body = await strapi.plugins['content-manager'].services['contentmanager'].getRefs(ctx.request.query); + }, + deleteAll: async ctx => { ctx.body = await strapi.plugins['content-manager'].services['contentmanager'].deleteMany(ctx.params, ctx.request.query); } diff --git a/packages/strapi-plugin-content-manager/package.json b/packages/strapi-plugin-content-manager/package.json index f41b7111a5b..03c23edb699 100755 --- a/packages/strapi-plugin-content-manager/package.json +++ b/packages/strapi-plugin-content-manager/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-content-manager", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "A powerful UI to easily manage your data.", "strapi": { "name": "Content Manager", @@ -22,8 +22,8 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "devDependencies": { - "react-select": "^1.0.0-rc.5", - "strapi-helper-plugin": "3.0.0-alpha.12.5" + "react-select": "1.0.0-rc.5", + "strapi-helper-plugin": "3.0.0-alpha.12.6" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-content-manager/services/ContentManager.js b/packages/strapi-plugin-content-manager/services/ContentManager.js index 31bc515131b..3e5c0ff9ceb 100644 --- a/packages/strapi-plugin-content-manager/services/ContentManager.js +++ b/packages/strapi-plugin-content-manager/services/ContentManager.js @@ -2,6 +2,24 @@ const _ = require('lodash'); +const getTitle = record => { + const keys = ['displayName', 'name', 'title', 'header', 'text', 'description']; + + for(let key of keys) { + if(record[key]) { + return record[key]; + } + else if(record[`${key}_sv`]) { + return record[`${key}_sv`] + } + else if(record[`${key}_en`]) { + return record[`${key}_en`] + } + } + + return record._id +} + /** * A set of functions called "actions" for `ContentManager` */ @@ -179,6 +197,44 @@ module.exports = { }); }, + getRefs: async (query = {}) => { + const { core_store, ...models } = strapi.models; + let propertyKeys = Object.keys(models); + const { model, name } = query; + + if(model) { + const attributes = _.get(models, `${model}._attributes`); + + if(attributes) { + // Get the attribute that is of type refs and match the requested field + const refField = Object.entries(attributes) + .map(([key, rest]) => ({ + ...rest, + name: key + })) + .find(a => a.type === 'refs' && a.name === name); + + const allowedRefs = refField && refField.refs; + if(allowedRefs && allowedRefs.length > 0) { + propertyKeys = propertyKeys.filter(key => allowedRefs.includes(key)) + } + } + } + + const fetchAllModels = propertyKeys.map(async model => { + const allRecords = await module.exports.fetchAll({ model }, {}); + + return allRecords.map(record => ({ + id: record._id, + title: getTitle(record), + type: model + })); + }); + + + return _.flatten(await Promise.all(fetchAllModels)); + }, + deleteMany: async (params, query) => { const { source } = query; const { model } = params; diff --git a/packages/strapi-plugin-content-type-builder/config/layout.js b/packages/strapi-plugin-content-type-builder/config/layout.js new file mode 100644 index 00000000000..7c6d6c73d3d --- /dev/null +++ b/packages/strapi-plugin-content-type-builder/config/layout.js @@ -0,0 +1 @@ +module.exports = {} \ No newline at end of file diff --git a/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js b/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js index 8849d3f31a9..ed76dbc1cf2 100755 --- a/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js +++ b/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js @@ -5,6 +5,57 @@ const _ = require('lodash'); const Service = require('../services/ContentTypeBuilder'); +const ensureLocales = attributes => { + const locales = strapi.config.autoLocales; + + if (!locales) return attributes; + const originalNames = []; + + attributes.forEach((attribute) => { + if ( + attribute.params.type.match(/(string|text|media)/i) && + !attribute.name.match(/.*?_..$/i) + ) { + originalNames.push(attribute.name); + + locales.forEach(locale => { + if (!attributes.find(a => a.name === `${attribute.name}_${locale}`)) { + attributes.push({ + name: `${attribute.name}_${locale}`, + params: attribute.params + }); + } + }); + } + }); + + // Remove the original fields + return attributes.filter(attribute => !originalNames.includes(attribute.name)); +}; + +const ensureResponsiveImages = attributes => { + const sizes = ['small']; + + attributes.forEach((attribute) => { + if ( + attribute.params.type.includes('media') && attribute.name.endsWith('_responsive') + ) { + attribute.name = attribute.name.replace('_responsive', ''); + + sizes.forEach(size => { + if (!attributes.find(a => a.name === `${attribute.name}_${size}`)) { + attributes.push({ + ...attribute, + name: `${attribute.name}_${size}` + }); + } + }); + } + }); + + return attributes; +}; + module.exports = { getModels: async ctx => { ctx.send({ models: Service.getModels() }); @@ -32,7 +83,11 @@ module.exports = { }, createModel: async ctx => { - const { name, description, connection, collectionName, attributes = [], plugin } = ctx.request.body; + const { name, description, connection, collectionName, plugin } = ctx.request.body; + let attributes = [...ctx.request.body.attributes || []]; + + attributes = ensureResponsiveImages(attributes); + attributes = ensureLocales(attributes); if (!name) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.name.missing' }] }]); if (!_.includes(Service.getConnections(), connection)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.connection.unknow' }] }]); @@ -86,7 +141,11 @@ module.exports = { updateModel: async ctx => { const { model } = ctx.params; - const { name, description, mainField, connection, collectionName, attributes = [], plugin } = ctx.request.body; + const { name, description, mainField, connection, collectionName, plugin } = ctx.request.body; + let { attributes = [] } = ctx.request.body; + + attributes = ensureResponsiveImages(attributes); + attributes = ensureLocales(attributes); if (!name) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.name.missing' }] }]); if (!_.includes(Service.getConnections(), connection)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.connection.unknow' }] }]); diff --git a/packages/strapi-plugin-content-type-builder/package.json b/packages/strapi-plugin-content-type-builder/package.json index 0f2dcfbae3c..e151f4edaa7 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Strapi plugin to create content type (API).", "strapi": { "name": "Content Type Builder", @@ -22,12 +22,12 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "dependencies": { - "pluralize": "^7.0.0", - "strapi-generate": "3.0.0-alpha.12.5", - "strapi-generate-api": "3.0.0-alpha.12.5" + "pluralize": "7.0.0", + "strapi-generate": "3.0.0-alpha.12.6", + "strapi-generate-api": "3.0.0-alpha.12.6" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.12.5" + "strapi-helper-plugin": "3.0.0-alpha.12.6" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-email/config/layout.js b/packages/strapi-plugin-email/config/layout.js new file mode 100644 index 00000000000..7c6d6c73d3d --- /dev/null +++ b/packages/strapi-plugin-email/config/layout.js @@ -0,0 +1 @@ +module.exports = {} \ No newline at end of file diff --git a/packages/strapi-plugin-email/package.json b/packages/strapi-plugin-email/package.json index 4e34c030319..ab80b6a6aa3 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "This is the description of the plugin.", "strapi": { "name": "Email", @@ -22,11 +22,11 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "dependencies": { - "strapi-email-sendmail": "3.0.0-alpha.12.5" + "strapi-email-sendmail": "3.0.0-alpha.12.6" }, "devDependencies": { "react-copy-to-clipboard": "5.0.1", - "strapi-helper-plugin": "3.0.0-alpha.12.5" + "strapi-helper-plugin": "3.0.0-alpha.12.6" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-graphql/package.json b/packages/strapi-plugin-graphql/package.json index b24c307c14a..4e1e6352757 100644 --- a/packages/strapi-plugin-graphql/package.json +++ b/packages/strapi-plugin-graphql/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-graphql", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "This is the description of the plugin.", "strapi": { "name": "graphql", @@ -21,15 +21,15 @@ "test": "echo \"Error: no test specified\"" }, "dependencies": { - "apollo-server-koa": "^1.3.3", - "glob": "^7.1.2", - "graphql": "^0.13.2", - "graphql-depth-limit": "^1.1.0", - "graphql-playground-middleware-koa": "^1.6.1", - "graphql-tools": "^2.23.1", - "graphql-type-json": "^0.2.0", - "pluralize": "^7.0.0", - "strapi-utils": "3.0.0-alpha.12.5" + "apollo-server-koa": "1.3.3", + "glob": "7.1.2", + "graphql": "0.13.2", + "graphql-depth-limit": "1.1.0", + "graphql-playground-middleware-koa": "1.6.1", + "graphql-tools": "2.23.1", + "graphql-type-json": "0.2.0", + "pluralize": "7.0.0", + "strapi-utils": "3.0.0-alpha.12.6" }, "author": { "name": "A Strapi developer", diff --git a/packages/strapi-plugin-settings-manager/config/layout.js b/packages/strapi-plugin-settings-manager/config/layout.js new file mode 100644 index 00000000000..7c6d6c73d3d --- /dev/null +++ b/packages/strapi-plugin-settings-manager/config/layout.js @@ -0,0 +1 @@ +module.exports = {} \ No newline at end of file diff --git a/packages/strapi-plugin-settings-manager/package.json b/packages/strapi-plugin-settings-manager/package.json index 5df42d3e96b..2282ba735e5 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Strapi plugin to manage settings.", "strapi": { "name": "Settings Manager", @@ -23,9 +23,9 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "devDependencies": { - "flag-icon-css": "^2.8.0", - "react-select": "^1.0.0-rc.5", - "strapi-helper-plugin": "3.0.0-alpha.12.5" + "flag-icon-css": "2.8.0", + "react-select": "1.0.0-rc.5", + "strapi-helper-plugin": "3.0.0-alpha.12.6" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-upload/config/layout.js b/packages/strapi-plugin-upload/config/layout.js new file mode 100644 index 00000000000..7c6d6c73d3d --- /dev/null +++ b/packages/strapi-plugin-upload/config/layout.js @@ -0,0 +1 @@ +module.exports = {} \ No newline at end of file diff --git a/packages/strapi-plugin-upload/package.json b/packages/strapi-plugin-upload/package.json index 43d76b1af75..67394b6b364 100644 --- a/packages/strapi-plugin-upload/package.json +++ b/packages/strapi-plugin-upload/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-upload", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "This is the description of the plugin.", "strapi": { "name": "Files Upload", @@ -22,13 +22,13 @@ "prepublishOnly": "IS_MONOREPO=true npm run build" }, "dependencies": { - "react-copy-to-clipboard": "^5.0.1", - "strapi-upload-local": "3.0.0-alpha.12.5", - "stream-to-array": "^2.3.0", - "uuid": "^3.2.1" + "react-copy-to-clipboard": "5.0.1", + "strapi-upload-local": "3.0.0-alpha.12.6", + "stream-to-array": "2.3.0", + "uuid": "3.2.1" }, "devDependencies": { - "strapi-helper-plugin": "3.0.0-alpha.12.5" + "strapi-helper-plugin": "3.0.0-alpha.12.6" }, "author": { "name": "A Strapi developer", diff --git a/packages/strapi-plugin-users-permissions/package.json b/packages/strapi-plugin-users-permissions/package.json index f5a690625c8..ad2d70176dc 100644 --- a/packages/strapi-plugin-users-permissions/package.json +++ b/packages/strapi-plugin-users-permissions/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-users-permissions", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "Protect your API with a full-authentication process based on JWT", "strapi": { "name": "Roles & Permissions", @@ -22,16 +22,16 @@ "prepublishOnly": "IS_MONOREPO=true 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" + "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.12.5" + "strapi-helper-plugin": "3.0.0-alpha.12.6" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js index 4e5fc46f2fd..27d4e5afedc 100644 --- a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js @@ -288,7 +288,7 @@ module.exports = { removeDuplicate: async function () { const primaryKey = strapi.query('permission', 'users-permissions').primaryKey; - + // Retrieve permissions by creation date (ID or ObjectID). const permissions = await strapi.query('permission', 'users-permissions').find({ sort: `${primaryKey}` diff --git a/packages/strapi-redis/package.json b/packages/strapi-redis/package.json index 95ab33c6df7..b69e24bf8df 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Redis hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -15,10 +15,10 @@ }, "main": "./lib", "dependencies": { - "ioredis": "^3.1.2", - "lodash": "^4.17.4", + "ioredis": "3.1.2", + "lodash": "4.17.4", "stack-trace": "0.0.10", - "strapi-utils": "3.0.0-alpha.12.5" + "strapi-utils": "3.0.0-alpha.12.6" }, "strapi": { "isHook": true diff --git a/packages/strapi-upload-aws-s3/lib/index.js b/packages/strapi-upload-aws-s3/lib/index.js index 0545af0b36c..e079a06f94b 100644 --- a/packages/strapi-upload-aws-s3/lib/index.js +++ b/packages/strapi-upload-aws-s3/lib/index.js @@ -49,6 +49,10 @@ module.exports = { bucket: { label: 'Bucket', type: 'text' + }, + basePath: { + label: 'Base path', + type: 'text' } }, init: (config) => { @@ -66,14 +70,20 @@ module.exports = { } }); + let basePath = config.basePath && config.basePath.trim() || ''; + basePath = basePath.match(/\/$/) ? basePath : `${basePath}/`; + + if (basePath === '/') basePath = ''; + return { upload: (file) => { return new Promise((resolve, reject) => { // upload file on S3 bucket S3.upload({ - Key: `${file.hash}${file.ext}`, + Key: `${basePath}${file.hash}${file.ext}`, Body: new Buffer(file.buffer, 'binary'), - ACL: 'public-read' + ACL: 'public-read', + ContentType: file.mime }, (err, data) => { if (err) { return reject(err); @@ -92,7 +102,7 @@ module.exports = { S3.deleteObjects({ Delete: { Objects: [{ - Key: `${file.hash}${file.ext}` + Key: `${basePath}${file.hash}${file.ext}` }] } }, (err, data) => { diff --git a/packages/strapi-upload-aws-s3/package.json b/packages/strapi-upload-aws-s3/package.json index 8b3da1fe900..c76b0180c9a 100644 --- a/packages/strapi-upload-aws-s3/package.json +++ b/packages/strapi-upload-aws-s3/package.json @@ -1,6 +1,6 @@ { "name": "strapi-upload-aws-s3", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "AWS S3 provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ @@ -14,7 +14,7 @@ }, "main": "./lib", "dependencies": { - "aws-sdk": "^2.199.0" + "aws-sdk": "2.199.0" }, "strapi": { "isProvider": true diff --git a/packages/strapi-upload-cloudinary/package.json b/packages/strapi-upload-cloudinary/package.json index e0cbdf9e9a0..308aba1a1e8 100644 --- a/packages/strapi-upload-cloudinary/package.json +++ b/packages/strapi-upload-cloudinary/package.json @@ -1,6 +1,6 @@ { "name": "strapi-upload-cloudinary", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "Cloudinary provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ @@ -13,8 +13,8 @@ }, "main": "./lib", "dependencies": { - "cloudinary": "^1.11.0", - "into-stream": "^3.1.0" + "cloudinary": "1.11.0", + "into-stream": "3.1.0" }, "strapi": { "isProvider": true diff --git a/packages/strapi-upload-local/package.json b/packages/strapi-upload-local/package.json index cb1ec30d80e..8b89b46153f 100644 --- a/packages/strapi-upload-local/package.json +++ b/packages/strapi-upload-local/package.json @@ -1,6 +1,6 @@ { "name": "strapi-upload-local", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "Local provider for strapi upload", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-upload-rackspace/package.json b/packages/strapi-upload-rackspace/package.json index f4137b7a6c5..9b27ccf236f 100644 --- a/packages/strapi-upload-rackspace/package.json +++ b/packages/strapi-upload-rackspace/package.json @@ -1,6 +1,6 @@ { "name": "strapi-upload-rackspace", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "description": "Rackspace provider for strapi upload", "main": "./lib", "scripts": { @@ -10,7 +10,7 @@ "author": "Pongstr Ordillo ", "license": "MIT", "dependencies": { - "pkgcloud": "^1.5.0", - "streamifier": "^0.1.1" + "pkgcloud": "1.5.0", + "streamifier": "0.1.1" } } \ No newline at end of file diff --git a/packages/strapi-utils/package.json b/packages/strapi-utils/package.json index 497f69a373b..361ed393ba9 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.12.5", + "version": "3.0.0-alpha.12.6", "description": "Shared utilities for the Strapi packages", "homepage": "http://strapi.io", "keywords": [ @@ -18,11 +18,11 @@ "test": "echo \"Error: no test specified yet!\"" }, "dependencies": { - "commander": "^2.11.0", - "joi-json": "^2.0.1", - "knex": "^0.13.0", - "lodash": "^4.17.4", - "pino": "^4.7.1" + "commander": "2.11.0", + "joi-json": "2.0.1", + "knex": "0.13.0", + "lodash": "4.17.4", + "pino": "4.17.6" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi/package.json b/packages/strapi/package.json index 1441d425f24..d9a4ad9746a 100755 --- a/packages/strapi/package.json +++ b/packages/strapi/package.json @@ -1,6 +1,6 @@ { "name": "strapi", - "version": "3.0.0-alpha.12.5", + "version": "3.0.0-alpha.12.6", "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": [ @@ -30,41 +30,41 @@ "strapi": "./bin/strapi.js" }, "dependencies": { - "async": "^2.1.2", - "boom": "^5.2.0", - "cheerio": "^1.0.0-rc.2", - "delegates": "^1.0.0", - "glob": "^7.1.2", - "kcors": "^2.2.0", - "koa": "^2.1.0", - "koa-body": "^2.5.0", - "koa-compose": "^4.0.0", - "koa-compress": "^2.0.0", - "koa-convert": "^1.2.0", - "koa-favicon": "^2.0.0", - "koa-i18n": "^2.1.0", - "koa-ip": "^1.0.0", - "koa-locale": "~1.3.0", - "koa-lusca": "~2.2.0", - "koa-router-joi": "^1.0.1", - "koa-session": "^5.5.1", - "koa-static": "^4.0.1", - "lodash": "^4.16.5", - "node-fetch": "^1.7.3", - "node-schedule": "^1.2.0", - "rimraf": "^2.6.2", - "semver": "^5.4.1", + "async": "2.1.2", + "boom": "5.2.0", + "cheerio": "1.0.0-rc.2", + "delegates": "1.0.0", + "glob": "7.1.2", + "kcors": "2.2.0", + "koa": "2.1.0", + "koa-body": "2.5.0", + "koa-compose": "4.0.0", + "koa-compress": "2.0.0", + "koa-convert": "1.2.0", + "koa-favicon": "2.0.0", + "koa-i18n": "2.1.0", + "koa-ip": "1.0.0", + "koa-locale": "1.3.0", + "koa-lusca": "2.2.0", + "koa-router-joi": "1.0.1", + "koa-session": "5.5.1", + "koa-static": "4.0.1", + "lodash": "4.16.5", + "node-fetch": "1.7.3", + "node-schedule": "1.2.0", + "rimraf": "2.6.2", + "semver": "5.4.1", "stack-trace": "0.0.10", - "strapi-generate": "3.0.0-alpha.12.5", - "strapi-generate-admin": "3.0.0-alpha.12.5", - "strapi-generate-api": "3.0.0-alpha.12.5", - "strapi-generate-controller": "3.0.0-alpha.12.5", - "strapi-generate-model": "3.0.0-alpha.12.5", - "strapi-generate-new": "3.0.0-alpha.12.5", - "strapi-generate-plugin": "3.0.0-alpha.12.5", - "strapi-generate-policy": "3.0.0-alpha.12.5", - "strapi-generate-service": "3.0.0-alpha.12.5", - "strapi-utils": "3.0.0-alpha.12.5" + "strapi-generate": "3.0.0-alpha.12.6", + "strapi-generate-admin": "3.0.0-alpha.12.6", + "strapi-generate-api": "3.0.0-alpha.12.6", + "strapi-generate-controller": "3.0.0-alpha.12.6", + "strapi-generate-model": "3.0.0-alpha.12.6", + "strapi-generate-new": "3.0.0-alpha.12.6", + "strapi-generate-plugin": "3.0.0-alpha.12.6", + "strapi-generate-policy": "3.0.0-alpha.12.6", + "strapi-generate-service": "3.0.0-alpha.12.6", + "strapi-utils": "3.0.0-alpha.12.6" }, "author": { "email": "hi@strapi.io",