From 5148987589685f52b6135fcf10ebb0dbc98f828c Mon Sep 17 00:00:00 2001 From: cyril lopez Date: Fri, 15 Dec 2017 17:36:21 +0100 Subject: [PATCH] Prevent from editing or deleting models from a plugin --- .../admin/src/components/TableListRow/index.js | 2 +- .../admin/src/containers/ModelPage/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/TableListRow/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/TableListRow/index.js index 7de5015cbd..422e59327b 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/TableListRow/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/TableListRow/index.js @@ -47,7 +47,7 @@ class TableListRow extends React.Component { // eslint-disable-line react/prefer const temporary = this.props.rowItem.isTemporary ? : ''; const description = isEmpty(this.props.rowItem.description) ? '-' : this.props.rowItem.description; const spanStyle = this.props.rowItem.isTemporary ? '60%' : '100%'; - const icons = [{ icoType: 'pencil', onClick: this.handleEdit }, { icoType: 'trash', onClick: this.handleShowModalWarning }]; + const icons = this.props.rowItem.source ? [] : [{ icoType: 'pencil', onClick: this.handleEdit }, { icoType: 'trash', onClick: this.handleShowModalWarning }]; return ( diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js index 6567fd0345..f6fba9d323 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js @@ -8,7 +8,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { createStructuredSelector } from 'reselect'; import { bindActionCreators, compose } from 'redux'; -import { get, has, isEmpty, size, replace, startCase, findIndex } from 'lodash'; +import { get, has, includes, isEmpty, size, replace, startCase, findIndex } from 'lodash'; import { FormattedMessage } from 'react-intl'; import { NavLink } from 'react-router-dom'; import PropTypes from 'prop-types'; @@ -290,7 +290,7 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr renderCustomLi={this.renderCustomLi} onButtonClick={this.handleClickAddAttribute} />; - + const icoType = includes(this.props.match.params.modelName, '&source=') ? '' : 'pencil'; return (
@@ -306,7 +306,7 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr