Skip to content

Commit

Permalink
EPMRPP-93588 || Add events for category "Plugins", "Unique Errors", "…
Browse files Browse the repository at this point in the history
…Log" (#3956)

* EPMRPP-93588 || Add events for category "Plugins", "Unique Errors", "Log"

* EPMRPP-93588 || remove extra event

* EPMRPP-93483 || small adjustments

* EPMRPP-93588 || code review fix - 1
  • Loading branch information
maria-hambardzumian authored Aug 9, 2024
1 parent 0d7f66c commit 6d0856c
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export class InstancesSection extends Component {
cancelText: formatMessage(COMMON_LOCALE_KEYS.CANCEL),
dangerConfirm: true,
eventsInfo: {
confirmBtn: PLUGINS_PAGE_EVENTS.OK_BTN_UNINSTALL_PLUGIN_MODAL,
confirmBtn: PLUGINS_PAGE_EVENTS.clickConfirmUninstallPlugin(instanceType),
closeIcon: PLUGINS_PAGE_EVENTS.CLOSE_ICON_UNINSTALL_PLUGIN_MODAL,
cancelBtn: PLUGINS_PAGE_EVENTS.CANCEL_BTN_UNINSTALL_PLUGIN_MODAL,
},
Expand Down
5 changes: 5 additions & 0 deletions app/src/components/main/analytics/events/logPageEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ export const LOG_PAGE_EVENTS = {
icon_name: `${viewMode}_mode`,
status: isActive ? 'on' : 'off',
}),
getClickOnLogMicrosecondPrecisionEvent: (isActive) => ({
...basicLogPageClickEventParameters,
element_name: 'microseconds',
switcher: isActive ? 'on' : 'off',
}),
CLICK_JUMP_TO_ERROR_LOG: {
...basicLogPageClickEventParameters,
place: 'stack_trace',
Expand Down
27 changes: 22 additions & 5 deletions app/src/components/main/analytics/events/pluginsPageEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,28 @@ export const PLUGINS_PAGE_EVENTS = {
element_name: 'add_integration',
type: normalizeEventParameter(type),
}),
navigatedInPluginsFilterList: (filterName) => ({
...BASIC_PLUGINS_EVENT_PARAMS,
element_name: normalizeEventParameter(filterName),
}),
clickConfirmUninstallPlugin: (pluginName) => ({
...BASIC_PLUGINS_EVENT_PARAMS,
element_name: 'uninstall',
modal: 'uninstall_plugin',
type: normalizeEventParameter(pluginName),
}),
clickDisablePlugin: (pluginName) => ({
...BASIC_PLUGINS_EVENT_PARAMS,
element_name: 'disable',
modal: 'disable_plugin',
type: normalizeEventParameter(pluginName),
}),
clickEnablePlugin: (pluginName) => ({
...BASIC_PLUGINS_EVENT_PARAMS,
element_name: 'enable',
modal: 'enable_plugin',
type: normalizeEventParameter(pluginName),
}),
// GA 3
CANCEL_BTN_UPLOAD_MODAL: {
category: PLUGINS_MODAL,
Expand Down Expand Up @@ -109,11 +131,6 @@ export const PLUGINS_PAGE_EVENTS = {
action: 'Click on Btn Cancel on Modal "Uninstall Plugin"',
label: 'Close Modal Uninstall Plugin',
},
OK_BTN_UNINSTALL_PLUGIN_MODAL: {
category: PLUGINS_MODAL,
action: 'Click on Btn Uninstall on Modal "Uninstall Plugin"',
label: 'Uninstall Plugin',
},
clickSaveEditAuthorizationBtn: getClickSaveBtnEditAuthorizationEvent(PLUGINS_MODAL),
clickDeleteBtnRemoveIntegration: getClickDeleteBtnRemoveIntegrationEvent(PLUGINS_MODAL),
pluginInstanceItemClick: getPluginInstanceItemClickEvent(PLUGINS_PAGE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export const UNIQUE_ERRORS_PAGE_EVENTS = {
...basicUniqueErrorsPageClickEventParameters,
icon_name: 'expand_error',
},
CLICK_MATCHED_TESTS_HEADER_CELL: {
...basicUniqueErrorsPageClickEventParameters,
icon_name: 'matched_tests',
},
TEST_ITEM_TABS_EVENTS: getClickOnTestItemsTabsEvents(UNIQUE_ERRORS_PAGE),
getChangeItemStatusEvent: getChangeItemStatusEventCreator(UNIQUE_ERRORS_PAGE),
POST_ISSUE_ACTION: getPostIssueActionEvent(UNIQUE_ERRORS_PAGE),
Expand Down
67 changes: 32 additions & 35 deletions app/src/pages/admin/pluginsPage/pluginsFilter/pluginsFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,46 @@
* limitations under the License.
*/

import React, { Component, Fragment } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { useTracking } from 'react-tracking';
import classNames from 'classnames/bind';
import { getPluginsFilter } from 'common/constants/pluginsFilter';
import { PLUGINS_PAGE_EVENTS } from 'components/main/analytics/events';
import styles from './pluginsFilter.scss';

const cx = classNames.bind(styles);

export class PluginsFilter extends Component {
static propTypes = {
filterItems: PropTypes.array.isRequired,
onFilterChange: PropTypes.func.isRequired,
activeItem: PropTypes.string.isRequired,
};

getFilterItems = () => getPluginsFilter(this.props.filterItems);
export const PluginsFilter = ({ filterItems, onFilterChange, activeItem }) => {
const { trackEvent } = useTracking();
const getFilterItems = () => getPluginsFilter(filterItems);

changeFilterItem = (e) => {
const changeFilterItem = (e) => {
e.preventDefault();
this.props.onFilterChange(e.currentTarget.id);
};

generateItems = () => {
const { activeItem } = this.props;

return (
<ul className={cx('plugins-filter-list')}>
{this.getFilterItems().map((item) => (
<li key={item.value} className={cx('plugins-filter-item')}>
<button
className={cx('plugins-filter-button', { active: activeItem === item.value })}
onClick={this.changeFilterItem}
id={item.value}
>
{item.label}
</button>
</li>
))}
</ul>
);
const { id } = e.currentTarget;
trackEvent(PLUGINS_PAGE_EVENTS.navigatedInPluginsFilterList(id));
onFilterChange(id);
};

render() {
return <Fragment>{this.generateItems()}</Fragment>;
}
}
return (
<ul className={cx('plugins-filter-list')}>
{getFilterItems().map((item) => (
<li key={item.value} className={cx('plugins-filter-item')}>
<button
className={cx('plugins-filter-button', { active: activeItem === item.value })}
onClick={changeFilterItem}
id={item.value}
>
{item.label}
</button>
</li>
))}
</ul>
);
};

PluginsFilter.propTypes = {
filterItems: PropTypes.array.isRequired,
onFilterChange: PropTypes.func.isRequired,
activeItem: PropTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ export class InstalledTab extends Component {
title: formatMessage(messages.enablePluginTitle),
confirmText: formatMessage(COMMON_LOCALE_KEYS.ENABLE),
cancelText: formatMessage(COMMON_LOCALE_KEYS.CANCEL),
eventsInfo: {
confirmBtn: PLUGINS_PAGE_EVENTS.clickEnablePlugin(pluginName),
},
},
});
};
Expand All @@ -167,6 +170,9 @@ export class InstalledTab extends Component {
title: formatMessage(messages.disablePluginTitle),
confirmText: formatMessage(COMMON_LOCALE_KEYS.DISABLE),
cancelText: formatMessage(COMMON_LOCALE_KEYS.CANCEL),
eventsInfo: {
confirmBtn: PLUGINS_PAGE_EVENTS.clickDisablePlugin(pluginName),
},
},
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,30 @@

import React from 'react';
import PropTypes from 'prop-types';
import { useTracking } from 'react-tracking';
import classNames from 'classnames/bind';
import { dateFormat, getMicroSeconds } from 'common/utils/timeDateUtils';
import { LOG_TIME_FORMAT_ABSOLUTE, LOG_TIME_FORMAT_EXTENDED } from 'controllers/user/constants';
import { useDispatch, useSelector } from 'react-redux';
import { setLogTimeFormatAction, userIdSelector } from 'controllers/user';
import { logTimeFormatSelector } from 'controllers/user/selectors';
import { setLogTimeFormatInStorage } from 'controllers/log/storageUtils';
import { LOG_PAGE_EVENTS } from 'components/main/analytics/events';
import styles from './flexibleLogTime.scss';

const cx = classNames.bind(styles);

export const FlexibleLogTime = ({ time }) => {
const dispatch = useDispatch();
const { trackEvent } = useTracking();
const logTimeFormat = useSelector(logTimeFormatSelector);
const userId = useSelector(userIdSelector);

const isAbsolute = () => logTimeFormat === LOG_TIME_FORMAT_ABSOLUTE;
const toggleFormat = () => {
const format = isAbsolute() ? LOG_TIME_FORMAT_EXTENDED : LOG_TIME_FORMAT_ABSOLUTE;
const hasAbsoluteState = isAbsolute();
const format = hasAbsoluteState ? LOG_TIME_FORMAT_EXTENDED : LOG_TIME_FORMAT_ABSOLUTE;
trackEvent(LOG_PAGE_EVENTS.getClickOnLogMicrosecondPrecisionEvent(hasAbsoluteState));
dispatch(setLogTimeFormatAction(format));
setLogTimeFormatInStorage(userId, format);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { NAMESPACE } from 'controllers/uniqueErrors';
import { querySelector } from 'controllers/pages';
import { ExtensionLoader } from 'components/extensionLoader';
import { SORTING_DESC, withSortingURL } from 'controllers/sorting';
import { UNIQUE_ERRORS_PAGE_EVENTS } from 'components/main/analytics/events';
import { EmptyUniqueErrors } from '../emptyUniqueErrors';
import { ClusterItemsGridRow } from './clusterItemsGridRow';
import styles from './uniqueErrorsGrid.scss';
Expand Down Expand Up @@ -90,6 +91,7 @@ export const UniqueErrorsGridWrapped = ({ parentLaunch, data, loading, ...rest }
customProps: {
gridHeaderCellStyles: cx('matched-header'),
},
sortingEventInfo: UNIQUE_ERRORS_PAGE_EVENTS.CLICK_MATCHED_TESTS_HEADER_CELL,
});

return (
Expand Down

0 comments on commit 6d0856c

Please sign in to comment.