From 60e7d876fc38f8197045eb0e547cf408abc16ecc Mon Sep 17 00:00:00 2001 From: pkupczyk <piotr.kupczyk@id.ethz.ch> Date: Thu, 5 Aug 2021 15:49:20 +0200 Subject: [PATCH] SSDM-11178 : make new admin UI and ELN consistent - hide 'showParents' and 'showContainer' fields; for new created sample types set both fields to true; for existing sample types maintain the current values --- .../js/components/types/common/TypesGrid.jsx | 12 ---- .../types/form/TypeFormControllerLoad.js | 2 +- .../types/form/TypeFormParametersType.jsx | 56 ------------------- .../types/form/TypeFormPreviewHeader.jsx | 44 --------------- .../js/components/types/search/TypeSearch.jsx | 2 - .../types/form/TypeFormControllerLoad.test.js | 2 +- .../search/TypeSearchComponentLoad.test.js | 28 +--------- 7 files changed, 5 insertions(+), 141 deletions(-) diff --git a/openbis_ng_ui/src/js/components/types/common/TypesGrid.jsx b/openbis_ng_ui/src/js/components/types/common/TypesGrid.jsx index 9c4903fe3d9..e774606f39d 100644 --- a/openbis_ng_ui/src/js/components/types/common/TypesGrid.jsx +++ b/openbis_ng_ui/src/js/components/types/common/TypesGrid.jsx @@ -100,18 +100,6 @@ class TypesGrid extends React.PureComponent { label: messages.get(messages.SUBCODES_UNIQUE), getValue: ({ row }) => row.subcodeUnique }) - - columns.push({ - name: 'showParents', - label: messages.get(messages.SHOW_PARENTS), - getValue: ({ row }) => row.showParents - }) - - columns.push({ - name: 'showContainer', - label: messages.get(messages.SHOW_CONTAINER), - getValue: ({ row }) => row.showContainer - }) } if (kind === openbis.EntityKind.DATA_SET) { diff --git a/openbis_ng_ui/src/js/components/types/form/TypeFormControllerLoad.js b/openbis_ng_ui/src/js/components/types/form/TypeFormControllerLoad.js index 32f39f79199..56f32aec28a 100644 --- a/openbis_ng_ui/src/js/components/types/form/TypeFormControllerLoad.js +++ b/openbis_ng_ui/src/js/components/types/form/TypeFormControllerLoad.js @@ -340,7 +340,7 @@ class ObjectTypeStrategy { value: _.get(loadedType, 'listable', true) }), showContainer: FormUtil.createField({ - value: _.get(loadedType, 'showContainer', false) + value: _.get(loadedType, 'showContainer', true) }), showParents: FormUtil.createField({ value: _.get(loadedType, 'showParents', true) diff --git a/openbis_ng_ui/src/js/components/types/form/TypeFormParametersType.jsx b/openbis_ng_ui/src/js/components/types/form/TypeFormParametersType.jsx index 5722438eaac..e9a95465b61 100644 --- a/openbis_ng_ui/src/js/components/types/form/TypeFormParametersType.jsx +++ b/openbis_ng_ui/src/js/components/types/form/TypeFormParametersType.jsx @@ -24,8 +24,6 @@ class TypeFormParametersType extends React.PureComponent { code: React.createRef(), description: React.createRef(), validationPlugin: React.createRef(), - showContainer: React.createRef(), - showParents: React.createRef(), generatedCodePrefix: React.createRef(), autoGeneratedCode: React.createRef(), subcodeUnique: React.createRef() @@ -95,8 +93,6 @@ class TypeFormParametersType extends React.PureComponent { {this.renderGeneratedCodePrefix(type)} {this.renderAutoGeneratedCode(type)} {this.renderSubcodeUnique(type)} - {this.renderShowParents(type)} - {this.renderShowContainer(type)} {this.renderMainDataSetPattern(type)} {this.renderMainDataSetPath(type)} {this.renderDisallowDeletion(type)} @@ -213,58 +209,6 @@ class TypeFormParametersType extends React.PureComponent { ) } - renderShowContainer(type) { - const { visible, enabled, error, value } = { ...type.showContainer } - - if (!visible) { - return null - } - - const { mode, classes } = this.props - return ( - <div className={classes.field}> - <CheckboxField - reference={this.references.showContainer} - label={messages.get(messages.SHOW_CONTAINER)} - name='showContainer' - error={error} - disabled={!enabled} - value={value} - mode={mode} - onChange={this.handleChange} - onFocus={this.handleFocus} - onBlur={this.handleBlur} - /> - </div> - ) - } - - renderShowParents(type) { - const { visible, enabled, error, value } = { ...type.showParents } - - if (!visible) { - return null - } - - const { mode, classes } = this.props - return ( - <div className={classes.field}> - <CheckboxField - reference={this.references.showParents} - label={messages.get(messages.SHOW_PARENTS)} - name='showParents' - error={error} - disabled={!enabled} - value={value} - mode={mode} - onChange={this.handleChange} - onFocus={this.handleFocus} - onBlur={this.handleBlur} - /> - </div> - ) - } - renderGeneratedCodePrefix(type) { const { visible, enabled, error, value } = { ...type.generatedCodePrefix } diff --git a/openbis_ng_ui/src/js/components/types/form/TypeFormPreviewHeader.jsx b/openbis_ng_ui/src/js/components/types/form/TypeFormPreviewHeader.jsx index 16ff88636be..96b21a55698 100644 --- a/openbis_ng_ui/src/js/components/types/form/TypeFormPreviewHeader.jsx +++ b/openbis_ng_ui/src/js/components/types/form/TypeFormPreviewHeader.jsx @@ -34,8 +34,6 @@ class TypeFormPreviewHeader extends React.PureComponent { <div> {this.renderTitle()} {this.renderCode()} - {this.renderParents()} - {this.renderContainer()} </div> ) } @@ -69,48 +67,6 @@ class TypeFormPreviewHeader extends React.PureComponent { </div> ) } - - renderParents() { - const { mode, type, preview, classes } = this.props - - if (type.showParents && type.showParents.value) { - return ( - <div className={classes.field}> - <TextField - name='parents' - label={messages.get(messages.PARENTS)} - value={_.get(preview, 'parents.value')} - disabled={mode !== PageMode.EDIT} - mode={PageMode.EDIT} - onChange={this.handleChange} - /> - </div> - ) - } else { - return null - } - } - - renderContainer() { - const { mode, type, preview, classes } = this.props - - if (type.showContainer && type.showContainer.value) { - return ( - <div className={classes.field}> - <TextField - name='container' - label={messages.get(messages.CONTAINER)} - value={_.get(preview, 'container.value')} - disabled={mode !== PageMode.EDIT} - mode={PageMode.EDIT} - onChange={this.handleChange} - /> - </div> - ) - } else { - return null - } - } } export default _.flow(withStyles(styles))(TypeFormPreviewHeader) diff --git a/openbis_ng_ui/src/js/components/types/search/TypeSearch.jsx b/openbis_ng_ui/src/js/components/types/search/TypeSearch.jsx index 449b75ea625..237bfde64e2 100644 --- a/openbis_ng_ui/src/js/components/types/search/TypeSearch.jsx +++ b/openbis_ng_ui/src/js/components/types/search/TypeSearch.jsx @@ -67,8 +67,6 @@ class TypeSearch extends React.Component { description: _.get(object, 'description'), subcodeUnique: _.get(object, 'subcodeUnique', false), autoGeneratedCode: _.get(object, 'autoGeneratedCode', false), - showContainer: _.get(object, 'showContainer', false), - showParents: _.get(object, 'showParents', false), generatedCodePrefix: _.get(object, 'generatedCodePrefix'), validationPlugin: _.get(object, 'validationPlugin.name') })) diff --git a/openbis_ng_ui/srcTest/js/components/types/form/TypeFormControllerLoad.test.js b/openbis_ng_ui/srcTest/js/components/types/form/TypeFormControllerLoad.test.js index 65f7bee6d91..7bc1fc7d76d 100644 --- a/openbis_ng_ui/srcTest/js/components/types/form/TypeFormControllerLoad.test.js +++ b/openbis_ng_ui/srcTest/js/components/types/form/TypeFormControllerLoad.test.js @@ -114,7 +114,7 @@ async function testLoadSuccessfulNew() { code: { value: null }, description: { value: null }, listable: { value: true }, - showContainer: { value: false }, + showContainer: { value: true }, showParents: { value: true }, showParentMetadata: { value: true }, autoGeneratedCode: { value: true }, diff --git a/openbis_ng_ui/srcTest/js/components/types/search/TypeSearchComponentLoad.test.js b/openbis_ng_ui/srcTest/js/components/types/search/TypeSearchComponentLoad.test.js index 52efa040700..487fa02a1d8 100644 --- a/openbis_ng_ui/srcTest/js/components/types/search/TypeSearchComponentLoad.test.js +++ b/openbis_ng_ui/srcTest/js/components/types/search/TypeSearchComponentLoad.test.js @@ -81,14 +81,6 @@ async function testLoadWithSearchText(resultsFound) { { name: 'subcodeUnique', label: 'Unique Subcodes' - }, - { - name: 'showParents', - label: 'Show Parents' - }, - { - name: 'showContainer', - label: 'Show Container' } ], rows: [ @@ -99,9 +91,7 @@ async function testLoadWithSearchText(resultsFound) { validationPlugin: testObjectType.validationPlugin.name, generatedCodePrefix: testObjectType.getGeneratedCodePrefix(), autoGeneratedCode: String(testObjectType.isAutoGeneratedCode()), - subcodeUnique: String(testObjectType.isSubcodeUnique()), - showParents: String(testObjectType.isShowParents()), - showContainer: String(testObjectType.isShowContainer()) + subcodeUnique: String(testObjectType.isSubcodeUnique()) } } ] @@ -277,14 +267,6 @@ async function testLoadWithObjectType(resultsFound) { { name: 'subcodeUnique', label: 'Unique Subcodes' - }, - { - name: 'showParents', - label: 'Show Parents' - }, - { - name: 'showContainer', - label: 'Show Container' } ], rows: resultsFound @@ -296,9 +278,7 @@ async function testLoadWithObjectType(resultsFound) { validationPlugin: null, generatedCodePrefix: null, autoGeneratedCode: null, - subcodeUnique: null, - showParents: null, - showContainer: null + subcodeUnique: null } }, { @@ -308,9 +288,7 @@ async function testLoadWithObjectType(resultsFound) { validationPlugin: testObjectType.validationPlugin.name, generatedCodePrefix: testObjectType.getGeneratedCodePrefix(), autoGeneratedCode: String(testObjectType.isAutoGeneratedCode()), - subcodeUnique: String(testObjectType.isSubcodeUnique()), - showParents: String(testObjectType.isShowParents()), - showContainer: String(testObjectType.isShowContainer()) + subcodeUnique: String(testObjectType.isSubcodeUnique()) } } ] -- GitLab