From 372a8a74c882d46e5a040c7eb118bbf919832a2d Mon Sep 17 00:00:00 2001 From: Siarhei Iukou Date: Tue, 10 Dec 2024 13:58:35 +0300 Subject: [PATCH] EPMRPP-91556 || Code Review fix - 4 --- app/src/components/filterEntities/utils.js | 2 +- app/src/controllers/instance/organizations/sagas.js | 8 ++++---- app/src/controllers/instance/organizations/selectors.js | 7 ------- app/src/controllers/organization/projects/sagas.js | 8 ++++---- app/src/controllers/organization/projects/selectors.js | 7 ------- 5 files changed, 9 insertions(+), 23 deletions(-) diff --git a/app/src/components/filterEntities/utils.js b/app/src/components/filterEntities/utils.js index 7fadd24f55..2f91d5a774 100644 --- a/app/src/components/filterEntities/utils.js +++ b/app/src/components/filterEntities/utils.js @@ -62,7 +62,7 @@ const getFormattedDate = (value) => { return `${getMinutesFromTimestamp(start)};${getMinutesFromTimestamp(endOfToday)};${utcString}`; }; -export const updateFormatDate = (filtersParams) => { +export const prepareQueryFilters = (filtersParams) => { const { limit, sort, offset, order, ...rest } = filtersParams; const searchCriteria = getAppliedFilters(rest)?.search_criterias; diff --git a/app/src/controllers/instance/organizations/sagas.js b/app/src/controllers/instance/organizations/sagas.js index e84a248b7f..eecdfacf16 100644 --- a/app/src/controllers/instance/organizations/sagas.js +++ b/app/src/controllers/instance/organizations/sagas.js @@ -18,8 +18,8 @@ import { takeEvery, all, put, select } from 'redux-saga/effects'; import { URLS } from 'common/urls'; import { showDefaultErrorNotification } from 'controllers/notification'; import { fetchDataAction } from 'controllers/fetch'; -import { updateFormatDate } from 'components/filterEntities/utils'; -import { filterQuerySelector, querySelector } from './selectors'; +import { prepareQueryFilters } from 'components/filterEntities/utils'; +import { querySelector } from './selectors'; import { FETCH_ORGANIZATIONS, FETCH_FILTERED_ORGANIZATIONS, NAMESPACE } from './constants'; function* fetchOrganizations() { @@ -37,8 +37,8 @@ function* watchFetchOrganizations() { } function* fetchFilteredOrganizations() { - const filtersParams = yield select(filterQuerySelector); - const data = updateFormatDate(filtersParams); + const filtersParams = yield select(querySelector); + const data = prepareQueryFilters(filtersParams); yield put( fetchDataAction(NAMESPACE)(URLS.organizationSearches(), { diff --git a/app/src/controllers/instance/organizations/selectors.js b/app/src/controllers/instance/organizations/selectors.js index f69cae3ebb..13c96e87e3 100644 --- a/app/src/controllers/instance/organizations/selectors.js +++ b/app/src/controllers/instance/organizations/selectors.js @@ -33,10 +33,3 @@ export const querySelector = createAlternativeQueryParametersSelector({ sortingKey: SORTING_KEY, namespace: NAMESPACE, }); - -export const filterQuerySelector = createAlternativeQueryParametersSelector({ - defaultPagination: DEFAULT_PAGINATION, - defaultSorting: SORTING_ASC, - sortingKey: SORTING_KEY, - namespace: NAMESPACE, -}); diff --git a/app/src/controllers/organization/projects/sagas.js b/app/src/controllers/organization/projects/sagas.js index 4159933dd3..290d9801af 100644 --- a/app/src/controllers/organization/projects/sagas.js +++ b/app/src/controllers/organization/projects/sagas.js @@ -20,7 +20,7 @@ import { URLS } from 'common/urls'; import { fetch } from 'common/utils'; import { hideModalAction } from 'controllers/modal'; import { NOTIFICATION_TYPES, showNotification } from 'controllers/notification'; -import { updateFormatDate } from 'components/filterEntities/utils'; +import { prepareQueryFilters } from 'components/filterEntities/utils'; import { CREATE_PROJECT, FETCH_ORGANIZATION_PROJECTS, @@ -30,7 +30,7 @@ import { FETCH_FILTERED_PROJECTS, } from './constants'; import { fetchOrganizationBySlugAction } from '..'; -import { filterQuerySelector, querySelector } from './selectors'; +import { querySelector } from './selectors'; import { activeOrganizationIdSelector, activeOrganizationSelector } from '../selectors'; import { fetchOrganizationProjectsAction } from './actionCreators'; @@ -121,8 +121,8 @@ function* watchDeleteProject() { function* fetchFilteredProjects() { const activeOrganizationId = yield select(activeOrganizationIdSelector); - const filtersParams = yield select(filterQuerySelector); - const data = updateFormatDate(filtersParams); + const filtersParams = yield select(querySelector); + const data = prepareQueryFilters(filtersParams); yield put( fetchDataAction(NAMESPACE)(URLS.organizationProjectsSearches(activeOrganizationId), { diff --git a/app/src/controllers/organization/projects/selectors.js b/app/src/controllers/organization/projects/selectors.js index 33f49c0649..14e0ad37f1 100644 --- a/app/src/controllers/organization/projects/selectors.js +++ b/app/src/controllers/organization/projects/selectors.js @@ -31,10 +31,3 @@ export const querySelector = createAlternativeQueryParametersSelector({ sortingKey: SORTING_KEY, namespace: NAMESPACE, }); - -export const filterQuerySelector = createAlternativeQueryParametersSelector({ - defaultPagination: DEFAULT_PAGINATION, - defaultSorting: SORTING_ASC, - sortingKey: SORTING_KEY, - namespace: NAMESPACE, -});