Skip to content

Commit

Permalink
[Security Solution][Detections] Fix labels and issue with mandatory f…
Browse files Browse the repository at this point in the history
…ields (elastic#84525)

* Fix labeling and bugs

* Improve naming
  • Loading branch information
cnasikas committed Dec 1, 2020
1 parent 438bbb5 commit 52815e3
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -19610,7 +19610,6 @@
"xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredDescriptionTextField": "説明が必要です。",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredEmailTextField": "電子メールアドレスまたはユーザー名が必要です",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredProjectKeyTextField": "プロジェクトキーが必要です",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredTitleTextField": "タイトルが必要です。",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.savedObjectIdFieldHelp": "JIRAは、このアクションを、Kibanaの保存されたオブジェクトのIDに関連付けます。",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.savedObjectIdFieldLabel": "オブジェクトID(任意)",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.searchIssuesComboBoxAriaLabel": "親問題を選択",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -19629,7 +19629,6 @@
"xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredDescriptionTextField": "“描述”必填。",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredEmailTextField": "“电子邮件”或“用户名”必填",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredProjectKeyTextField": "“项目键”必填",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredTitleTextField": "“标题”必填。",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.savedObjectIdFieldHelp": "JIRA 将此操作与 Kibana 已保存对象的 ID 关联。",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.savedObjectIdFieldLabel": "对象 ID(可选)",
"xpack.triggersActionsUI.components.builtinActionTypes.jira.searchIssuesComboBoxAriaLabel": "选择父问题",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('jira action params validation', () => {

expect(actionTypeModel.validateParams(actionParams)).toEqual({
errors: {
title: ['Title is required.'],
title: ['Summary is required.'],
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export function getActionType(): ActionTypeModel<JiraConfig, JiraSecrets, JiraAc
title: new Array<string>(),
};
validationResult.errors = errors;
if (actionParams.subActionParams && !actionParams.subActionParams.title?.length) {
errors.title.push(i18n.TITLE_REQUIRED);
if (!actionParams.subActionParams?.title?.length) {
errors.title.push(i18n.SUMMARY_REQUIRED);
}
return validationResult;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ export const DESCRIPTION_REQUIRED = i18n.translate(
}
);

export const TITLE_REQUIRED = i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredTitleTextField',
export const SUMMARY_REQUIRED = i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredSummaryTextField',
{
defaultMessage: 'Title is required.',
defaultMessage: 'Summary is required.',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('resilient action params validation', () => {

expect(actionTypeModel.validateParams(actionParams)).toEqual({
errors: {
title: ['Title is required.'],
title: ['Name is required.'],
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export function getActionType(): ActionTypeModel<
title: new Array<string>(),
};
validationResult.errors = errors;
if (actionParams.subActionParams && !actionParams.subActionParams.title?.length) {
errors.title.push(i18n.TITLE_REQUIRED);

if (!actionParams.subActionParams?.title?.length) {
errors.title.push(i18n.NAME_REQUIRED);
}
return validationResult;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ export const MAPPING_FIELD_COMMENTS = i18n.translate(
);

export const DESCRIPTION_REQUIRED = i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.common.requiredDescriptionTextField',
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.requiredDescriptionTextField',
{
defaultMessage: 'Description is required.',
}
);

export const TITLE_REQUIRED = i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.common.requiredTitleTextField',
export const NAME_REQUIRED = i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.requiredNameTextField',
{
defaultMessage: 'Title is required.',
defaultMessage: 'Name is required.',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('servicenow action params validation', () => {

expect(actionTypeModel.validateParams(actionParams)).toEqual({
errors: {
title: ['Title is required.'],
title: ['Short description is required.'],
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function getActionType(): ActionTypeModel<
title: new Array<string>(),
};
validationResult.errors = errors;
if (actionParams.subActionParams && !actionParams.subActionParams.title?.length) {
if (!actionParams.subActionParams?.title?.length) {
errors.title.push(i18n.TITLE_REQUIRED);
}
return validationResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ export const DESCRIPTION_REQUIRED = i18n.translate(
export const TITLE_REQUIRED = i18n.translate(
'xpack.triggersActionsUI.components.builtinActionTypes.common.requiredTitleTextField',
{
defaultMessage: 'Title is required.',
defaultMessage: 'Short description is required.',
}
);

0 comments on commit 52815e3

Please sign in to comment.