Skip to content

Commit 32e038e

Browse files
committed
Merge branch 'master' into dev
# Conflicts: # config/constants/dev.js # config/constants/master.js # config/constants/qa.js
2 parents aceb24f + a4987d2 commit 32e038e

File tree

21 files changed

+870
-106
lines changed

21 files changed

+870
-106
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ workflows:
136136
- build-dev
137137
filters:
138138
branches:
139-
only: ['feature/unified-permissions', 'feature/accept-reject-terms-in-profile']
139+
only: ['feature/taas-jobs-2']
140140

141141
- deployProd:
142142
context : org-global

config/constants/dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@ module.exports = {
5656
CONTENTFUL_DELIVERY_KEY : process.env.CONTENTFUL_DELIVERY_KEY,
5757
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID,
5858

59+
TAAS_APP_URL: 'https://platform.topcoder-dev.com/taas',
5960
DEFAULT_NDA_UUID: 'e5811a7b-43d1-407a-a064-69e5015b4900'
6061
}

config/constants/master.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@ module.exports = {
5656
CONTENTFUL_DELIVERY_KEY : process.env.CONTENTFUL_DELIVERY_KEY,
5757
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID,
5858

59+
TAAS_APP_URL: 'https://platform.topcoder.com/taas',
5960
DEFAULT_NDA_UUID: 'c41e90e5-4d0e-4811-bd09-38ff72674490'
6061
}

config/constants/qa.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ module.exports = {
5151

5252
TC_CDN_URL: process.env.TC_CDN_URL,
5353

54+
TAAS_APP_URL: 'https://platform.topcoder-dev.com/taas',
5455
DEFAULT_NDA_UUID: 'e5811a7b-43d1-407a-a064-69e5015b4900'
5556
}

src/api/skills.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { TC_API_URL } from '../config/constants'
2+
import { axiosInstance as axios } from './requestInterceptor'
3+
4+
const skillPageSize = 100
5+
let cachedSkillsAsPromise
6+
7+
/**
8+
* Loads and caches all the skills the first time. Returns the skills list from the cache from the second time.
9+
*/
10+
export function getSkills() {
11+
cachedSkillsAsPromise = cachedSkillsAsPromise || getAllSkills().catch(ex => {
12+
console.error('Error loading skills', ex)
13+
cachedSkillsAsPromise = null
14+
return []
15+
})
16+
17+
return cachedSkillsAsPromise
18+
}
19+
20+
/**
21+
* Recursively loads all the pages from skills api.
22+
*/
23+
function getAllSkills() {
24+
let skills = []
25+
26+
return new Promise((resolve, reject) => {
27+
const loop = (page) => getSkillsPage(page)
28+
.then((skillResponse) => {
29+
skills = skills.concat(skillResponse.data)
30+
if (skillResponse.data.length === skillPageSize) {
31+
page++
32+
loop(page)
33+
} else {
34+
resolve(skills)
35+
}
36+
})
37+
.catch(ex => reject(ex))
38+
39+
loop(1)
40+
})
41+
}
42+
43+
/**
44+
* Loads the skills in the given page.
45+
* @param {number} page The page number to load
46+
*/
47+
function getSkillsPage(page) {
48+
return axios.get(`${TC_API_URL}/v5/taas-teams/skills?perPage=${skillPageSize}&orderBy=name&page=${page}`)
49+
}

