Skip to content

Commit 202ec5a

Browse files
author
vikasrohit
authored
Merge pull request #4342 from appirio-tech/dev
Prod Release 2.18.0
2 parents 71c5aa1 + 90a9340 commit 202ec5a

File tree

23 files changed

+225
-53
lines changed

23 files changed

+225
-53
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ workflows:
128128
- build-dev
129129
filters:
130130
branches:
131-
only: ['dev']
131+
only: ['dev', 'feature/add_msg_for_taas_projects']
132132

133133
- deployTest01:
134134
context : org-global

config/constants/dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = {
3838
FILE_PICKER_ACCEPT: process.env.FILE_PICKER_ACCEPT_DEV,
3939

4040
SALESFORCE_PROJECT_LEAD_LINK: 'https://c.cs18.visual.force.com/apex/ConnectLead?connectProjectId=',
41+
SALESFORCE_BILLING_ACCOUNT_LINK: 'https://c.cs18.visual.force.com/apex/baredirect?id=',
4142

4243
CONNECT_SEGMENT_KEY: process.env.DEV_SEGMENT_KEY,
4344
PREDIX_PROGRAM_ID : 3448,

config/constants/master.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module.exports = {
3939
FILE_PICKER_ACCEPT: process.env.FILE_PICKER_ACCEPT_PROD,
4040

4141
SALESFORCE_PROJECT_LEAD_LINK: 'https://topcoder.my.salesforce.com/apex/ConnectLead?connectProjectId=',
42+
SALESFORCE_BILLING_ACCOUNT_LINK: 'https://topcoder.my.salesforce.com/apex/baredirect?id=',
4243
CONNECT_SEGMENT_KEY: process.env.PROD_SEGMENT_KEY,
4344
PREDIX_PROGRAM_ID : 3448,
4445
IBM_COGNITIVE_PROGRAM_ID : 3449,

config/constants/qa.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = {
3838
FILE_PICKER_ACCEPT: process.env.FILE_PICKER_ACCEPT_QA,
3939

4040
SALESFORCE_PROJECT_LEAD_LINK: 'https://c.cs18.visual.force.com/apex/ConnectLead?connectProjectId=',
41+
SALESFORCE_BILLING_ACCOUNT_LINK: 'https://c.cs18.visual.force.com/apex/baredirect?id=',
4142
CONNECT_SEGMENT_KEY: process.env.QA_SEGMENT_KEY,
4243
PREDIX_PROGRAM_ID : 3448,
4344
IBM_COGNITIVE_PROGRAM_ID : 3449,

src/actions/loadUser.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {
33
ACCOUNTS_APP_CONNECTOR_URL,
44
LOAD_USER_SUCCESS,
55
LOAD_USER_FAILURE,
6+
LOAD_USER_CREDENTIAL,
7+
LOAD_USER_CREDENTIAL_FAILURE,
68
LOAD_ORG_CONFIG_SUCCESS,
79
LOAD_ORG_CONFIG_FAILURE,
810
ROLE_ADMINISTRATOR,
@@ -16,7 +18,7 @@ import {
1618
ROLE_PRESALES, ROLE_PROJECT_MANAGER, ROLE_SOLUTION_ARCHITECT
1719
} from '../config/constants'
1820
import { getFreshToken, configureConnector, decodeToken } from 'tc-auth-lib'
19-
import { getUserProfile } from '../api/users'
21+
import { getUserProfile, getCredential } from '../api/users'
2022
import { fetchGroups } from '../api/groups'
2123
import { getOrgConfig } from '../api/orgConfig'
2224
import { EventTypes } from 'redux-segment'
@@ -26,6 +28,18 @@ configureConnector({
2628
frameId: 'tc-accounts-iframe'
2729
})
2830

31+
export function getUserCredential(userId) {
32+
return (dispatch) => {
33+
return dispatch({
34+
type: LOAD_USER_CREDENTIAL,
35+
payload: getCredential(userId)
36+
}).catch((err) => {
37+
console.log(err)
38+
dispatch({ type: LOAD_USER_CREDENTIAL_FAILURE })
39+
})
40+
}
41+
}
42+
2943
export function loadUser() {
3044
return ((dispatch, getState) => {
3145
const state = getState()
@@ -125,9 +139,9 @@ export function loadUserSuccess(dispatch, token) {
125139
loadGroups(dispatch, currentUser.userId)
126140
})
127141
.catch((err) => {
128-
// if we fail to load user's profile, still dispatch user load success
129-
// ideally it shouldn't happen, but if it is, we can render the page
130-
// without profile information
142+
// if we fail to load user's profile, still dispatch user load success
143+
// ideally it shouldn't happen, but if it is, we can render the page
144+
// without profile information
131145
console.log(err)
132146
dispatch({ type: LOAD_USER_SUCCESS, user : currentUser })
133147
})
@@ -161,7 +175,7 @@ function loadGroups(dispatch, userId) {
161175
}
162176
})
163177
.catch((err) => {
164-
// if we fail to load groups
178+
// if we fail to load groups
165179
console.log(err)
166180
})
167181
}

src/api/users.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,23 @@ export function getUserProfile(handle) {
1717
})
1818
}
1919

20+
21+
/**
22+
* Gets credential for the specified user id.
23+
*
24+
* NOTE: Only admins are authorized to use the underlying endpoint.
25+
*
26+
* @param {Number} userId The user id
27+
* @return {Promise} Resolves to the linked accounts array.
28+
*/
29+
export function getCredential(userId) {
30+
return axios.get(`${TC_API_URL}/v3/users/${userId}?fields=credential`)
31+
.then(resp => {
32+
return _.get(resp.data, 'result.content', {})
33+
})
34+
}
35+
36+
2037
/**
2138
* Update user profile
2239
*

src/components/MobileMenu/MobileMenu.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const MobileMenu = ({ user, onClose, menu }) => {
5252
</ul>
5353
))}
5454
</div>
55-
<div styleName="footer">Topcoder &copy; 2018</div>
55+
<div styleName="footer">Topcoder &copy; {new Date().getFullYear()}</div>
5656
</div>
5757
</MobilePage>
5858
)

src/components/Select/Select.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const Select = (props) => {
2626
{...props}
2727
createOptionPosition="first"
2828
className={containerclass}
29+
ref={props.createSelectRef}
2930
classNamePrefix="react-select"
3031
/>
3132
)
@@ -36,6 +37,7 @@ const Select = (props) => {
3637
createOptionPosition="first"
3738
className={containerclass}
3839
classNamePrefix="react-select"
40+
isClearable
3941
/>
4042
)
4143
}

src/components/TeamManagement/AutocompleteInput.jsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ class AutocompleteInput extends React.Component {
1616
const {
1717
placeholder,
1818
selectedMembers,
19-
disabled
19+
createSelectRef,
20+
disabled,
21+
onBlur
2022
} = this.props
2123

2224
return (
2325
<div className="autocomplete-wrapper">
2426
<Select
2527
isMulti
28+
onBlur={onBlur}
2629
closeMenuOnSelect
30+
createSelectRef={createSelectRef}
2731
showDropdownIndicator={false}
2832
createOption
2933
placeholder={placeholder}
@@ -41,6 +45,7 @@ class AutocompleteInput extends React.Component {
4145
AutocompleteInput.defaultProps = {
4246
placeholder: 'Enter one or more user handles',
4347
selectedMembers: [],
48+
createSelectRef: () => {},
4449
disabled: false
4550
}
4651

@@ -50,6 +55,16 @@ AutocompleteInput.propTypes = {
5055
*/
5156
onUpdate: PropTypes.func,
5257

58+
/**
59+
* Callback fired when input blur
60+
*/
61+
onBlur: PropTypes.func,
62+
63+
/**
64+
* Callback for pass select Ref to parent component
65+
*/
66+
createSelectRef : PropTypes.func,
67+
5368
/**
5469
* The current logged in user in the app.
5570
* Used to determinate "You" label and access

src/components/TeamManagement/AutocompleteInputContainer.jsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ class AutocompleteInputContainer extends React.Component {
1111
constructor(props) {
1212
super(props)
1313
this.debounceTimer = null
14+
this.selectInstance = null
1415

1516
this.clearUserSuggestions = this.clearUserSuggestions.bind(this)
17+
this.handleInputBlur = this.handleInputBlur.bind(this)
18+
this.createSelectRef = this.createSelectRef.bind(this)
1619
}
1720

1821
/**
@@ -66,13 +69,36 @@ class AutocompleteInputContainer extends React.Component {
6669
this.clearUserSuggestions()
6770
}
6871

72+
handleInputBlur(event) {
73+
const {
74+
selectedMembers
75+
} = this.props
76+
const value = event.target.value
77+
const innerSelectInstance = this.selectInstance.select
78+
79+
if (value) {
80+
const hasExist = _.find(selectedMembers, ({label}) => label === value)
81+
if (!hasExist) {
82+
// format new option from input value
83+
const newOption = {value, label: value}
84+
innerSelectInstance.select.selectOption(newOption)
85+
}
86+
}
87+
}
88+
89+
createSelectRef(ref) {
90+
this.selectInstance = ref
91+
}
92+
6993
render() {
7094

7195
const { placeholder, currentUser, selectedMembers, disabled } = this.props
7296

7397
return (
7498
<AutocompleteInput
99+
createSelectRef={this.createSelectRef}
75100
placeholder={placeholder ? placeholder:''}
101+
onBlur={this.handleInputBlur}
76102
onInputChange={this.onInputChange.bind(this)}
77103
onUpdate={this.onUpdate.bind(this)}
78104
suggestedMembers={this.props.suggestedMembers}

0 commit comments

Comments
 (0)