Skip to content

Commit 8e883e2

Browse files
committed
Revert "Revert "Merge pull request #4204 from appirio-tech/feature/taas-jobs""
This reverts commit 676ac05. # Conflicts: # config/constants/dev.js # config/constants/master.js # config/constants/qa.js # src/config/constants.js # src/projects/detail/components/SkillsQuestion/SkillsQuestionBase.jsx # src/projects/detail/containers/DashboardContainer.jsx
1 parent 3051ef4 commit 8e883e2

File tree

10 files changed

+134
-76
lines changed

10 files changed

+134
-76
lines changed

src/config/constants.js

Lines changed: 1 addition & 1 deletion
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}`

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: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SkillsQuestion extends React.PureComponent {
7474
this.setState({ options })
7575
this.updateAvailableOptions(this.props, options)
7676
if (onSkillsLoaded) {
77-
onSkillsLoaded(options.map((option) => _.pick(option, ['id', 'name'])))
77+
onSkillsLoaded(options)
7878
}
7979
}
8080

@@ -90,7 +90,6 @@ class SkillsQuestion extends React.PureComponent {
9090

9191
// if have a mapping for categories, then filter options, otherwise use all options
9292
const availableOptions = getAvailableOptions(categoriesMapping, selectedCategories, skillsCategories, options)
93-
.map(option => _.pick(option, ['id', 'name']))
9493
this.setState({ availableOptions })
9594
}
9695

@@ -179,17 +178,17 @@ class SkillsQuestion extends React.PureComponent {
179178
const selectedCategories = _.get(currentProjectData, categoriesField, [])
180179

181180
let currentValues = getValue() || []
182-
// remove from currentValues not available options but still keep created custom options without id
183-
currentValues = currentValues.filter(skill => _.some(availableOptions, skill) || !skill.id)
181+
// remove from currentValues not available options but still keep created custom options without skillId
182+
currentValues = currentValues.filter(skill => _.some(availableOptions, skill) || !skill.skillId)
184183

185184
const questionDisabled = isFormDisabled() || disabled || (selectedCategories.length === 0 && _.isUndefined(skillsCategories))
186185
const hasError = !isPristine() && !isValid()
187186
const errorMessage = getErrorMessage() || validationError
188187

189-
const checkboxGroupOptions = availableOptions.filter(option => frequentSkills.indexOf(option.id) > -1)
190-
const checkboxGroupValues = currentValues.filter(val => _.some(checkboxGroupOptions, option => option.id === val.id ))
188+
const checkboxGroupOptions = availableOptions.filter(option => frequentSkills.indexOf(option.skillId) > -1)
189+
const checkboxGroupValues = currentValues.filter(val => _.some(checkboxGroupOptions, option => option.skillId === val.skillId ))
191190

192-
const selectGroupOptions = availableOptions.filter(option => frequentSkills.indexOf(option.id) === -1)
191+
const selectGroupOptions = availableOptions.filter(option => frequentSkills.indexOf(option.skillId) === -1)
193192
if (customOptionValue) {
194193
selectGroupOptions.unshift({ name: customOptionValue })
195194
}
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
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@import '~tc-ui/src/styles/tc-includes';
2+
@import '../../../../styles/includes';
3+
4+
.container {
5+
align-items: center;
6+
display: flex;
7+
justify-content: center;
8+
height: 400px;
9+
10+
:global(.tc-btn-lg) {
11+
height: 70px;
12+
line-height: 68px;
13+
font-size: 30px;
14+
}
15+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import TaasProjectWelcome from './TaasProjectWelcome'
2+
export default TaasProjectWelcome

src/projects/detail/components/TalentPickerQuestion/TalentPickerQuestionV2.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class TalentPickerQuestionV2 extends Component {
7070
getDefaultValue() {
7171
const { options } = this.props
7272
return options.map((o) => ({
73+
roleTitle: o.roleTitle,
7374
role: o.role,
7475
people: '0',
7576
duration: '0',
@@ -96,13 +97,16 @@ class TalentPickerQuestionV2 extends Component {
9697
}
9798

9899
insertRole(index, role) {
99-
const { getValue } = this.props
100+
const { getValue, options } = this.props
100101
let values = getValue() || this.getDefaultValue()
101102

103+
const roleOption = _.find(options, { role })
104+
102105
values = [
103106
...values.slice(0, index),
104107
{
105108
role,
109+
roleTitle: roleOption.roleTitle,
106110
people: '0',
107111
duration: '0',
108112
skills: [],

src/projects/detail/containers/DashboardContainer.jsx

Lines changed: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import SystemFeed from '../../../components/Feed/SystemFeed'
4040
import ProjectScopeDrawer from '../components/ProjectScopeDrawer'
4141
import ProjectStages from '../components/ProjectStages'
4242
import ProjectPlanEmpty from '../components/ProjectPlanEmpty'
43+
import TaasProjectWelcome from '../components/TaasProjectWelcome'
4344
import NotificationsReader from '../../../components/NotificationsReader'
4445
import { hasPermission } from '../../../helpers/permissions'
4546
import { getProjectTemplateById } from '../../../helpers/templates'
@@ -60,6 +61,7 @@ import {
6061
PHASE_STATUS_DRAFT,
6162
SCREEN_BREAKPOINT_MD,
6263
CODER_BOT_USERID,
64+
PROJECT_TYPE_TALENT_AS_A_SERVICE,
6365
PHASE_PRODUCT_TEMPLATE_ID
6466
} from '../../../config/constants'
6567

@@ -179,6 +181,8 @@ class DashboardContainer extends React.Component {
179181

180182
const isProjectLive = project.status !== PROJECT_STATUS_COMPLETED && project.status !== PROJECT_STATUS_CANCELLED
181183

184+
const isTaasProject = project.type === PROJECT_TYPE_TALENT_AS_A_SERVICE
185+
182186
const leftArea = (
183187
<ProjectInfoContainer
184188
location={location}
@@ -223,61 +227,67 @@ class DashboardContainer extends React.Component {
223227
</TwoColsLayout.Sidebar>
224228

225229
<TwoColsLayout.Content>
226-
{unreadProjectUpdate.length > 0 &&
227-
<SystemFeed
228-
messages={sortedUnreadProjectUpdates}
229-
user={SYSTEM_USER}
230-
onNotificationRead={this.onNotificationRead}
231-
/>
232-
}
233-
{/* <button type="button" onClick={this.toggleDrawer}>Toggle drawer</button> */}
234-
{!!estimationQuestion &&
235-
<ProjectEstimation
236-
onClick={this.toggleDrawer}
237-
question={estimationQuestion}
238-
template={template}
239-
project={project}
240-
showPrice={!_.get(template, 'hidePrice')}
241-
theme="dashboard"
242-
/>
243-
}
244-
{/* The following containerStyle and overlayStyle are needed for shrink drawer and overlay size for not
245-
covering sidebar and topbar
246-
*/}
247-
<ProjectScopeDrawer
248-
open={this.state.open}
249-
containerStyle={{top: '60px', height: 'calc(100% - 60px)', display: 'flex', flexDirection: 'column' }}
250-
overlayStyle={{top: '60px', left: '280px'}}
251-
onRequestChange={(open) => this.setState({open})}
252-
project={project}
253-
template={template}
254-
updateProject={updateProject}
255-
processing={isProcessing}
256-
fireProjectDirty={fireProjectDirty}
257-
fireProjectDirtyUndo= {fireProjectDirtyUndo}
258-
addProjectAttachment={addProjectAttachment}
259-
updateProjectAttachment={updateProjectAttachment}
260-
removeProjectAttachment={removeProjectAttachment}
261-
productTemplates={productTemplates}
262-
productCategories={productCategories}
263-
/>
264-
265-
{visiblePhases && visiblePhases.length > 0 ? (
266-
<ProjectStages
267-
{...{
268-
...this.props,
269-
phases: visiblePhases,
270-
phasesNonDirty: visiblePhasesNonDirty,
271-
}}
272-
/>
230+
{isTaasProject ? (
231+
<TaasProjectWelcome projectId={project.id} />
273232
) : (
274-
<ProjectPlanEmpty />
275-
)}
276-
{isCreatingPhase? <LoadingIndicator/>: null}
277-
{isProjectLive && !isCreatingPhase && hasPermission(PERMISSIONS.MANAGE_PROJECT_PLAN) && !isLoadingPhases && (
278-
<CreatePhaseForm
279-
onSubmit={this.onFormSubmit}
280-
/>
233+
<div>
234+
{unreadProjectUpdate.length > 0 &&
235+
<SystemFeed
236+
messages={sortedUnreadProjectUpdates}
237+
user={SYSTEM_USER}
238+
onNotificationRead={this.onNotificationRead}
239+
/>
240+
}
241+
{/* <button type="button" onClick={this.toggleDrawer}>Toggle drawer</button> */}
242+
{!!estimationQuestion &&
243+
<ProjectEstimation
244+
onClick={this.toggleDrawer}
245+
question={estimationQuestion}
246+
template={template}
247+
project={project}
248+
showPrice={!_.get(template, 'hidePrice')}
249+
theme="dashboard"
250+
/>
251+
}
252+
{/* The following containerStyle and overlayStyle are needed for shrink drawer and overlay size for not
253+
covering sidebar and topbar
254+
*/}
255+
<ProjectScopeDrawer
256+
open={this.state.open}
257+
containerStyle={{top: '60px', height: 'calc(100% - 60px)', display: 'flex', flexDirection: 'column' }}
258+
overlayStyle={{top: '60px', left: '280px'}}
259+
onRequestChange={(open) => this.setState({open})}
260+
project={project}
261+
template={template}
262+
updateProject={updateProject}
263+
processing={isProcessing}
264+
fireProjectDirty={fireProjectDirty}
265+
fireProjectDirtyUndo= {fireProjectDirtyUndo}
266+
addProjectAttachment={addProjectAttachment}
267+
updateProjectAttachment={updateProjectAttachment}
268+
removeProjectAttachment={removeProjectAttachment}
269+
productTemplates={productTemplates}
270+
productCategories={productCategories}
271+
/>
272+
273+
{visiblePhases && visiblePhases.length > 0 ? (
274+
<ProjectStages
275+
{...{
276+
...this.props,
277+
phases: visiblePhases,
278+
phasesNonDirty: visiblePhasesNonDirty,
279+
}}
280+
/>
281+
) : (
282+
<ProjectPlanEmpty />
283+
)}
284+
{isCreatingPhase? <LoadingIndicator/>: null}
285+
{isProjectLive && !isCreatingPhase && hasPermission(PERMISSIONS.MANAGE_PROJECT_PLAN) && !isLoadingPhases && (
286+
<CreatePhaseForm
287+
onSubmit={this.onFormSubmit}
288+
/>
289+
)}
290+
</div>
281291
)}
282292
</TwoColsLayout.Content>
283293
</TwoColsLayout>

0 commit comments

Comments
 (0)