Skip to content

Commit

Permalink
EPMRPP-97602 || refactor filters
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazarQSO committed Jan 20, 2025
1 parent 5f183d9 commit 8b57e42
Show file tree
Hide file tree
Showing 26 changed files with 86 additions and 301 deletions.
19 changes: 5 additions & 14 deletions app/localization/translated/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,11 @@
"FilterButton.notContains": "Не змяшчае",
"FilterButton.notEqual": "Не роўна",
"FilterButton.today": "Сёння",
"FilterComponent.lastRunDate": "Дата апошняга запуску",
"FilterComponent.lastRunDatePlaceholder": "Любая",
"FilterComponent.launches": "Запускі",
"FilterComponent.launchesPlaceholder": "Увядзіце колькасць запускаў",
"FilterComponent.usersPlaceholder": "Увядзіце колькасць удзельнікаў",
"FilterEdit.editTitle": "Рэдагаваць фільтр",
"FilterNameById.statistics$defects$automation_bug": "Automation Bug",
"FilterNameById.statistics$defects$no_defect": "No Defect",
Expand Down Expand Up @@ -1545,12 +1550,6 @@
"OrganizationsControl.allOrganizations": "Усе арганізацыі",
"OrganizationsControl.assignmentsList": "Прызначаны спіс",
"OrganizationsControl.organization": "Арганізацыя",
"OrganizationsFilter.lastRunDate": "Дата апошняга запуску",
"OrganizationsFilter.lastRunDatePlaceholder": "Любая",
"OrganizationsFilter.launches": "Запускі",
"OrganizationsFilter.launchesPlaceholder": "Увядзіце колькасць запускаў",
"OrganizationsFilter.users": "Карыстальнік",
"OrganizationsFilter.usersPlaceholder": "Увядзіце колькасць удзельнікаў",
"OrganizationsItem.open": "адкрыць",
"OrganizationsPage.createNewOrganization": "Стварыце новую арганізацыю, каб пачаць свой шлях на партале справаздач",
"OrganizationsPage.createOrganization": "Стварыць арганізацыю",
Expand Down Expand Up @@ -1708,14 +1707,6 @@
"ProjectTeamPage.noUsers": "Карыстальнікаў пакуль не дададзена",
"ProjectTeamPage.searchPlaceholder": "Пошук па назве",
"ProjectTeamPage.title": "Праектная група",
"ProjectsFilter.lastRunDate": "Дата апошняга запуску",
"ProjectsFilter.lastRunDatePlaceholder": "Любая",
"ProjectsFilter.launches": "Запускі",
"ProjectsFilter.launchesPlaceholder": "Увядзіце колькасць запускаў",
"ProjectsFilter.name": "Назва Праекта",
"ProjectsFilter.namePlaceholder": "Увядзіце частку імя",
"ProjectsFilter.users": "Таварышы па камандзе",
"ProjectsFilter.usersPlaceholder": "Увядзіце колькасць удзельнікаў",
"ProjectsFilterPopover.clearAllFilters": "Ачысціць усе фільтры",
"ProjectsPage.addProject": "Дадаць Праект",
"ProjectsPage.addProjectSuccess": "Праект ''{name}'' быў паспяхова створаны",
Expand Down
19 changes: 5 additions & 14 deletions app/localization/translated/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,11 @@
"FilterButton.notContains": "Not contains",
"FilterButton.notEqual": "Not equal",
"FilterButton.today": "Today",
"FilterComponent.lastRunDate": "Last Run Date",
"FilterComponent.lastRunDatePlaceholder": "Any",
"FilterComponent.launches": "Launches",
"FilterComponent.launchesPlaceholder": "Enter the number of launches",
"FilterComponent.usersPlaceholder": "Enter the number of members",
"FilterEdit.editTitle": "Editar filtro",
"FilterNameById.statistics$defects$automation_bug": "Error de automatización",
"FilterNameById.statistics$defects$no_defect": "Sin defecto",
Expand Down Expand Up @@ -1545,12 +1550,6 @@
"OrganizationsControl.allOrganizations": "All organizations",
"OrganizationsControl.assignmentsList": "Assignments list",
"OrganizationsControl.organization": "Organization",
"OrganizationsFilter.lastRunDate": "Last Run Date",
"OrganizationsFilter.lastRunDatePlaceholder": "Any",
"OrganizationsFilter.launches": "Launches",
"OrganizationsFilter.launchesPlaceholder": "Enter the number of launches",
"OrganizationsFilter.users": "Users",
"OrganizationsFilter.usersPlaceholder": "Enter the number of members",
"OrganizationsItem.open": "open",
"OrganizationsPage.createNewOrganization": "Create a new organization to begin your ReportPortal journey",
"OrganizationsPage.createOrganization": "Create Organization",
Expand Down Expand Up @@ -1708,14 +1707,6 @@
"ProjectTeamPage.noUsers": "No users added yet",
"ProjectTeamPage.searchPlaceholder": "Type to search by name",
"ProjectTeamPage.title": "Project team",
"ProjectsFilter.lastRunDate": "Last Run Date",
"ProjectsFilter.lastRunDatePlaceholder": "Any",
"ProjectsFilter.launches": "Launches",
"ProjectsFilter.launchesPlaceholder": "Enter the number of launches",
"ProjectsFilter.name": "Project Name",
"ProjectsFilter.namePlaceholder": "Enter part of the name",
"ProjectsFilter.users": "Teammates",
"ProjectsFilter.usersPlaceholder": "Enter the number of members",
"ProjectsFilterPopover.clearAllFilters": "Clear all filters",
"ProjectsPage.addProject": "Crear Proyecto",
"ProjectsPage.addProjectSuccess": "El proyecto ''{name}'' ha sido creado exitosamente",
Expand Down
19 changes: 5 additions & 14 deletions app/localization/translated/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,11 @@
"FilterButton.notContains": "Не содержит",
"FilterButton.notEqual": "Не равны",
"FilterButton.today": "Сегодня",
"FilterComponent.lastRunDate": "Дата последнего запуска",
"FilterComponent.lastRunDatePlaceholder": "Любой",
"FilterComponent.launches": "Запуски",
"FilterComponent.launchesPlaceholder": "Введите количество запусков",
"FilterComponent.usersPlaceholder": "Введите количество участников",
"FilterEdit.editTitle": "Редактировать фильтр",
"FilterNameById.statistics$defects$automation_bug": "Automation Bug",
"FilterNameById.statistics$defects$no_defect": "No Defect",
Expand Down Expand Up @@ -1545,12 +1550,6 @@
"OrganizationsControl.allOrganizations": "Все организации",
"OrganizationsControl.assignmentsList": "Назначенный список",
"OrganizationsControl.organization": "Организация",
"OrganizationsFilter.lastRunDate": "Дата последнего запуска",
"OrganizationsFilter.lastRunDatePlaceholder": "Любой",
"OrganizationsFilter.launches": "Запуски",
"OrganizationsFilter.launchesPlaceholder": "Введите количество запусков",
"OrganizationsFilter.users": "Пользователи",
"OrganizationsFilter.usersPlaceholder": "Введите количество участников",
"OrganizationsItem.open": "открыть",
"OrganizationsPage.createNewOrganization": "Создайте новую организацию, чтобы начать свой путь на портале отчетов",
"OrganizationsPage.createOrganization": "Создать организацию",
Expand Down Expand Up @@ -1708,14 +1707,6 @@
"ProjectTeamPage.noUsers": "Пользователей пока не добавлено",
"ProjectTeamPage.searchPlaceholder": "Поиск по названию",
"ProjectTeamPage.title": "Проектная группа",
"ProjectsFilter.lastRunDate": "Дата последнего запуска",
"ProjectsFilter.lastRunDatePlaceholder": "Любой",
"ProjectsFilter.launches": "Запуски",
"ProjectsFilter.launchesPlaceholder": "Введите количество запусков",
"ProjectsFilter.name": "Название проекта",
"ProjectsFilter.namePlaceholder": "Введите часть имени",
"ProjectsFilter.users": "Товарищи по команде",
"ProjectsFilter.usersPlaceholder": "Введите количество участников",
"ProjectsFilterPopover.clearAllFilters": "Очистить все фильтры",
"ProjectsPage.addProject": "Создать Проект",
"ProjectsPage.addProjectSuccess": "Проект ''{name}'' успешно создан",
Expand Down
19 changes: 5 additions & 14 deletions app/localization/translated/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,11 @@
"FilterButton.notContains": "Не містить",
"FilterButton.notEqual": "Не рівні",
"FilterButton.today": "Сьогодні",
"FilterComponent.lastRunDate": "Дата останнього запуску",
"FilterComponent.lastRunDatePlaceholder": "Будь-який",
"FilterComponent.launches": "Запуски",
"FilterComponent.launchesPlaceholder": "Введіть кількість запусків",
"FilterComponent.usersPlaceholder": "Введіть кількість учасників",
"FilterEdit.editTitle": "Редагувати фільтр",
"FilterNameById.statistics$defects$automation_bug": "Помилка Автоматизації",
"FilterNameById.statistics$defects$no_defect": "Ніякої Дефект",
Expand Down Expand Up @@ -1545,12 +1550,6 @@
"OrganizationsControl.allOrganizations": "Всі організації",
"OrganizationsControl.assignmentsList": "Призначений список",
"OrganizationsControl.organization": "Організація",
"OrganizationsFilter.lastRunDate": "Last Run Date",
"OrganizationsFilter.lastRunDatePlaceholder": "Будь-який",
"OrganizationsFilter.launches": "Запуски",
"OrganizationsFilter.launchesPlaceholder": "Введіть кількість запусків",
"OrganizationsFilter.users": "Користувачі",
"OrganizationsFilter.usersPlaceholder": "Введіть кількість учасників",
"OrganizationsItem.open": "відкрити",
"OrganizationsPage.createNewOrganization": "Створіть нову організацію, щоб розпочати свій шлях на порталі звітів",
"OrganizationsPage.createOrganization": "Створити організацію",
Expand Down Expand Up @@ -1708,14 +1707,6 @@
"ProjectTeamPage.noUsers": "Користувачів поки не додано",
"ProjectTeamPage.searchPlaceholder": "Пошук по назві",
"ProjectTeamPage.title": "Проектна група",
"ProjectsFilter.lastRunDate": "Дата останнього запуску",
"ProjectsFilter.lastRunDatePlaceholder": "Будь-який",
"ProjectsFilter.launches": "Запуски",
"ProjectsFilter.launchesPlaceholder": "Введіть кількість запусків",
"ProjectsFilter.name": "Назва проекту",
"ProjectsFilter.namePlaceholder": "Введіть частину імені",
"ProjectsFilter.users": "Товариші по команді",
"ProjectsFilter.usersPlaceholder": "Введіть кількість учасників",
"ProjectsFilterPopover.clearAllFilters": "Очистити всі фільтри",
"ProjectsPage.addProject": "Створити Проект",
"ProjectsPage.addProjectSuccess": "Проект ''{name}'' успешно создан",
Expand Down
19 changes: 5 additions & 14 deletions app/localization/translated/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,11 @@
"FilterButton.notContains": "Not contains",
"FilterButton.notEqual": "Not equal",
"FilterButton.today": "Today",
"FilterComponent.lastRunDate": "Last Run Date",
"FilterComponent.lastRunDatePlaceholder": "Any",
"FilterComponent.launches": "Launches",
"FilterComponent.launchesPlaceholder": "Enter the number of launches",
"FilterComponent.usersPlaceholder": "Enter the number of members",
"FilterEdit.editTitle": "编辑过滤器",
"FilterNameById.statistics$defects$automation_bug": "自动化错误",
"FilterNameById.statistics$defects$no_defect": "无缺陷",
Expand Down Expand Up @@ -1545,12 +1550,6 @@
"OrganizationsControl.allOrganizations": "All organizations",
"OrganizationsControl.assignmentsList": "Assignments list",
"OrganizationsControl.organization": "组织",
"OrganizationsFilter.lastRunDate": "Last Run Date",
"OrganizationsFilter.lastRunDatePlaceholder": "Any",
"OrganizationsFilter.launches": "Launches",
"OrganizationsFilter.launchesPlaceholder": "Enter the number of launches",
"OrganizationsFilter.users": "Users",
"OrganizationsFilter.usersPlaceholder": "Enter the number of members",
"OrganizationsItem.open": "open",
"OrganizationsPage.createNewOrganization": "Create a new organization to begin your ReportPortal journey",
"OrganizationsPage.createOrganization": "Create Organization",
Expand Down Expand Up @@ -1708,14 +1707,6 @@
"ProjectTeamPage.noUsers": "No users added yet",
"ProjectTeamPage.searchPlaceholder": "Type to search by name",
"ProjectTeamPage.title": "Project team",
"ProjectsFilter.lastRunDate": "Last Run Date",
"ProjectsFilter.lastRunDatePlaceholder": "Any",
"ProjectsFilter.launches": "Launches",
"ProjectsFilter.launchesPlaceholder": "Enter the number of launches",
"ProjectsFilter.name": "Project Name",
"ProjectsFilter.namePlaceholder": "Enter part of the name",
"ProjectsFilter.users": "Teammates",
"ProjectsFilter.usersPlaceholder": "Enter the number of members",
"ProjectsFilterPopover.clearAllFilters": "Clear all filters",
"ProjectsPage.addProject": "Create Project",
"ProjectsPage.addProjectSuccess": "项目“{name}”创建成功",
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/filterEntities/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import moment from 'moment/moment';
import { getMinutesFromTimestamp } from 'common/utils';
import { LAST_RUN_DATE_FILTER_NAME } from 'components/main/filterButton';
import { LAST_RUN_DATE_FILTER_NAME } from 'components/main/filter/filterButton';
import { getAppliedFilters } from 'controllers/instance/events/utils';

