Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: BUGFIX: editor with implausible value #3580

Draft
wants to merge 1 commit into
base: 7.3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions packages/neos-ui-editors/src/EditorEnvelope/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import omit from 'lodash.omit';

import Label from '@neos-project/react-ui-components/src/Label/';
import {Tooltip} from '@neos-project/react-ui-components';
import {IconButton, Tooltip} from '@neos-project/react-ui-components';
import I18n from '@neos-project/neos-ui-i18n';
import {neos} from '@neos-project/neos-ui-decorators';

Expand All @@ -19,7 +19,8 @@
}))
export default class EditorEnvelope extends PureComponent {
state = {
showHelpMessage: false
showHelpMessage: false,
hasImplausibleValue: false
};

static defaultProps = {
Expand Down Expand Up @@ -66,6 +67,18 @@
renderEditorComponent() {
const editorDefinition = this.getEditorDefinition();

if (this.state.hasImplausibleValue) {
return <div>
<div className={style['envelope--invalid']}>invalid Value in editor {JSON.stringify(this.props.value)}</div>;
<IconButton onClick={() => {
this.props.commit('');
this.setState({
hasImplausibleValue: false
})

Check failure on line 77 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

Missing semicolon
}} icon='x'>Reset</IconButton>

Check failure on line 78 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

Unexpected usage of singlequote
</div>;
}

if (editorDefinition && editorDefinition.component) {
const EditorComponent = editorDefinition && editorDefinition.component;

Expand All @@ -82,6 +95,12 @@
<EditorComponent className={classNames}
id={this.generateIdentifier()}
renderHelpIcon={this.renderHelpIcon}
onImplausibleValue={(lieblingsWert) => {

Check failure on line 98 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

Unexpected parentheses around single function argument

Check failure on line 98 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

'lieblingsWert' is defined but never used. Allowed unused args must match /^_$/
this.setState({
hasImplausibleValue: true
})

Check failure on line 101 in packages/neos-ui-editors/src/EditorEnvelope/index.js

View workflow job for this annotation

GitHub Actions / Code style

Missing semicolon
}}

{...restProps} />
);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/neos-ui-editors/src/Editors/SelectBox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default class SelectBoxEditor extends PureComponent {
render() {
const {options} = this.props;

if (this.props.value) {
this.props.onImplausibleValue();
}

if (options.dataSourceIdentifier || options.dataSourceUri) {
return <DataSourceBasedSelectBoxEditor {...this.props}/>;
}
Expand Down
Loading