Resolve conflicts

This commit is contained in:
Aurelsicoko 2017-12-05 16:35:28 +01:00
commit b2204e533c
22 changed files with 141 additions and 166 deletions

View File

@ -24,7 +24,7 @@ class LeftMenuLink extends React.Component { // eslint-disable-line react/prefer
className={`${styles.link} ${isLinkActive ? styles.linkActive : ''}`}
to={{
pathname: this.props.destination,
search: `${this.props.source ? '?source=' : ''}${this.props.source}`,
search: this.props.source ? `?source=${this.props.source}` : '',
}}
>
<i className={`${styles.linkIcon} fa-${this.props.icon} fa`}></i>

View File

@ -47,14 +47,17 @@ function LeftMenuLinkContainer({ plugins }) {
// Check if the plugins list is empty or not and display plugins by name
const pluginsLinks = !isEmpty(pluginsObject) ?
map(sortBy(pluginsObject, 'name'), plugin => (
<LeftMenuLink
key={get(plugin, 'id')}
icon={get(plugin, 'icon') || 'plug'}
label={get(plugin, 'name')}
destination={`/plugins/${get(plugin, 'id')}`}
/>
))
map(sortBy(pluginsObject, 'name'), plugin => {
if (plugin.id !== 'email' && plugin.id !== 'content-manager') {
return (
<LeftMenuLink
key={get(plugin, 'id')}
icon={get(plugin, 'icon') || 'plug'}
label={get(plugin, 'name')}
destination={`/plugins/${get(plugin, 'id')}`}
/>
);
}})
: (
<li className={styles.noPluginsInstalled}>
<FormattedMessage {...messages.noPluginsInstalled} />.

View File

@ -64,14 +64,14 @@ class ListPlugins extends React.Component {
<ul>
{map(this.props.plugins, (plugin, key) => (
<ListRow key={plugin.name}>
<div className="col-md-1">
<div className={styles.icoContainer}>
<div className={cn("col-md-11", styles.nameWrapper)}>
<div className={styles.icoContainer} style={{ marginRight: '30px' }}>
<i className={`fa fa-${plugin.icon}`} />
</div>
</div>
<div className={cn(styles.pluginContent, 'col-md-10')}>
<span>{plugin.name} &nbsp;</span>
<FormattedMessage id={plugin.description} />
<div className={styles.pluginContent}>
<span>{plugin.name} &nbsp;</span>
<FormattedMessage id={plugin.description} />
</div>
</div>
<div className="col-md-1">
<div className={styles.actionContainer}>

View File

@ -57,6 +57,7 @@
.icoContainer {
width: 70px;
height: 36px;
margin: auto 0;
line-height: 36px;
text-align: center;
border: 1px solid rgba(28,93,231,0.1);
@ -68,3 +69,7 @@
display: flex;
justify-content: flex-end;
}
.nameWrapper {
display: flex;
}

View File

@ -38,7 +38,7 @@
right: -3px !important;
min-width: 100%!important;
margin: 0 !important;
padding: 12px 0 !important;
padding: 0px;
line-height: 1.8rem;
border: none!important;
border-top-left-radius: 0!important;
@ -47,20 +47,24 @@
font-size: 14px;
> button {
padding: 12px 15px 0 15px;
&:hover, &:focus, &:active {
background-color: #ffff!important;
background-color: #FAFAFB!important;
border-radius: 0px;
cursor: pointer;
}
}
> button:first-child {
padding-top: 16px;
padding-bottom: 5px;
&:hover, &:active {
color: #333740;
}
margin-bottom: 13px;
}
> button:not(:first-child) {
padding-bottom: 16px;
color: #F75B1D;
> i {
margin-left: 10px
@ -72,4 +76,7 @@
&:active {
color: black;
}
&:hover {
background-color: #FAFAFB !important;
}
}

View File

@ -52,14 +52,17 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
componentWillReceiveProps(nextProps) {
if (nextProps.location.pathname !== this.props.location.pathname) {
this.checkLogin(nextProps);
}
if (get(nextProps.plugins.toJS(), ['users-permissions', 'hasAdminUser']) !== get(this.props.plugins.toJS(), ['users-permissions', 'hasAdminUser'])) {
this.checkLogin(nextProps);
}
}
checkLogin = (props) => {
if (this.props.hasUserPlugin && this.isUrlProtected(props) && !auth.getToken()) {
const endPoint = this.hasAdminUser() ? 'login': 'register';
const endPoint = this.hasAdminUser(props) ? 'login': 'register';
this.props.history.push(`/plugins/users-permissions/auth/${endPoint}`);
}
@ -95,11 +98,11 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
}
}
hasAdminUser = () => get(this.props.plugins.toJS(), ['users-permissions', 'hasAdminUser']);
hasAdminUser = (props) => get(props.plugins.toJS(), ['users-permissions', 'hasAdminUser']);
isUrlProtected = (props) => !includes(props.location.pathname, get(this.props.plugins.toJS(), ['users-permissions', 'nonProtectedUrl']));
showLeftMenu = () => !includes(this.props.location.pathname, get(this.props.plugins.toJS(), ['users-permissions', 'nonProtectedUrl']));
showLeftMenu = () => !includes(this.props.location.pathname, 'users-permissions/auth/');
render() {
const leftMenu = this.showLeftMenu() ? <LeftMenu plugins={this.props.plugins} /> : '';

View File

@ -52,6 +52,9 @@
background: #FFFFFF;
}
}
&:disabled {
cursor: not-allowed;
}
}
.primary {

View File

@ -131,9 +131,15 @@ export class Edit extends React.Component {
componentWillReceiveProps(nextProps) {
if (this.props.editSuccess !== nextProps.editSuccess) {
if (!isEmpty(this.props.location.search) && includes(this.props.location.search, '?redirectUrl')) {
router.push(replace(this.props.location.search, '?redirectUrl=', ''));
router.push({
pathname: replace(this.props.location.search, '?redirectUrl=', ''),
search: `?source=${this.source}`,
});
} else {
router.push(replace(this.props.location.pathname, 'create', ''));
router.push({
pathname: replace(this.props.location.pathname, '/create', ''),
search: `?source=${this.source}`,
});
}
}
}

View File

@ -1 +1,3 @@
{}
{
"plugin.description": "Send emails"
}

View File

@ -1 +1,3 @@
{}
{
"plugin.description": "Envoyez des emails"
}

View File

@ -13,7 +13,7 @@
}
.controller {
padding: 1px 28px 0;
padding: 1px 43px 0 28px;
background: #ffffff;
opacity: none;
-webkit-font-smoothing: antialiased;

View File

@ -4,6 +4,7 @@
margin-top: .9rem;
background-color: rgba(16, 22, 34, 0.02);
border: 1px solid #E3E9F3;
border-bottom: 0px;
border-radius: 0.25rem;
border-bottom-left-radius: 0!important;
border-bottom-right-radius: 0!important;
@ -46,7 +47,7 @@
padding-left: 1rem;
background-size: 0 !important;
border: 1px solid #E3E9F3;
// border-left: none;
border-bottom: 0px;
border-radius: 0.25rem;
border-bottom-right-radius: 0;
line-height: 3.4rem;

View File

@ -6,7 +6,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { router } from 'app';
import styles from './styles.scss';
function InputSearchLi({ onClick, isAdding, item }) {
@ -14,18 +13,15 @@ function InputSearchLi({ onClick, isAdding, item }) {
const liStyle = isAdding ? { cursor: 'pointer' } : {};
const handleClick = isAdding ? () => onClick(item) : () => {};
const path = `/plugins/content-manager/user/${item.id}?redirectUrl=/plugins/content-manager/user/?page=1&limit=20&sort=id&source=users-permissions`;
const handleGoto = (e) => {
e.preventDefault();
e.stopPropagation();
router.push(path);
};
return (
<li className={styles.li} style={liStyle} onClick={handleClick}>
<div>
<div className={styles.container}>
{item.username}
<i className="fa fa-external-link" onClick={handleGoto} />
<a href={`${path}`} target="_blank">
<i className="fa fa-external-link" />
</a>
</div>
<div
onClick={(e) => {

View File

@ -31,7 +31,7 @@
.container {
>i {
>a {
margin-left: 10px;
color: #1C5DE7;
font-size: 10px;

View File

@ -9,6 +9,7 @@
justify-content: space-between;
padding: 0 28px;
padding-right: 43px;
color: #787E8F;
cursor: pointer;
> div:first-child {

View File

@ -7,14 +7,14 @@
margin-bottom: 1.1rem;
padding-top: 2.8rem;
font-size: 18px;
font-weight: 800;
font-weight: 700;
line-height: 3.6rem;
}
.inputWrapper {
> div:nth-child(2) {
> label {
font-weight: 800!important;
// font-weight: 800!important;
}
}
}

View File

@ -102,21 +102,6 @@ export class EditPage extends React.Component { // eslint-disable-line react/pre
this.props.submit();
}
pluginHeaderActions = [
{
label: 'users-permissions.EditPage.cancel',
kind: 'secondary',
onClick: this.props.onCancel,
type: 'button',
},
{
kind: 'primary',
label: 'users-permissions.EditPage.submit',
onClick: this.handleSubmit,
type: 'submit',
},
];
render() {
const pluginHeaderTitle = this.props.match.params.actionType === 'create' ?
'users-permissions.EditPage.header.title.create'
@ -124,8 +109,22 @@ export class EditPage extends React.Component { // eslint-disable-line react/pre
const pluginHeaderDescription = this.props.match.params.actionType === 'create' ?
'users-permissions.EditPage.header.description.create'
: 'users-permissions.EditPage.header.description';
const pluginHeaderActions = !isEqual(this.props.editPage.modifiedData, this.props.editPage.initialData) ? this.pluginHeaderActions : [];
const pluginHeaderActions = [
{
label: 'users-permissions.EditPage.cancel',
kind: 'secondary',
onClick: this.props.onCancel,
type: 'button',
},
{
kind: 'primary',
label: 'users-permissions.EditPage.submit',
onClick: this.handleSubmit,
type: 'submit',
disabled: isEqual(this.props.editPage.modifiedData, this.props.editPage.initialData),
},
];
return (
<div>
<BackHeader onClick={() => this.props.history.goBack()} />

View File

@ -85,6 +85,7 @@ export function* submit() {
method: actionType,
body,
};
const requestURL = actionType === 'POST' ? '/users-permissions/roles' : `/users-permissions/roles/${roleId}`;
const response = yield call(request, requestURL, opts);
@ -92,8 +93,7 @@ export function* submit() {
yield put(submitSucceeded());
}
} catch(error) {
console.log(error.response.payload);
// TODO handle error message
console.log(error);
}
}

View File

@ -1,106 +0,0 @@
{
"0": {
"description": "Allow editing and deleting (except users)",
"name": "owner",
"users": [
{
"id": "11",
"username": "John Lennon"
},
{
"id": "12",
"username": "Paul McCartney"
},
{
"id": "13",
"username": "George Harrison"
},
{
"id": "14",
"username": "Ringo Starr"
}
],
"permissions": {
"application": {
"icon": "",
"controllers": {
"invoices": {
"create": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"find": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"payInvoice": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"delete": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"update": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"updateAddress": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"findOne": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"updateRelationship": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"changeOwner": {
"enabled": false,
"policy": "entriesCreatedByUser"
}
}
}
},
"mailchimp": {
"icon": "",
"controllers": {
"invoices": {
"delete": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"update": {
"enabled": false,
"policy": "entriesCreatedByUser"
}
}
}
}
}
},
"permissions": {
"application": {
"icon": "",
"controllers": {
"invoices": {
"delete": {
"enabled": true,
"policy": "entriesCreatedByUser"
},
"update": {
"enabled": false,
"policy": "entriesCreatedByUser"
}
}
}
}
},
"initRole": {
"description": "",
"name": "",
"permissions": {}
}
}

View File

@ -256,7 +256,34 @@
}
},
"application": {
"controllers": {}
"controllers": {
"toto": {
"find": {
"enabled": true,
"policy": ""
},
"findOne": {
"enabled": true,
"policy": ""
},
"create": {
"enabled": true,
"policy": ""
},
"update": {
"enabled": true,
"policy": ""
},
"destroy": {
"enabled": true,
"policy": ""
},
"identity": {
"enabled": true,
"policy": ""
}
}
}
}
}
},
@ -517,7 +544,34 @@
}
},
"application": {
"controllers": {}
"controllers": {
"toto": {
"find": {
"enabled": false,
"policy": ""
},
"findOne": {
"enabled": false,
"policy": ""
},
"create": {
"enabled": false,
"policy": ""
},
"update": {
"enabled": false,
"policy": ""
},
"destroy": {
"enabled": false,
"policy": ""
},
"identity": {
"enabled": false,
"policy": ""
}
}
}
}
}
}

View File

@ -6,7 +6,6 @@
* @description: A set of functions called "actions" of the `users-permissions` plugin.
*/
const fakeData = require('../config/fakeData.json');
const _ = require('lodash');
module.exports = {

View File

@ -44,7 +44,7 @@ module.exports = {
}
if (!values.provider) {
values.password = 'local';
values.provider = 'local';
}
return strapi.query('user', 'users-permissions').create(values);