diff --git a/app/localization/translated/be.json b/app/localization/translated/be.json index e69c0969a8..764850b21f 100644 --- a/app/localization/translated/be.json +++ b/app/localization/translated/be.json @@ -702,6 +702,8 @@ "EventActions.deletePattern": "Выдаленне шаблону", "EventActions.deleteWidget": "Выдаленне віджэта", "EventActions.import": "Імпарт", + "EventActions.startImport": "Пачаць імпарт", + "EventActions.finishImport": "Скончыць імпарт", "EventActions.finishLaunch": "Канчатак запуску", "EventActions.generateIndex": "Генерацыя індэкса", "EventActions.linkIssue": "Прывязка праблемы", diff --git a/app/localization/translated/ru.json b/app/localization/translated/ru.json index 5d1361816d..821eae49ef 100644 --- a/app/localization/translated/ru.json +++ b/app/localization/translated/ru.json @@ -699,6 +699,8 @@ "EventActions.deletePattern": "Удаление шаблона", "EventActions.deleteWidget": "Удаление виджета", "EventActions.import": "Импорт", + "EventActions.startImport": "Начать импорт", + "EventActions.finishImport": "Закончить импорт", "EventActions.finishLaunch": "Окончание запуска", "EventActions.generateIndex": "Генерация индекса", "EventActions.linkIssue": "Привязка ошибки", diff --git a/app/localization/translated/uk.json b/app/localization/translated/uk.json index 490cc577b7..5caec2e1f8 100644 --- a/app/localization/translated/uk.json +++ b/app/localization/translated/uk.json @@ -700,6 +700,8 @@ "EventActions.deletePattern": "Видалення шаблону", "EventActions.deleteWidget": "Видалення міні-програми", "EventActions.import": "Імпорт", + "EventActions.startImport": "Розпочати імпорт", + "EventActions.finishImport": "Завершити імпорт", "EventActions.finishLaunch": "Закінчення запуску", "EventActions.generateIndex": "Генерація індексу", "EventActions.linkIssue": "Прив’язка помилки", diff --git a/app/localization/translated/zh.json b/app/localization/translated/zh.json index 8cb8ceedbf..7f6187011d 100644 --- a/app/localization/translated/zh.json +++ b/app/localization/translated/zh.json @@ -696,6 +696,8 @@ "EventActions.deletePattern": "删除模板规则", "EventActions.deleteWidget": "删除小部件", "EventActions.import": "导入", + "EventActions.startImport": "Start import", + "EventActions.finishImport": "Finish import", "EventActions.finishLaunch": "完成测试任务", "EventActions.generateIndex": "生成索引", "EventActions.linkIssue": "与问题关联", diff --git a/app/src/common/constants/actionTypes.js b/app/src/common/constants/actionTypes.js index 8af904a159..3abfa9ce03 100644 --- a/app/src/common/constants/actionTypes.js +++ b/app/src/common/constants/actionTypes.js @@ -43,7 +43,6 @@ export const DELETE_INDEX = 'deleteIndex'; export const CREATE_DEFECT = 'createDefect'; export const UPDATE_DEFECT = 'updateDefect'; export const DELETE_DEFECT = 'deleteDefect'; -export const IMPORT = 'import'; export const START_IMPORT = 'startImport'; export const FINISH_IMPORT = 'finishImport'; export const UPDATE_ITEM = 'updateItem'; @@ -56,6 +55,7 @@ export const DELETE_PATTERN = 'deletePattern'; export const MATCHED_PATTERN = 'patternMatched'; export const CREATE_PROJECT = 'createProject'; export const CREATE_INVITATION_LINK = 'createInvitationLink'; +export const IMPORT = 'import'; // grouped actions export const ACTIONS_WITH_ISSUES = 'issuesActions'; diff --git a/app/src/common/constants/localization/eventsLocalization.js b/app/src/common/constants/localization/eventsLocalization.js index 002473adcd..0ef64b9c8f 100644 --- a/app/src/common/constants/localization/eventsLocalization.js +++ b/app/src/common/constants/localization/eventsLocalization.js @@ -44,7 +44,6 @@ import { START_LAUNCH, FINISH_LAUNCH, DELETE_LAUNCH, - IMPORT as EVENT_ACTIONS_IMPORT, UPDATE_PROJECT, CREATE_DEFECT, UPDATE_DEFECT, @@ -71,6 +70,9 @@ import { CREATE_PROJECT, UPDATE_AUTO_PATTERN_ANALYSIS_SETTINGS, CREATE_INVITATION_LINK, + IMPORT as EVENT_ACTIONS_IMPORT, + FINISH_IMPORT, + START_IMPORT, } from 'common/constants/actionTypes'; export const actionMessages = defineMessages({ @@ -123,9 +125,17 @@ export const actionMessages = defineMessages({ defaultMessage: 'Delete launch', }, [EVENT_ACTIONS_IMPORT]: { - id: 'EventActions.startImport', + id: 'EventActions.import', defaultMessage: 'Import', }, + [START_IMPORT]: { + id: 'EventActions.startImport', + defaultMessage: 'Start import', + }, + [FINISH_IMPORT]: { + id: 'EventActions.finishImport', + defaultMessage: 'Finish import', + }, [ASSIGN_USER]: { id: 'EventActions.assignUser', defaultMessage: 'Assign user', diff --git a/app/src/components/filterEntities/entityDropdown.jsx b/app/src/components/filterEntities/entityDropdown.jsx index 6f096c61ad..9919f1a066 100644 --- a/app/src/components/filterEntities/entityDropdown.jsx +++ b/app/src/components/filterEntities/entityDropdown.jsx @@ -19,6 +19,8 @@ import PropTypes from 'prop-types'; import track from 'react-tracking'; import { InputDropdown } from 'components/inputs/inputDropdown'; import { FieldFilterEntity } from 'components/fields/fieldFilterEntity'; +import { GROUP_TO_ACTION_MAP } from 'common/constants/actionTypes'; +import { arrayRemoveDoubles } from 'common/utils'; @track() export class EntityDropdown extends Component { @@ -51,17 +53,23 @@ export class EntityDropdown extends Component { events: {}, }; + formatActionTypes = ({ value }, actionToGroup = {}) => + arrayRemoveDoubles(value.split(',').map((action) => actionToGroup[action] || action)); + + parseActionTypes = (value) => value.map((group) => GROUP_TO_ACTION_MAP[group] || group).join(','); + getValue = () => { const { value, - customProps: { multiple }, + customProps: { multiple, actionToGroup }, } = this.props; if (!multiple) { return value.value; } else if (!value.value) { return []; } - return value.value.split(','); + + return this.formatActionTypes(value, actionToGroup); }; getOptionLabelByValue = (value) => { @@ -83,9 +91,10 @@ export class EntityDropdown extends Component { const label = this.getOptionLabelByValue(value); tracking.trackEvent(events.getChangeFilterEvent(title, label)); } + this.props.onChange({ condition: this.props.value.condition, - value: multiple ? value.join(',') : value, + value: multiple ? this.parseActionTypes(value) : value, }); }; diff --git a/app/src/pages/admin/projectEventsPage/eventsEntities.jsx b/app/src/pages/admin/projectEventsPage/eventsEntities.jsx index b70112fe19..96f2762a69 100644 --- a/app/src/pages/admin/projectEventsPage/eventsEntities.jsx +++ b/app/src/pages/admin/projectEventsPage/eventsEntities.jsx @@ -66,7 +66,7 @@ import { CREATE_DEFECT, UPDATE_DEFECT, DELETE_DEFECT, - IMPORT as EVENT_ACTIONS_IMPORT, + ACTIONS_WITH_IMPORT, UPDATE_ITEM, LINK_ISSUE_AA, ANALYZE_ITEM, @@ -80,6 +80,9 @@ import { CHANGE_ROLE, UPDATE_AUTO_PATTERN_ANALYSIS_SETTINGS, CREATE_PROJECT, + IMPORT as EVENT_ACTIONS_IMPORT, + START_IMPORT, + FINISH_IMPORT, } from 'common/constants/actionTypes'; import { DASHBOARD, @@ -167,6 +170,10 @@ export class EventsEntities extends Component { customProps: { multiple: true, selectAll: true, + actionToGroup: { + [START_IMPORT]: ACTIONS_WITH_IMPORT, + [FINISH_IMPORT]: ACTIONS_WITH_IMPORT, + }, options: [ { label: intl.formatMessage(actionMessages[CREATE_DASHBOARD]), @@ -286,7 +293,7 @@ export class EventsEntities extends Component { }, { label: intl.formatMessage(actionMessages[EVENT_ACTIONS_IMPORT]), - value: EVENT_ACTIONS_IMPORT, + value: ACTIONS_WITH_IMPORT, }, { label: intl.formatMessage(actionMessages[UPDATE_ITEM]),