Merge branch 'master' into patch-1

This commit is contained in:
Scott Agirs 2020-03-07 13:06:30 -05:00 committed by GitHub
commit c56c3a0aae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 279 additions and 196 deletions

View File

@ -186,7 +186,9 @@ To disable the information box containing the tutorial videos, create a file at
Add the following configuration:
```js
export const LOGIN_LOGO = null;
export const SHOW_TUTORIALS = false;
export const SETTINGS_BASE_URL = '/settings';
```
### Changing the port

View File

@ -84,7 +84,7 @@ services:
- '1337:1337'
mongo:
image: postgres
image: mongo
environment:
MONGO_INITDB_ROOT_USERNAME: strapi
MONGO_INITDB_ROOT_PASSWORD: strapi

View File

@ -53,3 +53,15 @@ Although we do not recommend it (as it is error prone), you can still access a g
## Rebuilding your administration panel
Now delete the `.cache` and `build` folders. Then run `yarn develop`.
::: warning NOTE
If you have modified the `admin/src/config.js` file you need to update its content with:
```
export const LOGIN_LOGO = null;
export const SHOW_TUTORIALS = false;
export const SETTINGS_BASE_URL = '/settings';
```
:::

View File

@ -17,7 +17,7 @@ $ yarn develop --watch-admin
### Strapi global variable
The administration exposes a global variable thqt is accessible for all the plugins.
The administration exposes a global variable that is accessible for all the plugins.
#### `strapi.backendURL`
@ -56,7 +56,7 @@ The administration url (e.g. `http://localhost:4000/admin`).
### Main plugin object
Each plugin exports all its configurations in a object. This object is located in `my-plugin/admin/src/index.js`
Each plugin exports all its configurations in an object. This object is located in `my-plugin/admin/src/index.js`
Here are its properties:
@ -169,7 +169,7 @@ Each route defined in a plugin must be prefixed by the plugin's id.
Let's say that you want to create a route `/user` with params `/:id` associated with the container UserPage.
The declaration would be as followed :
The declaration would be as follows :
**Path —** `plugins/my-plugin/admin/src/containers/App/index.js`.

View File

