Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Watcher UI] Not possible to edit a watch that was created with the API if the ID contains a dot #59383

Merged
merged 5 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import '../../../es_ui_shared/console_lang/mocks';

import { act } from 'react-dom/test-utils';
Expand Down Expand Up @@ -76,7 +77,7 @@ describe('<JsonWatchEdit /> create route', () => {
actions.clickSubmitButton();

expect(form.getErrorsMessages()).toContain(
'ID can only contain letters, underscores, dashes, and numbers.'
'ID can only contain letters, underscores, dashes, periods and numbers.'
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class JsonWatch extends BaseWatch {

validate() {
const validationResult = {};
const idRegex = /^[A-Za-z0-9\-\_]+$/;
const idRegex = /^[A-Za-z0-9\-\_.]+$/;
const errors = {
id: [],
json: [],
Expand All @@ -47,7 +47,7 @@ export class JsonWatch extends BaseWatch {
} else if (!idRegex.test(this.id)) {
errors.id.push(
i18n.translate('xpack.watcher.sections.watchEdit.json.error.invalidIdText', {
defaultMessage: 'ID can only contain letters, underscores, dashes, and numbers.',
defaultMessage: 'ID can only contain letters, underscores, dashes, periods and numbers.',
})
);
}
Expand Down