export function bindDefaultValue(key, options = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
*/

import { useIntl } from 'react-intl';
import { useDispatch } from 'react-redux';
import PropTypes from 'prop-types';
import { CONDITION_BETWEEN } from 'components/filterEntities/constants';
import {
FilterButton,
LAUNCHES_FILTER_NAME,
TEAMMATES_FILTER_NAME,
LAST_RUN_DATE_FILTER_NAME,
Expand All @@ -26,20 +27,18 @@ import {
getRangeComparisons,
getTimeRange,
messages as helpMessage,
} from 'components/main/filterButton';
import { FilterButton } from 'components/main/filterButton/filterButton';
import { fetchFilteredProjectAction } from 'controllers/organization/projects';
import { CONDITION_BETWEEN } from 'components/filterEntities/constants';
} from './filterButton';
import { messages } from './messages';

export const ProjectsFilter = ({
export const Filter = ({
entities,
onFilterChange,
appliedFiltersCount,
setAppliedFiltersCount,
filteredAction,
teammatesFilterMessage,
}) => {
const { formatMessage } = useIntl();
const dispatch = useDispatch();

const timeRange = getTimeRange(formatMessage);
const rangeComparisons = getRangeComparisons(formatMessage);
Expand Down Expand Up @@ -77,7 +76,7 @@ export const ProjectsFilter = ({
},
[TEAMMATES_FILTER_NAME]: {
filterName: TEAMMATES_FILTER_NAME,
title: formatMessage(messages.users),
title: teammatesFilterMessage,
helpText: formatMessage(helpMessage.helpText),
fields: [
{
Expand All @@ -101,21 +100,23 @@ export const ProjectsFilter = ({
setAppliedFiltersCount={setAppliedFiltersCount}
definedFilters={entities}
onFilterChange={onFilterChange}
filteredAction={() => dispatch(fetchFilteredProjectAction())}
filteredAction={filteredAction}
/>
);
};

ProjectsFilter.propTypes = {
Filter.propTypes = {
entities: PropTypes.objectOf(
PropTypes.shape({
filter_key: PropTypes.string,
value: PropTypes.string,
condition: PropTypes.string,
}),
),
onFilterChange: PropTypes.func,
appliedFiltersCount: PropTypes.number,
setAppliedFiltersCount: PropTypes.func,
defaultFilters: PropTypes.object,
onFilterChange: PropTypes.func.isRequired,
appliedFiltersCount: PropTypes.number.isRequired,
setAppliedFiltersCount: PropTypes.func.isRequired,
defaultFilters: PropTypes.object.isRequired,
filteredAction: PropTypes.func.isRequired,
teammatesFilterMessage: PropTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ import { reduxForm } from 'redux-form';
import { Button } from '@reportportal/ui-kit';
import { useIntl } from 'react-intl';
import PropTypes from 'prop-types';
import {
LAUNCHES_FILTER_NAME,
TEAMMATES_FILTER_NAME,
LAST_RUN_DATE_FILTER_NAME,
LAUNCHES_FILTER_NAME_CONDITION,
TEAMMATES_FILTER_NAME_CONDITION,
} from 'components/main/filterButton';
import { COMMON_LOCALE_KEYS } from 'common/constants/localization';
import { useEffect } from 'react';
import { connect } from 'react-redux';
import { FilterInput } from './filterInput';
import {
LAST_RUN_DATE_FILTER_NAME,
LAUNCHES_FILTER_NAME,
LAUNCHES_FILTER_NAME_CONDITION,
TEAMMATES_FILTER_NAME,
TEAMMATES_FILTER_NAME_CONDITION,
} from '../constants';
import { messages } from './messages';
import styles from './filterContent.scss';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*!
/*
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,4 +14,4 @@
* limitations under the License.
*/

export { ProjectsFilter } from './projectsFilter';
export { Filter } from './filter';
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,23 @@ import { defineMessages } from 'react-intl';

export const messages = defineMessages({
lastRunDate: {
id: 'OrganizationsFilter.lastRunDate',
id: 'FilterComponent.lastRunDate',
defaultMessage: 'Last Run Date',
},
lastRunDatePlaceholder: {
id: 'OrganizationsFilter.lastRunDatePlaceholder',
id: 'FilterComponent.lastRunDatePlaceholder',
defaultMessage: 'Any',
},
launches: {
id: 'OrganizationsFilter.launches',
id: 'FilterComponent.launches',
defaultMessage: 'Launches',
},
launchesPlaceholder: {
id: 'OrganizationsFilter.launchesPlaceholder',
id: 'FilterComponent.launchesPlaceholder',
defaultMessage: 'Enter the number of launches',
},
users: {
id: 'OrganizationsFilter.users',
defaultMessage: 'Users',
},
usersPlaceholder: {
id: 'OrganizationsFilter.usersPlaceholder',
id: 'FilterComponent.usersPlaceholder',
defaultMessage: 'Enter the number of members',
},
});

This file was deleted.

Loading

0 comments on commit 8b57e42

Please sign in to comment.