Skip to content

Commit

Permalink
[Index Management] Fix errors with validation (elastic#56072)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Jan 28, 2020
1 parent 2f2cd9a commit ef2d66f
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 @@ -367,7 +367,7 @@ export class IndexActionsContextMenu extends Component {
<EuiSpacer size="m" />

<EuiForm
isInvalid={this.forcemergeSegmentsError()}
isInvalid={!!this.forcemergeSegmentsError()}
error={this.forcemergeSegmentsError()}
>
<EuiFormRow
Expand All @@ -379,10 +379,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 ef2d66f

Please sign in to comment.