Skip to content

Commit

Permalink
EPMRPP-89037 || Test item details modal. Track description change via…
Browse files Browse the repository at this point in the history
… GA (#3728)
  • Loading branch information
AmsterGet authored Jan 17, 2024
1 parent a2b0a4c commit ee77582
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,21 +316,6 @@ export const getEditItemsModalEvents = (category, itemType = 'Item') => ({
action: `Edit description in Modal "Edit ${itemType}"`,
label: 'Edit description',
},
DETAILS_TAB_EVENT: {
category,
action: `Click on tab "Details" on modal "Test item details"`,
label: 'Open tab "Details"',
},
STACK_TRACE_TAB_EVENT: {
category,
action: `Click on tab "Stack trace" on modal "Test item details"`,
label: 'Open tab "Stack trace"',
},
ADD_ATTRIBUTE: {
category,
action: 'Click on add new attributes on modal "Test item details"',
label: 'Add attributes',
},
});

const TEST_ITEM_DETAILS_MODAL = 'test_item_details';
Expand All @@ -355,10 +340,11 @@ export const getEditItemDetailsModalEvents = (category) => {
modal,
icon_name: 'arrow_to_expand',
},
SAVE_BTN: {
getSaveBtnEvent: (isDescriptionUpdated) => ({
...basicClickEventParams,
modal,
element_name: 'save',
},
link_name: isDescriptionUpdated,
}),
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
getPostIssueModalEvents,
getUnlinkIssueModalEvents,
getIgnoreBtnIgnoreItemsInAAModalEvent,
getEditItemDetailsModalEvents,
} from './common/testItemPages/modalEventsCreators';

export const UNIQUE_ERRORS_PAGE = 'unique_errors';
Expand Down Expand Up @@ -92,6 +93,7 @@ export const UNIQUE_ERRORS_PAGE_EVENTS = {
onClickIssueTicketEvent: getClickIssueTicketEvent(UNIQUE_ERRORS_PAGE),
MAKE_DECISION_MODAL_EVENTS: getMakeDecisionModalEvents(UNIQUE_ERRORS_PAGE),
EDIT_ITEMS_MODAL_EVENTS: getEditItemsModalEvents(UNIQUE_ERRORS_PAGE),
EDIT_ITEM_DETAILS_MODAL_EVENTS: getEditItemDetailsModalEvents(UNIQUE_ERRORS_PAGE),
CLICK_EXPAND_STACK_TRACE_ARROW: getClickExpandStackTraceArrowEvent(UNIQUE_ERRORS_PAGE),
getClickOnDeleteBtnDeleteItemModalEvent: getClickOnDeleteBtnDeleteItemModalEventCreator(
UNIQUE_ERRORS_PAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,26 +178,25 @@ export class TestItemDetailsModal extends Component {
updateItemAndCloseModal = (closeModal) => (formData) => {
const {
dirty,
data: { eventsInfo },
data: { item, eventsInfo },
tracking,
} = this.props;
dirty && this.updateItem(formData);
closeModal();
eventsInfo.clickSaveEvent && tracking.trackEvent(eventsInfo.clickSaveEvent);

if (eventsInfo.getSaveBtnEvent) {
const isDescriptionUpdated = item.description !== formData.description;
tracking.trackEvent(eventsInfo.getSaveBtnEvent(isDescriptionUpdated));
}
};

updateItem = (data) => {
const {
intl: { formatMessage },
currentProject,
data: { item, type, fetchFunc, eventsInfo },
tracking,
data: { item, type, fetchFunc },
} = this.props;

if (item.description !== data.description) {
tracking.trackEvent(eventsInfo.editDescription);
}

fetch(URLS.launchesItemsUpdate(currentProject, item.id, type), {
method: 'put',
data,
Expand Down Expand Up @@ -362,7 +361,6 @@ export class TestItemDetailsModal extends Component {
onClick: (closeModal) => {
handleSubmit(this.updateItemAndCloseModal(closeModal))();
},
eventInfo: eventsInfo.saveBtn,
};
const cancelButton = {
text: intl.formatMessage(COMMON_LOCALE_KEYS.CANCEL),
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/inside/stepPage/stepPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class StepPage extends Component {
type: LAUNCH_ITEM_TYPES.item,
fetchFunc: this.props.fetchTestItemsAction,
eventsInfo: {
saveBtn: STEP_PAGE_EVENTS.EDIT_ITEM_DETAILS_MODAL_EVENTS.SAVE_BTN,
getSaveBtnEvent: STEP_PAGE_EVENTS.EDIT_ITEM_DETAILS_MODAL_EVENTS.getSaveBtnEvent,
detailsTab: STEP_PAGE_EVENTS.EDIT_ITEM_DETAILS_MODAL_EVENTS.DETAILS_TAB,
stackTraceTab: STEP_PAGE_EVENTS.EDIT_ITEM_DETAILS_MODAL_EVENTS.STACK_TRACE_TAB,
onOpenStackTraceEvent: () =>
Expand Down
10 changes: 5 additions & 5 deletions app/src/pages/inside/uniqueErrorsPage/uniqueErrorsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ export class UniqueErrorsPage extends Component {
type: LAUNCH_ITEM_TYPES.item,
fetchFunc: this.unselectAndFetchItems,
eventsInfo: {
stackTraceTab: UNIQUE_ERRORS_PAGE_EVENTS.EDIT_ITEMS_MODAL_EVENTS.STACK_TRACE_TAB_EVENT,
addAttribute: UNIQUE_ERRORS_PAGE_EVENTS.EDIT_ITEMS_MODAL_EVENTS.ADD_ATTRIBUTE,
clickSaveEvent:
UNIQUE_ERRORS_PAGE_EVENTS.EDIT_ITEMS_MODAL_EVENTS.SAVE_BTN_EDIT_ITEM_MODAL,
onOpenStackTraceEvent: () => UNIQUE_ERRORS_PAGE_EVENTS.CLICK_EXPAND_STACK_TRACE_ARROW,
getSaveBtnEvent: UNIQUE_ERRORS_PAGE_EVENTS.EDIT_ITEM_DETAILS_MODAL_EVENTS.getSaveBtnEvent,
detailsTab: UNIQUE_ERRORS_PAGE_EVENTS.EDIT_ITEM_DETAILS_MODAL_EVENTS.DETAILS_TAB,
stackTraceTab: UNIQUE_ERRORS_PAGE_EVENTS.EDIT_ITEM_DETAILS_MODAL_EVENTS.STACK_TRACE_TAB,
onOpenStackTraceEvent: () =>
UNIQUE_ERRORS_PAGE_EVENTS.EDIT_ITEM_DETAILS_MODAL_EVENTS.EXPAND_STACK_TRACE,
},
},
});
Expand Down

0 comments on commit ee77582

Please sign in to comment.