@ -290,6 +290,10 @@ If the provider is not in the mono repo, you probably don't need `@beta` dependi
Then, visit [http://localhost:1337/admin/plugins/upload/configurations/development](http://localhost:1337/admin/plugins/upload/configurations/development) on your web browser and configure the provider.
::: tip
Some providers may have additional settings such as the AWS S3 needs an API endpoint URL. You can find a list of these for AWS [here](https://docs.aws.amazon.com/general/latest/gr/ses.html)
:::
## Create providers
If you want to create your own, make sure the name starts with `strapi-provider-upload-` (duplicating an existing one will be easier to create), modify the `auth` config object and customize the `upload` and `delete` functions.

View File

@ -1,7 +1,7 @@
{
"name": "getstarted",
"private": true,
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "A Strapi application.",
"scripts": {
"develop": "strapi develop",
@ -15,21 +15,21 @@
"mysql": "^2.17.1",
"pg": "^7.10.0",
"sqlite3": "^4.0.6",
"strapi": "3.0.0-beta.19",
"strapi-admin": "3.0.0-beta.19",
"strapi-connector-bookshelf": "3.0.0-beta.19",
"strapi-connector-mongoose": "3.0.0-beta.19",
"strapi-middleware-views": "3.0.0-beta.19",
"strapi-plugin-content-manager": "3.0.0-beta.19",
"strapi-plugin-content-type-builder": "3.0.0-beta.19",
"strapi-plugin-documentation": "3.0.0-beta.19",
"strapi-plugin-email": "3.0.0-beta.19",
"strapi-plugin-graphql": "3.0.0-beta.19",
"strapi-plugin-upload": "3.0.0-beta.19",
"strapi-plugin-users-permissions": "3.0.0-beta.19",
"strapi-provider-email-mailgun": "3.0.0-beta.19",
"strapi-provider-upload-aws-s3": "3.0.0-beta.19",
"strapi-utils": "3.0.0-beta.19"
"strapi": "3.0.0-beta.19.3",
"strapi-admin": "3.0.0-beta.19.3",
"strapi-connector-bookshelf": "3.0.0-beta.19.3",
"strapi-connector-mongoose": "3.0.0-beta.19.3",
"strapi-middleware-views": "3.0.0-beta.19.3",
"strapi-plugin-content-manager": "3.0.0-beta.19.3",
"strapi-plugin-content-type-builder": "3.0.0-beta.19.3",
"strapi-plugin-documentation": "3.0.0-beta.19.3",
"strapi-plugin-email": "3.0.0-beta.19.3",
"strapi-plugin-graphql": "3.0.0-beta.19.3",
"strapi-plugin-upload": "3.0.0-beta.19.3",
"strapi-plugin-users-permissions": "3.0.0-beta.19.3",
"strapi-provider-email-mailgun": "3.0.0-beta.19.3",
"strapi-provider-upload-aws-s3": "3.0.0-beta.19.3",
"strapi-utils": "3.0.0-beta.19.3"
},
"strapi": {
"uuid": "getstarted"

View File

@ -1,5 +1,5 @@
{
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"packages": [
"packages/*",
"examples/*"

View File

@ -1,6 +1,6 @@
{
"name": "create-strapi-app",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Generate a new Strapi application.",
"license": "MIT",
"homepage": "http://strapi.io",
@ -21,7 +21,7 @@
],
"dependencies": {
"commander": "^2.20.0",
"strapi-generate-new": "3.0.0-beta.19"
"strapi-generate-new": "3.0.0-beta.19.3"
},
"scripts": {
"test": "echo \"no tests yet\""

View File

@ -24,12 +24,7 @@ import { BrowserRouter } from 'react-router-dom';
import { merge } from 'lodash';
import { Fonts } from '@buffetjs/styles';
import {
freezeApp,
pluginLoaded,
unfreezeApp,
updatePlugin,
} from './containers/App/actions';
import { freezeApp, pluginLoaded, unfreezeApp, updatePlugin } from './containers/App/actions';
import { showNotification } from './containers/NotificationProvider/actions';
import basename from './utils/basename';
@ -55,8 +50,7 @@ import plugins from './plugins';
const initialState = {};
const store = configureStore(initialState, history);
const { dispatch } = store;
const MOUNT_NODE =
document.getElementById('app') || document.createElement('div');
const MOUNT_NODE = document.getElementById('app') || document.createElement('div');
Object.keys(plugins).forEach(current => {
const registerPlugin = plugin => {
@ -65,21 +59,18 @@ Object.keys(plugins).forEach(current => {
const currentPluginFn = plugins[current];
const plugin = currentPluginFn({
registerPlugin,
settingsBaseURL: SETTINGS_BASE_URL,
settingsBaseURL: SETTINGS_BASE_URL || '/settings',
});
const pluginTradsPrefixed = languages.reduce((acc, lang) => {
const currentLocale = plugin.trads[lang];
if (currentLocale) {
const localeprefixedWithPluginId = Object.keys(currentLocale).reduce(
(acc2, current) => {
acc2[`${plugin.id}.${current}`] = currentLocale[current];
const localeprefixedWithPluginId = Object.keys(currentLocale).reduce((acc2, current) => {
acc2[`${plugin.id}.${current}`] = currentLocale[current];
return acc2;
},
{}
);
return acc2;
}, {});
acc[lang] = localeprefixedWithPluginId;
}
@ -139,9 +130,7 @@ window.strapi = Object.assign(window.strapi || {}, {
render(merge({}, translationMessages, translationMessagesUpdated));
},
leftMenuSections: leftMenuSectionsUpdated => {
store.dispatch(
updatePlugin(pluginId, 'leftMenuSections', leftMenuSectionsUpdated)
);
store.dispatch(updatePlugin(pluginId, 'leftMenuSections', leftMenuSectionsUpdated));
},
}),
router: history,

View File

@ -137,6 +137,39 @@ const GlobalStyle = createGlobalStyle`
}
// scrollbar
::-webkit-scrollbar {
width: 9px;
}
::-webkit-scrollbar-track {
background-color: #eee;
}
::-webkit-scrollbar-track:hover {
background-color: #ddd;
}
::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 0.5rem;
}
::-webkit-scrollbar-thumb:hover {
background-color: #bbb;
}
::-webkit-scrollbar-button {
display: none;
}
// firefox scrollbar
* {
scrollbar-color: #bbb #eee;
scrollbar-width: thin;
}
`;
export default GlobalStyle;

View File

@ -0,0 +1,18 @@
// I am keeping this file if we want to join the scrollbars again
import styled from 'styled-components';
const LeftMenuSection = styled.div`
box-sizing: border-box;
display: flex;
flex-direction: column;
flex: 1;
&:first-child {
overflow: hidden;
max-height: 180px;
height: auto;
flex: 0 1 auto;
}
`;
export default LeftMenuSection;

View File

@ -11,6 +11,9 @@ const Wrapper = styled.div`
overflow-y: auto;
height: calc(100vh - (${props => props.theme.main.sizes.leftMenu.height} + 10.2rem));
box-sizing: border-box;
// I am keeping these lines if we want to join the scrollbars again
// display: flex;
// flex-direction: column;
.title {
padding-left: 2rem;

View File

@ -23,9 +23,7 @@ const LeftMenuLinkContainer = ({ plugins }) => {
section.links
.filter(link => link.isDisplayed !== false)
.map(link => {
link.plugin = !isEmpty(plugins[link.plugin])
? link.plugin
: plugins[current].id;
link.plugin = !isEmpty(plugins[link.plugin]) ? link.plugin : plugins[current].id;
return link;
})
@ -40,10 +38,7 @@ const LeftMenuLinkContainer = ({ plugins }) => {
// Generate the list of plugin links (plugins without a mainComponent should not appear in the left menu)
const pluginsLinks = Object.values(plugins)
.filter(
plugin =>
plugin.id !== 'email' &&
plugin.id !== 'content-manager' &&
!!plugin.mainComponent
plugin => plugin.id !== 'email' && plugin.id !== 'content-manager' && !!plugin.mainComponent
)
.map(plugin => {
const pluginSuffixUrl = plugin.suffixUrl ? plugin.suffixUrl(plugins) : '';

View File

@ -3,6 +3,7 @@ import styled from 'styled-components';
const SearchWrapper = styled.div`
display: flex;
width: 100%;
height: 19px;
justify-content: space-between;
border-bottom: 1px solid;
`;

View File

@ -1,8 +1,11 @@
import styled from 'styled-components';
const EmptyLinksListWrapper = styled.div`
padding: 0.7rem 0;
padding: 0.8rem 0 0.7rem 2rem;
// padding-top: 0.8rem;
// padding-left: 2rem;
margin-bottom: 0.1rem;
line-height: 18px;
`;
export default EmptyLinksListWrapper;

View File

@ -2,7 +2,7 @@ import styled from 'styled-components';
const LeftMenuListLink = styled.div`
max-height: 180px;
margin-bottom: 0.1rem;
margin-bottom: 19px;
overflow: auto;
`;

View File

@ -10,7 +10,14 @@ import LeftMenuListLink from './LeftMenuListLink';
import EmptyLinksList from './EmptyLinksList';
import EmptyLinksListWrapper from './EmptyLinksListWrapper';
const LeftMenuLinksSection = ({ section, searchable, location, links, emptyLinksListMessage }) => {
const LeftMenuLinksSection = ({
section,
searchable,
location,
links,
emptyLinksListMessage,
shrink,
}) => {
const [search, setSearch] = useState('');
const filteredList = sortBy(
@ -39,7 +46,7 @@ const LeftMenuLinksSection = ({ section, searchable, location, links, emptyLinks
setSearch={setSearch}
search={search}
/>
<LeftMenuListLink>
<LeftMenuListLink shrink={shrink}>
{filteredList.length > 0 ? (
filteredList.map((link, index) => (
<LeftMenuLink
@ -64,9 +71,14 @@ const LeftMenuLinksSection = ({ section, searchable, location, links, emptyLinks
);
};
LeftMenuLinksSection.defaultProps = {
shrink: false,
};
LeftMenuLinksSection.propTypes = {
section: PropTypes.string.isRequired,
searchable: PropTypes.bool.isRequired,
shrink: PropTypes.bool,
location: PropTypes.shape({
pathname: PropTypes.string,
}).isRequired,

View File

@ -99,9 +99,7 @@ export class Admin extends React.Component {
global: { plugins },
} = props;
return !Object.keys(plugins).every(
plugin => plugins[plugin].isReady === true
);
return !Object.keys(plugins).every(plugin => plugins[plugin].isReady === true);
};
/**
@ -121,9 +119,7 @@ export class Admin extends React.Component {
const InitializerComponent = plugins[current].initializer;
const key = plugins[current].id;
acc.push(
<InitializerComponent key={key} {...this.props} {...this.helpers} />
);
acc.push(<InitializerComponent key={key} {...this.props} {...this.helpers} />);
return acc;
}, []);
@ -174,7 +170,7 @@ export class Admin extends React.Component {
enableGlobalOverlayBlocker={enableGlobalOverlayBlocker}
formatMessage={formatMessage}
plugins={plugins}
settingsBaseURL={SETTINGS_BASE_URL}
settingsBaseURL={SETTINGS_BASE_URL || '/settings'}
updatePlugin={updatePlugin}
>
<Wrapper>
@ -188,19 +184,11 @@ export class Admin extends React.Component {
<Header />
<Content>
<Switch>
<Route
path="/"
render={props => this.renderRoute(props, HomePage)}
exact
/>
<Route
path="/plugins/:pluginId"
render={this.renderPluginDispatcher}
/>
<Route path="/" render={props => this.renderRoute(props, HomePage)} exact />
<Route path="/plugins/:pluginId" render={this.renderPluginDispatcher} />
<Route
path="/list-plugins"
render={props =>
this.renderRoute(props, InstalledPluginsPage)}
render={props => this.renderRoute(props, InstalledPluginsPage)}
exact
/>
<Route
@ -208,11 +196,11 @@ export class Admin extends React.Component {
render={props => this.renderRoute(props, MarketplacePage)}
/>
<Route
path={`${SETTINGS_BASE_URL}/:settingId`}
path={`${SETTINGS_BASE_URL || '/settings'}/:settingId`}
render={props => this.renderRoute(props, SettingsPage)}
/>
<Route
path={SETTINGS_BASE_URL}
path={SETTINGS_BASE_URL || '/settings'}
render={props => this.renderRoute(props, SettingsPage)}
exact
/>

View File

@ -15,6 +15,29 @@ const Wrapper = styled.div`
height: 100vh;
width: ${props => props.theme.main.sizes.leftMenu.width};
background: ${props => props.theme.main.colors.strapi['blue-darker']};
// scrollbar overrides
* {
::-webkit-scrollbar {
width: 7px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-track:hover {
background-color: transparent;
}
::-webkit-scrollbar-thumb {
background-color: ${props => props.theme.main.colors.leftMenu['title-color']};
}
::-webkit-scrollbar-thumb:hover {
background-color: ${props => props.theme.main.colors.leftMenu['link-color']};
}
// firefox
scrollbar-color: ${props => props.theme.main.colors.leftMenu['title-color']} transparent;
}
`;
Wrapper.defaultProps = {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-admin",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Strapi Admin",
"repository": {
"type": "git",
@ -85,8 +85,8 @@
"reselect": "^3.0.1",
"sanitize.css": "^4.1.0",
"shelljs": "^0.7.8",
"strapi-helper-plugin": "3.0.0-beta.19",
"strapi-utils": "3.0.0-beta.19",
"strapi-helper-plugin": "3.0.0-beta.19.3",
"strapi-utils": "3.0.0-beta.19.3",
"style-loader": "^0.23.1",
"styled-components": "^5.0.0",
"terser-webpack-plugin": "^1.2.3",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-connector-bookshelf",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Bookshelf hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -22,7 +22,7 @@
"lodash": "^4.17.11",
"pluralize": "^7.0.0",
"rimraf": "3.0.0",
"strapi-utils": "3.0.0-beta.19"
"strapi-utils": "3.0.0-beta.19.3"
},
"peerDependencies": {
"knex": "^0.20.0"

View File

@ -1,6 +1,6 @@
{
"name": "strapi-connector-mongoose",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Mongoose hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -20,7 +20,7 @@
"mongoose-float": "^1.0.4",
"mongoose-long": "^0.2.1",
"pluralize": "^7.0.0",
"strapi-utils": "3.0.0-beta.19"
"strapi-utils": "3.0.0-beta.19.3"
},
"author": {
"email": "hi@strapi.io",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-database",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Strapi's database layer",
"homepage": "http://strapi.io",
"main": "./lib/index.js",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-api",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Generate an API for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-controller",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Generate a controller for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-model",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Generate a model for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-new",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Generate a new Strapi application.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,4 +1,3 @@
import React from 'react';
import pluginPkg from '../../package.json';
import pluginId from './pluginId';
import App from './containers/App';
@ -6,30 +5,28 @@ import Initializer from './containers/Initializer';
import lifecycles from './lifecycles';
import trads from './translations';
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
export default strapi => {
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
function Comp(props) {
return <App {...props} />;
}
const plugin = {
blockerComponent: null,
blockerComponentProps: {},
description: pluginDescription,
icon: pluginPkg.strapi.icon,
id: pluginId,
initializer: Initializer,
injectedComponents: [],
isReady: false,
isRequired: pluginPkg.strapi.required || false,
layout: null,
lifecycles,
leftMenuLinks: [],
leftMenuSections: [],
mainComponent: App,
name: pluginPkg.strapi.name,
preventComponentRendering: false,
trads,
};
const plugin = {
blockerComponent: null,
blockerComponentProps: {},
description: pluginDescription,
icon: pluginPkg.strapi.icon,
id: pluginId,
initializer: Initializer,
injectedComponents: [],
isReady: false,
isRequired: pluginPkg.strapi.required || false,
layout: null,
lifecycles,
leftMenuLinks: [],
leftMenuSections: [],
mainComponent: Comp,
name: pluginPkg.strapi.name,
preventComponentRendering: false,
trads,
return strapi.registerPlugin(plugin);
};
export default plugin;

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-plugin",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Generate an plugin for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-policy",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Generate a policy for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-service",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Generate a service for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Master of ceremonies for the Strapi generators.",
"homepage": "http://strapi.io",
"keywords": [
@ -20,7 +20,7 @@
"fs-extra": "^8.0.1",
"lodash": "^4.17.11",
"reportback": "^2.0.2",
"strapi-utils": "3.0.0-beta.19"
"strapi-utils": "3.0.0-beta.19.3"
},
"author": {
"name": "Strapi team",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-helper-plugin",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Helper for Strapi plugins development",
"files": [
"dist"

View File

@ -1,6 +1,6 @@
{
"name": "strapi-hook-ejs",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "EJS hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-hook-redis",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Redis hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -19,7 +19,7 @@
"lodash": "^4.17.11",
"rimraf": "3.0.0",
"stack-trace": "0.0.10",
"strapi-utils": "3.0.0-beta.19"
"strapi-utils": "3.0.0-beta.19.3"
},
"author": {
"email": "hi@strapi.io",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-middleware-views",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Views middleware to enable server-side rendering for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,7 +1,6 @@
import styled from 'styled-components';
const ListWrapper = styled.div`
overflow: hidden;
max-height: 116px;
> ul {

View File

@ -77,6 +77,7 @@ const Wrapper = styled.div`
top: 4px;
}
& + div {
z-index: 2;
height: fit-content;
padding: 0;
margin-top: -2px;

View File

@ -191,6 +191,11 @@ const EditViewDataManagerProvider = ({ allLayoutData, children, redirectToPrevio
inputValue = null;
}
// Allow to reset number input
if (type === 'number' && value === '') {
inputValue = null;
}
dispatch({
type: 'ON_CHANGE',
keys: name.split('.'),

View File

@ -36,13 +36,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
const toggleModalForm = () => setIsModalFormOpen(prevState => !prevState);
const {
labelForm,
labelToEdit,
initialData,
modifiedData,
isLoading,
} = reducerState.toJS();
const { labelForm, labelToEdit, initialData, modifiedData, isLoading } = reducerState.toJS();
const abortController = new AbortController();
const { signal } = abortController;
@ -82,8 +76,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
return get(modifiedData, ['schema', 'info', 'name'], '');
}, [modifiedData]);
const getListDisplayedFields = () =>
get(modifiedData, ['layouts', 'list'], []);
const getListDisplayedFields = () => get(modifiedData, ['layouts', 'list'], []);
const getListRemainingFields = () => {
const metadatas = get(modifiedData, ['metadatas'], {});
@ -93,10 +86,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
.filter(key => {
const type = get(attributes, [key, 'type'], '');
return (
!['json', 'component', 'richtext', 'relation'].includes(type) &&
!!type
);
return !['json', 'component', 'richtext', 'relation'].includes(type) && !!type;
})
.filter(field => {
return !getListDisplayedFields().includes(field);
@ -137,6 +127,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
try {
const body = cloneDeep(modifiedData);
delete body.apiID;
delete body.schema;
delete body.uid;
@ -171,9 +162,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
<div className="col-6" style={{ marginBottom: 4 }}>
<FormattedMessage id={`${pluginId}.form.Input.label`}>
{label => (
<FormattedMessage
id={`${pluginId}.form.Input.label.inputDescription`}
>
<FormattedMessage id={`${pluginId}.form.Input.label.inputDescription`}>
{description => (
<Input
description={description}
@ -238,11 +227,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
}}
>
{getListDisplayedFields().map((item, index) => {
const label = get(
modifiedData,
['metadatas', item, 'list', 'label'],
''
);
const label = get(modifiedData, ['metadatas', item, 'list', 'label'], '');
return (
<Label
@ -258,9 +243,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
e.stopPropagation();
if (getListDisplayedFields().length === 1) {
strapi.notification.info(
`${pluginId}.notification.info.minimumFields`
);
strapi.notification.info(`${pluginId}.notification.info.minimumFields`);
} else {
dispatch({
type: 'REMOVE_FIELD',

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-manager",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "A powerful UI to easily manage your data.",
"strapi": {
"name": "Content Manager",
@ -30,8 +30,8 @@
"redux-immutable": "^4.0.0",
"reselect": "^3.0.1",
"showdown": "^1.9.0",
"strapi-helper-plugin": "3.0.0-beta.19",
"strapi-utils": "3.0.0-beta.19",
"strapi-helper-plugin": "3.0.0-beta.19.3",
"strapi-utils": "3.0.0-beta.19.3",
"yup": "^0.27.0"
},
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-type-builder",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Strapi plugin to create content type (API).",
"strapi": {
"name": "Content Type Builder",
@ -26,10 +26,10 @@
"redux": "^4.0.1",
"redux-immutable": "^4.0.0",
"reselect": "^3.0.1",
"strapi-generate": "3.0.0-beta.19",
"strapi-generate-api": "3.0.0-beta.19",
"strapi-helper-plugin": "3.0.0-beta.19",
"strapi-utils": "3.0.0-beta.19",
"strapi-generate": "3.0.0-beta.19.3",
"strapi-generate-api": "3.0.0-beta.19.3",
"strapi-helper-plugin": "3.0.0-beta.19.3",
"strapi-utils": "3.0.0-beta.19.3",
"yup": "^0.27.0"
},
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-documentation",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Documentation",
@ -32,7 +32,7 @@
"redux": "^4.0.1",
"redux-immutable": "^4.0.0",
"reselect": "^4.0.0",
"strapi-helper-plugin": "3.0.0-beta.19",
"strapi-helper-plugin": "3.0.0-beta.19.3",
"swagger-ui-dist": "3.24.3"
},
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-email",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Email",
@ -13,13 +13,13 @@
},
"dependencies": {
"lodash": "^4.17.11",
"strapi-provider-email-sendmail": "3.0.0-beta.19",
"strapi-utils": "3.0.0-beta.19"
"strapi-provider-email-sendmail": "3.0.0-beta.19.3",
"strapi-utils": "3.0.0-beta.19.3"
},
"devDependencies": {
"react-copy-to-clipboard": "5.0.1",
"rimraf": "3.0.0",
"strapi-helper-plugin": "3.0.0-beta.19"
"strapi-helper-plugin": "3.0.0-beta.19.3"
},
"author": {
"name": "Strapi team",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-graphql",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "This is the description of the plugin.",
"strapi": {
"name": "graphql",
@ -24,7 +24,7 @@
"koa-compose": "^4.1.0",
"lodash": "4.17.11",
"pluralize": "^7.0.0",
"strapi-utils": "3.0.0-beta.19"
"strapi-utils": "3.0.0-beta.19.3"
},
"devDependencies": {
"cross-env": "^5.2.0",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-upload",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Files Upload",
@ -23,9 +23,9 @@
"react-router-dom": "^5.0.0",
"react-transition-group": "^2.5.0",
"reactstrap": "^5.0.0",
"strapi-helper-plugin": "3.0.0-beta.19",
"strapi-provider-upload-local": "3.0.0-beta.19",
"strapi-utils": "3.0.0-beta.19",
"strapi-helper-plugin": "3.0.0-beta.19.3",
"strapi-provider-upload-local": "3.0.0-beta.19.3",
"strapi-utils": "3.0.0-beta.19.3",
"stream-to-array": "^2.3.0",
"uuid": "^3.2.1"
},

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-users-permissions",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Protect your API with a full-authentication process based on JWT",
"strapi": {
"name": "Roles & Permissions",
@ -32,8 +32,8 @@
"reactstrap": "^5.0.0",
"redux-saga": "^0.16.0",
"request": "^2.83.0",
"strapi-helper-plugin": "3.0.0-beta.19",
"strapi-utils": "3.0.0-beta.19",
"strapi-helper-plugin": "3.0.0-beta.19.3",
"strapi-utils": "3.0.0-beta.19.3",
"uuid": "^3.1.0"
},
"devDependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-amazon-ses",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Amazon SES provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-mailgun",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Mailgun provider for strapi email plugin",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-sendgrid",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Sendgrid provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-sendmail",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Sendmail provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-aws-s3",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "AWS S3 provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-cloudinary",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Cloudinary provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-local",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Local provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-rackspace",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Rackspace provider for strapi upload",
"main": "./lib",
"keywords": [],

View File

@ -1,6 +1,6 @@
{
"name": "strapi-utils",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "Shared utilities for the Strapi packages",
"homepage": "http://strapi.io",
"keywords": [
@ -15,11 +15,11 @@
"main": "./lib",
"dependencies": {
"date-fns": "^2.8.1",
"lodash": "4.17.11",
"lodash": "4.17.12",
"pino": "^4.7.1",
"pluralize": "^7.0.0",
"shelljs": "^0.8.3",
"yup": "^0.28.0"
"yup": "0.28.1"
},
"author": {
"email": "hi@strapi.io",

View File

@ -40,8 +40,7 @@ module.exports = async strapi => {
category,
modelType: 'component',
modelName: key,
globalId:
schema.globalId || _.upperFirst(_.camelCase(`component_${key}`)),
globalId: schema.globalId || _.upperFirst(_.camelCase(`component_${uid}`)),
});
});
return acc;

View File

@ -80,9 +80,13 @@ module.exports = strapi => {
}
// Log error.
strapi.log.error(error);
const { status, body } = formatBoomPayload(error);
if (status >= 500) {
strapi.log.error(error);
}
ctx.body = body;
ctx.status = status;
}
@ -101,13 +105,13 @@ module.exports = strapi => {
// Custom function to avoid ctx.body repeat
createResponses() {
boomMethods.forEach(method => {
strapi.app.response[method] = function(...rest) {
const boomError = Boom[method](...rest) || {};
strapi.app.response[method] = function(msg, ...rest) {
const boomError = Boom[method](msg, ...rest) || {};
const { status, body } = formatBoomPayload(boomError);
// keep retro-compatibility for old error formats
body.message = body.data;
body.message = msg || body.data || body.message;
this.body = body;
this.status = status;

View File

@ -45,10 +45,18 @@ module.exports = ({ strapi }) => ({
},
});
const isMedia = attr => {
return (attr.collection || attr.model) === 'file' && attr.plugin === 'upload';
};
const createValidator = model => {
return yup
.object(
_.mapValues(model.attributes, attr => {
if (isMedia(attr)) {
return yup.mixed().nullable();
}
const { required } = attr;
const validator = createAttributeValidator(attr).nullable();
@ -67,6 +75,10 @@ const createUpdateValidator = model => {
return yup
.object(
_.mapValues(model.attributes, attr => {
if (isMedia(attr)) {
return yup.mixed().nullable();
}
const { required } = attr;
const validator = createAttributeValidator(attr).nullable();

View File

@ -1,6 +1,6 @@
{
"name": "strapi",
"version": "3.0.0-beta.19",
"version": "3.0.0-beta.19.3",
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite",
"homepage": "http://strapi.io",
"directories": {
@ -50,16 +50,16 @@
"resolve-cwd": "^3.0.0",
"rimraf": "^2.6.2",
"shelljs": "^0.8.3",
"strapi-database": "3.0.0-beta.19",
"strapi-generate": "3.0.0-beta.19",
"strapi-generate-api": "3.0.0-beta.19",
"strapi-generate-controller": "3.0.0-beta.19",
"strapi-generate-model": "3.0.0-beta.19",
"strapi-generate-new": "3.0.0-beta.19",
"strapi-generate-plugin": "3.0.0-beta.19",
"strapi-generate-policy": "3.0.0-beta.19",
"strapi-generate-service": "3.0.0-beta.19",
"strapi-utils": "3.0.0-beta.19"
"strapi-database": "3.0.0-beta.19.3",
"strapi-generate": "3.0.0-beta.19.3",
"strapi-generate-api": "3.0.0-beta.19.3",
"strapi-generate-controller": "3.0.0-beta.19.3",
"strapi-generate-model": "3.0.0-beta.19.3",
"strapi-generate-new": "3.0.0-beta.19.3",
"strapi-generate-plugin": "3.0.0-beta.19.3",
"strapi-generate-policy": "3.0.0-beta.19.3",
"strapi-generate-service": "3.0.0-beta.19.3",
"strapi-utils": "3.0.0-beta.19.3"
},
"scripts": {
"postinstall": "node lib/utils/success.js"