mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Index Management] Restrict dot-prefixed index patterns in template form (#193196)
Closes https://github.com/elastic/kibana/issues/190251
## Summary
This PR adds validation that restricts creating a template with a
dot-prefixed index pattern.
<img width="1194" alt="Screenshot 2024-09-18 at 10 49 47"
src="https://github.com/user-attachments/assets/f24c3e29-7db0-46fc-97de-52d4654073de">
Note: I tried adding tests for this validation
[here](6a3adf73da/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx (L163)
),
but it didn't work because the index pattern field is mocked in the
tests and errors are not triggered from invalid values.
This commit is contained in:
parent
78b21cd9f9
commit
38d6143f72
1 changed files with 12 additions and 0 deletions
|
@ -129,6 +129,18 @@ export const schemas: Record<string, FormSchema> = {
|
|||
type: VALIDATION_TYPES.ARRAY_ITEM,
|
||||
isBlocking: false,
|
||||
},
|
||||
{
|
||||
validator: startsWithField({
|
||||
char: '.',
|
||||
message: i18n.translate(
|
||||
'xpack.idxMgmt.templateValidation.indexPatternDotPrefixedError',
|
||||
{
|
||||
defaultMessage: 'Index patterns cannot match dot-prefixed indices.',
|
||||
}
|
||||
),
|
||||
}),
|
||||
type: VALIDATION_TYPES.ARRAY_ITEM,
|
||||
},
|
||||
],
|
||||
},
|
||||
doCreateDataStream: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue