From 9eff97ecd8eae0aff366bde653f194d1633be2f6 Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Mon, 11 Nov 2024 18:06:22 +0400 Subject: [PATCH 1/3] EPMRPP-96870 || 'Delete' button is not disabled when incorrect project name is entered --- .../modals/deleteProjectModal/deleteProjectModal.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/pages/organization/organizationProjectsPage/modals/deleteProjectModal/deleteProjectModal.jsx b/app/src/pages/organization/organizationProjectsPage/modals/deleteProjectModal/deleteProjectModal.jsx index 5ea84674a7..6c6b89693f 100644 --- a/app/src/pages/organization/organizationProjectsPage/modals/deleteProjectModal/deleteProjectModal.jsx +++ b/app/src/pages/organization/organizationProjectsPage/modals/deleteProjectModal/deleteProjectModal.jsx @@ -35,7 +35,12 @@ const cx = classNames.bind(styles); const PROJECT_NAME_FIELD = 'projectName'; const DELETE_PROJECT_FORM = 'deleteProjectForm'; -export const DeleteProjectModal = ({ data: { onSave, projectDetails }, handleSubmit }) => { +export const DeleteProjectModal = ({ + data: { onSave, projectDetails }, + handleSubmit, + anyTouched, + invalid, +}) => { const dispatch = useDispatch(); const { formatMessage } = useIntl(); @@ -54,6 +59,7 @@ export const DeleteProjectModal = ({ data: { onSave, projectDetails }, handleSub handleSubmit(handleDelete)(); }, variant: 'danger', + disabled: anyTouched && invalid, }} cancelButton={{ children: formatMessage(COMMON_LOCALE_KEYS.CANCEL), @@ -82,6 +88,8 @@ export const DeleteProjectModal = ({ data: { onSave, projectDetails }, handleSub DeleteProjectModal.propTypes = { data: PropTypes.object, handleSubmit: PropTypes.func, + anyTouched: PropTypes.bool.isRequired, + invalid: PropTypes.bool.isRequired, }; export default withModal('deleteProjectModal')( From 8a1215fcdd135539c1821a082fa8bd89fe383e62 Mon Sep 17 00:00:00 2001 From: maria-hambardzumian Date: Mon, 11 Nov 2024 18:11:02 +0400 Subject: [PATCH 2/3] EPMRPP-96118 || Missing options in the meatball menu for project for Member-editor --- .../organizationProjectsPage.jsx | 20 ++++++++++++++++++- .../projectActionMenu/projectActionMenu.jsx | 20 +++++++++++++------ .../projectsListTable/projectsListTable.jsx | 1 + 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/app/src/pages/organization/organizationProjectsPage/organizationProjectsPage.jsx b/app/src/pages/organization/organizationProjectsPage/organizationProjectsPage.jsx index c1589d155b..a7d822ee0d 100644 --- a/app/src/pages/organization/organizationProjectsPage/organizationProjectsPage.jsx +++ b/app/src/pages/organization/organizationProjectsPage/organizationProjectsPage.jsx @@ -30,6 +30,7 @@ import { useState } from 'react'; import { COMMON_LOCALE_KEYS } from 'common/constants/localization'; import { EmptyPageState } from 'pages/common'; import NoResultsIcon from 'common/img/newIcons/no-results-icon-inline.svg'; +import { assignedProjectsSelector } from 'controllers/user'; import { ProjectsPageHeader } from './projectsPageHeader'; import EmptyIcon from './img/empty-projects-icon-inline.svg'; import { messages } from './messages'; @@ -51,6 +52,19 @@ export const OrganizationProjectsPage = () => { const buttonTitle = formatMessage(messages.createProject); const projects = useSelector(projectsSelector); + const assignedProjects = useSelector(assignedProjectsSelector); + + const projectsWithAssignedRoles = projects.map((project) => { + const assignedProject = Object.values(assignedProjects || {}).find( + (assigned) => assigned.projectSlug === project.slug, + ); + + return { + ...project, + role: assignedProject?.projectRole, + }; + }); + const isProjectsEmpty = !projectsLoading && projects.length === 0; const [searchValue, setSearchValue] = useState(null); @@ -113,7 +127,11 @@ export const OrganizationProjectsPage = () => { searchValue={searchValue} setSearchValue={setSearchValue} /> - {isProjectsEmpty ? getEmptyPageState() : } + {isProjectsEmpty ? ( + getEmptyPageState() + ) : ( + + )} ); diff --git a/app/src/pages/organization/organizationProjectsPage/projectsListTable/projectActionMenu/projectActionMenu.jsx b/app/src/pages/organization/organizationProjectsPage/projectsListTable/projectActionMenu/projectActionMenu.jsx index 659413a274..c144225756 100644 --- a/app/src/pages/organization/organizationProjectsPage/projectsListTable/projectActionMenu/projectActionMenu.jsx +++ b/app/src/pages/organization/organizationProjectsPage/projectsListTable/projectActionMenu/projectActionMenu.jsx @@ -37,8 +37,16 @@ import styles from './projectActionMenu.scss'; const cx = classNames.bind(styles); export const ProjectActionMenu = ({ details }) => { - const { projectName, projectKey, projectId, projectSlug, organizationSlug } = details; - const userRoles = useSelector(userRolesSelector); + const { + projectName, + projectKey, + projectId, + projectSlug, + projectRole, + organizationSlug, + } = details; + const roles = useSelector(userRolesSelector); + const projectUserRoles = { ...roles, projectRole }; const dispatch = useDispatch(); const { formatMessage } = useIntl(); const actionsButtons = useMemo(() => { @@ -46,12 +54,12 @@ export const ProjectActionMenu = ({ details }) => { { actionLabel: formatMessage(COMMON_LOCALE_KEYS.RENAME), onclick: () => {}, - hasPermission: canRenameProject(userRoles), + hasPermission: canRenameProject(projectUserRoles), }, { actionLabel: formatMessage(messages.actionInviteUser), onclick: () => {}, - hasPermission: canInviteUserToProject(userRoles), + hasPermission: canInviteUserToProject(projectUserRoles), }, { actionLabel: formatMessage(messages.actionUnassign), @@ -74,10 +82,10 @@ export const ProjectActionMenu = ({ details }) => { ); }, className: cx('delete-button'), - hasPermission: canDeleteProject(userRoles), + hasPermission: canDeleteProject(projectUserRoles), }, ]; - }, [userRoles]); + }, [projectUserRoles]); return ( Date: Tue, 12 Nov 2024 13:26:01 +0400 Subject: [PATCH 3/3] EPMRPP-96118 || code review fix - 1 --- .../projectsListTable/projectActionMenu/projectActionMenu.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/pages/organization/organizationProjectsPage/projectsListTable/projectActionMenu/projectActionMenu.jsx b/app/src/pages/organization/organizationProjectsPage/projectsListTable/projectActionMenu/projectActionMenu.jsx index c144225756..2a964706aa 100644 --- a/app/src/pages/organization/organizationProjectsPage/projectsListTable/projectActionMenu/projectActionMenu.jsx +++ b/app/src/pages/organization/organizationProjectsPage/projectsListTable/projectActionMenu/projectActionMenu.jsx @@ -46,10 +46,10 @@ export const ProjectActionMenu = ({ details }) => { organizationSlug, } = details; const roles = useSelector(userRolesSelector); - const projectUserRoles = { ...roles, projectRole }; const dispatch = useDispatch(); const { formatMessage } = useIntl(); const actionsButtons = useMemo(() => { + const projectUserRoles = { ...roles, projectRole }; return [ { actionLabel: formatMessage(COMMON_LOCALE_KEYS.RENAME), @@ -85,7 +85,7 @@ export const ProjectActionMenu = ({ details }) => { hasPermission: canDeleteProject(projectUserRoles), }, ]; - }, [projectUserRoles]); + }, [roles, projectRole]); return (