[Maps][File upload] Add validation check that ensure index name has been provided (#99118)

This commit is contained in:
Aaron Caldwell 2021-05-03 16:42:01 -06:00 committed by GitHub
parent c7977614ed
commit 7a92ea3e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,12 @@ export function checkIndexPatternValid(name: string) {
}
export const validateIndexName = async (indexName: string) => {
if (!indexName) {
return i18n.translate('xpack.fileUpload.indexNameRequired', {
defaultMessage: 'Index name required',
});
}
if (!checkIndexPatternValid(indexName)) {
return i18n.translate('xpack.fileUpload.indexNameContainsIllegalCharactersErrorMessage', {
defaultMessage: 'Index name contains illegal characters.',