diff --git a/.circleci/config.yml b/.circleci/config.yml index 1187420eb..5b9dace6e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,7 +128,7 @@ workflows: - build-dev filters: branches: - only: ['dev'] + only: ['dev', 'feature/add_msg_for_taas_projects'] - deployTest01: context : org-global diff --git a/config/constants/dev.js b/config/constants/dev.js index d8c3e285f..5776dd80a 100644 --- a/config/constants/dev.js +++ b/config/constants/dev.js @@ -38,6 +38,7 @@ module.exports = { FILE_PICKER_ACCEPT: process.env.FILE_PICKER_ACCEPT_DEV, SALESFORCE_PROJECT_LEAD_LINK: 'https://c.cs18.visual.force.com/apex/ConnectLead?connectProjectId=', + SALESFORCE_BILLING_ACCOUNT_LINK: 'https://c.cs18.visual.force.com/apex/baredirect?id=', CONNECT_SEGMENT_KEY: process.env.DEV_SEGMENT_KEY, PREDIX_PROGRAM_ID : 3448, diff --git a/config/constants/master.js b/config/constants/master.js index 924643813..a594a3545 100644 --- a/config/constants/master.js +++ b/config/constants/master.js @@ -39,6 +39,7 @@ module.exports = { FILE_PICKER_ACCEPT: process.env.FILE_PICKER_ACCEPT_PROD, SALESFORCE_PROJECT_LEAD_LINK: 'https://topcoder.my.salesforce.com/apex/ConnectLead?connectProjectId=', + SALESFORCE_BILLING_ACCOUNT_LINK: 'https://topcoder.my.salesforce.com/apex/baredirect?id=', CONNECT_SEGMENT_KEY: process.env.PROD_SEGMENT_KEY, PREDIX_PROGRAM_ID : 3448, IBM_COGNITIVE_PROGRAM_ID : 3449, diff --git a/config/constants/qa.js b/config/constants/qa.js index 0d94ada46..31d32cce2 100644 --- a/config/constants/qa.js +++ b/config/constants/qa.js @@ -38,6 +38,7 @@ module.exports = { FILE_PICKER_ACCEPT: process.env.FILE_PICKER_ACCEPT_QA, SALESFORCE_PROJECT_LEAD_LINK: 'https://c.cs18.visual.force.com/apex/ConnectLead?connectProjectId=', + SALESFORCE_BILLING_ACCOUNT_LINK: 'https://c.cs18.visual.force.com/apex/baredirect?id=', CONNECT_SEGMENT_KEY: process.env.QA_SEGMENT_KEY, PREDIX_PROGRAM_ID : 3448, IBM_COGNITIVE_PROGRAM_ID : 3449, diff --git a/src/actions/loadUser.js b/src/actions/loadUser.js index b70c3eb88..0669fb51a 100644 --- a/src/actions/loadUser.js +++ b/src/actions/loadUser.js @@ -3,6 +3,8 @@ import { ACCOUNTS_APP_CONNECTOR_URL, LOAD_USER_SUCCESS, LOAD_USER_FAILURE, + LOAD_USER_CREDENTIAL, + LOAD_USER_CREDENTIAL_FAILURE, LOAD_ORG_CONFIG_SUCCESS, LOAD_ORG_CONFIG_FAILURE, ROLE_ADMINISTRATOR, @@ -16,7 +18,7 @@ import { ROLE_PRESALES, ROLE_PROJECT_MANAGER, ROLE_SOLUTION_ARCHITECT } from '../config/constants' import { getFreshToken, configureConnector, decodeToken } from 'tc-auth-lib' -import { getUserProfile } from '../api/users' +import { getUserProfile, getCredential } from '../api/users' import { fetchGroups } from '../api/groups' import { getOrgConfig } from '../api/orgConfig' import { EventTypes } from 'redux-segment' @@ -26,6 +28,18 @@ configureConnector({ frameId: 'tc-accounts-iframe' }) +export function getUserCredential(userId) { + return (dispatch) => { + return dispatch({ + type: LOAD_USER_CREDENTIAL, + payload: getCredential(userId) + }).catch((err) => { + console.log(err) + dispatch({ type: LOAD_USER_CREDENTIAL_FAILURE }) + }) + } +} + export function loadUser() { return ((dispatch, getState) => { const state = getState() @@ -125,9 +139,9 @@ export function loadUserSuccess(dispatch, token) { loadGroups(dispatch, currentUser.userId) }) .catch((err) => { - // if we fail to load user's profile, still dispatch user load success - // ideally it shouldn't happen, but if it is, we can render the page - // without profile information + // if we fail to load user's profile, still dispatch user load success + // ideally it shouldn't happen, but if it is, we can render the page + // without profile information console.log(err) dispatch({ type: LOAD_USER_SUCCESS, user : currentUser }) }) @@ -161,7 +175,7 @@ function loadGroups(dispatch, userId) { } }) .catch((err) => { - // if we fail to load groups + // if we fail to load groups console.log(err) }) } diff --git a/src/api/users.js b/src/api/users.js index 68a85159a..88b025020 100644 --- a/src/api/users.js +++ b/src/api/users.js @@ -17,6 +17,23 @@ export function getUserProfile(handle) { }) } + +/** + * Gets credential for the specified user id. + * + * NOTE: Only admins are authorized to use the underlying endpoint. + * + * @param {Number} userId The user id + * @return {Promise} Resolves to the linked accounts array. + */ +export function getCredential(userId) { + return axios.get(`${TC_API_URL}/v3/users/${userId}?fields=credential`) + .then(resp => { + return _.get(resp.data, 'result.content', {}) + }) +} + + /** * Update user profile * diff --git a/src/components/MobileMenu/MobileMenu.jsx b/src/components/MobileMenu/MobileMenu.jsx index 8f58407e8..199cba071 100644 --- a/src/components/MobileMenu/MobileMenu.jsx +++ b/src/components/MobileMenu/MobileMenu.jsx @@ -52,7 +52,7 @@ const MobileMenu = ({ user, onClose, menu }) => { ))} -
Topcoder © 2018
+
Topcoder © {new Date().getFullYear()}
) diff --git a/src/components/Select/Select.jsx b/src/components/Select/Select.jsx index 92f300a7e..3c2e470ae 100644 --- a/src/components/Select/Select.jsx +++ b/src/components/Select/Select.jsx @@ -26,6 +26,7 @@ const Select = (props) => { {...props} createOptionPosition="first" className={containerclass} + ref={props.createSelectRef} classNamePrefix="react-select" /> ) @@ -36,6 +37,7 @@ const Select = (props) => { createOptionPosition="first" className={containerclass} classNamePrefix="react-select" + isClearable /> ) } diff --git a/src/components/TeamManagement/AutocompleteInput.jsx b/src/components/TeamManagement/AutocompleteInput.jsx index d670dfc90..006466628 100644 --- a/src/components/TeamManagement/AutocompleteInput.jsx +++ b/src/components/TeamManagement/AutocompleteInput.jsx @@ -16,14 +16,18 @@ class AutocompleteInput extends React.Component { const { placeholder, selectedMembers, - disabled + createSelectRef, + disabled, + onBlur } = this.props return (