src/config/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ export const SEGMENT_KEY = process.env.CONNECT_SEGMENT_KEY
729729
*/
730730
export const DOMAIN = process.env.domain || 'topcoder.com'
731731
export const CONNECT_DOMAIN = `connect.${DOMAIN}`
732-
export const CONNECT_MAIN_PAGE_URL = `http://connect.${DOMAIN}`
732+
export const CONNECT_MAIN_PAGE_URL = `https://connect.${DOMAIN}`
733733
export const ACCOUNTS_APP_CONNECTOR_URL = process.env.ACCOUNTS_APP_CONNECTOR_URL
734734
export const ACCOUNTS_APP_LOGIN_URL = process.env.ACCOUNTS_APP_LOGIN_URL || `https://accounts-auth0.${DOMAIN}`
735735
export const ACCOUNTS_APP_REGISTER_URL = process.env.ACCOUNTS_APP_REGISTER_URL || `https://accounts-auth0.${DOMAIN}`
@@ -1109,7 +1109,7 @@ export const PROJECT_TYPE_TALENT_AS_A_SERVICE = 'talent-as-a-service'
11091109
/**
11101110
* URL to the Topcoder TaaS App
11111111
*/
1112-
export const TAAS_APP_URL = process.env.TAAS_APP_URL || 'https://mfe.topcoder-dev.com/taas'
1112+
export const TAAS_APP_URL = process.env.TAAS_APP_URL || 'https://platform.topcoder-dev.com/taas'
11131113

11141114
/**
11151115
* Milestone Types

src/projects/create/components/ProjectSubmitted.jsx

Lines changed: 86 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,104 @@
11
import React from 'react'
22
import PT from 'prop-types'
3+
import qs from 'query-string'
34

45
require('./ProjectSubmitted.scss')
6+
import {
7+
CONNECT_MAIN_PAGE_URL, PROJECT_TYPE_TALENT_AS_A_SERVICE, TAAS_APP_URL
8+
} from '../../../config/constants'
9+
510
class ProjectSubmitted extends React.Component {
6-
constructor(props) {
7-
super(props)
8-
this.state = {
9-
url: `projects/${props.params.status || props.projectId}`
11+
/**
12+
* Build project URL based on the `type` query param in URL.
13+
*
14+
* @param {boolean} isTaas
15+
* @param {String} projectId project id
16+
*/
17+
getProjectUrl(isTaas, projectId = '') {
18+
const url = isTaas
19+
// if the project type is TaaS, then use link to TaaS App
20+
? `${TAAS_APP_URL}/myteams/${projectId}`
21+
// otherwise use link inside Connect App
22+
: `${CONNECT_MAIN_PAGE_URL}/projects/${projectId}`
23+
24+
return url
25+
}
26+
27+
getPageConfiguration() {
28+
const { type } = qs.parse(window.location.search)
29+
const isTaas = type === PROJECT_TYPE_TALENT_AS_A_SERVICE
30+
31+
const projectId = this.props.params.status || this.props.projectId
32+
33+
const project = {
34+
headerSubTitle: 'Your project has been created',
35+
textBody: (
36+
<div className="content">
37+
Topcoder will be contacting you soon to discuss your project proposal.
38+
<br />
39+
<br />
40+
<span>
41+
In the meantime, get a jump on the process by inviting your coworkers to your project and securely share any detailed requirements documents you have inside your project.
42+
</span>
43+
</div>
44+
),
45+
leftButton: {
46+
header: 'All Projects',
47+
subText: 'View all of your projects',
48+
url: this.getProjectUrl(isTaas)
49+
},
50+
rightButton: {
51+
header: 'Go to Project',
52+
subText: 'Invite your team members and share requirements',
53+
url: this.getProjectUrl(isTaas, projectId)
54+
},
1055
}
56+
57+
const taas = {
58+
headerSubTitle: 'Your talent request has been created',
59+
textBody: (
60+
<div className="content">
61+
Topcoder will be contacting you soon to discuss your talent needs.
62+
</div>
63+
),
64+
leftButton: {
65+
header: 'All Projects',
66+
subText: 'View all of your projects',
67+
url: this.getProjectUrl(false) // also showing link to Connect App Project List
68+
},
69+
rightButton: {
70+
header: 'View Talent Request',
71+
subText: 'Modify your request and track fulfillment',
72+
url: this.getProjectUrl(isTaas, projectId)
73+
},
74+
}
75+
76+
return isTaas? taas: project
1177
}
1278

