Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d2d6a76
integrate with phase member api
nqviet Jul 24, 2021
5e572b2
fix alert message typo
nqviet Jul 24, 2021
fba5404
fix issue 4428
nqviet Jul 26, 2021
e2ce1ba
fix phaseId when updating phase members of a newly created phase
nqviet Jul 26, 2021
97e7fde
Merge pull request #4434 from nqviet/new-milestone-concept--issue-4428
elkhawajah Jul 26, 2021
7f2c285
Merge remote-tracking branch 'origin/feature/new-milestone-concept' i…
tasqat Jul 28, 2021
e33705d
Put back copilots and wire with new api
tasqat Jul 28, 2021
223a411
Updated width of copilots entry
tasqat Jul 28, 2021
a49bfe0
fix issue 4439
nqviet Jul 29, 2021
45ddbdb
Merge pull request #4441 from nqviet/new-milestone-concept--phase-cop…
elkhawajah Jul 29, 2021
2c11f5f
fix issue 4433
nqviet Jul 29, 2021
91143f0
fix avatar disappeared after updating phase
nqviet Jul 29, 2021
5f94374
Merge pull request #4442 from nqviet/new-milestone-concept--phase-cop…
elkhawajah Jul 29, 2021
e284491
fix avatars disappeared when saving
nqviet Jul 30, 2021
650c560
Merge pull request #4444 from nqviet/new-milestone-concept--phase-cop…
elkhawajah Jul 30, 2021
5d979d9
Milestone Challenges Listing - Initial submission
tasqat Aug 3, 2021
9ba9f6c
fix: fix issues
yoution Aug 4, 2021
d3ae844
Final Fixes for Challenge Milstone Listing
tasqat Aug 4, 2021
b9661ef
moved details.challengeId to configurable string
tasqat Aug 4, 2021
abf4795
attempt to fix pagination
tasqat Aug 4, 2021
a432b2c
fixed lint
tasqat Aug 4, 2021
56ae5f1
fix: issue about pagination and gap line
yoution Aug 5, 2021
88dbdb5
fix: issue about no challenges
yoution Aug 5, 2021
7346027
Merge pull request #4446 from yoution/feature/new-milestone-concept
elkhawajah Aug 5, 2021
26bb1ff
Revert challenge id config map, put it as constant in constants
tasqat Aug 5, 2021
6f75f09
fix: issue about milestone challenge count
yoution Aug 6, 2021
fe8d458
Merge pull request #4448 from yoution/feature/new-milestone-concept
elkhawajah Aug 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/api/phaseMembers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { axiosInstance as axios } from './requestInterceptor'
import { PROJECTS_API_URL } from '../config/constants'

export function updatePhaseMembers(projectId, phaseId, userIds) {
const url = `${PROJECTS_API_URL}/v5/projects/${projectId}/phases/${phaseId}/members`
const data = { userIds }
return axios.post(url, data)
.then(res => res.data)
}
13 changes: 13 additions & 0 deletions src/api/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ export function getProjectSuggestions() {
// TODO
}

/**
* Get a challenge detail based on it's id
* @param {integer} challenId challenge id
* @return {object} challenge detail returned by api
*/
export function getChallengeById(challengeId) {
return axios.get(`${PROJECTS_API_URL}/v5/challenges/${challengeId}/`)
.then(resp => {
const res = resp.data
return res
})
}


