Skip to content

Commit

Permalink
EPMRPP-83572 || Update the view of Notification rule with attributes (#…
Browse files Browse the repository at this point in the history
…3636)

* EPMRPP-83572 || Update the view of Notification rule with attributes

* EPMRPP-83572 || code review fixes - 1

* EPMRPP-83572 || code review fixes - 2

* EPMRPP-83572 || code review fixes - 3

* EPMRPP-83572 || code review fixes - 4
  • Loading branch information
Vadim73i authored Nov 6, 2023
1 parent 9904c8f commit 1ef736d
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 171 deletions.
65 changes: 27 additions & 38 deletions app/localization/translated/be.json

Large diffs are not rendered by default.

62 changes: 27 additions & 35 deletions app/localization/translated/ru.json

Large diffs are not rendered by default.

76 changes: 27 additions & 49 deletions app/localization/translated/uk.json

Large diffs are not rendered by default.

48 changes: 29 additions & 19 deletions app/localization/translated/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@
"AddEditNotificationCaseModal.active": "激活规则",
"AddEditNotificationCaseModal.addAttribute": "添加属性",
"AddEditNotificationCaseModal.attributesLabel": "属性",
"AddEditNotificationCaseModal.attributesLabelAll": "(All attributes should match)",
"AddEditNotificationCaseModal.attributesLabelAny": "(Any attribute should match)",
"AddEditNotificationCaseModal.attributesNotActive": "属性未生效。请勾选复选框“属性”进行激活",
"AddEditNotificationCaseModal.attributesNote": "发送有关包含了指定属性的测试任务的通知",
"AddEditNotificationCaseModal.attributesNote": "Notify if the launch has all/at least one of specified attributes",
"AddEditNotificationCaseModal.attributesOperatorAnd": "所有属性应当匹配",
"AddEditNotificationCaseModal.attributesOperatorOr": "任何属性应当匹配",
"AddEditNotificationCaseModal.controlPanelName": "规则",
Expand Down Expand Up @@ -156,6 +158,7 @@
"Analyzer.updateErrorNotification": "未知错误,请联系管理员。",
"Analyzer.updateSuccessNotification": "项目设置更新成功",
"ApiKeyGeneratedModal.description": "拷贝API密钥并保存在安全的地方。\n在点击“关闭”按钮后,您将无法再看到该密钥。",
"ApiKeyGeneratedModal.descriptionNote": "You won’t be able to see your Key once you click \"Close\" button.",
"ApiKeyGeneratedModal.header": "API密钥已生成",
"ApiKeyGeneratedModal.loaderText": "正在生成...",
"ApiKeyGeneratedModal.successNotification": "API密钥已被成功拷贝",
Expand Down Expand Up @@ -189,7 +192,6 @@
"AttributesContainer.addAttribute": "添加属性",
"AttributesContainer.attributes": "属性",
"AttributesContainer.attributesNotActive": "属性未生效。请勾选复选框“属性”进行激活",
"AttributesContainer.attributesNote": "发送有关包含了指定属性的测试任务的通知",
"AttributesFieldArrayControl.addOneMoreLevel": "+ 再添加一级",
"AttributesFieldArrayControl.attributeKeyFieldLabel": "等级 {number} {view}",
"AttributesFieldArrayControl.attributeKeyFieldPlaceholder": "请输入属性名",
Expand All @@ -198,12 +200,17 @@
"AutoAnalysis.AutoAnalysisMode": "自动分析服务基于的数据",
"AutoAnalysis.AutoAnalysisModeDescription": "您可以选择测试分析是基于之前同名测试任务的分析结果,还是基于全部测试任务的分析结果",
"AutoAnalysis.allLaunchesCaption": "所有测试任务",
"AutoAnalysis.allMessagesShouldMatch": "包含3行或更多行的所有日志都应匹配",
"AutoAnalysis.allMessagesShouldMatchDescription": "当分析的测试项包含3行或更多行的日志时",
"AutoAnalysis.autoAnalysis": "自动分析模块",
"AutoAnalysis.autoAnalysisDescription": "任何测试任务完成后,将立即主动开始自动分析",
"AutoAnalysis.current": "仅限当前测试任务",
"AutoAnalysis.currentAndWithSameName": "Current launch and Launches with the same name",
"AutoAnalysis.minShouldMatch": "自动分析时匹配的最低精度",
"AutoAnalysis.minShouldMatchDescription": "已分析的日志与来自ElasticSearch的指定日志之间单词相等部分所占百分比。如果通过分析ElasticSearch的日志得到的值小于设置的值,那么该日志将被自动分析服务忽略",
"AutoAnalysis.numberOfLogLines": "在Elasticsearch中应考虑的日志行数",
"AutoAnalysis.numberOfLogLinesAllOption": "全部",
"AutoAnalysis.numberOfLogLinesDescription": "在ElasticSearch中应考虑的日志消息的前几行",
"AutoAnalysis.previousLaunch": "之前具有相同名称的启动",
"AutoAnalysis.sameNameLaunchesCaption": "同名的测试任务",
"AutoAnalysis.tabDescription": "自动分析允许通过在自动模式下分析测试失败来减少测试执行调查所花费的时间。自动分析的过程基于之前使用机器学习进行的用户调查结果。当启动完成事件和测试项完成事件触发自动分析时,将应用这些设置。有关自动分析的更多信息,您可以在<a>文档</a>中阅读。",
Expand Down Expand Up @@ -247,6 +254,7 @@
"ChangeProjectRoleModal.changeAccountRoleText": "您确定要更改”{name}”的帐户角色吗?",
"ChangeProjectRoleModal.changeAccountRoleTitle": "更改角色",
"ChangeProjectRoleModal.submitText": "确定",
"ChangeRole": "role was changed on the project by",
"Chart.label.automationBug": "自动化错误",
"Chart.label.investigated": "已调查分析",
"Chart.label.launchesQuantity": "所有测试任务",
Expand Down Expand Up @@ -422,6 +430,7 @@
"ConnectionSection.connectionFailedDescription": "未能连接至{pluginName}.",
"ConnectionSection.connectionFailedHeader": "连接错误",
"ConnectionSection.connectionFailedMessage": "连接失败",
"ConnectionSection.deleteIntegrationDescription": "您确定要删除项目集成吗",
"ConnectionSection.removeIntegrationSuccess": "已成功删除集成",
"ConnectionSection.warningMessage": "警告",
"ConnectionSection.warningMessageDescription": "由于您已配置项目集成,全局集成将不会生效",
Expand All @@ -439,7 +448,7 @@
"CreatePatternAnalysisModal.createPatternModalToggle": "激活规则",
"CreatePatternAnalysisModal.createPatternModalType": "类型",
"CreatePatternAnalysisModal.patternConditionPlaceholder": "请输入文字说明",
"CreateUser.welcome": "欢迎使用ReportPortal!",
"CreateProject": "is created",
"CumulativeTrendControls.CriteriaFieldLabel": "小部件的标准",
"CumulativeTrendControls.LaunchesLimitFieldLabel": "测试任务的数量",
"CumulativeTrendControls.LaunchesLimitValidationError": "测试项个数应为1到20000个",
Expand Down Expand Up @@ -680,12 +689,14 @@
"ErrorLogsBlock.showErrorLog": "显示",
"EventActions.analyzeItem": "自动分析服务已更改缺陷类型",
"EventActions.assignUser": "分配用户",
"EventActions.changeRole": "Change role",
"EventActions.createDashboard": "创建报告面板",
"EventActions.createDefect": "创建自定义缺陷类型",
"EventActions.createFilter": "创建过滤器",
"EventActions.createIntegration": "创建集成",
"EventActions.createInvitationLink": "Create invitation link",
"EventActions.createPattern": "创建模板规则",
"EventActions.createUser": "创建用户",
"EventActions.createProject": "Create project",
"EventActions.createWidget": "创建小部件",
"EventActions.deleteDashboard": "删除报告面板",
"EventActions.deleteDefect": "删除缺陷",
Expand All @@ -695,40 +706,40 @@
"EventActions.deleteLaunch": "删除测试任务",
"EventActions.deletePattern": "删除模板规则",
"EventActions.deleteWidget": "删除小部件",
"EventActions.import": "导入",
"EventActions.startImport": "开始导入",
"EventActions.finishImport": "完成导入",
"EventActions.finishLaunch": "完成测试任务",
"EventActions.generateIndex": "生成索引",
"EventActions.import": "导入",
"EventActions.linkIssue": "与问题关联",
"EventActions.linkIssueAA": "自动分析服务关联的问题",
"EventActions.matchedPattern": "模板分析已找到模板",
"EventActions.postIssue": "发布问题",
"EventActions.startImport": "开始导入",
"EventActions.startLaunch": "开始执行测试任务",
"EventActions.unassignUser": "取消分配用户",
"EventActions.unlinkIssue": "取消已关联的问题",
"EventActions.updateAnalyzer": "更新分析器",
"EventActions.updateAutoPatternAnalysisSettings": "更新模式分析设置",
"EventActions.updateDashboard": "更新报告面板",
"EventActions.updateDefect": "更新缺陷",
"EventActions.updateFilter": "更新过滤器",
"EventActions.updateIntegration": "更新集成",
"EventActions.updateItem": "更新测试项",
"EventActions.updatePattern": "更新模板规则",
"EventActions.updateAutoPatternAnalysisSettings": "更新模式分析设置",
"EventActions.updateProject": "更新项目",
"EventActions.updateWidget": "更新小部件",
"EventObjectTypes.dashboard": "报告面板",
"EventObjectTypes.defectType": "自定义缺陷类型",
"EventObjectTypes.emailConfig": "通知规则",
"EventObjectTypes.filter": "过滤器",
"EventObjectTypes.import": "导入",
"EventObjectTypes.index": "Index",
"EventObjectTypes.integration": "集成",
"EventObjectTypes.invitationLink": "Invitation link",
"EventObjectTypes.itemIssue": "缺陷",
"EventObjectTypes.launch": "测试任务",
"EventObjectTypes.patternRule": "模板规则",
"EventObjectTypes.project": "项目",
"EventObjectTypes.testItem": "测试项",
"EventObjectTypes.ticket": "关联到BTS",
"EventObjectTypes.user": "用户",
"EventObjectTypes.widget": "小部件",
"EventsGrid.actionCol": "操作",
Expand Down Expand Up @@ -968,14 +979,9 @@
"IndexActionsBlock.removeIndexButtonCaption": "删除索引",
"IndexActionsBlock.removeIndexDescription": "您调查的所有数据都将从ElasticSearch中删除。如需创建新数据,您可以再次手动调查测试结果或根据先前的项目结果生成数据",
"IndexActionsBlock.title": "操作索引",
"AutoAnalysis.allMessagesShouldMatch": "包含3行或更多行的所有日志都应匹配",
"AutoAnalysis.allMessagesShouldMatchDescription": "当分析的测试项包含3行或更多行的日志时",
"IndexSettings.generateIndexButtonCaption": "生成索引",
"IndexSettings.generateIndexDescription": "所有数据已从ElasticSearch中删除,新数据已根据之前对该项目的所有调查生成。您可以在收到关于生成过程结束的电子邮件后开始使用自动分析。",
"IndexSettings.inCaseOf": "",
"AutoAnalysis.numberOfLogLines": "在Elasticsearch中应考虑的日志行数",
"AutoAnalysis.numberOfLogLinesAllOption": "全部",
"AutoAnalysis.numberOfLogLinesDescription": "在ElasticSearch中应考虑的日志消息的前几行",
"IndexSettings.regenerateIndexDescription": "您已更改参数“日志行数”。此操作会影响分析结果。为了保证分析器能正常工作,请在ElasticSearch中重新生成索引。您想现在就重新生成吗?",
"IndexSettings.regenerateIndexProgress": "请稍候,正在生成新索引",
"IndexSettings.regenerateIndexTitle": "重新生成索引",
Expand Down Expand Up @@ -1037,6 +1043,7 @@
"IntegrationsCase.noIntegrationsDescription": "您的项目还没有任何集成",
"IntegrationsCase.noIntegrationsMessage": "无集成",
"IntegrationsDescription.ConnectionErrorMessage": "连接错误",
"IntegrationsDescription.GlobalIntegrationsSystemMessage": "Warning",
"IntegrationsDescription.GlobalIntegrationsSystemMessageModalCaption": "全局集成和项目集成不能同时工作。",
"IntegrationsDescription.GlobalIntegrationsSystemMessageModalText": "请注意!如果您创建了项目集成,全局集成将被取消关联!",
"IntegrationsDescription.GlobalIntegrationsSystemMessageText": "由于您已配置项目集成,全局集成将不会生效",
Expand All @@ -1048,8 +1055,6 @@
"IntegrationsDescription.noGlobalIntegrationsButtonAdd": "添加项目集成",
"IntegrationsDescription.noGlobalIntegrationsDescription": "未配置任何集成。您可以手动为此项目设置集成。",
"IntegrationsDescription.noGlobalIntegrationsMessage": "无集成",
"IntegrationsDescription.projectIntegrationCreate": "创建项目集成",
"ConnectionSection.deleteIntegrationDescription": "您确定要删除项目集成吗",
"IntegrationsDescription.projectIntegrationReset": "重置为全局集成",
"IntegrationsDescription.projectIntegrationResetDescription": "您确定要重置为全球集成吗?您的所有项目集成都将被永久删除。",
"IntegrationsDescription.projectIntegrationText": "项目集成已基于项目创建",
Expand Down Expand Up @@ -1479,7 +1484,6 @@
"NotPassedTestCasesTrendControls.ItemsValidationError": "测试项的数量应为1到600个",
"NotificationCase.attributesLabel": "属性(与)",
"NotificationCase.attributesLabelWithOperator": "属性({attributesOperator})",
"NotificationCase.attributesNote": "发送有关包含指定属性的测试任务的通知",
"NotificationCase.attributesOperatorAnd": "所有属性",
"NotificationCase.attributesOperatorNote": "通知是否启动具有所有或至少一个指定属性。",
"NotificationCase.attributesOperatorOr": "任一属性",
Expand Down Expand Up @@ -2055,6 +2059,9 @@
"UpdateAnalysisSettings.numbersInErrorLog": "删除错误日志中的数字",
"UpdateAnalysisSettings.uniqueError": "开关独特错误",
"UpdateAnalysisSettings.updated": "已更新",
"UpdateAutoPatternAnalysisSettings.description": "switch from {oldValue} to {newValue}.",
"UpdateAutoPatternAnalysisSettings.linkText": "Pattern-Analysis properties:",
"UpdateAutoPatternAnalysisSettings.updated": "updated",
"UserBlock.adminBadge": "管理",
"UserBlock.administrate": "管理",
"UserBlock.logout": "登出",
Expand All @@ -2075,8 +2082,9 @@
"WidgetCriteriaOption.aa_settings_actions": "更新自动分析设置",
"WidgetCriteriaOption.assign_user": "分配,邀请用户",
"WidgetCriteriaOption.attributes": "属性",
"WidgetCriteriaOption.change_role": "Change role",
"WidgetCriteriaOption.create_pattern": "创建模板",
"WidgetCriteriaOption.create_user": "添加、注册用户",
"WidgetCriteriaOption.create_project": "Create project",
"WidgetCriteriaOption.dashboards_actions": "更新报告面板",
"WidgetCriteriaOption.defects_actions": "更新缺陷类型",
"WidgetCriteriaOption.delete_launch": "删除测试任务",
Expand All @@ -2092,6 +2100,7 @@
"WidgetCriteriaOption.startTime": "开始时间",
"WidgetCriteriaOption.start_launch": "启动测试任务",
"WidgetCriteriaOption.unassign_user": "Unassign user",
"WidgetCriteriaOption.updateAutoPatternAnalysisSettings": "Update Pattern-Analysis settings",
"WidgetCriteriaOption.update_pattern": "更新模板",
"WidgetCriteriaOption.update_project": "更新项目设置",
"WidgetCriteriaOption.user": "用户",
Expand Down Expand Up @@ -2162,6 +2171,7 @@
"WizardInfoSection.addWidgetButton": "添加",
"WizardInfoSection.nextStepButton": "下一步",
"WizardInfoSection.prevStepButton": "上一步",
"administrateEventsPageToolbar.searchPlaceholder": "Search by user, action, object type, object name",
"administrateUsersPage.allUsers": "全部用户",
"administrateUsersPage.deleteModalContent": "您确定要删除用户{name}吗?",
"administrateUsersPage.deleteModalHeader": "删除用户",
Expand Down Expand Up @@ -2233,4 +2243,4 @@
"usersGrid.roleNonAdmin": "非管理",
"usersGrid.type": "类型",
"usersGrid.user": "登录"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ import styles from './attributeListFormField.scss';
const cx = className.bind(styles);

