Skip to content

Commit 70847fc

Browse files
authored
[PROD] TaaS Release 1.0 (#4279)
Changes Supporting TaaS Release 1.0
1 parent 9b3363c commit 70847fc

File tree

24 files changed

+901
-114
lines changed

24 files changed

+901
-114
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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@ module.exports = {
5454

5555
DASHBOARD_FAQ_CONTENT_ID : process.env.DASHBOARD_FAQ_CONTENT_ID,
5656
CONTENTFUL_DELIVERY_KEY : process.env.CONTENTFUL_DELIVERY_KEY,
57-
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID
57+
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID,
58+
59+
TAAS_APP_URL: 'https://platform.topcoder-dev.com/taas'
5860
}

config/constants/master.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@ module.exports = {
5454

5555
DASHBOARD_FAQ_CONTENT_ID : process.env.DASHBOARD_FAQ_CONTENT_ID,
5656
CONTENTFUL_DELIVERY_KEY : process.env.CONTENTFUL_DELIVERY_KEY,
57-
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID
57+
CONTENTFUL_SPACE_ID : process.env.CONTENTFUL_SPACE_ID,
58+
59+
TAAS_APP_URL: 'https://platform.topcoder.com/taas'
5860
}

config/constants/qa.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@ module.exports = {
4949
TC_SYSTEM_USERID: process.env.QA_TC_SYSTEM_USERID,
5050
MAINTENANCE_MODE: process.env.QA_MAINTENANCE_MODE,
5151

52-
TC_CDN_URL: process.env.TC_CDN_URL
52+
TC_CDN_URL: process.env.TC_CDN_URL,
53+
54+
TAAS_APP_URL: 'https://platform.topcoder-dev.com/taas'
5355
}

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/components/Feed/FeedComments.jsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,21 @@ class FeedComments extends React.Component {
176176
}
177177
}
178178

179+
convertMdToHtml(markdown) {
180+
try {
181+
return (<div dangerouslySetInnerHTML={{__html: markdownToHTML(markdown)}} />)
182+
} catch (e) {
183+
return (
184+
<div>
185+
<p>{markdown}</p>
186+
<p styleName="comment-render-error">
187+
This message could not be rendered properly, please contact Topcoder Support.
188+
</p>
189+
</div>
190+
)
191+
}
192+
}
193+
179194
render() {
180195
const {
181196
currentUser, onLoadMoreComments, isLoadingComments, hasMoreComments, onAddNewComment,
@@ -325,7 +340,7 @@ class FeedComments extends React.Component {
325340
canDelete={comments && (idx !== comments.length - 1)} // cannot delete the first post which is now shown as a last one
326341
commentAnchorPrefix={commentAnchorPrefix}
327342
>
328-
<div dangerouslySetInnerHTML={{__html: markdownToHTML(itemContent)}} />
343+
{ this.convertMdToHtml(itemContent) }
329344
</Comment>
330345
)
331346
})

src/components/Feed/FeedComments.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
padding-bottom: 2 * $base-unit;
3333
}
3434

35+
.comment-render-error {
36+
border: 1px dashed $tc-orange-70;
37+
color: $tc-orange-70;
38+
text-align: center;
39+
padding: 2px;
40+
margin-top: 5px;
41+
}
42+
3543
.load-more {
3644
background-color: $tc-white;
3745
padding: 2 * $base-unit 0 $base-unit;

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/helpers/markdownToState.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {convertFromRaw} from 'draft-js'
22
import sanitizeHtml from 'sanitize-html'
3-
import Alert from 'react-s-alert'
43
const Remarkable = require('remarkable')
54

65
// Block level items, key is Remarkable's key for them, value returned is
@@ -363,13 +362,11 @@ function markdownToState(markdown, options = {}) {
363362
// If any error occurs set value to plain text
364363
const plainTextBlock = getNewBlock(BlockTypes['paragraph_open']())
365364
plainTextBlock.text = markdown
366-
365+
367366
result = convertFromRaw({
368367
entityMap: [],
369368
blocks: [plainTextBlock],
370369
})
371-
372-
Alert.warning('Some message could not be rendered properly, please contact Topcoder Support')
373370
}
374371

375372
return result

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

0 commit comments

Comments
 (0)