/**
* Get a project based on it's id
Expand Down
36 changes: 36 additions & 0 deletions src/assets/icons/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/icon-calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/icon-calendar2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/icon-copilot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/icon-delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/icons/icon-disselect.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/icon-save2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/icon-trash2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export const LOAD_USER_CREDENTIAL_PENDING = 'LOAD_USER_CREDENTIAL_PENDING'
export const LOAD_USER_CREDENTIAL_SUCCESS = 'LOAD_USER_CREDENTIAL_SUCCESS'
export const LOAD_USER_CREDENTIAL_FAILURE = 'LOAD_USER_CREDENTIAL_FAILURE'

// Load_CHALLEGNES
export const LOAD_CHALLEGNES = 'LOAD_CHALLEGNES'
export const LOAD_CHALLEGNES_PENDING = 'LOAD_CHALLEGNES_PENDING'
export const LOAD_CHALLEGNES_SUCCESS = 'LOAD_CHALLEGNES_SUCCESS'
export const LOAD_CHALLEGNES_FAILURE = 'Load_CHALLEGNES_FAILURE'

// Load organization configs
export const LOAD_ORG_CONFIG_SUCCESS = 'LOAD_ORG_CONFIG_SUCCESS'
Expand Down Expand Up @@ -753,6 +758,8 @@ export const PROJECT_ATTACHMENTS_FOLDER = process.env.PROJECT_ATTACHMENTS_FOLDER
export const FILE_PICKER_ACCEPT = process.env.FILE_PICKER_ACCEPT || ['.bmp', '.gif', '.jpg', '.tex', '.xls', '.xlsx', '.doc', '.docx', '.zip', '.txt', '.pdf', '.png', '.ppt', '.pptx', '.rtf', '.csv']

export const SEGMENT_KEY = process.env.CONNECT_SEGMENT_KEY

export const CHALLENGE_ID_MAPPING = 'challengeGuid'
/*
* URLs
*/
Expand All @@ -766,6 +773,7 @@ export const ACCOUNTS_APP_REGISTER_URL = process.env.ACCOUNTS_APP_REGISTER_URL |
export const TC_API_URL = `https://api.${DOMAIN}`
export const DIRECT_PROJECT_URL = `https://www.${DOMAIN}/direct/projectOverview?formData.projectId=`
export const WORK_MANAGER_APP = `https://challenges.${DOMAIN}/projects`
export const CHALLENGE_DETAIL_APP = `https://www.${DOMAIN}/challenges`
export const SALESFORCE_PROJECT_LEAD_LINK = process.env.SALESFORCE_PROJECT_LEAD_LINK
export const SALESFORCE_BILLING_ACCOUNT_LINK = process.env.SALESFORCE_BILLING_ACCOUNT_LINK
export const TC_NOTIFICATION_URL = process.env.TC_NOTIFICATION_URL || `${TC_API_URL}/v5/notifications`
Expand Down
10 changes: 10 additions & 0 deletions src/projects/actions/phaseMember.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { updatePhaseMembers as updatePhaseMembersAPI } from '../../api/phaseMembers'

