diff --git a/.circleci/config.yml b/.circleci/config.yml index b062b4d44..443b21887 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -136,7 +136,7 @@ workflows: - build-dev filters: branches: - only: ['feature/permissions'] + only: ['feature/bulk-milestone-updates'] - deployProd: context : org-global diff --git a/config/constants/dev.js b/config/constants/dev.js index 0ab9baa0a..deaa09883 100644 --- a/config/constants/dev.js +++ b/config/constants/dev.js @@ -49,5 +49,5 @@ module.exports = { TC_SYSTEM_USERID: process.env.DEV_TC_SYSTEM_USERID, MAINTENANCE_MODE: process.env.DEV_MAINTENANCE_MODE, - TC_CDN_URL: process.env.TC_CDN_URL || 'https://d1aahxkjiobka8.cloudfront.net' + TC_CDN_URL: process.env.TC_CDN_URL } diff --git a/config/constants/master.js b/config/constants/master.js index e0aa0b448..8eaef1198 100644 --- a/config/constants/master.js +++ b/config/constants/master.js @@ -49,5 +49,5 @@ module.exports = { TC_SYSTEM_USERID: process.env.PROD_TC_SYSTEM_USERID, MAINTENANCE_MODE: process.env.PROD_MAINTENANCE_MODE, - TC_CDN_URL: process.env.TC_CDN_URL || 'https://dlxczxztayxv6.cloudfront.net' + TC_CDN_URL: process.env.TC_CDN_URL } diff --git a/config/constants/qa.js b/config/constants/qa.js index e9a131a3b..3f2f7910c 100644 --- a/config/constants/qa.js +++ b/config/constants/qa.js @@ -48,5 +48,5 @@ module.exports = { TC_SYSTEM_USERID: process.env.QA_TC_SYSTEM_USERID, MAINTENANCE_MODE: process.env.QA_MAINTENANCE_MODE, - TC_CDN_URL: process.env.TC_CDN_URL || 'https://d1aahxkjiobka8.cloudfront.net' + TC_CDN_URL: process.env.TC_CDN_URL } diff --git a/package-lock.json b/package-lock.json index eba1f584a..a862fde30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -851,11 +851,29 @@ "dev": true }, "axios": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.13.1.tgz", - "integrity": "sha1-Pmer/kMzvJ0tX+b70TtGlOr8jfg=", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", "requires": { - "follow-redirects": "0.0.7" + "follow-redirects": "1.5.10" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + } } }, "axobject-query": { diff --git a/package.json b/package.json index 814ba7c08..54a176771 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ }, "dependencies": { "appirio-tech-react-components": "git+https://github.com/appirio-tech/react-components.git#feature/connectv2", - "axios": "^0.13.1", + "axios": "^0.19.2", "brace": "^0.11.1", "classnames": "^2.2.3", "coffeescript": "^1.12.7", diff --git a/scripts/permissions-doc/webpack.config.js b/scripts/permissions-doc/webpack.config.js index 3b9eeb65d..bf20a177d 100644 --- a/scripts/permissions-doc/webpack.config.js +++ b/scripts/permissions-doc/webpack.config.js @@ -21,6 +21,7 @@ webpackConfig.module.rules.push({ webpackConfig.plugins = [] -console.log('webpackConfig', JSON.stringify(webpackConfig, null, 2)) +// Uncomment for debugging the final webpack config +// console.log('webpackConfig', JSON.stringify(webpackConfig, null, 2)) module.exports = webpackConfig diff --git a/src/actions/loadUser.js b/src/actions/loadUser.js index bc3b3c896..c96e383d5 100644 --- a/src/actions/loadUser.js +++ b/src/actions/loadUser.js @@ -54,6 +54,8 @@ export function loadUserSuccess(dispatch, token) { currentUser.id = currentUser.userId currentUser.token = token } + // uncomment to add admin role to the user for testing admin functionality locally + // currentUser.roles.push('administrator') if (currentUser) { getUserProfile(currentUser.handle).then((profile) => { currentUser = _.assign(currentUser, profile) diff --git a/src/api/timelines.js b/src/api/timelines.js index e9270dc7c..f76392791 100644 --- a/src/api/timelines.js +++ b/src/api/timelines.js @@ -53,6 +53,19 @@ export function updateMilestone(timelineId, milestoneId, updatedProps) { .then(resp => resp.data) } +/** + * Bulk update milestones + * + * @param {Number} timelineId timeline id + * @param {Array<{}>} milestones the timeline's milestones + * + * @returns {Promise} milestones + */ +export function updateMilestones(timelineId, milestones) { + return axios.patch(`${PROJECTS_API_URL}/v5/timelines/${timelineId}/milestones`, milestones) + .then(resp => resp.data) +} + /** * Get milestone templates by product template id * diff --git a/src/components/ProjectInfo/ProjectInfo.jsx b/src/components/ProjectInfo/ProjectInfo.jsx index 365feac7c..7786145a9 100644 --- a/src/components/ProjectInfo/ProjectInfo.jsx +++ b/src/components/ProjectInfo/ProjectInfo.jsx @@ -11,7 +11,9 @@ import { SCREEN_BREAKPOINT_MD, PROJECT_STATUS_ACTIVE, PHASE_STATUS_ACTIVE, PHASE import ReviewProjectButton from '../../projects/detail/components/ReviewProjectButton' import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip' import { TOOLTIP_DEFAULT_DELAY } from '../../config/constants' +import { getProjectTemplateByKey } from '../../helpers/templates' +import ProjectTypeIcon from '../../components/ProjectTypeIcon' import './ProjectInfo.scss' class ProjectInfo extends Component { @@ -23,7 +25,7 @@ class ProjectInfo extends Component { render() { const { project, currentMemberRole, onChangeStatus, isSuperUser, phases, onSubmitForReview, isProjectProcessing, - showDeleteConfirm, toggleProjectDelete, onConfirmDelete } = this.props + showDeleteConfirm, toggleProjectDelete, onConfirmDelete, projectTemplates } = this.props const code = _.get(project, 'details.utm.code', '') @@ -50,29 +52,47 @@ class ProjectInfo extends Component { ) + const url = `/projects/${project.id}` + const projectTemplateId = project.templateId + const projectTemplateKey = _.get(project, 'details.products[0]') + const projectTemplate = projectTemplateId + ? _.find(projectTemplates, pt => pt.id === projectTemplateId) + : getProjectTemplateByKey(projectTemplates, projectTemplateKey) + // icon for the product, use default generic work project icon for categories which no longer exist now + const productIcon = _.get(projectTemplate, 'icon', 'tech-32px-outline-work-project') + const templateName = _.get(projectTemplate, 'name', null) + const projectType = project.type !== undefined ? project.type[0].toUpperCase() + project.type.substr(1).replace(/_/g, ' ') : null return (