From ee77582a975c11c4f83bf6bad090cd92a2ab1499 Mon Sep 17 00:00:00 2001 From: Ilya Date: Wed, 17 Jan 2024 23:52:27 +0100 Subject: [PATCH] EPMRPP-89037 || Test item details modal. Track description change via GA (#3728) --- .../testItemPages/modalEventsCreators.js | 20 +++---------------- .../events/uniqueErrorsPageEvents.js | 2 ++ .../testItemDetailsModal.jsx | 16 +++++++-------- app/src/pages/inside/stepPage/stepPage.jsx | 2 +- .../uniqueErrorsPage/uniqueErrorsPage.jsx | 10 +++++----- 5 files changed, 18 insertions(+), 32 deletions(-) diff --git a/app/src/components/main/analytics/events/common/testItemPages/modalEventsCreators.js b/app/src/components/main/analytics/events/common/testItemPages/modalEventsCreators.js index 5d55547a7e..755cf9ec06 100644 --- a/app/src/components/main/analytics/events/common/testItemPages/modalEventsCreators.js +++ b/app/src/components/main/analytics/events/common/testItemPages/modalEventsCreators.js @@ -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'; @@ -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, + }), }; }; diff --git a/app/src/components/main/analytics/events/uniqueErrorsPageEvents.js b/app/src/components/main/analytics/events/uniqueErrorsPageEvents.js index 4ab46c142a..1f49a1bba4 100644 --- a/app/src/components/main/analytics/events/uniqueErrorsPageEvents.js +++ b/app/src/components/main/analytics/events/uniqueErrorsPageEvents.js @@ -46,6 +46,7 @@ import { getPostIssueModalEvents, getUnlinkIssueModalEvents, getIgnoreBtnIgnoreItemsInAAModalEvent, + getEditItemDetailsModalEvents, } from './common/testItemPages/modalEventsCreators'; export const UNIQUE_ERRORS_PAGE = 'unique_errors'; @@ -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, diff --git a/app/src/pages/inside/stepPage/modals/testItemDetailsModal/testItemDetailsModal.jsx b/app/src/pages/inside/stepPage/modals/testItemDetailsModal/testItemDetailsModal.jsx index 00ee288df1..8ab42c7b1b 100644 --- a/app/src/pages/inside/stepPage/modals/testItemDetailsModal/testItemDetailsModal.jsx +++ b/app/src/pages/inside/stepPage/modals/testItemDetailsModal/testItemDetailsModal.jsx @@ -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, @@ -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), diff --git a/app/src/pages/inside/stepPage/stepPage.jsx b/app/src/pages/inside/stepPage/stepPage.jsx index 11cde22120..3b63466ac5 100644 --- a/app/src/pages/inside/stepPage/stepPage.jsx +++ b/app/src/pages/inside/stepPage/stepPage.jsx @@ -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: () => diff --git a/app/src/pages/inside/uniqueErrorsPage/uniqueErrorsPage.jsx b/app/src/pages/inside/uniqueErrorsPage/uniqueErrorsPage.jsx index 8cb3926bae..38948cef17 100644 --- a/app/src/pages/inside/uniqueErrorsPage/uniqueErrorsPage.jsx +++ b/app/src/pages/inside/uniqueErrorsPage/uniqueErrorsPage.jsx @@ -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, }, }, });