Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
edfb775
Merge pull request #1268 from topcoder-platform/hotfix/parse-review-s…
ThomasKranitsas Jan 12, 2022
caea065
WIP...
doctorhilarius Jan 18, 2022
d3cadf4
clean-up
doctorhilarius Jan 18, 2022
cd604f7
clean-up
doctorhilarius Jan 18, 2022
c01cfba
clean-up
doctorhilarius Jan 19, 2022
e45334c
fix active feedback nav;
doctorhilarius Jan 19, 2022
ef5a1f7
clean-up
doctorhilarius Jan 19, 2022
272b4af
clean-up
doctorhilarius Jan 19, 2022
c77b05a
clean-up
doctorhilarius Jan 19, 2022
81a7f09
clean-up
doctorhilarius Jan 19, 2022
ff8e4f1
change "self serve" to "self service"
doctorhilarius Jan 19, 2022
fe90cac
only show active and draft for self service
doctorhilarius Jan 19, 2022
1146630
change no challenges msg for self service
doctorhilarius Jan 19, 2022
29da52d
fix content of draft tab for self service
doctorhilarius Jan 19, 2022
ff1d86b
disable hover for self serv chellanges
doctorhilarius Jan 19, 2022
c2347cf
Merge pull request #1272 from doctorhilarius/self-service-opps
ThomasKranitsas Jan 19, 2022
12ab8e7
minor fixes and put everything related to self-service under beta
ThomasKranitsas Jan 19, 2022
c4d1e60
fix package-lock
ThomasKranitsas Jan 19, 2022
df72422
fix package-lock
ThomasKranitsas Jan 19, 2022
790cec8
set self-serve-specfic statuses; clean-up
doctorhilarius Jan 19, 2022
1c3bf64
get user-specific challenges;
doctorhilarius Jan 19, 2022
5defce4
clean-up
doctorhilarius Jan 19, 2022
621956e
add assign yourself copilit button
doctorhilarius Jan 20, 2022
1c84971
change launch button text;
doctorhilarius Jan 20, 2022
05f0029
add reject button
doctorhilarius Jan 20, 2022
3091e5e
Merge pull request #1279 from doctorhilarius/self-service-opps
ThomasKranitsas Jan 20, 2022
7929ce0
style and wire up reject button
doctorhilarius Jan 20, 2022
7fa4ba5
fix typo copilot;
doctorhilarius Jan 20, 2022
8ba6acb
create resource
doctorhilarius Jan 20, 2022
edc20f3
remove copilot query from drafts
doctorhilarius Jan 20, 2022
a98a22c
fix import of create resource
doctorhilarius Jan 20, 2022
3f32ca6
reject challenge modal wip
doctorhilarius Jan 21, 2022
b936b4c
update UI after challenge is assigned to self
doctorhilarius Jan 21, 2022
8f601d9
wire up reject modal
doctorhilarius Jan 21, 2022
3302195
Merge pull request #1280 from doctorhilarius/self-service-opps
ThomasKranitsas Jan 21, 2022
c100f4b
remove patching to change the selfServiceCopilot as that has been mov…
ThomasKranitsas Jan 21, 2022
ba7c63b
fix console errors
doctorhilarius Jan 21, 2022
a285513
wire up and style cancel reason modal
doctorhilarius Jan 21, 2022
6cda335
Merge pull request #1282 from doctorhilarius/self-service-opps
ThomasKranitsas Jan 21, 2022
cde6d00
change challenge list name header
doctorhilarius Jan 21, 2022
4eddce9
Merge branch 'develop' into self-service-opps
doctorhilarius Jan 21, 2022
db18d64
require approving before launching for self service challenges
doctorhilarius Jan 21, 2022
8cd71aa
clean-up
doctorhilarius Jan 21, 2022
3b90fe6
Merge pull request #1283 from doctorhilarius/self-service-opps
ThomasKranitsas Jan 21, 2022
3e3f19a
minor fixes on access check
ThomasKranitsas Jan 22, 2022
9dc43bf
add approved tab
doctorhilarius Jan 24, 2022
aa6280a
Merge pull request #1285 from doctorhilarius/self-service-opps
ThomasKranitsas Jan 27, 2022
8a500cb
auto add copilot as approver and screener on self service challenges
ThomasKranitsas Jan 27, 2022
adf88d8
update screener to primary screener
ThomasKranitsas Jan 27, 2022
ab19d57
do not set actualEndDate
ThomasKranitsas Jan 28, 2022
263fa35
clean-up rejectchallenge console error
doctorhilarius Jan 28, 2022
176e8e9
fix issue w/not assigning copilots to self-serve challenges
doctorhilarius Jan 28, 2022
bcee707
fix typo
doctorhilarius Jan 28, 2022
ce6fa30
unassign copilot
doctorhilarius Jan 28, 2022
9e185ad
Merge pull request #1293 from doctorhilarius/self-service-fixes
ThomasKranitsas Jan 30, 2022
0ff512f
Merge pull request #1294 from doctorhilarius/self-service-fixes
ThomasKranitsas Jan 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/actions/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ import {
DELETE_CHALLENGE_PENDING,
DELETE_CHALLENGE_SUCCESS,
DELETE_CHALLENGE_FAILURE,
LOAD_CHALLENGE_RESOURCES
LOAD_CHALLENGE_RESOURCES,
CHALLENGE_STATUS
} from '../config/constants'
import { loadProject } from './projects'
import { removeChallengeFromPhaseProduct, saveChallengeAsPhaseProduct } from '../services/projects'
Expand All @@ -58,7 +59,7 @@ import { removeChallengeFromPhaseProduct, saveChallengeAsPhaseProduct } from '..
/**
* Loads active challenges of project by page
*/
export function loadChallengesByPage (page, projectId, status, filterChallengeName = null) {
export function loadChallengesByPage (page, projectId, status, filterChallengeName = null, selfService = false, userHandle = null) {
return (dispatch, getState) => {
dispatch({
type: LOAD_CHALLENGES_PENDING,
Expand All @@ -85,6 +86,12 @@ export function loadChallengesByPage (page, projectId, status, filterChallengeNa
} else if (!(_.isInteger(projectId) && projectId > 0)) {
filters['status'] = 'Active'
}
if (selfService) {
filters.selfService = true
if (userHandle && filters.status.toUpperCase() !== CHALLENGE_STATUS.DRAFT) {
filters.selfServiceCopilot = userHandle
}
}

return fetchChallenges(filters, {
page,
Expand Down
12 changes: 12 additions & 0 deletions src/actions/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ export function loadProjects (filterProjectName = '', myProjects = true) {
}
}

/**
* Unloads projects of the authenticated user
*/
export function unloadProjects () {
return (dispatch) => {
dispatch({
type: LOAD_PROJECTS_SUCCESS,
projects: []
})
}
}

/**
* Reset active params. e.g activeProjectId
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,12 @@ class ChallengeScheduleField extends Component {
phase.scheduledStartDate = startDate
phase.scheduledEndDate = moment(startDate).add(phase.duration || 0, 'hours').toDate()
phase.actualStartDate = phase.scheduledStartDate
phase.actualEndDate = phase.scheduledEndDate
} else {
const preIndex = _.findIndex(phases, (p) => p.id === phase.predecessor)
// `Invalid phase predecessor: ${phase.predecessor}`
phase.scheduledStartDate = phases[preIndex].scheduledEndDate
phase.scheduledEndDate = moment(phase.scheduledStartDate).add(phase.duration || 0, 'hours').toDate()
phase.actualStartDate = phase.scheduledStartDate
phase.actualEndDate = phase.scheduledEndDate
}
}

Expand Down
37 changes: 22 additions & 15 deletions src/components/ChallengeEditor/ChallengeView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ const ChallengeView = ({
enableEdit,
onLaunchChallenge,
onCloseTask,
projectPhases
projectPhases,
assignYourselfCopilot,
showRejectChallengeModal,
loggedInUser
}) => {
const selectedType = _.find(metadata.challengeTypes, { id: challenge.typeId })
const challengeTrack = _.find(metadata.challengeTracks, { id: challenge.trackId })
Expand Down Expand Up @@ -74,7 +77,7 @@ const ChallengeView = ({
const reviewerFromResources = reviewerResource ? reviewerResource.memberHandle : ''
let copilot, reviewer
if (challenge) {
copilot = challenge.copilot
copilot = challenge.copilot || (challenge.legacy && challenge.legacy.selfServiceCopilot)
reviewer = challenge.reviewer
}
copilot = copilot || copilotFromResources
Expand Down Expand Up @@ -103,18 +106,18 @@ const ChallengeView = ({
</span>
</div>
{selectedMilestone &&
<div className={styles.col}>
<span><span className={styles.fieldTitle}>Milestone:</span> {selectedMilestone ? (
<a href={`${CONNECT_APP_URL}/projects/${projectDetail.id}`} target='_blank'
rel='noopener noreferrer'>
{selectedMilestone.name}
</a>
) : ''}</span>
</div>
<div className={styles.col}>
<span><span className={styles.fieldTitle}>Milestone:</span> {selectedMilestone ? (
<a href={`${CONNECT_APP_URL}/projects/${projectDetail.id}`} target='_blank'
rel='noopener noreferrer'>
{selectedMilestone.name}
</a>
) : ''}</span>
</div>
}
<div className={styles.col}>
<span className={styles.fieldTitle}>Track:</span>
<Track disabled type={challengeTrack} isActive key={challenge.trackId} onUpdateOthers={() => {}} />
<Track disabled type={challengeTrack} isActive key={challenge.trackId} onUpdateOthers={() => { }} />
</div>
<div className={styles.col}>
<span><span className={styles.fieldTitle}>Type:</span> {selectedType ? selectedType.name : ''}</span>
Expand All @@ -130,10 +133,11 @@ const ChallengeView = ({
</div>
</div>
{isTask &&
<AssignedMemberField challenge={challenge} assignedMemberDetails={assignedMemberDetails} readOnly />}
<AssignedMemberField challenge={challenge} assignedMemberDetails={assignedMemberDetails} readOnly />}
<CopilotField challenge={{
copilot
}} copilots={metadata.members} readOnly />
copilot,
selfService: challenge.legacy.selfService
}} copilots={challengeResources} assignYourselfCopilot={assignYourselfCopilot} showRejectChallengeModal={showRejectChallengeModal} readOnly loggedInUser={loggedInUser} />
<div className={cn(styles.row, styles.topRow)}>
<div className={styles.col}>
<span><span
Expand Down Expand Up @@ -259,7 +263,10 @@ ChallengeView.propTypes = {
enableEdit: PropTypes.bool,
onLaunchChallenge: PropTypes.func,
onCloseTask: PropTypes.func,
projectPhases: PropTypes.arrayOf(PropTypes.object)
projectPhases: PropTypes.arrayOf(PropTypes.object),
assignYourselfCopilot: PropTypes.func.isRequired,
showRejectChallengeModal: PropTypes.func.isRequired,
loggedInUser: PropTypes.object
}

export default withRouter(ChallengeView)
67 changes: 57 additions & 10 deletions src/components/ChallengeEditor/ChallengeViewTabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import LegacyLinks from '../../LegacyLinks'
import ForumLink from '../../ForumLink'
import Registrants from '../Registrants'
import Submissions from '../Submissions'
import { getResourceRoleByName } from '../../../util/tc'
import { MESSAGE } from '../../../config/constants'
import { checkAdmin, getResourceRoleByName } from '../../../util/tc'
import { CHALLENGE_STATUS, MESSAGE } from '../../../config/constants'
import Tooltip from '../../Tooltip'
import CancelDropDown from '../Cancel-Dropdown'
import 'react-tabs/style/react-tabs.css'
Expand Down Expand Up @@ -43,7 +43,11 @@ const ChallengeViewTabs = ({
onLaunchChallenge,
cancelChallenge,
onCloseTask,
projectPhases
projectPhases,
assignYourselfCopilot,
showRejectChallengeModal,
loggedInUser,
onApproveChallenge
}) => {
const [selectedTab, setSelectedTab] = useState(0)

Expand Down Expand Up @@ -80,6 +84,22 @@ const ChallengeViewTabs = ({

const isTask = _.get(challenge, 'task.isTask', false)

const isSelfService = challenge.legacy.selfService
const isDraft = challenge.status.toUpperCase() === CHALLENGE_STATUS.DRAFT
const isSelfServiceCopilot = challenge.legacy.selfServiceCopilot === loggedInUser.handle
const isAdmin = checkAdmin(token)
const canApprove = isSelfServiceCopilot && isDraft && isSelfService
const hasBillingAccount = _.get(projectDetail, 'billingAccountId') !== null
// only challenges that have a billing account can be launched AND
// if this isn't self-service, permit launching if the challenge is draft
// OR if this isn't a non-self-service draft, permit launching if:
// a) the current user is either the self-service copilot or is an admin AND
// b) the challenge is approved
const canLaunch = hasBillingAccount &&
((!isSelfService && isDraft) ||
((isSelfServiceCopilot || isAdmin) &&
challenge.status.toUpperCase() === CHALLENGE_STATUS.APPROVED))

return (
<div className={styles.list}>
<Helmet title='View Details' />
Expand All @@ -94,7 +114,7 @@ const ChallengeViewTabs = ({
styles.actionButtonsLeft
)}
>
{ isTask ? (<ForumLink challenge={challenge} />)
{isTask ? (<ForumLink challenge={challenge} />)
: (<LegacyLinks challenge={challenge} challengeView />)
}
</div>
Expand All @@ -107,13 +127,14 @@ const ChallengeViewTabs = ({
styles.actionButtonsRight
)}
>
{(challenge.status === 'Draft' || challenge.status === 'New') && <div className={styles['cancel-button']}><CancelDropDown challenge={challenge} onSelectMenu={cancelChallenge} /></div>}
{challenge.status === 'Draft' && (
{(isDraft || challenge.status === 'New') && !isSelfService &&
(<div className={styles['cancel-button']}><CancelDropDown challenge={challenge} onSelectMenu={cancelChallenge} /></div>)}
{canLaunch && (
<div className={styles.button}>
{challenge.legacyId || isTask ? (
<PrimaryButton
text={'Launch'}
type={'info'}
text='Launch'
type='info'
onClick={onLaunchChallenge}
/>
) : (
Expand All @@ -124,6 +145,15 @@ const ChallengeViewTabs = ({
)}
</div>
)}
{canApprove && (
<div className={styles.button}>
<PrimaryButton
text='Approve'
type='info'
onClick={onApproveChallenge}
/>
</div>
)}
{isTask && challenge.status === 'Active' && (
<div className={styles.button}>
{assignedMemberDetails ? (
Expand All @@ -138,9 +168,18 @@ const ChallengeViewTabs = ({
)}
</div>
)}
{enableEdit && (
{enableEdit && !isSelfService && (
<PrimaryButton text={'Edit'} type={'info'} submit link={`./edit`} />
)}
{isSelfService && isDraft && (isAdmin || isSelfServiceCopilot) && (
<div className={styles.button}>
<PrimaryButton
text='Reject challenge'
type='danger'
onClick={showRejectChallengeModal}
/>
</div>
)}
<PrimaryButton text={'Back'} type={'info'} submit link={`..`} />
</div>
</div>
Expand Down Expand Up @@ -208,6 +247,10 @@ const ChallengeViewTabs = ({
onLaunchChallenge={onLaunchChallenge}
onCloseTask={onCloseTask}
projectPhases={projectPhases}
assignYourselfCopilot={assignYourselfCopilot}
showRejectChallengeModal={showRejectChallengeModal}
onApproveChallenge={onApproveChallenge}
loggedInUser={loggedInUser}
/>
)}
{selectedTab === 1 && (
Expand Down Expand Up @@ -244,7 +287,11 @@ ChallengeViewTabs.propTypes = {
onLaunchChallenge: PropTypes.func,
cancelChallenge: PropTypes.func.isRequired,
onCloseTask: PropTypes.func,
projectPhases: PropTypes.arrayOf(PropTypes.object)
projectPhases: PropTypes.arrayOf(PropTypes.object),
assignYourselfCopilot: PropTypes.func.isRequired,
showRejectChallengeModal: PropTypes.func.isRequired,
loggedInUser: PropTypes.object.isRequired,
onApproveChallenge: PropTypes.func
}

export default ChallengeViewTabs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;

div {
margin-right: 13px;
Expand Down
Loading