From b7bf220b64811a606433445c2b6c02daec55d606 Mon Sep 17 00:00:00 2001 From: Siarhei Iukou Date: Mon, 9 Dec 2024 15:05:28 +0300 Subject: [PATCH] EPMRPP-91556 || Code Review fix - 1 --- app/localization/translated/be.json | 56 ++++++++------- app/localization/translated/es.json | 2 + app/localization/translated/ru.json | 56 ++++++++------- app/localization/translated/uk.json | 54 +++++++------- app/localization/translated/zh.json | 2 + app/src/common/urls.js | 30 ++++---- .../containers/filterEntitiesURLContainer.jsx | 1 - .../filterButton/constants.js | 0 .../filterButton/filterButton.jsx | 5 +- .../filterButton/filterButton.scss | 0 .../filterContent/filterContent.jsx | 15 ++-- .../filterContent/filterContent.scss | 3 +- .../filterContent/filterInput/filterInput.jsx | 71 +++++++++++-------- .../filterInput/filterInput.scss | 19 +++++ .../filterContent/filterInput/index.js | 0 .../filterButton/filterContent/index.js | 0 .../filterButton/filterContent/messages.js | 0 .../{buttons => main}/filterButton/index.jsx | 1 + .../filterButton/messages.js | 4 ++ .../instance/organizations/actionCreators.js | 4 +- .../instance/organizations/constants.js | 2 +- .../instance/organizations/index.js | 2 +- .../instance/organizations/sagas.js | 4 +- .../instance/organizations/selectors.js | 4 +- .../organization/projects/actionCreators.js | 4 +- .../organization/projects/constants.js | 2 +- .../organization/projects/index.js | 2 +- .../organization/projects/sagas.js | 6 +- .../organization/projects/selectors.js | 4 +- .../organizationsFilter.jsx | 11 ++- .../organizationsPageHeader.jsx | 8 +-- .../projectsFilter/projectsFilter.jsx | 8 ++- .../projectsPageHeader/projectsPageHeader.jsx | 8 +-- 33 files changed, 219 insertions(+), 169 deletions(-) rename app/src/components/{buttons => main}/filterButton/constants.js (100%) rename app/src/components/{buttons => main}/filterButton/filterButton.jsx (97%) rename app/src/components/{buttons => main}/filterButton/filterButton.scss (100%) rename app/src/components/{buttons => main}/filterButton/filterContent/filterContent.jsx (91%) rename app/src/components/{buttons => main}/filterButton/filterContent/filterContent.scss (98%) rename app/src/components/{buttons => main}/filterButton/filterContent/filterInput/filterInput.jsx (55%) rename app/src/components/{buttons => main}/filterButton/filterContent/filterInput/filterInput.scss (79%) rename app/src/components/{buttons => main}/filterButton/filterContent/filterInput/index.js (100%) rename app/src/components/{buttons => main}/filterButton/filterContent/index.js (100%) rename app/src/components/{buttons => main}/filterButton/filterContent/messages.js (100%) rename app/src/components/{buttons => main}/filterButton/index.jsx (95%) rename app/src/components/{buttons => main}/filterButton/messages.js (94%) diff --git a/app/localization/translated/be.json b/app/localization/translated/be.json index 4917cb690d..cb95531ab0 100644 --- a/app/localization/translated/be.json +++ b/app/localization/translated/be.json @@ -774,17 +774,18 @@ "Filter.name": "Назва", "Filter.namePlaceholder": "Увядзіце назву фільтра", "FilterAdd.addTitle": "Дадаць новы фільтр", - "FilterButton.any": "Any", - "FilterButton.contains": "Contains", - "FilterButton.equals": "Equals", - "FilterButton.greaterOrEqual": "Greater or equal", - "FilterButton.lessOrEqual": "Less or equal", - "FilterButton.last2days": "Last 2 days", - "FilterButton.last7days": "Last 7 days", - "FilterButton.last30days": "Last 30 days", - "FilterButton.notContains": "Not contains", - "FilterButton.notEqual": "Not equal", - "FilterButton.today": "Today", + "FilterButton.any": "Нейкі", + "FilterButton.contains": "Змяшчае", + "FilterButton.equals": "Раўняецца", + "FilterButton.greaterOrEqual": "Больш або роўна", + "FilterButton.helpText": "Дазволеныя толькі лічбы", + "FilterButton.lessOrEqual": "Менш або роўна", + "FilterButton.last2days": "Апошнія 2 дні", + "FilterButton.last7days": "Апошнія 7 дзён", + "FilterButton.last30days": "Апошнія 30 дзён", + "FilterButton.notContains": "Не змяшчае", + "FilterButton.notEqual": "Не роўна", + "FilterButton.today": "Сёння", "FilterEdit.editTitle": "Рэдагаваць фільтр", "FilterNameById.statistics$defects$automation_bug": "Automation Bug", "FilterNameById.statistics$defects$no_defect": "No Defect", @@ -1577,14 +1578,14 @@ "OrganizationsControl.all": "Усе", "OrganizationsControl.allOrganizations": "Усе арганізацыі", "OrganizationsControl.organization": "Арганізацыя", - "OrganizationsFilter.lastRunDate": "Last Run Date", - "OrganizationsFilter.lastRunDatePlaceholder": "Any", - "OrganizationsFilter.launches": "Launches", - "OrganizationsFilter.launchesPlaceholder": "Enter the number of launches", - "OrganizationsFilter.name": "Organization Name", - "OrganizationsFilter.namePlaceholder": "Enter part of the name", - "OrganizationsFilter.users": "Users", - "OrganizationsFilter.usersPlaceholder": "Enter the number of members", + "OrganizationsFilter.lastRunDate": "Дата апошняга запуску", + "OrganizationsFilter.lastRunDatePlaceholder": "Любая", + "OrganizationsFilter.launches": "Запускі", + "OrganizationsFilter.launchesPlaceholder": "Увядзіце колькасць запускаў", + "OrganizationsFilter.name": "Назва Арганізацыі", + "OrganizationsFilter.namePlaceholder": "Увядзіце частку імя", + "OrganizationsFilter.users": "Карыстальнік", + "OrganizationsFilter.usersPlaceholder": "Увядзіце колькасць удзельнікаў", "OrganizationsItem.open": "адкрыць", "OrganizationsPage.title": "Усе арганізацыі", "OrganizationsPage.description": "Спіс даступных вам арганізацый у дадзены момант пусты. Калі ласка, звяжыцеся са сваім адміністратарам, каб атрымаць прызначэнне ва ўжо існуючую арганізацыю.", @@ -1813,14 +1814,15 @@ "ProjectsGrid.nameCol": "Назва", "ProjectsGrid.organizationCol": "Арганізацыя", "ProjectsGrid.projectTypeCol": "Тып праекта", - "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", + "ProjectsFilter.lastRunDate": "Дата апошняга запуску", + "ProjectsFilter.lastRunDatePlaceholder": "Любая", + "ProjectsFilter.launches": "Запускі", + "ProjectsFilter.launchesPlaceholder": "Увядзіце колькасць запускаў", + "ProjectsFilter.name": "Назва Праекта", + "ProjectsFilter.namePlaceholder": "Увядзіце частку імя", + "ProjectsFilter.users": "Таварышы па камандзе", + "ProjectsFilter.usersPlaceholder": "Увядзіце колькасць удзельнікаў", + "ProjectsFilterPopover.clearAllFilters": "Ачысціць усе фільтры", "ProjectsPage.addProject": "Дадаць Праект", "ProjectsPage.addProjectSuccess": "Праект ''{name}'' быў паспяхова створаны", "ProjectsPage.addProjectTitle": "Дадаць Праект", diff --git a/app/localization/translated/es.json b/app/localization/translated/es.json index fa269b445d..4a458b4943 100644 --- a/app/localization/translated/es.json +++ b/app/localization/translated/es.json @@ -777,6 +777,7 @@ "FilterButton.contains": "Contains", "FilterButton.equals": "Equals", "FilterButton.greaterOrEqual": "Greater or equal", + "FilterButton.helpText": "Only digits are allowed", "FilterButton.lessOrEqual": "Less or equal", "FilterButton.last2days": "Last 2 days", "FilterButton.last7days": "Last 7 days", @@ -1819,6 +1820,7 @@ "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", "ProjectsPage.addProjectTitle": "Agregar Proyecto", diff --git a/app/localization/translated/ru.json b/app/localization/translated/ru.json index ccf2fe66a1..bf0ec639a1 100644 --- a/app/localization/translated/ru.json +++ b/app/localization/translated/ru.json @@ -774,17 +774,18 @@ "Filter.name": "Имя", "Filter.namePlaceholder": "Ввести имя фильтра", "FilterAdd.addTitle": "Добавить новый фильтр", - "FilterButton.any": "Any", - "FilterButton.contains": "Contains", - "FilterButton.equals": "Equals", - "FilterButton.greaterOrEqual": "Greater or equal", - "FilterButton.lessOrEqual": "Less or equal", - "FilterButton.last2days": "Last 2 days", - "FilterButton.last7days": "Last 7 days", - "FilterButton.last30days": "Last 30 days", - "FilterButton.notContains": "Not contains", - "FilterButton.notEqual": "Not equal", - "FilterButton.today": "Today", + "FilterButton.any": "Любой", + "FilterButton.contains": "Содержит", + "FilterButton.equals": "Равняется", + "FilterButton.greaterOrEqual": "Больше или равно", + "FilterButton.helpText": "Разрешены только цифры", + "FilterButton.lessOrEqual": "Меньше или равно", + "FilterButton.last2days": "Последние 2 дня", + "FilterButton.last7days": "Последние 7 дней", + "FilterButton.last30days": "Последние 30 дней", + "FilterButton.notContains": "Не содержит", + "FilterButton.notEqual": "Не равны", + "FilterButton.today": "Сегодня", "FilterEdit.editTitle": "Редактировать фильтр", "FilterNameById.statistics$defects$automation_bug": "Automation Bug", "FilterNameById.statistics$defects$no_defect": "No Defect", @@ -1572,14 +1573,14 @@ "OrganizationsControl.all": "Все", "OrganizationsControl.allOrganizations": "Все организации", "OrganizationsControl.organization": "Организация", - "OrganizationsFilter.lastRunDate": "Last Run Date", - "OrganizationsFilter.lastRunDatePlaceholder": "Any", - "OrganizationsFilter.launches": "Launches", - "OrganizationsFilter.launchesPlaceholder": "Enter the number of launches", - "OrganizationsFilter.name": "Organization Name", - "OrganizationsFilter.namePlaceholder": "Enter part of the name", - "OrganizationsFilter.users": "Users", - "OrganizationsFilter.usersPlaceholder": "Enter the number of members", + "OrganizationsFilter.lastRunDate": "Дата последнего запуска", + "OrganizationsFilter.lastRunDatePlaceholder": "Любой", + "OrganizationsFilter.launches": "Запуски", + "OrganizationsFilter.launchesPlaceholder": "Введите количество запусков", + "OrganizationsFilter.name": "Название Организации", + "OrganizationsFilter.namePlaceholder": "Введите часть имени", + "OrganizationsFilter.users": "Пользователи", + "OrganizationsFilter.usersPlaceholder": "Введите количество участников", "OrganizationsItem.open": "открыть", "OrganizationsPage.title": "Все организации", "OrganizationsPage.description": "Список доступных вам организаций в данный момент пуст. Пожалуйста, свяжитесь со своим администратором, чтобы получить назначение в уже существующую организацию.", @@ -1808,14 +1809,15 @@ "ProjectsGrid.nameCol": "Название", "ProjectsGrid.organizationCol": "Организация", "ProjectsGrid.projectTypeCol": "Тип проекта", - "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", + "ProjectsFilter.lastRunDate": "Дата последнего запуска", + "ProjectsFilter.lastRunDatePlaceholder": "Любой", + "ProjectsFilter.launches": "Запуски", + "ProjectsFilter.launchesPlaceholder": "Введите количество запусков", + "ProjectsFilter.name": "Название проекта", + "ProjectsFilter.namePlaceholder": "Введите часть имени", + "ProjectsFilter.users": "Товарищи по команде", + "ProjectsFilter.usersPlaceholder": "Введите количество участников", + "ProjectsFilterPopover.clearAllFilters": "Очистить все фильтры", "ProjectsPage.addProject": "Создать Проект", "ProjectsPage.addProjectSuccess": "Проект ''{name}'' успешно создан", "ProjectsPage.addProjectTitle": "Добавить Проект", diff --git a/app/localization/translated/uk.json b/app/localization/translated/uk.json index 6dc19735a0..30421986d4 100644 --- a/app/localization/translated/uk.json +++ b/app/localization/translated/uk.json @@ -774,17 +774,18 @@ "Filter.name": "Ім’я", "Filter.namePlaceholder": "Ввести ім’я фільтра", "FilterAdd.addTitle": "Додати новий фільтр", - "FilterButton.any": "Any", - "FilterButton.contains": "Contains", - "FilterButton.equals": "Equals", - "FilterButton.greaterOrEqual": "Greater or equal", - "FilterButton.lessOrEqual": "Less or equal", - "FilterButton.last2days": "Last 2 days", - "FilterButton.last7days": "Last 7 days", - "FilterButton.last30days": "Last 30 days", - "FilterButton.notContains": "Not contains", - "FilterButton.notEqual": "Not equal", - "FilterButton.today": "Today", + "FilterButton.any": "Будь-який", + "FilterButton.contains": "Містити", + "FilterButton.equals": "Дорівнювати", + "FilterButton.greaterOrEqual": "Більше або дорівнює", + "FilterButton.helpText": "Дозволені лише цифри", + "FilterButton.lessOrEqual": "Менше або дорівнює", + "FilterButton.last2days": "Останні 2 дні", + "FilterButton.last7days": "Останні 7 днів", + "FilterButton.last30days": "Останні 30 днів", + "FilterButton.notContains": "Не містить", + "FilterButton.notEqual": "Не рівні", + "FilterButton.today": "Сьогодні", "FilterEdit.editTitle": "Редагувати фільтр", "FilterNameById.statistics$defects$automation_bug": "Помилка Автоматизації", "FilterNameById.statistics$defects$no_defect": "Ніякої Дефект", @@ -1575,13 +1576,13 @@ "OrganizationsControl.allOrganizations": "Всі організації", "OrganizationsControl.organization": "Організація", "OrganizationsFilter.lastRunDate": "Last Run Date", - "OrganizationsFilter.lastRunDatePlaceholder": "Any", - "OrganizationsFilter.launches": "Launches", - "OrganizationsFilter.launchesPlaceholder": "Enter the number of launches", - "OrganizationsFilter.name": "Organization Name", - "OrganizationsFilter.namePlaceholder": "Enter part of the name", - "OrganizationsFilter.users": "Users", - "OrganizationsFilter.usersPlaceholder": "Enter the number of members", + "OrganizationsFilter.lastRunDatePlaceholder": "Будь-який", + "OrganizationsFilter.launches": "Запуски", + "OrganizationsFilter.launchesPlaceholder": "Введіть кількість запусків", + "OrganizationsFilter.name": "Назва організації", + "OrganizationsFilter.namePlaceholder": "Введіть частину імені", + "OrganizationsFilter.users": "Користувачі", + "OrganizationsFilter.usersPlaceholder": "Введіть кількість учасників", "OrganizationsItem.open": "відкрити", "OrganizationsPage.title": "Всі організації", "OrganizationsPage.description": "Список доступних вам організацій в даний момент порожній. Будь ласка, зв'яжіться зі своїм адміністратором, щоб отримати призначення в уже існуючу організацію.", @@ -1810,14 +1811,15 @@ "ProjectsGrid.nameCol": "Назва", "ProjectsGrid.organizationCol": "Організація", "ProjectsGrid.projectTypeCol": "Тип проекту", - "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", + "ProjectsFilter.lastRunDate": "Дата останнього запуску", + "ProjectsFilter.lastRunDatePlaceholder": "Будь-який", + "ProjectsFilter.launches": "Запуски", + "ProjectsFilter.launchesPlaceholder": "Введіть кількість запусків", + "ProjectsFilter.name": "Назва проекту", + "ProjectsFilter.namePlaceholder": "Введіть частину імені", + "ProjectsFilter.users": "Товариші по команді", + "ProjectsFilter.usersPlaceholder": "Введіть кількість учасників", + "ProjectsFilterPopover.clearAllFilters": "Очистити всі фільтри", "ProjectsPage.addProject": "Створити Проект", "ProjectsPage.addProjectSuccess": "Проект ''{name}'' успешно создан", "ProjectsPage.addProjectTitle": "Проект Додати", diff --git a/app/localization/translated/zh.json b/app/localization/translated/zh.json index 960ff22afc..ca5048a7f2 100644 --- a/app/localization/translated/zh.json +++ b/app/localization/translated/zh.json @@ -778,6 +778,7 @@ "FilterButton.contains": "Contains", "FilterButton.equals": "Equals", "FilterButton.greaterOrEqual": "Greater or equal", + "FilterButton.helpText": "Only digits are allowed", "FilterButton.lessOrEqual": "Less or equal", "FilterButton.last2days": "Last 2 days", "FilterButton.last7days": "Last 7 days", @@ -1818,6 +1819,7 @@ "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}”创建成功", "ProjectsPage.addProjectTitle": "创建项目", diff --git a/app/src/common/urls.js b/app/src/common/urls.js index 7e635dacb6..37ac093efc 100644 --- a/app/src/common/urls.js +++ b/app/src/common/urls.js @@ -122,15 +122,15 @@ export const URLS = { login: () => `${uatBase}sso/oauth/token`, sessionToken: () => `${uatBase}sso/me`, - apiKeys: (userId) => `${urlCommonBase}users/${userId}/api-keys`, - apiKeyById: (userId, apiKeyId) => `${urlCommonBase}users/${userId}/api-keys/${apiKeyId}`, + apiKeys: (userId) => `${urlBase}users/${userId}/api-keys`, + apiKeyById: (userId, apiKeyId) => `${urlBase}users/${userId}/api-keys/${apiKeyId}`, organizationList: (preferencesObj = {}) => `${urlCommonBase}organizations${getQueryParams(preferencesObj)}`, - organizationSearch: () => `${urlCommonBase}organizations/searches`, + organizationSearches: () => `${urlCommonBase}organizations/searches`, organizationProjects: (organizationId, preferencesObj = {}) => `${urlCommonBase}organizations/${organizationId}/projects${getQueryParams(preferencesObj)}`, - filterOrganizationProjects: (organizationId) => + organizationProjectsSearches: (organizationId) => `${urlCommonBase}organizations/${organizationId}/projects/searches`, organizationUsers: (organizationId, preferencesObj = {}) => `${urlCommonBase}organizations/${organizationId}/users${getQueryParams(preferencesObj)}`, @@ -155,7 +155,7 @@ export const URLS = { term: searchTerm, })}`, searchUsers: (term) => - `${urlCommonBase}users/search${getQueryParams({ + `${urlBase}users/search${getQueryParams({ term, })}`, projectAddPattern: (projectKey) => `${urlBase}${projectKey}/settings/pattern`, @@ -245,17 +245,17 @@ export const URLS = { })}`, logSearch: (projectKey, itemId) => `${urlBase}${projectKey}/log/search/${itemId}`, bulkLastLogs: (projectKey) => `${urlBase}${projectKey}/log/under`, - users: (ids = []) => `${urlCommonBase}users?ids=${ids.join(',')}`, - userRegistration: () => `${urlCommonBase}users/registration`, - userValidateRegistrationInfo: () => `${urlCommonBase}users/registration/info`, - userPasswordReset: () => `${urlCommonBase}users/password/reset`, - userPasswordResetToken: (token) => `${urlCommonBase}users/password/reset/${token}`, - userPasswordRestore: () => `${urlCommonBase}users/password/restore`, - userChangePassword: () => `${urlCommonBase}users/password/change`, + users: (ids = []) => `${urlBase}users?ids=${ids.join(',')}`, + userRegistration: () => `${urlBase}users/registration`, + userValidateRegistrationInfo: () => `${urlBase}users/registration/info`, + userPasswordReset: () => `${urlBase}users/password/reset`, + userPasswordResetToken: (token) => `${urlBase}users/password/reset/${token}`, + userPasswordRestore: () => `${urlBase}users/password/restore`, + userChangePassword: () => `${urlBase}users/password/change`, userSynchronize: (type) => `${uatBase}sso/me/${type}/synchronize`, - userInfo: (userId) => `${urlCommonBase}users/${userId}`, + userInfo: (userId) => `${urlBase}users/${userId}`, userInviteInternal: (projectKey) => `${urlBase}project/${projectKey}/assign`, - userInviteExternal: () => `${urlCommonBase}users/bid`, + userInviteExternal: () => `${urlBase}users/bid`, userUnassign: (projectKey) => `${urlBase}project/${projectKey}/unassign`, generateDemoData: (projectKey) => `${urlBase}demo/${projectKey}/generate`, @@ -268,7 +268,7 @@ export const URLS = { events: () => `${urlBase}activities/searches`, searchEventsBySubjectName: (projectName) => (searchTerm = '') => `${urlBase}activities/${projectName}/subjectName?filter.cnt.subjectName=${searchTerm}`, - allUsers: () => `${urlCommonBase}users/all`, + allUsers: () => `${urlBase}users/all`, exportUsers: (filterEntities) => `${urlCommonBase}users/export${getQueryParams({ diff --git a/app/src/components/filterEntities/containers/filterEntitiesURLContainer.jsx b/app/src/components/filterEntities/containers/filterEntitiesURLContainer.jsx index cb6a34a1b5..c45db0a6e1 100644 --- a/app/src/components/filterEntities/containers/filterEntitiesURLContainer.jsx +++ b/app/src/components/filterEntities/containers/filterEntitiesURLContainer.jsx @@ -36,7 +36,6 @@ const FilterEntitiesURL = ({ } const filterQuery = createFilterQuery(newEntities, entities, prefixQueryKey); if (!isEmptyObject(filterQuery)) { - console.log('filterQuery', filterQuery); updateFilters(filterQuery, defaultPagination[PAGE_KEY]); } }, diff --git a/app/src/components/buttons/filterButton/constants.js b/app/src/components/main/filterButton/constants.js similarity index 100% rename from app/src/components/buttons/filterButton/constants.js rename to app/src/components/main/filterButton/constants.js diff --git a/app/src/components/buttons/filterButton/filterButton.jsx b/app/src/components/main/filterButton/filterButton.jsx similarity index 97% rename from app/src/components/buttons/filterButton/filterButton.jsx rename to app/src/components/main/filterButton/filterButton.jsx index e9daa81935..2bbc115040 100644 --- a/app/src/components/buttons/filterButton/filterButton.jsx +++ b/app/src/components/main/filterButton/filterButton.jsx @@ -15,7 +15,6 @@ */ import { useEffect, useState } from 'react'; -import { useDispatch } from 'react-redux'; import PropTypes from 'prop-types'; import classNames from 'classnames/bind'; import { Popover } from '@reportportal/ui-kit'; @@ -36,12 +35,12 @@ export const FilterButton = ({ filteredAction, }) => { const [isOpen, setIsOpen] = useState(false); - const dispatch = useDispatch(); const [filters, setFilters] = useState(defaultFilters); const [initialFilters, setInitialFilters] = useState(defaultFilters); useEffect(() => { - dispatch(filteredAction()); + setAppliedFiltersCount(Object.keys(definedFilters).length); + filteredAction(); }, []); useEffect(() => { diff --git a/app/src/components/buttons/filterButton/filterButton.scss b/app/src/components/main/filterButton/filterButton.scss similarity index 100% rename from app/src/components/buttons/filterButton/filterButton.scss rename to app/src/components/main/filterButton/filterButton.scss diff --git a/app/src/components/buttons/filterButton/filterContent/filterContent.jsx b/app/src/components/main/filterButton/filterContent/filterContent.jsx similarity index 91% rename from app/src/components/buttons/filterButton/filterContent/filterContent.jsx rename to app/src/components/main/filterButton/filterContent/filterContent.jsx index 87bafb0576..1cfbf97fd6 100644 --- a/app/src/components/buttons/filterButton/filterContent/filterContent.jsx +++ b/app/src/components/main/filterButton/filterContent/filterContent.jsx @@ -17,10 +17,10 @@ import classNames from 'classnames/bind'; import { Button } from '@reportportal/ui-kit'; import { useIntl } from 'react-intl'; -import { useDispatch } from 'react-redux'; import PropTypes from 'prop-types'; import isEqual from 'fast-deep-equal'; import { COMMON_LOCALE_KEYS } from 'common/constants/localization'; +import { useMemo } from 'react'; import { FilterInput } from './filterInput'; import { messages } from './messages'; import styles from './filterContent.scss'; @@ -38,7 +38,6 @@ export const FilterContent = ({ filteredAction, }) => { const { formatMessage } = useIntl(); - const dispatch = useDispatch(); const closePopover = () => { setIsOpen(false); @@ -63,12 +62,18 @@ export const FilterContent = ({ }, {}); onFilterChange(fields); setAppliedFiltersCount(appliedFiltersCount); - dispatch(filteredAction()); + filteredAction(); setIsOpen(false); }; - const isDefaultFilters = isEqual(defaultFilters, filters); - const isDefinedFilters = isEqual(initialFilters, filters); + const isDefaultFilters = useMemo(() => isEqual(defaultFilters, filters), [ + defaultFilters, + filters, + ]); + const isDefinedFilters = useMemo(() => isEqual(initialFilters, filters), [ + initialFilters, + filters, + ]); return (
diff --git a/app/src/components/buttons/filterButton/filterContent/filterContent.scss b/app/src/components/main/filterButton/filterContent/filterContent.scss similarity index 98% rename from app/src/components/buttons/filterButton/filterContent/filterContent.scss rename to app/src/components/main/filterButton/filterContent/filterContent.scss index 909fba1f48..b760c08945 100644 --- a/app/src/components/buttons/filterButton/filterContent/filterContent.scss +++ b/app/src/components/main/filterButton/filterContent/filterContent.scss @@ -17,13 +17,12 @@ .filter-popover-content { display: flex; flex-direction: column; - gap: 32px; + gap: 16px; } .filter-items { display: flex; flex-direction: column; - gap: 16px; } .actions { diff --git a/app/src/components/buttons/filterButton/filterContent/filterInput/filterInput.jsx b/app/src/components/main/filterButton/filterContent/filterInput/filterInput.jsx similarity index 55% rename from app/src/components/buttons/filterButton/filterContent/filterInput/filterInput.jsx rename to app/src/components/main/filterButton/filterContent/filterInput/filterInput.jsx index c506f50cd5..9ded5538bf 100644 --- a/app/src/components/buttons/filterButton/filterContent/filterInput/filterInput.jsx +++ b/app/src/components/main/filterButton/filterContent/filterInput/filterInput.jsx @@ -22,47 +22,60 @@ import styles from './filterInput.scss'; const cx = classNames.bind(styles); export const FilterInput = ({ filter, setFilters }) => { - const { filterName, options, value, condition, placeholder, title, withField } = filter; + const { filterName, options, value, condition, placeholder, title, withField, helpText } = filter; + + const onChangeOption = (newValue) => { + setFilters((prevFilters) => ({ + ...prevFilters, + [filterName]: { + ...filter, + ...(withField ? { condition: newValue } : { value: newValue }), + }, + })); + }; + + const onTextFieldChange = ({ target }) => { + if (helpText && !Number(target.value)) { + return; + } + + setFilters((prevFilters) => ({ + ...prevFilters, + [filterName]: { ...filter, value: target.value }, + })); + }; + + const onClear = () => { + setFilters((prevFilters) => ({ + ...prevFilters, + [filterName]: { ...filter, value: '' }, + })); + }; return ( -
+
{title}
{ - setFilters((prevFilters) => ({ - ...prevFilters, - [filterName]: { - ...filter, - ...(withField ? { condition: newValue } : { value: newValue }), - }, - })); - }} + onChange={onChangeOption} isListWidthLimited className={cx({ dropdown: withField })} placeholder={placeholder} /> {withField && ( - { - setFilters((prevFilters) => ({ - ...prevFilters, - [filterName]: { ...filter, value: target.value }, - })); - }} - onClear={() => { - setFilters((prevFilters) => ({ - ...prevFilters, - [filterName]: { ...filter, value: '' }, - })); - }} - clearable - /> +
+ +
)}
diff --git a/app/src/components/buttons/filterButton/filterContent/filterInput/filterInput.scss b/app/src/components/main/filterButton/filterContent/filterInput/filterInput.scss similarity index 79% rename from app/src/components/buttons/filterButton/filterContent/filterInput/filterInput.scss rename to app/src/components/main/filterButton/filterContent/filterInput/filterInput.scss index 19c1268ccc..4c37692b73 100644 --- a/app/src/components/buttons/filterButton/filterContent/filterInput/filterInput.scss +++ b/app/src/components/main/filterButton/filterContent/filterInput/filterInput.scss @@ -18,6 +18,7 @@ display: flex; flex-direction: column; gap: 4px; + margin-bottom: 16px; .label { font-size: 13px; @@ -28,9 +29,11 @@ .container { display: flex; + width: 100%; gap: 8px; .dropdown { + min-width: 156px; width: 156px; } @@ -39,3 +42,19 @@ } } } + +.with-help-text { + margin-bottom: 0; +} + +.input-field-container { + width: 100%; + + &:last-child span { + color: $COLOR--e-400; + } + + div.input-field { + width: 100%; + } +} diff --git a/app/src/components/buttons/filterButton/filterContent/filterInput/index.js b/app/src/components/main/filterButton/filterContent/filterInput/index.js similarity index 100% rename from app/src/components/buttons/filterButton/filterContent/filterInput/index.js rename to app/src/components/main/filterButton/filterContent/filterInput/index.js diff --git a/app/src/components/buttons/filterButton/filterContent/index.js b/app/src/components/main/filterButton/filterContent/index.js similarity index 100% rename from app/src/components/buttons/filterButton/filterContent/index.js rename to app/src/components/main/filterButton/filterContent/index.js diff --git a/app/src/components/buttons/filterButton/filterContent/messages.js b/app/src/components/main/filterButton/filterContent/messages.js similarity index 100% rename from app/src/components/buttons/filterButton/filterContent/messages.js rename to app/src/components/main/filterButton/filterContent/messages.js diff --git a/app/src/components/buttons/filterButton/index.jsx b/app/src/components/main/filterButton/index.jsx similarity index 95% rename from app/src/components/buttons/filterButton/index.jsx rename to app/src/components/main/filterButton/index.jsx index 47eaeee42e..446d829301 100644 --- a/app/src/components/buttons/filterButton/index.jsx +++ b/app/src/components/main/filterButton/index.jsx @@ -24,3 +24,4 @@ export { getRangeComparisons, getTimeRange, } from './constants'; +export { messages } from './messages'; diff --git a/app/src/components/buttons/filterButton/messages.js b/app/src/components/main/filterButton/messages.js similarity index 94% rename from app/src/components/buttons/filterButton/messages.js rename to app/src/components/main/filterButton/messages.js index 1bc497131a..e7333803e5 100644 --- a/app/src/components/buttons/filterButton/messages.js +++ b/app/src/components/main/filterButton/messages.js @@ -61,4 +61,8 @@ export const messages = defineMessages({ id: 'FilterButton.notContains', defaultMessage: 'Not contains', }, + helpText: { + id: 'FilterButton.helpText', + defaultMessage: 'Only digits are allowed', + }, }); diff --git a/app/src/controllers/instance/organizations/actionCreators.js b/app/src/controllers/instance/organizations/actionCreators.js index 01501d14f0..44eb3ea8f9 100644 --- a/app/src/controllers/instance/organizations/actionCreators.js +++ b/app/src/controllers/instance/organizations/actionCreators.js @@ -14,12 +14,12 @@ * limitations under the License. */ -import { FETCH_ORGANIZATIONS, FILTERED_ORGANIZATIONS } from './constants'; +import { FETCH_ORGANIZATIONS, FETCH_FILTERED_ORGANIZATIONS } from './constants'; export const fetchOrganizationsAction = () => ({ type: FETCH_ORGANIZATIONS, }); export const fetchFilteredOrganizationsAction = () => ({ - type: FILTERED_ORGANIZATIONS, + type: FETCH_FILTERED_ORGANIZATIONS, }); diff --git a/app/src/controllers/instance/organizations/constants.js b/app/src/controllers/instance/organizations/constants.js index b94fa0ace9..a69e335d49 100644 --- a/app/src/controllers/instance/organizations/constants.js +++ b/app/src/controllers/instance/organizations/constants.js @@ -19,7 +19,7 @@ import { PAGE_KEY, SIZE_KEY } from 'controllers/pagination'; export const NAMESPACE = 'organizations'; export const FETCH_ORGANIZATIONS = 'fetchOrganizations'; -export const FILTERED_ORGANIZATIONS = 'filteredOrganizations'; +export const FETCH_FILTERED_ORGANIZATIONS = 'fetchFilteredOrganizations'; export const DEFAULT_PAGE_SIZE_OPTIONS = [10, 20, 50, 100]; export const DEFAULT_LIMITATION = 20; export const initialPaginationState = { diff --git a/app/src/controllers/instance/organizations/index.js b/app/src/controllers/instance/organizations/index.js index 5b645458b9..1763ffeded 100644 --- a/app/src/controllers/instance/organizations/index.js +++ b/app/src/controllers/instance/organizations/index.js @@ -14,7 +14,7 @@ * limitations under the License. */ -export { FETCH_ORGANIZATIONS, FILTERED_ORGANIZATIONS } from './constants'; +export { FETCH_ORGANIZATIONS, FETCH_FILTERED_ORGANIZATIONS } from './constants'; export { fetchOrganizationsAction, fetchFilteredOrganizationsAction } from './actionCreators'; export { organizationsReducer } from './reducer'; export { diff --git a/app/src/controllers/instance/organizations/sagas.js b/app/src/controllers/instance/organizations/sagas.js index 64414b40a5..47111dcca4 100644 --- a/app/src/controllers/instance/organizations/sagas.js +++ b/app/src/controllers/instance/organizations/sagas.js @@ -19,7 +19,7 @@ import { URLS } from 'common/urls'; import { showDefaultErrorNotification } from 'controllers/notification'; import { fetchDataAction } from 'controllers/fetch'; import { filterQuerySelector, querySelector } from './selectors'; -import { FETCH_ORGANIZATIONS, FILTERED_ORGANIZATIONS, NAMESPACE } from './constants'; +import { FETCH_ORGANIZATIONS, FETCH_FILTERED_ORGANIZATIONS, NAMESPACE } from './constants'; function* fetchOrganizations() { try { @@ -47,7 +47,7 @@ function* fetchFilteredOrganizations() { } function* watchFetchFilteredProjects() { - yield takeEvery(FILTERED_ORGANIZATIONS, fetchFilteredOrganizations); + yield takeEvery(FETCH_FILTERED_ORGANIZATIONS, fetchFilteredOrganizations); } export function* organizationsSagas() { diff --git a/app/src/controllers/instance/organizations/selectors.js b/app/src/controllers/instance/organizations/selectors.js index 67178e429c..20a5cb200d 100644 --- a/app/src/controllers/instance/organizations/selectors.js +++ b/app/src/controllers/instance/organizations/selectors.js @@ -19,7 +19,7 @@ import { createFilterQuerySelector, } from 'controllers/pages/selectors'; import { SORTING_ASC } from 'controllers/sorting'; -import { NAMESPACE, DEFAULT_PAGINATION, SORTING_KEY, FILTERED_ORGANIZATIONS } from './constants'; +import { NAMESPACE, DEFAULT_PAGINATION, SORTING_KEY } from './constants'; export const organizationsSelector = (state) => state.organizations || {}; @@ -41,5 +41,5 @@ export const filterQuerySelector = createFilterQuerySelector({ defaultPagination: DEFAULT_PAGINATION, defaultSorting: SORTING_ASC, sortingKey: SORTING_KEY, - namespace: FILTERED_ORGANIZATIONS, + namespace: NAMESPACE, }); diff --git a/app/src/controllers/organization/projects/actionCreators.js b/app/src/controllers/organization/projects/actionCreators.js index bd0622bdec..5c2fd07c9b 100644 --- a/app/src/controllers/organization/projects/actionCreators.js +++ b/app/src/controllers/organization/projects/actionCreators.js @@ -18,7 +18,7 @@ import { CREATE_PROJECT, DELETE_PROJECT, FETCH_ORGANIZATION_PROJECTS, - FILTERED_PROJECTS, + FETCH_FILTERED_PROJECTS, } from './constants'; export const fetchOrganizationProjectsAction = (params) => { @@ -39,5 +39,5 @@ export const deleteProjectAction = (project) => ({ }); export const fetchFilteredProjectAction = () => ({ - type: FILTERED_PROJECTS, + type: FETCH_FILTERED_PROJECTS, }); diff --git a/app/src/controllers/organization/projects/constants.js b/app/src/controllers/organization/projects/constants.js index 10e2f8f5a4..5ced36e308 100644 --- a/app/src/controllers/organization/projects/constants.js +++ b/app/src/controllers/organization/projects/constants.js @@ -18,7 +18,7 @@ import { PAGE_KEY, SIZE_KEY } from 'controllers/pagination'; import { formatSortingString, SORTING_ASC } from 'controllers/sorting'; export const FETCH_ORGANIZATION_PROJECTS = 'fetchOrganizationProjects'; -export const FILTERED_PROJECTS = 'filteredProjects'; +export const FETCH_FILTERED_PROJECTS = 'fetchFilteredProjects'; export const NAMESPACE = 'organizationProjects'; export const CREATE_PROJECT = 'createProject'; export const DELETE_PROJECT = 'deleteProject'; diff --git a/app/src/controllers/organization/projects/index.js b/app/src/controllers/organization/projects/index.js index 1a2addab43..b113ec77e4 100644 --- a/app/src/controllers/organization/projects/index.js +++ b/app/src/controllers/organization/projects/index.js @@ -31,5 +31,5 @@ export { DEFAULT_QUERY_PARAMS, FETCH_ORGANIZATION_PROJECTS, SORTING_KEY, - FILTERED_PROJECTS, + FETCH_FILTERED_PROJECTS, } from './constants'; diff --git a/app/src/controllers/organization/projects/sagas.js b/app/src/controllers/organization/projects/sagas.js index 8faf97bff2..2e6610f8ff 100644 --- a/app/src/controllers/organization/projects/sagas.js +++ b/app/src/controllers/organization/projects/sagas.js @@ -26,7 +26,7 @@ import { ERROR_CODES, NAMESPACE, DELETE_PROJECT, - FILTERED_PROJECTS, + FETCH_FILTERED_PROJECTS, } from './constants'; import { fetchOrganizationBySlugAction } from '..'; import { filterQuerySelector, querySelector } from './selectors'; @@ -123,7 +123,7 @@ function* fetchFilteredProjects() { const filtersParams = yield select(filterQuerySelector); yield put( - fetchDataAction(NAMESPACE)(URLS.filterOrganizationProjects(activeOrganizationId), { + fetchDataAction(NAMESPACE)(URLS.organizationProjectsSearches(activeOrganizationId), { method: 'post', data: filtersParams, }), @@ -131,7 +131,7 @@ function* fetchFilteredProjects() { } function* watchFetchFilteredProjects() { - yield takeEvery(FILTERED_PROJECTS, fetchFilteredProjects); + yield takeEvery(FETCH_FILTERED_PROJECTS, fetchFilteredProjects); } export function* projectsSagas() { diff --git a/app/src/controllers/organization/projects/selectors.js b/app/src/controllers/organization/projects/selectors.js index 94f1b3e635..6388158b05 100644 --- a/app/src/controllers/organization/projects/selectors.js +++ b/app/src/controllers/organization/projects/selectors.js @@ -20,7 +20,7 @@ import { } from 'controllers/pages/selectors'; import { SORTING_ASC } from 'controllers/sorting'; import { organizationSelector } from '../selectors'; -import { DEFAULT_PAGINATION, FILTERED_PROJECTS, NAMESPACE, SORTING_KEY } from './constants'; +import { DEFAULT_PAGINATION, NAMESPACE, SORTING_KEY } from './constants'; const domainSelector = (state) => organizationSelector(state).projects || {}; @@ -39,5 +39,5 @@ export const filterQuerySelector = createFilterQuerySelector({ defaultPagination: DEFAULT_PAGINATION, defaultSorting: SORTING_ASC, sortingKey: SORTING_KEY, - namespace: FILTERED_PROJECTS, + namespace: NAMESPACE, }); diff --git a/app/src/pages/instance/organizationsPage/organizationsPageHeader/organizationsFilter/organizationsFilter.jsx b/app/src/pages/instance/organizationsPage/organizationsPageHeader/organizationsFilter/organizationsFilter.jsx index d4f24f8bb4..66fdb0275f 100644 --- a/app/src/pages/instance/organizationsPage/organizationsPageHeader/organizationsFilter/organizationsFilter.jsx +++ b/app/src/pages/instance/organizationsPage/organizationsPageHeader/organizationsFilter/organizationsFilter.jsx @@ -16,6 +16,7 @@ import { useIntl } from 'react-intl'; import PropTypes from 'prop-types'; +import { useDispatch } from 'react-redux'; import { LAUNCHES_FILTER_NAME, FILTER_NAME, @@ -24,8 +25,9 @@ import { getContainmentComparisons, getRangeComparisons, getTimeRange, -} from 'components/buttons/filterButton'; -import { FilterButton } from 'components/buttons/filterButton/filterButton'; + messages as helpMessage, +} from 'components/main/filterButton'; +import { FilterButton } from 'components/main/filterButton/filterButton'; import { fetchFilteredOrganizationsAction } from 'controllers/instance/organizations'; import { messages } from './messages'; @@ -36,6 +38,7 @@ export const OrganizationsFilter = ({ setAppliedFiltersCount, }) => { const { formatMessage } = useIntl(); + const dispatch = useDispatch(); const timeRange = getTimeRange(formatMessage); const rangeComparisons = getRangeComparisons(formatMessage); @@ -56,6 +59,7 @@ export const OrganizationsFilter = ({ placeholder: formatMessage(messages.launchesPlaceholder), options: rangeComparisons, condition: rangeComparisons[0].value, + helpText: formatMessage(helpMessage.helpText), withField: true, }, [TEAMMATES_FILTER_NAME]: { @@ -65,6 +69,7 @@ export const OrganizationsFilter = ({ placeholder: formatMessage(messages.usersPlaceholder), options: rangeComparisons, condition: rangeComparisons[0].value, + helpText: formatMessage(helpMessage.helpText), withField: true, }, [FILTER_NAME]: { @@ -85,7 +90,7 @@ export const OrganizationsFilter = ({ setAppliedFiltersCount={setAppliedFiltersCount} definedFilters={entities} onFilterChange={onFilterChange} - filteredAction={fetchFilteredOrganizationsAction} + filteredAction={() => dispatch(fetchFilteredOrganizationsAction())} /> ); }; diff --git a/app/src/pages/instance/organizationsPage/organizationsPageHeader/organizationsPageHeader.jsx b/app/src/pages/instance/organizationsPage/organizationsPageHeader/organizationsPageHeader.jsx index 4a36dc96a1..ce3692bae0 100644 --- a/app/src/pages/instance/organizationsPage/organizationsPageHeader/organizationsPageHeader.jsx +++ b/app/src/pages/instance/organizationsPage/organizationsPageHeader/organizationsPageHeader.jsx @@ -15,17 +15,16 @@ */ import React from 'react'; +import { useSelector } from 'react-redux'; import PropTypes from 'prop-types'; import Parser from 'html-react-parser'; import classNames from 'classnames/bind'; import { BaseIconButton } from '@reportportal/ui-kit'; -import filterIcon from 'common/img/newIcons/filters-outline-inline.svg'; import { useIntl } from 'react-intl'; import { SearchField } from 'components/fields/searchField'; import { SEARCH_KEY } from 'controllers/organization/projects/constants'; import { withFilter } from 'controllers/filter'; -import { FILTERED_ORGANIZATIONS, NAMESPACE } from 'controllers/instance/organizations/constants'; -import { useSelector } from 'react-redux'; +import { NAMESPACE } from 'controllers/instance/organizations/constants'; import { organizationsListLoadingSelector } from 'controllers/instance/organizations'; import { ORGANIZATION_PAGE_EVENTS } from 'components/main/analytics/events/ga4Events/organizationsPageEvents'; import { withFilterEntitiesURL } from 'components/filterEntities/containers'; @@ -41,7 +40,7 @@ const SearchFieldWithFilter = withFilter({ filterKey: SEARCH_KEY, namespace: NAM SearchField, ); -const FiltersFields = withFilterEntitiesURL(FILTERED_ORGANIZATIONS)(OrganizationsFilter); +const FiltersFields = withFilterEntitiesURL(NAMESPACE)(OrganizationsFilter); export const OrganizationsPageHeader = ({ isEmpty, @@ -70,7 +69,6 @@ export const OrganizationsPageHeader = ({ placeholder={formatMessage(messages.searchPlaceholder)} event={ORGANIZATION_PAGE_EVENTS.SEARCH_ORGANIZATION_FIELD} /> - {Parser(filterIcon)} { const { formatMessage } = useIntl(); + const dispatch = useDispatch(); const timeRange = getTimeRange(formatMessage); const rangeComparisons = getRangeComparisons(formatMessage); @@ -85,7 +87,7 @@ export const ProjectsFilter = ({ setAppliedFiltersCount={setAppliedFiltersCount} definedFilters={entities} onFilterChange={onFilterChange} - filteredAction={fetchFilteredProjectAction} + filteredAction={() => dispatch(fetchFilteredProjectAction())} /> ); }; diff --git a/app/src/pages/organization/organizationProjectsPage/projectsPageHeader/projectsPageHeader.jsx b/app/src/pages/organization/organizationProjectsPage/projectsPageHeader/projectsPageHeader.jsx index f17e851613..1840c40299 100644 --- a/app/src/pages/organization/organizationProjectsPage/projectsPageHeader/projectsPageHeader.jsx +++ b/app/src/pages/organization/organizationProjectsPage/projectsPageHeader/projectsPageHeader.jsx @@ -25,11 +25,7 @@ import { Breadcrumbs } from 'componentLibrary/breadcrumbs'; import { activeOrganizationSelector } from 'controllers/organization'; import { loadingSelector } from 'controllers/organization/projects'; import { SearchField } from 'components/fields/searchField'; -import { - SEARCH_KEY, - NAMESPACE, - FILTERED_PROJECTS, -} from 'controllers/organization/projects/constants'; +import { SEARCH_KEY, NAMESPACE } from 'controllers/organization/projects/constants'; import { withFilter } from 'controllers/filter'; import { withFilterEntitiesURL } from 'components/filterEntities/containers'; import projectsIcon from './img/projects-inline.svg'; @@ -44,7 +40,7 @@ const SearchFieldWithFilter = withFilter({ filterKey: SEARCH_KEY, namespace: NAM SearchField, ); -const FiltersFields = withFilterEntitiesURL(FILTERED_PROJECTS)(ProjectsFilter); +const FiltersFields = withFilterEntitiesURL(NAMESPACE)(ProjectsFilter); export const ProjectsPageHeader = ({ hasPermission,