const messages = defineMessages({
attributesNote: {
id: 'AttributesContainer.attributesNote',
defaultMessage: 'Send notifications about launches containing specified attributes',
},
attributesNotActive: {
id: 'AttributesContainer.attributesNotActive',
defaultMessage: 'Attributes are non active. To activate please select checkbox ‘Attributes’',
Expand All @@ -54,11 +50,6 @@ export const AttributeListFormField = ({
}) => {
const { formatMessage } = useIntl();

const attributesCaption =
shown || (!shown && !value?.length)
? attributesNote || formatMessage(messages.attributesNote)
: formatMessage(messages.attributesNotActive);

const attributeControlHandler = (e) => {
setShowEditor(e.target.checked);
const filteredAttributes = value.reduce((acc, curr) => {
Expand All @@ -82,7 +73,9 @@ export const AttributeListFormField = ({
>
{formatMessage(messages.attributes)}
</Checkbox>
<div className={cx('description')}>{attributesCaption}</div>
<div className={cx('description')}>
{!shown && value?.length ? formatMessage(messages.attributesNotActive) : attributesNote}
</div>
<AttributeListContainer value={value} {...rest} />
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames/bind';
import { defineMessages, useIntl } from 'react-intl';
import { AttributeListContainer } from 'components/containers/attributeListContainer';
import { LAUNCH_CASES } from '../../notifications/constants';
import { ATTRIBUTES_OPERATORS, LAUNCH_CASES } from '../../notifications/constants';
import styles from './notificationRuleContent.scss';

const cx = classNames.bind(styles);
Expand All @@ -46,6 +46,14 @@ const messages = defineMessages({
id: 'AddEditNotificationCaseModal.attributesLabel',
defaultMessage: 'Attributes',
},
attributesLabelAll: {
id: 'AddEditNotificationCaseModal.attributesLabelAll',
defaultMessage: '(All attributes should match)',
},
attributesLabelAny: {
id: 'AddEditNotificationCaseModal.attributesLabelAny',
defaultMessage: '(Any attribute should match)',
},
[LAUNCH_CASES.ALWAYS]: {
id: 'AddEditNotificationCaseModal.dropdownValueAlways',
defaultMessage: 'Always',
Expand All @@ -72,12 +80,14 @@ const messages = defineMessages({
},
});

export const NotificationRuleContent = ({ item }) => {
export const NotificationRuleContent = ({
item: { informOwner, recipients, attributes, attributesOperator, launchNames, sendCase },
}) => {
const { formatMessage } = useIntl();

const recipients = item.informOwner
? [formatMessage(messages.launchOwner), ...item.recipients]
: item.recipients;
const recipientsValue = informOwner
? [formatMessage(messages.launchOwner), ...recipients]
: recipients;

const inCaseOptions = {
[LAUNCH_CASES.ALWAYS]: formatMessage(messages[LAUNCH_CASES.ALWAYS]),
Expand All @@ -88,23 +98,35 @@ export const NotificationRuleContent = ({ item }) => {
[LAUNCH_CASES.TO_INVESTIGATE]: formatMessage(messages[LAUNCH_CASES.TO_INVESTIGATE]),
};

const getAttributesFieldText = () => {
if (attributes.length > 1) {
return `${formatMessage(messages.attributesLabel)} ${formatMessage(
attributesOperator === ATTRIBUTES_OPERATORS.AND
? messages.attributesLabelAll
: messages.attributesLabelAny,
)}`;
} else {
return formatMessage(messages.attributesLabel);
}
};

return (
<div className={cx('info')}>
{item.launchNames.length > 0 && (
{launchNames.length > 0 && (
<>
<span className={cx('field')}>{formatMessage(messages.launchNameLabel)}</span>
<span className={cx('value')}>{item.launchNames.join(SEPARATOR)}</span>
<span className={cx('value')}>{launchNames.join(SEPARATOR)}</span>
</>
)}
<span className={cx('field')}>{formatMessage(messages.inCaseLabel)}</span>
<span className={cx('value')}>{inCaseOptions[item.sendCase]}</span>
<span className={cx('value')}>{inCaseOptions[sendCase]}</span>
<span className={cx('field')}>{formatMessage(messages.recipientsLabel)}</span>
<span className={cx('value')}>{recipients.join(SEPARATOR)}</span>
{item.attributes.length > 0 && (
<span className={cx('value')}>{recipientsValue.join(SEPARATOR)}</span>
{attributes.length > 0 && (
<>
<span className={cx('field')}>{formatMessage(messages.attributesLabel)}</span>
<span className={cx('field', 'attributes-text')}>{getAttributesFieldText()}</span>
<div className={cx('value')}>
<AttributeListContainer disabled attributes={item.attributes} />
<AttributeListContainer disabled attributes={attributes} />
</div>
</>
)}
Expand All @@ -118,5 +140,6 @@ NotificationRuleContent.propTypes = {
recipients: PropTypes.array,
attributes: PropTypes.array,
informOwner: PropTypes.bool,
attributesOperator: PropTypes.oneOf([ATTRIBUTES_OPERATORS.AND, ATTRIBUTES_OPERATORS.OR]),
}).isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@
color: $COLOR--almost-black;
margin-bottom: 16px;
}

.attributes-text {
text-transform: none;
}
Loading

0 comments on commit 1ef736d

Please sign in to comment.