1379
render() {
80+
81+
const {
82+
headerSubTitle,
83+
textBody,
84+
leftButton,
85+
rightButton
86+
} = this.getPageConfiguration()
87+
1488
return (
1589
<div className="ProjectSubmitted flex column middle center tc-ui">
1690
<div className="container flex column middle center">
1791
<div className="title">Congratulations!</div>
18-
<div className="sub-title">Your project has been created</div>
19-
<div className="content">
20-
Topcoder will be contacting you soon to discuss your project proposal.
21-
<br />
22-
<br />
23-
<span>
24-
In the meantime, get a jump on the process by inviting your coworkers to your project and securely share any detailed requirements documents you have inside your project.
25-
</span>
26-
</div>
92+
<div className="sub-title">{headerSubTitle}</div>
93+
{textBody}
2794
<div className="button-container flex row middle center">
28-
<a type="button" href={this.state.url} className="go-to-project-btn tc-btn tc-btn-sm tc-btn-default flex middle center" disabled={false}>
29-
Go to Project
30-
<small>Invite your team members and share requirements</small>
95+
<a type="button" href={leftButton.url} className="go-to-project-btn tc-btn tc-btn-sm tc-btn-default flex middle center">
96+
{leftButton.header}
97+
<small>{leftButton.subText}</small>
3198
</a>
32-
<a href="projects" type="button" className="go-to-project-dashboard-btn tc-btn tc-btn-sm tc-btn-primary flex middle center" disabled={false}>
33-
All Projects
34-
<small>View all of your projects</small>
99+
<a href={rightButton.url} type="button" className="go-to-project-dashboard-btn tc-btn tc-btn-sm tc-btn-primary flex middle center">
100+
{rightButton.header}
101+
<small>{rightButton.subText}</small>
35102
</a>
36103
</div>
37104
</div>
@@ -41,7 +108,6 @@ In the meantime, get a jump on the process by inviting your coworkers to your pr
41108
}
42109

43110
ProjectSubmitted.defaultProps = {
44-
vm: {},
45111
params: {},
46112
}
47113

src/projects/create/components/ProjectWizard.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,6 @@ class ProjectWizard extends Component {
605605
/>
606606
<div />
607607
<ProjectSubmitted
608-
project={ project }
609-
projectTemplates={ projectTemplates }
610-
dirtyProject={ dirtyProject }
611608
params={ params }
612609
projectId={ projectId }
613610
/>

src/projects/create/containers/CreateContainer.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,12 @@ class CreateContainer extends React.Component {
124124
projectId: nextProjectId,
125125
isProjectDirty: false
126126
}, () => {
127+
const type = _.get(this.state, 'updatedProject.type')
127128
// go to submitted state
128129
console.log('go to submitted state')
129130
window.localStorage.removeItem(LS_INCOMPLETE_PROJECT)
130131
window.localStorage.removeItem(LS_INCOMPLETE_WIZARD)
131-
this.props.history.push('/new-project/submitted/' + nextProjectId)
132+
this.props.history.push('/new-project/submitted/' + nextProjectId + (type ? `?type=${type}` : ''))
132133
})
133134

134135
} else if (this.state.creatingProject !== nextProps.processing) {

src/projects/detail/components/Accordion/Accordion.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const TYPE = {
3333
SELECT_DROPDOWN: 'select-dropdown',
3434
TALENT_PICKER: 'talent-picker',
3535
TALENT_PICKER_V2: 'talent-picker-v2',
36+
JOBS_PICKER: 'jobs-picker',
3637
}
3738

3839
/**
@@ -180,6 +181,9 @@ class Accordion extends React.Component {
180181
const totalPeoplePerRole = _.mapValues(_.groupBy(value, v => v.role), valuesUnderGroup => _.sumBy(valuesUnderGroup, v => Number(v.people)))
181182
return _.toPairs(totalPeoplePerRole).filter(([, people]) => people > 0).map(([role, people]) => `${getRoleName(role)}: ${people}`).join(', ')
182183
}
184+
case TYPE.JOBS_PICKER: {
185+
return _.map(value, 'title').join(', ')
186+
}
183187
default: return value
184188
}
185189
}

0 commit comments

Comments
 (0)