[ML] File data viz fix index pattern warning after index change (#57807)

This commit is contained in:
James Gowdy 2020-02-18 07:16:40 +00:00 committed by GitHub
parent c31c7ee4c7
commit 3c51fb0314
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -325,9 +325,17 @@ export class ImportView extends Component {
onIndexChange = e => {
const name = e.target.value;
const { indexNames, indexPattern, indexPatternNames } = this.state;
this.setState({
index: name,
indexNameError: isIndexNameValid(name, this.state.indexNames),
indexNameError: isIndexNameValid(name, indexNames),
// if index pattern has been altered, check that it still matches the inputted index
...(indexPattern === ''
? {}
: {
indexPatternNameError: isIndexPatternNameValid(indexPattern, indexPatternNames, name),
}),
});
};