Skip to content

Commit 6238fef

Browse files
authored
Merge pull request #4204 from appirio-tech/feature/taas-jobs
Updates for TaaS Intake Form
2 parents aa61325 + 09f9d8f commit 6238fef

File tree

14 files changed

+167
-82
lines changed

14 files changed

+167
-82
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/taas-jobs']
132132

133133
- deployTest01:
134134
context : org-global

config/constants/dev.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,8 @@ module.exports = {
5353

5454
DASHBOARD_FAQ_CONTENT_ID : process.env.DASHBOARD_FAQ_CONTENT_ID,
5555
CONTENTFUL_DELIVERY_KEY : process.env.CONTENTFUL_DELIVERY_KEY,
56-
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID
56+
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID,
57+
58+
SKILL_PROVIDER_ID: '9cc0795a-6e12-4c84-9744-15858dba1861',
59+
TAAS_APP_URL: 'https://mfe.topcoder-dev.com/taas'
5760
}

config/constants/master.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,8 @@ module.exports = {
5353

5454
DASHBOARD_FAQ_CONTENT_ID : process.env.DASHBOARD_FAQ_CONTENT_ID,
5555
CONTENTFUL_DELIVERY_KEY : process.env.CONTENTFUL_DELIVERY_KEY,
56-
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID
56+
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID,
57+
58+
SKILL_PROVIDER_ID: 'e8467a61-7e20-4ed2-a839-c6340d90f408',
59+
TAAS_APP_URL: 'https://mfe.topcoder.com/taas'
5760
}

config/constants/qa.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,8 @@ module.exports = {
4848
TC_SYSTEM_USERID: process.env.QA_TC_SYSTEM_USERID,
4949
MAINTENANCE_MODE: process.env.QA_MAINTENANCE_MODE,
5050

51-
TC_CDN_URL: process.env.TC_CDN_URL
51+
TC_CDN_URL: process.env.TC_CDN_URL,
52+
53+
SKILL_PROVIDER_ID: '9cc0795a-6e12-4c84-9744-15858dba1861',
54+
TAAS_APP_URL: 'https://mfe.topcoder-dev.com/taas'
5255
}

src/config/constants.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,12 +717,13 @@ export const PROJECT_ATTACHMENTS_FOLDER = process.env.PROJECT_ATTACHMENTS_FOLDER
717717
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']
718718

719719
export const SEGMENT_KEY = process.env.CONNECT_SEGMENT_KEY
720+
export const SKILL_PROVIDER_ID = process.env.SKILL_PROVIDER_ID || '9cc0795a-6e12-4c84-9744-15858dba1861'
720721
/*
721722
* URLs
722723
*/
723724
export const DOMAIN = process.env.domain || 'topcoder.com'
724725
export const CONNECT_DOMAIN = `connect.${DOMAIN}`
725-
export const CONNECT_MAIN_PAGE_URL = `http://connect.${DOMAIN}`
726+
export const CONNECT_MAIN_PAGE_URL = `https://connect.${DOMAIN}`
726727
export const ACCOUNTS_APP_CONNECTOR_URL = process.env.ACCOUNTS_APP_CONNECTOR_URL
727728
export const ACCOUNTS_APP_LOGIN_URL = process.env.ACCOUNTS_APP_LOGIN_URL || `https://accounts-auth0.${DOMAIN}`
728729
export const ACCOUNTS_APP_REGISTER_URL = process.env.ACCOUNTS_APP_REGISTER_URL || `https://accounts-auth0.${DOMAIN}`
@@ -1093,3 +1094,13 @@ export const PROFILE_FIELDS_CONFIG = {
10931094
// businessPhone: false,
10941095
}
10951096
}
1097+
1098+
/**
1099+
* The type of the project for talent as a service app.
1100+
*/
1101+
export const PROJECT_TYPE_TALENT_AS_A_SERVICE = 'talent-as-a-service'
1102+
1103+
/**
1104+
* URL to the Topcoder TaaS App
1105+
*/
1106+
export const TAAS_APP_URL = process.env.TAAS_APP_URL || 'https://mfe.topcoder-dev.com/taas'

