+ const excludeModel = ['role', 'permission', 'file'].includes(
+ this.props.relation.model || this.props.relation.collection,
+ ); // Temporary.
+ const entryLink =
+ isNull(value) || isUndefined(value) || excludeModel ? (
+ ''
+ ) : (
+
{title => (
- this.handleClick({value})} title={title}>
+ this.handleClick({ value })} title={title}>
+
+
)}
- )
- );
+ );
/* eslint-disable jsx-a11y/label-has-for */
return (
{description}
@@ -160,10 +173,18 @@ class SelectOne extends React.Component { // eslint-disable-line react/prefer-st
onInputChange={this.handleInputChange}
onSelectResetsInput={false}
simpleValue
- value={isNull(value) || isUndefined(value) ? null : {
- value: isFunction(value.toJS) ? value.toJS() : value,
- label: templateObject({ mainField: this.props.relation.displayedAttribute }, isFunction(value.toJS) ? value.toJS() : value).mainField || (isFunction(value.toJS) ? get(value.toJS(), 'id') : get(value, 'id')),
- }}
+ value={
+ isNull(value) || isUndefined(value)
+ ? null
+ : {
+ value: isFunction(value.toJS) ? value.toJS() : value,
+ label:
+ templateObject(
+ { mainField: this.props.relation.displayedAttribute },
+ isFunction(value.toJS) ? value.toJS() : value,
+ ).mainField || (isFunction(value.toJS) ? get(value.toJS(), 'id') : get(value, 'id')),
+ }
+ }
/>
);
@@ -173,10 +194,7 @@ class SelectOne extends React.Component { // eslint-disable-line react/prefer-st
SelectOne.propTypes = {
onRedirect: PropTypes.func.isRequired,
- record: PropTypes.oneOfType([
- PropTypes.object,
- PropTypes.bool,
- ]).isRequired,
+ record: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]).isRequired,
relation: PropTypes.object.isRequired,
setRecordAttribute: PropTypes.func.isRequired,
};