From a2f28ea98f7547b421d7d8865c06f4ef8a93f6a2 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Tue, 14 Sep 2021 17:31:39 +0300 Subject: [PATCH 01/11] fix "npm run lint" command ignore test automation folder as it uses TypeScript with its own Eslint config --- .eslintignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.eslintignore b/.eslintignore index 49690170e..60d551283 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,4 @@ # ignore dist directory to speed up linting after we build project dist/* +# ignore test automation folder as it uses TypeScript with its own Eslint config +connect-automation/* \ No newline at end of file From 6dce7b4ecfb9148d4d67003afb949321fa34aa32 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Fri, 24 Sep 2021 17:36:00 +0800 Subject: [PATCH 02/11] Fix table layout --- .../SimplePlan/ManageMilestones/ManageMilestones.jsx | 9 +++++++-- .../SimplePlan/components/MilestoneRow/MilestoneRow.jsx | 9 ++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx b/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx index 31d19298f..9a8174352 100644 --- a/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx +++ b/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx @@ -16,7 +16,7 @@ import MilestoneMoveDateButton from '../components/MilestoneMoveDateButton' import * as milestoneHelper from '../components/helpers/milestone' import IconUnselect from '../../../../../assets/icons/icon-disselect.svg' import IconCopilot from '../../../../../assets/icons/icon-copilot.svg' -import { CHALLENGE_ID_MAPPING, PHASE_STATUS_IN_REVIEW } from '../../../../../config/constants' +import { CHALLENGE_ID_MAPPING, PHASE_STATUS_IN_REVIEW, PROJECT_STATUS_CANCELLED, PROJECT_STATUS_COMPLETED } from '../../../../../config/constants' import './ManageMilestones.scss' import MilestoneApprovalButton from '../components/MilestoneApprovalButton' @@ -256,8 +256,11 @@ class ManageMilestones extends React.Component { onChangeMilestones, isUpdatable, isCustomer, + project, } = this.props + const hideCheckbox = project.status === PROJECT_STATUS_CANCELLED || project.status === PROJECT_STATUS_COMPLETED + // const isNeedApproval = project.status === PROJECT_STATUS_IN_REVIEW const isNeedApproval = !milestones.filter(ms => ms.selected === true).find(ms => !(ms.status === PHASE_STATUS_IN_REVIEW)) const canShowApproval = isCustomer && isNeedApproval @@ -325,7 +328,7 @@ class ManageMilestones extends React.Component { - {/* CHECKBOX */} + {hideCheckbox ? null : }{/* CHECKBOX */} {/* MILESTONE */} {/* DESCRIPTION */} {/* START DATE */} @@ -339,6 +342,7 @@ class ManageMilestones extends React.Component { milestones={milestones} onChangeMilestones={onChangeMilestones} isUpdatable={isUpdatable || isCustomer} + hideCheckbox={hideCheckbox} /> @@ -365,6 +369,7 @@ class ManageMilestones extends React.Component { onApprove={this.onApprove} phaseMembers={milestone.members} isApproving={milestonesInApproval.indexOf(milestone.id) !== -1} + hideCheckbox={hideCheckbox} />, ...this.renderChallengeTable(milestone) ] diff --git a/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx b/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx index 47ebf9e32..f14a3c4c5 100644 --- a/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx +++ b/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx @@ -45,7 +45,8 @@ function MilestoneRow({ phaseMembers, disableDeleteAction, isCustomer, - isApproving + isApproving, + hideCheckbox }) { const isNeedApproval = milestone.status === PHASE_STATUS_IN_REVIEW const showApproval = isCustomer && isNeedApproval @@ -58,11 +59,12 @@ function MilestoneRow({ let milestoneRef let startDateRef let endDateRef + const tdEl = hideCheckbox ? null : {isUpdatable ? : - {isUpdatable ? + + } @@ -54,6 +56,7 @@ function MilestoneHeaderRow ({ milestones, onChangeMilestones, isUpdatable }) { MilestoneHeaderRow.propTypes = { onChangeMilestones: PT.func, + hideCheckbox: PT.bool, } export default MilestoneHeaderRow diff --git a/src/projects/detail/containers/DashboardContainer.jsx b/src/projects/detail/containers/DashboardContainer.jsx index e8b42b1f6..4c6d2a8bd 100644 --- a/src/projects/detail/containers/DashboardContainer.jsx +++ b/src/projects/detail/containers/DashboardContainer.jsx @@ -275,6 +275,8 @@ class DashboardContainer extends React.Component { ...action.payload, edit: this.state.createGameplanPhases[idx].edit, selected: this.state.createGameplanPhases[idx].selected, + products: this.state.createGameplanPhases[idx].products, + challenges: this.state.createGameplanPhases[idx].challenges, members }) this.setState({ createGameplanPhases: updatedCreateGameplanPhases }) From 0682daf971246b7337f2e1af4d427fa1d7f57e92 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Fri, 24 Sep 2021 17:43:16 +0800 Subject: [PATCH 04/11] add permission copilot user to remove copilot --- src/config/permissions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config/permissions.js b/src/config/permissions.js index 82e33250d..774cc60c3 100644 --- a/src/config/permissions.js +++ b/src/config/permissions.js @@ -253,7 +253,8 @@ export const PERMISSIONS = { ], topcoderRoles: [ ...TOPCODER_ADMINS, - ROLE_CONNECT_COPILOT_MANAGER + ROLE_CONNECT_COPILOT_MANAGER, + ROLE_CONNECT_COPILOT ] }, From a3a067b81d9c146bfb6c425d96a93451e9da7c33 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Fri, 24 Sep 2021 20:05:52 +0800 Subject: [PATCH 05/11] add bulk delete phases functionality --- src/api/projects.js | 5 +++++ src/config/constants.js | 5 +++++ src/projects/actions/project.js | 13 ++++++++++++- .../CreateSimplePlan/CreateSimplePlan.jsx | 3 +++ .../ManageMilestones/ManageMilestones.jsx | 14 +++++++++----- .../detail/containers/DashboardContainer.jsx | 19 +++++++++++++++++++ src/projects/reducers/project.js | 15 ++++++++++++++- src/reducers/alerts.js | 13 ++++++++++++- 8 files changed, 79 insertions(+), 8 deletions(-) diff --git a/src/api/projects.js b/src/api/projects.js index 17cc966da..950a39e7c 100644 --- a/src/api/projects.js +++ b/src/api/projects.js @@ -223,3 +223,8 @@ export function deleteProjectPhase(projectId, phaseId) { return axios.delete(`${PROJECTS_API_URL}/v5/projects/${projectId}/phases/${phaseId}`) .then(() => ({ projectId, phaseId })) } + +export function deleteBulkProjectPhase(projectId, phaseIds) { + return axios.delete(`${PROJECTS_API_URL}/v5/projects/${projectId}/phases`, { data: { phaseIds } }) + .then(() => ({ phaseIds })) +} diff --git a/src/config/constants.js b/src/config/constants.js index 0b27005a0..420aeda9f 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -300,6 +300,11 @@ export const DELETE_PROJECT_PHASE_PENDING = 'DELETE_PROJECT_PHASE_PENDING' export const DELETE_PROJECT_PHASE_FAILURE = 'DELETE_PROJECT_PHASE_FAILURE' export const DELETE_PROJECT_PHASE_SUCCESS = 'DELETE_PROJECT_PHASE_SUCCESS' +export const DELETE_BULK_PROJECT_PHASE = 'DELETE_BULK_PROJECT_PHASE' +export const DELETE_BULK_PROJECT_PHASE_PENDING = 'DELETE_BULK_PROJECT_PHASE_PENDING' +export const DELETE_BULK_PROJECT_PHASE_FAILURE = 'DELETE_BULK_PROJECT_PHASE_FAILURE' +export const DELETE_BULK_PROJECT_PHASE_SUCCESS = 'DELETE_BULK_PROJECT_PHASE_SUCCESS' + export const UPDATE_PRODUCT = 'UPDATE_PRODUCT' export const UPDATE_PRODUCT_PENDING = 'UPDATE_PRODUCT_PENDING' export const UPDATE_PRODUCT_SUCCESS = 'UPDATE_PRODUCT_SUCCESS' diff --git a/src/projects/actions/project.js b/src/projects/actions/project.js index 6bcb8aff7..3030de8b8 100644 --- a/src/projects/actions/project.js +++ b/src/projects/actions/project.js @@ -7,6 +7,7 @@ import { getProjectById, updateProject as updateProjectAPI, deleteProject as deleteProjectAPI, deleteProjectPhase as deleteProjectPhaseAPI, + deleteBulkProjectPhase as deleteBulkProjectPhaseAPI, getProjectPhases, updateProduct as updateProductAPI, updatePhase as updatePhaseAPI, @@ -79,7 +80,8 @@ import { CUSTOMER_APPROVE_MILESTONE_APPROVE_SUCCESS, CUSTOMER_APPROVE_MILESTONE_REJECT_FAILURE, CUSTOMER_APPROVE_MILESTONE_APPROVE_FAILURE, - CUSTOMER_APPROVE_MILESTONE_REJECT_SUCCESS + CUSTOMER_APPROVE_MILESTONE_REJECT_SUCCESS, + DELETE_BULK_PROJECT_PHASE } from '../../config/constants' import { updateProductMilestone, @@ -441,6 +443,15 @@ export function deleteProjectPhase(projectId, phaseId) { } } +export function deleteBulkProjectPhase(projectId, phaseIds) { + return (dispatch) => { + return dispatch({ + type: DELETE_BULK_PROJECT_PHASE, + payload: deleteBulkProjectPhaseAPI(projectId, phaseIds) + }) + } +} + export function updateProject(projectId, updatedProps, updateExisting = false) { return (dispatch) => { return dispatch({ diff --git a/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx b/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx index 10a37ccfe..c96add512 100644 --- a/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx +++ b/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx @@ -39,6 +39,7 @@ class CreateSimplePlan extends React.Component { onChangeMilestones, onSaveMilestone, onRemoveMilestone, + onRemoveAllMilestones, onGetChallenges, onApproveMilestones, isProjectLive, @@ -78,6 +79,7 @@ class CreateSimplePlan extends React.Component { onChangeMilestones={onChangeMilestones} onSaveMilestone={onSaveMilestone} onRemoveMilestone={onRemoveMilestone} + onRemoveAllMilestones={onRemoveAllMilestones} onApproveMilestones={onApproveMilestones} projectMembers={project.members} project={project} @@ -97,6 +99,7 @@ CreateSimplePlan.propTypes = { onChangeMilestones: PT.func, onSaveMilestone: PT.func, onRemoveMilestone: PT.func, + onRemoveAllMilestones: PT.func, onGetChallenges: PT.func, onApproveMilestones: PT.func, isCustomer: PT.bool, diff --git a/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx b/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx index 9a8174352..0fd2b913b 100644 --- a/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx +++ b/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx @@ -84,11 +84,14 @@ class ManageMilestones extends React.Component { } onDeleteAll() { - const { milestones, onRemoveMilestone } = this.props - const seletedMilestones = _.filter(milestones, m => m.selected) - _.forEach(seletedMilestones, m => { - onRemoveMilestone(m.id) - }) + const { milestones, onRemoveAllMilestones } = this.props + const selectedPhases = _.filter(milestones, m => m.selected) + + if (selectedPhases.length) { + const { projectId } = selectedPhases[0] + const phaseIds = selectedPhases.map(m => m.id) + onRemoveAllMilestones(projectId, phaseIds) + } } onUnselectAll() { @@ -388,6 +391,7 @@ ManageMilestones.propTypes = { onChangeMilestones: PT.func, onSaveMilestone: PT.func, onRemoveMilestone: PT.func, + onRemoveAllMilestones: PT.func, onGetChallenges: PT.func, onApproveMilestones: PT.func, projectMembers: PT.arrayOf(PT.shape()), diff --git a/src/projects/detail/containers/DashboardContainer.jsx b/src/projects/detail/containers/DashboardContainer.jsx index 4c6d2a8bd..2789fecf3 100644 --- a/src/projects/detail/containers/DashboardContainer.jsx +++ b/src/projects/detail/containers/DashboardContainer.jsx @@ -26,6 +26,7 @@ import { fireProductDirty, fireProductDirtyUndo, deleteProjectPhase, + deleteBulkProjectPhase, expandProjectPhase, collapseProjectPhase, collapseAllProjectPhases, @@ -94,6 +95,7 @@ class DashboardContainer extends React.Component { this.onChangeMilestones = this.onChangeMilestones.bind(this) this.onSaveMilestone = this.onSaveMilestone.bind(this) this.onRemoveMilestone = this.onRemoveMilestone.bind(this) + this.onRemoveAllMilestones = this.onRemoveAllMilestones.bind(this) this.onGetChallenges = this.onGetChallenges.bind(this) this.onApproveMilestones = this.onApproveMilestones.bind(this) } @@ -323,6 +325,21 @@ class DashboardContainer extends React.Component { }) } + onRemoveAllMilestones(projectId, phaseIds) { + this.props.deleteBulkProjectPhase( + projectId, + phaseIds + ).then(() => { + if (!this.state.createGameplanPhases) { + return + } + + // remove phases + const newGameplanPhases = this.state.createGameplanPhases.filter(phase => !phaseIds.includes(phase.id)) + this.setState({createGameplanPhases: newGameplanPhases}) + }) + } + render() { const { @@ -525,6 +542,7 @@ class DashboardContainer extends React.Component { onSaveMilestone={this.onSaveMilestone} onGetChallenges={this.onGetChallenges} onRemoveMilestone={this.onRemoveMilestone} + onRemoveAllMilestones={this.onRemoveAllMilestones} onApproveMilestones={this.onApproveMilestones} /> ) @@ -577,6 +595,7 @@ const mapDispatchToProps = { updateProductAttachment, removeProductAttachment, deleteProjectPhase, + deleteBulkProjectPhase, expandProjectPhase, collapseProjectPhase, collapseAllProjectPhases, diff --git a/src/projects/reducers/project.js b/src/projects/reducers/project.js index d6b11b9f0..b04a79c62 100644 --- a/src/projects/reducers/project.js +++ b/src/projects/reducers/project.js @@ -26,7 +26,7 @@ import { ACCEPT_OR_REFUSE_INVITE_SUCCESS, ACCEPT_OR_REFUSE_INVITE_FAILURE, ACCEPT_OR_REFUSE_INVITE_PENDING, UPLOAD_PROJECT_ATTACHMENT_FILES, DISCARD_PROJECT_ATTACHMENT, CHANGE_ATTACHMENT_PERMISSION, CREATE_SCOPE_CHANGE_REQUEST_SUCCESS, APPROVE_SCOPE_CHANGE_SUCCESS, REJECT_SCOPE_CHANGE_SUCCESS, CANCEL_SCOPE_CHANGE_SUCCESS, ACTIVATE_SCOPE_CHANGE_SUCCESS, - LOAD_PROJECT_MEMBERS_SUCCESS, LOAD_PROJECT_MEMBER_INVITES_SUCCESS, LOAD_PROJECT_MEMBER_SUCCESS, CREATE_PROJECT_PHASE_PENDING, CREATE_PROJECT_PHASE_SUCCESS, CUSTOMER_APPROVE_MILESTONE_PENDING, CUSTOMER_APPROVE_MILESTONE_FINISHED, + LOAD_PROJECT_MEMBERS_SUCCESS, LOAD_PROJECT_MEMBER_INVITES_SUCCESS, LOAD_PROJECT_MEMBER_SUCCESS, CREATE_PROJECT_PHASE_PENDING, CREATE_PROJECT_PHASE_SUCCESS, CUSTOMER_APPROVE_MILESTONE_PENDING, CUSTOMER_APPROVE_MILESTONE_FINISHED, DELETE_BULK_PROJECT_PHASE_PENDING, DELETE_BULK_PROJECT_PHASE_SUCCESS, } from '../../config/constants' import _ from 'lodash' import update from 'react-addons-update' @@ -519,6 +519,7 @@ export const projectState = function (state=initialState, action) { case UPDATE_PROJECT_PENDING: case UPDATE_PHASE_PENDING: case DELETE_PROJECT_PHASE_PENDING: + case DELETE_BULK_PROJECT_PHASE_PENDING: return Object.assign({}, state, { isLoading: false, processing: true, @@ -562,6 +563,18 @@ export const projectState = function (state=initialState, action) { }) } + case DELETE_BULK_PROJECT_PHASE_SUCCESS: { + const { phaseIds } = action.payload + + const newPhases = state.phases.filter(phase => !phaseIds.includes(phase.id)) + + return Object.assign({}, state, { + phases: newPhases, + phasesNonDirty: newPhases, + processing: false, + }) + } + case UPDATE_PRODUCT_SUCCESS: return { ...state, diff --git a/src/reducers/alerts.js b/src/reducers/alerts.js index da1b345e3..6de87290c 100644 --- a/src/reducers/alerts.js +++ b/src/reducers/alerts.js @@ -77,7 +77,8 @@ import { CUSTOMER_APPROVE_MILESTONE_APPROVE_SUCCESS, CUSTOMER_APPROVE_MILESTONE_REJECT_SUCCESS, CUSTOMER_APPROVE_MILESTONE_APPROVE_FAILURE, - CUSTOMER_APPROVE_MILESTONE_REJECT_FAILURE + CUSTOMER_APPROVE_MILESTONE_REJECT_FAILURE, + DELETE_BULK_PROJECT_PHASE_SUCCESS } from '../config/constants' /* eslint-enable no-unused-vars */ @@ -112,6 +113,16 @@ export default function(state = {}, action) { return state } + case DELETE_BULK_PROJECT_PHASE_SUCCESS: { + if (state.project.version === 'v4') { + Alert.success('Project milestones deleted.') + } else { + Alert.success('Project phases deleted.') + } + + return state + } + case DELETE_PROJECT_SUCCESS: Alert.success('Project deleted.') return state From 8805263c6f60f64061e5977ffb0cc20f82f232a6 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Fri, 24 Sep 2021 22:47:14 +0800 Subject: [PATCH 06/11] fix layout issue --- .../components/MilestoneHeaderRow/MilestoneHeaderRow.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/projects/detail/components/SimplePlan/components/MilestoneHeaderRow/MilestoneHeaderRow.jsx b/src/projects/detail/components/SimplePlan/components/MilestoneHeaderRow/MilestoneHeaderRow.jsx index d3527285d..b59849839 100644 --- a/src/projects/detail/components/SimplePlan/components/MilestoneHeaderRow/MilestoneHeaderRow.jsx +++ b/src/projects/detail/components/SimplePlan/components/MilestoneHeaderRow/MilestoneHeaderRow.jsx @@ -33,7 +33,7 @@ function MilestoneHeaderRow ({ milestones, onChangeMilestones, isUpdatable, hide {/* END DATE */} {/* STATUS */} {/* COPILOTS */} - {(isUpdatable || isCustomer) && ()}{/* ACTION */} + {(isUpdatable) && ()}{/* ACTION */} From 4c79edee7c60522e8710c5b520c795d715240c8c Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Mon, 27 Sep 2021 21:42:27 +0800 Subject: [PATCH 09/11] customer row issue --- .../SimplePlan/components/MilestoneRow/MilestoneRow.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx b/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx index f14a3c4c5..eb29facf0 100644 --- a/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx +++ b/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx @@ -356,7 +356,7 @@ function MilestoneRow({ )} { - isCustomer && ( + (isCustomer && isUpdatable) && ( {/* END DATE */} {/* STATUS */} {/* COPILOTS */} - {(isUpdatable) && ()}{/* ACTION */} + {(isUpdatable || isInReview) && ()}{/* ACTION */} @@ -373,6 +374,7 @@ class ManageMilestones extends React.Component { phaseMembers={milestone.members} isApproving={milestonesInApproval.indexOf(milestone.id) !== -1} hideCheckbox={hideCheckbox} + isInReview={isInReview} />, ...this.renderChallengeTable(milestone) ] @@ -397,6 +399,7 @@ ManageMilestones.propTypes = { projectMembers: PT.arrayOf(PT.shape()), isUpdatable: PT.bool, isCustomer: PT.bool, + isInReview: PT.bool, project: PT.shape() } diff --git a/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx b/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx index eb29facf0..93024fb94 100644 --- a/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx +++ b/src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx @@ -46,7 +46,8 @@ function MilestoneRow({ disableDeleteAction, isCustomer, isApproving, - hideCheckbox + hideCheckbox, + isInReview }) { const isNeedApproval = milestone.status === PHASE_STATUS_IN_REVIEW const showApproval = isCustomer && isNeedApproval @@ -356,7 +357,7 @@ function MilestoneRow({ )} { - (isCustomer && isUpdatable) && ( + (isCustomer && isInReview) && (
return edit ? (
: null} - {isEditingMilestone ? : + {(isEditingMilestone || hideCheckbox) ? : {isUpdatable ? onExpand(!isExpand, milestone)}>{isExpand ? : }} - {isEditingMilestone ? : + {(isEditingMilestone || hideCheckbox) ? tdEl : Date: Fri, 24 Sep 2021 17:36:13 +0800 Subject: [PATCH 03/11] fix save copilot issue --- .../MilestoneHeaderRow/MilestoneHeaderRow.jsx | 25 +++++++++++-------- .../detail/containers/DashboardContainer.jsx | 2 ++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/projects/detail/components/SimplePlan/components/MilestoneHeaderRow/MilestoneHeaderRow.jsx b/src/projects/detail/components/SimplePlan/components/MilestoneHeaderRow/MilestoneHeaderRow.jsx index 7e940a433..d3527285d 100644 --- a/src/projects/detail/components/SimplePlan/components/MilestoneHeaderRow/MilestoneHeaderRow.jsx +++ b/src/projects/detail/components/SimplePlan/components/MilestoneHeaderRow/MilestoneHeaderRow.jsx @@ -9,7 +9,7 @@ import './MilestoneHeaderRow.scss' const TCFormFields = FormsyForm.Fields -function MilestoneHeaderRow ({ milestones, onChangeMilestones, isUpdatable }) { +function MilestoneHeaderRow ({ milestones, onChangeMilestones, isUpdatable, hideCheckbox }) { const checked = milestones.reduce( (selected, milestone) => selected = selected && milestone.selected, milestones.length > 0 @@ -31,16 +31,18 @@ function MilestoneHeaderRow ({ milestones, onChangeMilestones, isUpdatable }) { return (
: null} - - { - value ? selectAll() : unselectAll() - }} - /> - + { + hideCheckbox ? : + { + value ? selectAll() : unselectAll() + }} + /> + MILESTONE DESCRIPTION START DATE
{ - hideCheckbox ? : + hideCheckbox ? null : Date: Sat, 25 Sep 2021 21:45:29 +0400 Subject: [PATCH 07/11] Fixed bug in adding new milestone with null copilots --- src/projects/detail/containers/DashboardContainer.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/projects/detail/containers/DashboardContainer.jsx b/src/projects/detail/containers/DashboardContainer.jsx index 50e8fd906..d9cbd75ce 100644 --- a/src/projects/detail/containers/DashboardContainer.jsx +++ b/src/projects/detail/containers/DashboardContainer.jsx @@ -216,7 +216,7 @@ class DashboardContainer extends React.Component { } const phaseMembers = getUpdatedPhaseMembers() - if(phaseMembers !== undefined) { + if(phaseMembers !== null) { productTemplate.members = phaseMembers.map(member => member.userId) } @@ -248,7 +248,7 @@ class DashboardContainer extends React.Component { } const phaseMembers = getUpdatedPhaseMembers() - if(phaseMembers !== undefined) { + if(phaseMembers !== null) { updateParam.members = phaseMembers.map(member => member.userId) } @@ -256,7 +256,7 @@ class DashboardContainer extends React.Component { phase.projectId, phase.id, updateParam - ).then(([{ action }]) => { + ).then(({ action }) => { const updatedCreateGameplanPhases = [...this.state.createGameplanPhases] const idx = updatedCreateGameplanPhases.findIndex(phase => phase.id === action.payload.id) From 329eb029e5623899fdfd3da1c04d64c5f8713721 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Mon, 27 Sep 2021 19:28:46 +0800 Subject: [PATCH 08/11] fix issue 4495 --- .../SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx | 7 ++++++- .../SimplePlan/ManageMilestones/ManageMilestones.jsx | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx b/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx index c96add512..112ab8f67 100644 --- a/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx +++ b/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx @@ -10,6 +10,7 @@ import * as milestoneHelper from '../components/helpers/milestone' import styles from './CreateSimplePlan.scss' import MilestonesApprovalNotification from '../components/MilestonesApprovalNotification' +import { PHASE_STATUS_IN_REVIEW } from '../../../../../config/constants' const createTabs = ({ onClick } ) => ([ { @@ -47,6 +48,10 @@ class CreateSimplePlan extends React.Component { } = this.props const onClickMilestonesTab = () => {} + const isUpdatable = + isCustomer ? project.status === PHASE_STATUS_IN_REVIEW + : isProjectLive + if (milestones.length === 0) { return isCustomer ? null : (
@@ -83,7 +88,7 @@ class CreateSimplePlan extends React.Component { onApproveMilestones={onApproveMilestones} projectMembers={project.members} project={project} - isUpdatable={isProjectLive && !isCustomer} + isUpdatable={isUpdatable} isCustomer={isCustomer} />
diff --git a/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx b/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx index 0fd2b913b..0b8af69ed 100644 --- a/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx +++ b/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx @@ -338,13 +338,13 @@ class ManageMilestones extends React.Component {
{ From 0cdffc9eaf343473a2e0117b73f73255f3a760ec Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Tue, 28 Sep 2021 09:48:59 +0800 Subject: [PATCH 10/11] fix customer issue --- .../SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx | 7 ++++--- .../SimplePlan/ManageMilestones/ManageMilestones.jsx | 7 +++++-- .../SimplePlan/components/MilestoneRow/MilestoneRow.jsx | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx b/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx index 112ab8f67..34d0c65e3 100644 --- a/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx +++ b/src/projects/detail/components/SimplePlan/CreateSimplePlan/CreateSimplePlan.jsx @@ -48,8 +48,8 @@ class CreateSimplePlan extends React.Component { } = this.props const onClickMilestonesTab = () => {} - const isUpdatable = - isCustomer ? project.status === PHASE_STATUS_IN_REVIEW + const isInReview = + isCustomer ? (milestones.filter( x => x.status === PHASE_STATUS_IN_REVIEW).length > 0 && isProjectLive) : isProjectLive if (milestones.length === 0) { @@ -88,7 +88,8 @@ class CreateSimplePlan extends React.Component { onApproveMilestones={onApproveMilestones} projectMembers={project.members} project={project} - isUpdatable={isUpdatable} + isUpdatable={isProjectLive && !isCustomer} + isInReview={isInReview} isCustomer={isCustomer} />
diff --git a/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx b/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx index 0b8af69ed..97c52277f 100644 --- a/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx +++ b/src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx @@ -259,6 +259,7 @@ class ManageMilestones extends React.Component { onChangeMilestones, isUpdatable, isCustomer, + isInReview, project, } = this.props @@ -338,13 +339,13 @@ class ManageMilestones extends React.Component {
{ @@ -405,6 +406,7 @@ MilestoneRow.propTypes = { isCustomer: PT.bool, members: PT.object, hideCheckbox: PT.bool, + isInReview: PT.bool, } export default MilestoneRow From bd92e918ed0fecaf14fafc98041c06ac35015d18 Mon Sep 17 00:00:00 2001 From: Nursoltan Saipolda Date: Wed, 29 Sep 2021 15:20:59 +0800 Subject: [PATCH 11/11] Update e2e tests (#4513) * update e2e tests * fixed failing e2e tests --- .../project-creation-flow/projects/projects.po.ts | 2 +- .../project-milestone/project-milestone.helper.ts | 12 ++++++------ .../project-milestone/project-milestone.model.ts | 1 + .../project-settings/project-settings.helper.ts | 2 +- connect-automation/test-data/test-data.json | 3 ++- .../milestone-flow/create-new-milestone.spec.ts | 1 + .../project-settings-flow/project-settings.spec.ts | 7 ++++--- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/connect-automation/page-objects/project-creation-flow/projects/projects.po.ts b/connect-automation/page-objects/project-creation-flow/projects/projects.po.ts index 795241608..773c75e80 100644 --- a/connect-automation/page-objects/project-creation-flow/projects/projects.po.ts +++ b/connect-automation/page-objects/project-creation-flow/projects/projects.po.ts @@ -84,7 +84,7 @@ export class ProjectsPageObject { await CommonHelper.fillInputField(searchInput, inputText); await this.searchButton.click(); - await BrowserHelper.sleep(2000); + await BrowserHelper.sleep(4000); } /** diff --git a/connect-automation/page-objects/project-milestone/project-milestone.helper.ts b/connect-automation/page-objects/project-milestone/project-milestone.helper.ts index 9448d9d24..2f1d2ff74 100644 --- a/connect-automation/page-objects/project-milestone/project-milestone.helper.ts +++ b/connect-automation/page-objects/project-milestone/project-milestone.helper.ts @@ -347,9 +347,9 @@ export class ProjectMilestonePageHelper { await this.projectMilestonePageObject.yesButton.click(); logger.info('Clicked Yes button'); - const milestoneDeletionMessage = await CommonHelper.getAlertMessageAndClosePopup(); - expect(milestoneDeletionMessage).toEqual(projectMilestones.milestoneDeletionMessage); - logger.info(`Verified Delete Milestone Message ${milestoneDeletionMessage}`); + const milestoneBulkDeletionMessage = await CommonHelper.getAlertMessageAndClosePopup(); + expect(milestoneBulkDeletionMessage).toEqual(projectMilestones.milestoneBulkDeletionMessage); + logger.info(`Verified Delete Milestone Message ${milestoneBulkDeletionMessage}`); } /** @@ -438,9 +438,9 @@ export class ProjectMilestonePageHelper { await this.projectMilestonePageObject.yesButton.click(); logger.info('Clicked Yes button'); - const milestoneDeletionMessage = await CommonHelper.getAlertMessageAndClosePopup(); - expect(milestoneDeletionMessage).toEqual(projectMilestones.milestoneDeletionMessage); - logger.info(`Verified Delete Milestone Message ${milestoneDeletionMessage}`); + const milestoneBulkDeletionMessage = await CommonHelper.getAlertMessageAndClosePopup(); + expect(milestoneBulkDeletionMessage).toEqual(projectMilestones.milestoneBulkDeletionMessage); + logger.info(`Verified Delete Milestone Message ${milestoneBulkDeletionMessage}`); await BrowserHelper.waitUntilClickableOf( this.projectMilestonePageObject.getAddButton(), diff --git a/connect-automation/page-objects/project-milestone/project-milestone.model.ts b/connect-automation/page-objects/project-milestone/project-milestone.model.ts index 515f41cbc..feba02595 100644 --- a/connect-automation/page-objects/project-milestone/project-milestone.model.ts +++ b/connect-automation/page-objects/project-milestone/project-milestone.model.ts @@ -7,6 +7,7 @@ export interface IProjectMilestone { deleteConfirmation: string; deletePopupMessage: string; milestoneDeletionMessage: string; + milestoneBulkDeletionMessage: string; copilot: string; copilotName: string; moveMilestoneDatesTitle: string; diff --git a/connect-automation/page-objects/project-settings/project-settings.helper.ts b/connect-automation/page-objects/project-settings/project-settings.helper.ts index 141990168..511a692e5 100644 --- a/connect-automation/page-objects/project-settings/project-settings.helper.ts +++ b/connect-automation/page-objects/project-settings/project-settings.helper.ts @@ -425,7 +425,7 @@ export class ProjectSettingsPageHelper { public static async specifyUploadFilePathAndClickUploadButton() { // Specify the File Upload Path const fileToUploadElement = this.projectSettingsPageObject.selectFileToUploadButton; - const fileToUpload = '../../sample.pdf'; + const fileToUpload = '../../../sample.pdf'; let absolutePath = path.resolve(__dirname, fileToUpload); absolutePath = absolutePath.replace('/temp/', '/'); await fileToUploadElement.sendKeys(absolutePath); diff --git a/connect-automation/test-data/test-data.json b/connect-automation/test-data/test-data.json index 9f0be18a7..474686854 100644 --- a/connect-automation/test-data/test-data.json +++ b/connect-automation/test-data/test-data.json @@ -83,6 +83,7 @@ "deleteConfirmation": "Deletion Confirmation", "deletePopupMessage": "Are you sure you want to delete the selected Milestone (s)?", "milestoneDeletionMessage": "PROJECT MILESTONE DELETED.", + "milestoneBulkDeletionMessage": "PROJECT MILESTONES DELETED.", "copilot": "Copilot", "copilotName": "TCConnCopilot", "moveMilestoneDatesTitle": "Move Milestone Dates", @@ -94,6 +95,6 @@ "inReview": "In Review", "actionOnMilestoneApprove": "approve", "milestoneApprovedMessageStr": "APPROVED MILESTONES SUCCESSFULLY.", - "allMilestoneApprovedNotificationStr": "All the milestone(s) has been approved by the customer" + "allMilestoneApprovedNotificationStr": "The following milestone(s) has been approved" } } \ No newline at end of file diff --git a/connect-automation/test-suites/milestone-flow/create-new-milestone.spec.ts b/connect-automation/test-suites/milestone-flow/create-new-milestone.spec.ts index 4e79a6dfd..45a028787 100644 --- a/connect-automation/test-suites/milestone-flow/create-new-milestone.spec.ts +++ b/connect-automation/test-suites/milestone-flow/create-new-milestone.spec.ts @@ -35,6 +35,7 @@ describe('Connect App - Create New Milestone Tests:', () => { it('[TC_003] Should verify user can bulk update the milestone.', async () => { await ProjectMilestonePageHelper.deleteAllMilestones(testData.projectMilestone); + await CommonHelper.waitForAddNewMilestones(); const milestoneNames = await ProjectMilestonePageHelper.addMilestones(testData.projectMilestone, 2, testData.projectMilestone.active); await ProjectMilestonePageHelper.verifyUserCanBulkUpdateTheMilestone(testData.projectMilestone); }); diff --git a/connect-automation/test-suites/project-settings-flow/project-settings.spec.ts b/connect-automation/test-suites/project-settings-flow/project-settings.spec.ts index ed30ac073..8da9612fa 100644 --- a/connect-automation/test-suites/project-settings-flow/project-settings.spec.ts +++ b/connect-automation/test-suites/project-settings-flow/project-settings.spec.ts @@ -1,3 +1,4 @@ +import { BrowserHelper } from 'topcoder-testing-lib'; import { CommonHelper } from '../../page-objects/common-page/common.helper'; import { ProjectSettingsPageHelper } from '../../page-objects/project-settings/project-settings.helper' import * as testData from '../../test-data/test-data.json'; @@ -42,19 +43,19 @@ describe('Connect App - Project Settings Tests:', () => { it('[TC_003] Should verify user can Add/Edit/Delete/Download Files', async () => { await CommonHelper.goToRecentlyCreatedProject(); - await CommonHelper.waitForAddNewMilestones(); + await BrowserHelper.sleep(5000); await ProjectSettingsPageHelper.verifyUserCanAddEditDeleteDownloadFiles(testData.projectSettings); }); it('[TC_004] Should verify user can Add/Edit/Delete/Download Links', async () => { await CommonHelper.goToRecentlyCreatedProject(); - await CommonHelper.waitForAddNewMilestones(); + await BrowserHelper.sleep(5000); await ProjectSettingsPageHelper.verifyUserCanAddEditDeleteDownloadLinks(testData.projectSettings); }); it('[TC_005] Should verify user can Add Message with Files Attachment', async () => { await CommonHelper.goToRecentlyCreatedProject(); - await CommonHelper.waitForAddNewMilestones(); + await BrowserHelper.sleep(5000); await ProjectSettingsPageHelper.verifyUserCanAddMessageWithFileAttachment(testData.projectSettings); }); });