Skip to content

Commit

Permalink
EPMRPP-86766 || Fix import event (#3594)
Browse files Browse the repository at this point in the history
Co-authored-by: Dzmitry Kosarau <Dzmitry_Kosarau@epam.com>
  • Loading branch information
BlazarQSO and Dzmitry Kosarau authored Sep 29, 2023
1 parent 5e97234 commit ed7ac76
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/localization/translated/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"EventActions.deletePattern": "Выдаленне шаблону",
"EventActions.deleteWidget": "Выдаленне віджэта",
"EventActions.import": "Імпарт",
"EventActions.startImport": "Пачаць імпарт",
"EventActions.finishImport": "Скончыць імпарт",
"EventActions.finishLaunch": "Канчатак запуску",
"EventActions.generateIndex": "Генерацыя індэкса",
"EventActions.linkIssue": "Прывязка праблемы",
Expand Down
2 changes: 2 additions & 0 deletions app/localization/translated/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@
"EventActions.deletePattern": "Удаление шаблона",
"EventActions.deleteWidget": "Удаление виджета",
"EventActions.import": "Импорт",
"EventActions.startImport": "Начать импорт",
"EventActions.finishImport": "Закончить импорт",
"EventActions.finishLaunch": "Окончание запуска",
"EventActions.generateIndex": "Генерация индекса",
"EventActions.linkIssue": "Привязка ошибки",
Expand Down
2 changes: 2 additions & 0 deletions app/localization/translated/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,8 @@
"EventActions.deletePattern": "Видалення шаблону",
"EventActions.deleteWidget": "Видалення міні-програми",
"EventActions.import": "Імпорт",
"EventActions.startImport": "Розпочати імпорт",
"EventActions.finishImport": "Завершити імпорт",
"EventActions.finishLaunch": "Закінчення запуску",
"EventActions.generateIndex": "Генерація індексу",
"EventActions.linkIssue": "Прив’язка помилки",
Expand Down
2 changes: 2 additions & 0 deletions app/localization/translated/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@
"EventActions.deletePattern": "删除模板规则",
"EventActions.deleteWidget": "删除小部件",
"EventActions.import": "导入",
"EventActions.startImport": "Start import",
"EventActions.finishImport": "Finish import",
"EventActions.finishLaunch": "完成测试任务",
"EventActions.generateIndex": "生成索引",
"EventActions.linkIssue": "与问题关联",
Expand Down
2 changes: 1 addition & 1 deletion app/src/common/constants/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down
14 changes: 12 additions & 2 deletions app/src/common/constants/localization/eventsLocalization.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
START_LAUNCH,
FINISH_LAUNCH,
DELETE_LAUNCH,
IMPORT as EVENT_ACTIONS_IMPORT,
UPDATE_PROJECT,
CREATE_DEFECT,
UPDATE_DEFECT,
Expand All @@ -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({
Expand Down Expand Up @@ -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',
Expand Down
15 changes: 12 additions & 3 deletions app/src/components/filterEntities/entityDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) => {
Expand All @@ -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,
});
};

Expand Down
11 changes: 9 additions & 2 deletions app/src/pages/admin/projectEventsPage/eventsEntities.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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]),
Expand Down Expand Up @@ -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]),
Expand Down

0 comments on commit ed7ac76

Please sign in to comment.