diff --git a/app/javascript/src/apps/mydb/elements/details/cellLines/propertiesTab/CellLineName.js b/app/javascript/src/apps/mydb/elements/details/cellLines/propertiesTab/CellLineName.js index ed49d633dd..c29a9026bb 100644 --- a/app/javascript/src/apps/mydb/elements/details/cellLines/propertiesTab/CellLineName.js +++ b/app/javascript/src/apps/mydb/elements/details/cellLines/propertiesTab/CellLineName.js @@ -18,7 +18,7 @@ export default class CellLineName extends React.Component { componentDidMount() { CellLinesFetcher.getAllCellLineNames() - .then((data) => data.map((x) => ({ value: x.id, label: x.name, name: x.name }))) + .then((data) => data.map((x) => ({ value: x.id, label: `${x.name} - ${x.source}`, name: x.name }))) .then((data) => { this.setState({ nameSuggestions: data }); }); diff --git a/app/javascript/src/apps/mydb/elements/details/cellLines/propertiesTab/GeneralProperties.js b/app/javascript/src/apps/mydb/elements/details/cellLines/propertiesTab/GeneralProperties.js index b91e54fc73..43ac98eb6b 100644 --- a/app/javascript/src/apps/mydb/elements/details/cellLines/propertiesTab/GeneralProperties.js +++ b/app/javascript/src/apps/mydb/elements/details/cellLines/propertiesTab/GeneralProperties.js @@ -9,11 +9,28 @@ import PropTypes from 'prop-types'; import CellLineName from 'src/apps/mydb/elements/details/cellLines/propertiesTab/CellLineName'; import Amount from 'src/apps/mydb/elements/details/cellLines/propertiesTab/Amount'; import InvalidPropertyWarning from 'src/apps/mydb/elements/details/cellLines/propertiesTab/InvalidPropertyWarning'; +import UserStore from 'src/stores/alt/stores/UserStore'; class GeneralProperties extends React.Component { // eslint-disable-next-line react/static-property-placement static contextType = StoreContext; + checkPermission(attributeName) { + const readonlyAttributes = [ + 'Disease', 'Organism', 'Tissue', 'Growth medium', 'Mutation', 'Variant', 'Biosafety level', + 'Cryopreservation medium', 'Opt. growth temperature', 'Gender', 'Cell type', 'Material Description' + ]; + const { item } = this.props; + const { currentUser } = UserStore.getState(); + if (item.created_by == null) { + const { cellLineDetailsStore } = this.context; + const cellLine = cellLineDetailsStore.cellLines(item.id); + return readonlyAttributes.includes(attributeName) + && cellLine.created_by !== '' && cellLine.created_by !== currentUser.id.toString(); + } + return readonlyAttributes.includes(attributeName) && item.created_by !== currentUser.id; + } + renderOptionalAttribute(attributeName, defaultValue, onChangeCallBack) { return this.renderAttribute(attributeName, defaultValue, onChangeCallBack, true); } @@ -43,7 +60,7 @@ class GeneralProperties extends React.Component { {attributeName} Biosafety level