Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-95676 || Add events for the search field and filter #4194

Merged
merged 5 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/src/components/main/analytics/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,12 @@ export const baseEventParametersShape = PropTypes.shape({
projectInfoId: PropTypes.number.isRequired,
isAdmin: PropTypes.bool.isRequired,
}).isRequired;

export const getFilterProps = (fields, conditionProp) => {
AmsterGet marked this conversation as resolved.
Show resolved Hide resolved
const type = Object.keys(fields)
.filter((field) => fields[field].value)
.join('#');
const condition = fields[conditionProp]?.value;

return { type, condition };
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
getTimeRange,
messages as helpMessage,
} from 'components/main/filterButton';
import { getFilterProps } from 'components/main/analytics/utils';
import { messages } from './messages';

export const OrganizationsFilter = ({
Expand Down Expand Up @@ -98,10 +99,7 @@ export const OrganizationsFilter = ({
};

const eventHandler = (fields) => {
const type = Object.keys(fields)
.filter((field) => fields[field].value)
.join('#');
const condition = fields[LAST_RUN_DATE_FILTER_NAME]?.value;
const { type, condition } = getFilterProps(fields, LAST_RUN_DATE_FILTER_NAME);

return ORGANIZATION_PAGE_EVENTS.clickApplyFilterButton(type, condition);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
} from 'components/main/filterButton';
import { fetchFilteredProjectAction } from 'controllers/organization/projects';
import { PROJECTS_PAGE_EVENTS } from 'components/main/analytics/events/ga4Events/projectsPageEvents';
import { getFilterProps } from 'components/main/analytics/utils';
import { messages } from './messages';

export const ProjectsFilter = ({
Expand Down Expand Up @@ -98,10 +99,7 @@ export const ProjectsFilter = ({
};

const eventHandler = (fields) => {
const type = Object.keys(fields)
.filter((field) => fields[field].value)
.join('#');
const condition = fields[LAST_RUN_DATE_FILTER_NAME]?.value;
const { type, condition } = getFilterProps(fields, LAST_RUN_DATE_FILTER_NAME);

return PROJECTS_PAGE_EVENTS.clickApplyFilterButton(type, condition);
};
Expand Down
Loading