src/projects/create/components/ProjectSubmitted.jsx

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,49 @@
11
import React from 'react'
22
import PT from 'prop-types'
3+
import qs from 'query-string'
34

45
require('./ProjectSubmitted.scss')
56
import {
6-
CONNECT_DOMAIN
7+
CONNECT_MAIN_PAGE_URL, PROJECT_TYPE_TALENT_AS_A_SERVICE, TAAS_APP_URL
78
} from '../../../config/constants'
89

10+
/**
11+
* Build project URL based on the `type` query param in URL.
12+
*
13+
* @param {String} projectId project id
14+
*/
15+
const formatProjectURL = (projectId) => {
16+
const { type } = qs.parse(window.location.search)
17+
18+
const url = type === PROJECT_TYPE_TALENT_AS_A_SERVICE
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+
927
class ProjectSubmitted extends React.Component {
1028
constructor(props) {
1129
super(props)
1230

1331
this.copyToClipboard = this.copyToClipboard.bind(this)
14-
this.state = {
15-
domain: `${CONNECT_DOMAIN}/`,
16-
url: `projects/${props.params.status || props.projectId}`
17-
}
1832
}
1933

2034
copyToClipboard() {
35+
const url = formatProjectURL(this.props.params.status || this.props.projectId)
2136
const textField = document.createElement('textarea')
22-
textField.innerText = `${this.state.domain}${this.state.url}`
37+
textField.innerText = url
2338
document.body.appendChild(textField)
2439
textField.select()
2540
document.execCommand('copy')
2641
textField.remove()
2742
}
2843

2944
render() {
45+
const url = formatProjectURL(this.props.params.status || this.props.projectId)
46+
3047
return (
3148
<div className="ProjectSubmitted flex column middle center tc-ui">
3249
<div className="container flex column middle center">
@@ -39,11 +56,11 @@ class ProjectSubmitted extends React.Component {
3956
Use the link below to share your project with members of your team. You can also access all your Topcoder projects in one place from your Connect project dashboard.
4057
</div>
4158
<div className="project-link-container flex row middle center">
42-
{ `${this.state.domain}${this.state.url}` }
59+
<a href={url}>{url.replace('https://', '')}</a>
4360
</div>
4461
<div className="button-container flex row middle center">
4562
<a type="button" onClick={this.copyToClipboard} className="copy-link-btn tc-btn tc-btn-sm tc-btn-default flex middle center" disabled={false}>Copy link</a>
46-
<a href={this.state.url} type="button" className="go-to-project-dashboard-btn tc-btn tc-btn-sm tc-btn-primary flex middle center" disabled={false}>Go to project dashboard</a>
63+
<a href={url} type="button" className="go-to-project-dashboard-btn tc-btn tc-btn-sm tc-btn-primary flex middle center" disabled={false}>Go to project dashboard</a>
4764
</div>
4865
</div>
4966
</div>
@@ -52,7 +69,6 @@ class ProjectSubmitted extends React.Component {
5269
}
5370

5471
ProjectSubmitted.defaultProps = {
55-
vm: {},
5672
params: {},
5773
}
5874

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/SkillsQuestion/SkillsQuestionBase.jsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SkillsCheckboxGroup from './SkillsCheckboxGroup'
44
import Select from '../../../../components/Select/Select'
55
import './SkillsQuestion.scss'
66
import { axiosInstance as axios } from '../../../../api/requestInterceptor'
7-
import { TC_API_URL } from '../../../../config/constants'
7+
import { TC_API_URL, SKILL_PROVIDER_ID } from '../../../../config/constants'
88
import { createFilter } from 'react-select'
99

1010
let cachedOptions
@@ -21,6 +21,9 @@ let cachedOptions
2121
* @returns {Array} available options
2222
*/
2323
const getAvailableOptions = (categoriesMapping, selectedCategories, skillsCategories, options) => {
24+
// NOTE:
25+
// Disable filtering skills by categories for now, because V5 Skills API doesn't have categories for now.
26+
/*
2427
let mappedCategories
2528
if (categoriesMapping) {
2629
mappedCategories = _.map(selectedCategories, (category) => categoriesMapping[category] ? categoriesMapping[category].toLowerCase() : null)
@@ -31,6 +34,7 @@ const getAvailableOptions = (categoriesMapping, selectedCategories, skillsCatego
3134
if (mappedCategories) {
3235
return options.filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedCategories).length > 0)
3336
}
37+
*/
3438
return options
3539
}
3640

@@ -48,12 +52,15 @@ class SkillsQuestion extends React.PureComponent {
4852

4953
componentWillMount() {
5054
if (!cachedOptions) {
51-
axios.get(`${TC_API_URL}/v3/tags/?domain=SKILLS&status=APPROVED`)
55+
axios.get(`${TC_API_URL}/v5/skills?skillProviderId=${SKILL_PROVIDER_ID}&perPage=100`)
5256
.then(resp => {
53-
const options = _.get(resp.data, 'result.content', {})
57+
const options = _.get(resp, 'data', [])
5458

55-
cachedOptions = options
56-
this.updateOptions(options)
59+
cachedOptions = options.map((option) => ({
60+
skillId: option.id,
61+
name: option.name
62+
}))
63+
this.updateOptions(cachedOptions)
5764
})
5865
} else {
5966
this.updateOptions(cachedOptions)
@@ -77,7 +84,7 @@ class SkillsQuestion extends React.PureComponent {
7784
this.setState({ options })
7885
this.updateAvailableOptions(this.props, options)
7986
if (onSkillsLoaded) {
80-
onSkillsLoaded(options.map((option) => _.pick(option, ['id', 'name'])))
87+
onSkillsLoaded(options)
8188
}
8289
}
8390

@@ -93,7 +100,6 @@ class SkillsQuestion extends React.PureComponent {
93100

94101
// if have a mapping for categories, then filter options, otherwise use all options
95102
const availableOptions = getAvailableOptions(categoriesMapping, selectedCategories, skillsCategories, options)
96-
.map(option => _.pick(option, ['id', 'name']))
97103
this.setState({ availableOptions })
98104
}
99105

@@ -182,17 +188,17 @@ class SkillsQuestion extends React.PureComponent {
182188
const selectedCategories = _.get(currentProjectData, categoriesField, [])
183189

184190
let currentValues = getValue() || []
185-
// remove from currentValues not available options but still keep created custom options without id
186-
currentValues = currentValues.filter(skill => _.some(availableOptions, skill) || !skill.id)
191+
// remove from currentValues not available options but still keep created custom options without 'skillId'
192+
currentValues = currentValues.filter(skill => _.some(availableOptions, skill) || !skill.skillId)
187193

188194
const questionDisabled = isFormDisabled() || disabled || (selectedCategories.length === 0 && _.isUndefined(skillsCategories))
189195
const hasError = !isPristine() && !isValid()
190196
const errorMessage = getErrorMessage() || validationError
191197

192-
const checkboxGroupOptions = availableOptions.filter(option => frequentSkills.indexOf(option.id) > -1)
193-
const checkboxGroupValues = currentValues.filter(val => _.some(checkboxGroupOptions, option => option.id === val.id ))
198+
const checkboxGroupOptions = availableOptions.filter(option => frequentSkills.indexOf(option.skillId) > -1)
199+
const checkboxGroupValues = currentValues.filter(val => _.some(checkboxGroupOptions, option => option.skillId === val.skillId ))
194200

195-
const selectGroupOptions = availableOptions.filter(option => frequentSkills.indexOf(option.id) === -1)
201+
const selectGroupOptions = availableOptions.filter(option => frequentSkills.indexOf(option.skillId) === -1)
196202
if (customOptionValue) {
197203
selectGroupOptions.unshift({ name: customOptionValue })
198204
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
import { TAAS_APP_URL } from '../../../../../config/constants/dev'
3+
import './TaasProjectWelcome.scss'
4+
5+
const TaasProjectWelcome = ({ projectId }) => {
6+
const url = `${TAAS_APP_URL}/myteams/${projectId}`
7+
return (
8+
<div styleName="container">
9+
<a href={url} className="tc-btn tc-btn-lg tc-btn-primary">Go to your Talent Team</a>
10+
</div>
11+
)
12+
}
13+
14+
export default TaasProjectWelcome

0 commit comments

Comments
 (0)