Skip to content

Commit

Permalink
Allow Watcher index actions to be configured without specifying an in…
Browse files Browse the repository at this point in the history
…dex name. (#74684) (#75242)
  • Loading branch information
cjcenizal authored Aug 18, 2020
1 parent ea08e93 commit b1dda2b
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 37 deletions.
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -19310,7 +19310,6 @@
"xpack.watcher.models.jiraAction.typeName": "Jira",
"xpack.watcher.models.jsonWatch.selectMessageText": "生 JSON のカスタムウォッチをセットアップします。",
"xpack.watcher.models.jsonWatch.typeName": "高度なウォッチ",
"xpack.watcher.models.loggingAction.actionJsonIndexNamePropertyMissingBadRequestMessage": "json引数には{actionJsonIndexName}プロパティが含まれている必要があります",
"xpack.watcher.models.loggingAction.actionJsonLoggingPropertyMissingBadRequestMessage": "json 引数には {actionJsonLogging} プロパティが含まれている必要があります",
"xpack.watcher.models.loggingAction.actionJsonLoggingTextPropertyMissingBadRequestMessage": "json 引数には {actionJsonLoggingText} プロパティが含まれている必要があります",
"xpack.watcher.models.loggingAction.actionJsonWebhookHostPropertyMissingBadRequestMessage": "json引数には{actionJsonWebhookHost}プロパティが含まれている必要があります",
Expand Down Expand Up @@ -19576,7 +19575,6 @@
"xpack.watcher.timeUnits.minuteLabel": "{timeValue, plural, one {分} other {分}}",
"xpack.watcher.timeUnits.secondLabel": "{timeValue, plural, one {秒} other {秒}}",
"xpack.watcher.watchActions.email.emailRecipientIsRequiredValidationMessage": "送信先メールアドレスが必要です。",
"xpack.watcher.watchActions.index.indexIsRequiredValidationMessage": "インデックス名が必要です。",
"xpack.watcher.watchActions.jira.issueTypeNameIsRequiredValidationMessage": "Jira問題タイプが必要です。",
"xpack.watcher.watchActions.jira.projectKeyIsRequiredValidationMessage": "Jiraプロジェクトキーが必要です。",
"xpack.watcher.watchActions.jira.summaryIsRequiredValidationMessage": "Jira概要が必要です。",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -19318,7 +19318,6 @@
"xpack.watcher.models.jiraAction.typeName": "Jira",
"xpack.watcher.models.jsonWatch.selectMessageText": "以原始 JSON 格式设置定制监视。",
"xpack.watcher.models.jsonWatch.typeName": "高级监视",
"xpack.watcher.models.loggingAction.actionJsonIndexNamePropertyMissingBadRequestMessage": "JSON 参数必须包含 {actionJsonIndexName} 属性",
"xpack.watcher.models.loggingAction.actionJsonLoggingPropertyMissingBadRequestMessage": "json 参数必须包含 {actionJsonLogging} 属性",
"xpack.watcher.models.loggingAction.actionJsonLoggingTextPropertyMissingBadRequestMessage": "json 参数必须包含 {actionJsonLoggingText} 属性",
"xpack.watcher.models.loggingAction.actionJsonWebhookHostPropertyMissingBadRequestMessage": "JSON 参数必须包含 {actionJsonWebhookHost} 属性",
Expand Down Expand Up @@ -19584,7 +19583,6 @@
"xpack.watcher.timeUnits.minuteLabel": "{timeValue, plural, one {分钟} other {分钟}}",
"xpack.watcher.timeUnits.secondLabel": "{timeValue, plural, one {秒} other {秒}}",
"xpack.watcher.watchActions.email.emailRecipientIsRequiredValidationMessage": "“收件人”电子邮件地址必填。",
"xpack.watcher.watchActions.index.indexIsRequiredValidationMessage": "索引名称必填。",
"xpack.watcher.watchActions.jira.issueTypeNameIsRequiredValidationMessage": "Jira 问题类型必填。",
"xpack.watcher.watchActions.jira.projectKeyIsRequiredValidationMessage": "Jira 项目键必填。",
"xpack.watcher.watchActions.jira.summaryIsRequiredValidationMessage": "Jira 摘要必填。",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,24 +290,16 @@ describe('<ThresholdWatchEdit /> create route', () => {
});

test('should simulate an index action', async () => {
const { form, find, actions, exists } = testBed;

const INDEX = 'my_index';
const { form, actions, exists } = testBed;

actions.clickAddActionButton();
actions.clickActionLink('index');

expect(exists('watchActionAccordion')).toBe(true);

// First, provide invalid field and verify
// Verify an empty index is allowed
form.setInputValue('indexInput', '');

expect(form.getErrorsMessages()).toContain('Index name is required.');
expect(find('simulateActionButton').props().disabled).toEqual(true);

// Next, provide valid field and verify
form.setInputValue('indexInput', INDEX);

await act(async () => {
actions.clickSimulateButton();
await nextTick();
Expand All @@ -327,7 +319,7 @@ describe('<ThresholdWatchEdit /> create route', () => {
id: 'index_1',
type: 'index',
index: {
index: INDEX,
index: '',
},
},
],
Expand Down
15 changes: 0 additions & 15 deletions x-pack/plugins/watcher/common/models/action/index_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,6 @@ export class IndexAction extends BaseAction {
});
}

if (json.index && !json.index.index) {
errors.push({
code: ERROR_CODES.ERR_PROP_MISSING,
message: i18n.translate(
'xpack.watcher.models.loggingAction.actionJsonIndexNamePropertyMissingBadRequestMessage',
{
defaultMessage: 'JSON argument must contain an {actionJsonIndexName} property',
values: {
actionJsonIndexName: 'actionJson.index.index',
},
}
),
});
}

return { errors: errors.length ? errors : null };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ export class IndexAction extends BaseAction {
const errors = {
index: [],
};
if (!this.index) {
errors.index.push(
i18n.translate('xpack.watcher.watchActions.index.indexIsRequiredValidationMessage', {
defaultMessage: 'Index name is required.',
})
);
}
return errors;
}

Expand Down

0 comments on commit b1dda2b

Please sign in to comment.