export function updatePhaseMembers(projectId, phaseId, userIds) {
return (dispatch) => {
return dispatch({
type: 'UPDATE_PROJECT_PHASE_MEMBERS',
payload: updatePhaseMembersAPI(projectId, phaseId, userIds)
})
}
}
39 changes: 34 additions & 5 deletions src/projects/actions/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'lodash'
import moment from 'moment'
import { flatten, unflatten } from 'flat'
import { getProjectById,
getChallengeById,
createProject as createProjectAPI,
updateProject as updateProjectAPI,
deleteProject as deleteProjectAPI,
Expand Down Expand Up @@ -36,6 +37,7 @@ import {
DELETE_PROJECT,
PROJECT_DIRTY,
PROJECT_DIRTY_UNDO,
LOAD_CHALLEGNES,
LOAD_PROJECT_PHASES,
UPDATE_PRODUCT,
PROJECT_STATUS_DRAFT,
Expand Down Expand Up @@ -161,6 +163,7 @@ export function loadProjectInvite(projectId) {
}*/
}


/**
* Get project phases together with products
*
Expand All @@ -187,12 +190,40 @@ function getProjectPhasesWithProducts(projectId) {
'spentBudget',
'startDate',
'status',
'members',
'updatedAt',
'updatedBy',
].join(',')
})
}

/**
* Get challenges by challenge ids
*
* @param {Number} milestoneId milestone id
* @param {Array} challengeIds challenge ids
*
* @returns {Promise<[]>} resolves to the list of challenge
*/
export function getChallengesByIds(milestoneId, challengeIds) {

const requests = _.map(challengeIds, id => getChallengeById(id))
const challengesAPIs = Promise.all(requests)

return (dispatch) => {
return dispatch({
type: LOAD_CHALLEGNES,
payload: challengesAPIs,
meta: {
milestoneId
}
})
}

}



/**
* Load project phases with populated products
*
Expand Down Expand Up @@ -286,14 +317,12 @@ function createProductsTimelineAndMilestone(project) {
*
* @return {Promise} project
*/
export function createProjectPhaseAndProduct(project, productTemplate, status = PHASE_STATUS_DRAFT, startDate, endDate, createTimeline = true, budget, details) {
export function createProjectPhaseAndProduct(project, productTemplate, status = PHASE_STATUS_DRAFT, startDate, endDate, createTimeline = true) {
const param = {
status,
name: productTemplate.name,
description: productTemplate.description,
productTemplateId: productTemplate.id,
budget,
details,
}
if (startDate) {
param['startDate'] = startDate.format('YYYY-MM-DD')
Expand Down Expand Up @@ -358,12 +387,12 @@ function createPhaseAndMilestonesRequest(project, productTemplate, status = PHAS
* @param {*} startDate
* @param {*} endDate
*/
export function createPhaseWithoutTimeline(project, productTemplate, status, startDate, endDate, budget, details) {
export function createPhaseWithoutTimeline(project, productTemplate, status, startDate, endDate) {
return (dispatch) => {
console.log(CREATE_PROJECT_PHASE)
return dispatch({
type: CREATE_PROJECT_PHASE,
payload: createProjectPhaseAndProduct(project, productTemplate, status, startDate, endDate, false, budget, details)
payload: createProjectPhaseAndProduct(project, productTemplate, status, startDate, endDate, false)
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import React from 'react'
import PT from 'prop-types'
import _ from 'lodash'
import GenericMenu from '../../../../../components/GenericMenu'
// import ProjectDetailsWidget from '../ProjectDetailsWidget'
import ManageMilestones from '../ManageMilestones'
Expand All @@ -21,19 +20,6 @@ const createTabs = ({ onClick } ) => ([

class CreateSimplePlan extends React.Component {
componentDidMount() {
const { project, milestones, loadMembers } = this.props

let copilotIds = []
milestones.forEach((milestone) => {
copilotIds = copilotIds.concat(_.get(milestone, 'details.copilots', []))
})

const projectMemberIds = project.members.map(member => member.userId)
const missingMemberIds = _.difference(copilotIds, projectMemberIds)
if (missingMemberIds.length) {
loadMembers(missingMemberIds)
}

const contentInnerElement = document.querySelector('.twoColsLayout-contentInner')
contentInnerElement.classList.add(styles['twoColsLayout-contentInner'])
}
Expand All @@ -51,8 +37,8 @@ class CreateSimplePlan extends React.Component {
onChangeMilestones,
onSaveMilestone,
onRemoveMilestone,
onGetChallenges,
isProjectLive,
members,
isCustomer,
} = this.props
const onClickMilestonesTab = () => {}
Expand Down Expand Up @@ -83,12 +69,12 @@ class CreateSimplePlan extends React.Component {
</div>
<ManageMilestones
milestones={milestones}
onGetChallenges={onGetChallenges}
onChangeMilestones={onChangeMilestones}
onSaveMilestone={onSaveMilestone}
onRemoveMilestone={onRemoveMilestone}
projectMembers={project.members}
isUpdatable={isProjectLive && !isCustomer}
members={members}
/>
</div>
</div>
Expand All @@ -103,7 +89,7 @@ CreateSimplePlan.propTypes = {
onChangeMilestones: PT.func,
onSaveMilestone: PT.func,
onRemoveMilestone: PT.func,
members: PT.object,
onGetChallenges: PT.func,
isCustomer: PT.bool,
}

Expand Down
Loading