Skip to content

Commit

Permalink
fix errors with validation
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Jan 27, 2020
1 parent aa695ec commit a75ca60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class EditSettingsJson extends React.PureComponent {
const editor = (this.editor = createAceEditor(this.aceDiv, prettyJson, false, settingsKeys));
const session = editor.getSession();
session.on('changeAnnotation', () => {
this.setState({ valid: session.getAnnotations().length === 0 });
const isEmptyString = session.getValue() === '';
this.setState({ valid: !isEmptyString && session.getAnnotations().length === 0 });
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
EuiButton,
EuiCallOut,
EuiContextMenu,
EuiFieldText,
EuiFieldNumber,
EuiForm,
EuiFormRow,
EuiPopover,
Expand Down Expand Up @@ -368,7 +368,7 @@ export class IndexActionsContextMenu extends Component {
<EuiSpacer size="m" />

<EuiForm
isInvalid={this.forcemergeSegmentsError()}
isInvalid={!!this.forcemergeSegmentsError()}
error={this.forcemergeSegmentsError()}
>
<EuiFormRow
Expand All @@ -380,10 +380,11 @@ export class IndexActionsContextMenu extends Component {
)}
helpText={helpText}
>
<EuiFieldText
<EuiFieldNumber
onChange={event => {
this.setState({ forcemergeSegments: event.target.value });
}}
min={1}
name="maxNumberSegments"
/>
</EuiFormRow>
Expand Down

0 comments on commit a75ca60

Please sign in to comment.