Skip to content
Snippets Groups Projects
Commit 38438646 authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

SSDM-7583 : ObjectTypeForm - get rid of Collapse for showing/hiding additional...

SSDM-7583 : ObjectTypeForm - get rid of Collapse for showing/hiding additional fields in the parameters panel (too many animations)
parent 52177f19
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,6 @@ import Typography from '@material-ui/core/Typography' ...@@ -4,7 +4,6 @@ import Typography from '@material-ui/core/Typography'
import CheckboxField from '../../common/form/CheckboxField.jsx' import CheckboxField from '../../common/form/CheckboxField.jsx'
import TextField from '../../common/form/TextField.jsx' import TextField from '../../common/form/TextField.jsx'
import SelectField from '../../common/form/SelectField.jsx' import SelectField from '../../common/form/SelectField.jsx'
import Collapse from '@material-ui/core/Collapse'
import WarningIcon from '@material-ui/icons/Warning' import WarningIcon from '@material-ui/icons/Warning'
import { facade, dto } from '../../../services/openbis.js' import { facade, dto } from '../../../services/openbis.js'
import logger from '../../../common/logger.js' import logger from '../../../common/logger.js'
...@@ -282,23 +281,23 @@ class ObjectTypeParametersProperty extends React.PureComponent { ...@@ -282,23 +281,23 @@ class ObjectTypeParametersProperty extends React.PureComponent {
} }
renderVocabulary(property) { renderVocabulary(property) {
const { classes } = this.props if (property.dataType === dto.DataType.CONTROLLEDVOCABULARY) {
const { vocabularies } = this.state const { classes } = this.props
const { vocabularies } = this.state
let options = []
let options = []
if (vocabularies) {
options = vocabularies.map(vocabulary => { if (vocabularies) {
return { options = vocabularies.map(vocabulary => {
label: vocabulary.code, return {
value: vocabulary.code label: vocabulary.code,
} value: vocabulary.code
}) }
options.unshift({}) })
} options.unshift({})
}
return ( return (
<Collapse in={property.dataType === dto.DataType.CONTROLLEDVOCABULARY}>
<div className={classes.field}> <div className={classes.field}>
<SelectField <SelectField
reference={this.references.vocabulary} reference={this.references.vocabulary}
...@@ -314,28 +313,30 @@ class ObjectTypeParametersProperty extends React.PureComponent { ...@@ -314,28 +313,30 @@ class ObjectTypeParametersProperty extends React.PureComponent {
onBlur={this.handleBlur} onBlur={this.handleBlur}
/> />
</div> </div>
</Collapse> )
) } else {
return null
}
} }
renderMaterialType(property) { renderMaterialType(property) {
const { classes } = this.props if (property.dataType === dto.DataType.MATERIAL) {
const { materialTypes } = this.state const { classes } = this.props
const { materialTypes } = this.state
let options = []
let options = []
if (materialTypes) {
options = materialTypes.map(materialType => { if (materialTypes) {
return { options = materialTypes.map(materialType => {
label: materialType.code, return {
value: materialType.code label: materialType.code,
} value: materialType.code
}) }
options.unshift({}) })
} options.unshift({})
}
return ( return (
<Collapse in={property.dataType === dto.DataType.MATERIAL}>
<div className={classes.field}> <div className={classes.field}>
<SelectField <SelectField
reference={this.references.materialType} reference={this.references.materialType}
...@@ -351,14 +352,16 @@ class ObjectTypeParametersProperty extends React.PureComponent { ...@@ -351,14 +352,16 @@ class ObjectTypeParametersProperty extends React.PureComponent {
onBlur={this.handleBlur} onBlur={this.handleBlur}
/> />
</div> </div>
</Collapse> )
) } else {
return null
}
} }
renderSchema(property) { renderSchema(property) {
const { classes } = this.props if (property.dataType === dto.DataType.XML) {
return ( const { classes } = this.props
<Collapse in={property.dataType === dto.DataType.XML}> return (
<div className={classes.field}> <div className={classes.field}>
<TextField <TextField
reference={this.references.schema} reference={this.references.schema}
...@@ -372,14 +375,16 @@ class ObjectTypeParametersProperty extends React.PureComponent { ...@@ -372,14 +375,16 @@ class ObjectTypeParametersProperty extends React.PureComponent {
onBlur={this.handleBlur} onBlur={this.handleBlur}
/> />
</div> </div>
</Collapse> )
) } else {
return null
}
} }
renderTransformation(property) { renderTransformation(property) {
const { classes } = this.props if (property.dataType === dto.DataType.XML) {
return ( const { classes } = this.props
<Collapse in={property.dataType === dto.DataType.XML}> return (
<div className={classes.field}> <div className={classes.field}>
<TextField <TextField
reference={this.references.transformation} reference={this.references.transformation}
...@@ -393,8 +398,10 @@ class ObjectTypeParametersProperty extends React.PureComponent { ...@@ -393,8 +398,10 @@ class ObjectTypeParametersProperty extends React.PureComponent {
onBlur={this.handleBlur} onBlur={this.handleBlur}
/> />
</div> </div>
</Collapse> )
) } else {
return null
}
} }
renderMandatory(property) { renderMandatory(property) {
...@@ -420,12 +427,8 @@ class ObjectTypeParametersProperty extends React.PureComponent { ...@@ -420,12 +427,8 @@ class ObjectTypeParametersProperty extends React.PureComponent {
const wasMandatory = property.original ? property.original.mandatory : false const wasMandatory = property.original ? property.original.mandatory : false
const isMandatory = property.mandatory const isMandatory = property.mandatory
return ( if (type.used && !wasMandatory && isMandatory) {
<Collapse return (
in={type.used && !wasMandatory && isMandatory}
mountOnEnter={true}
unmountOnExit={true}
>
<div className={classes.field}> <div className={classes.field}>
<TextField <TextField
reference={this.references.initialValueForExistingEntities} reference={this.references.initialValueForExistingEntities}
...@@ -439,8 +442,10 @@ class ObjectTypeParametersProperty extends React.PureComponent { ...@@ -439,8 +442,10 @@ class ObjectTypeParametersProperty extends React.PureComponent {
onBlur={this.handleBlur} onBlur={this.handleBlur}
/> />
</div> </div>
</Collapse> )
) } else {
return null
}
} }
renderVisible(property) { renderVisible(property) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment