From 6d8516833ed34c41528250321367644ce14ed834 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 2 Sep 2022 11:22:33 +1000 Subject: [PATCH 01/21] Fix billing account status display https://github.com/topcoder-platform/work-manager/issues/1412 1. A "project" contains "status" field , this status field can be "active"/"in_review" 2. A "project" also has a billingAccount mapped. 3. Application makes a GET call with billingAccount id to get billingAccount details. and response of it is this screenshot https://imgur.com/cU3s4yU 4. response has "active" boolean field and enddate field which is correctly utilised in reducer code to set the flag "isBillingAccountExpired". check this screenshot https://imgur.com/l5nyxbt 5. now this "isBillingAccountExpired" flag is used like this. check screenshot https://imgur.com/mjDhbAF 6. when "isBillingAccountExpired" is true, we show hardcoded "INACTIVE" which is correct. 7. but when "isBillingAccountExpired" is false , we show "status" field of "project" which is wrong, because we need to show whether billingAccount is active or not. 8. hence "status" field of project can be active/inReview , thats why u see "IN_REVIEW" in UI, 9. hence my solution/approach is that flag "isBillingAccountExpired" is already there which clearly indicates active/inactive, hence i hardcoded "ACTIVE" in code because it is obvious. --- src/components/ChallengesComponent/ChallengeList/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ChallengesComponent/ChallengeList/index.js b/src/components/ChallengesComponent/ChallengeList/index.js index 65329c5e..5feec134 100644 --- a/src/components/ChallengesComponent/ChallengeList/index.js +++ b/src/components/ChallengesComponent/ChallengeList/index.js @@ -178,7 +178,7 @@ class ChallengeList extends Component {
{!isBillingAccountLoading && !isBillingAccountLoadingFailed && !isBillingAccountExpired && (
- Billing Account: {status}   Start Date: {billingStartDate}   End Date: {billingEndDate} + Billing Account: ACTIVE   Start Date: {billingStartDate}   End Date: {billingEndDate}
)} {!isBillingAccountLoading && !isBillingAccountLoadingFailed && isBillingAccountExpired && ( From 74128099e695ae2f512afaecc6a5d490d0506076 Mon Sep 17 00:00:00 2001 From: Abhinav Koppula Date: Sun, 4 Sep 2022 17:11:28 +0530 Subject: [PATCH 02/21] [Security][Clickjacking]-Adding X-Frame-Options and X-Frame-Options header to prevent clickjacking --- server.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server.js b/server.js index 7aa29253..eaccf988 100644 --- a/server.js +++ b/server.js @@ -23,6 +23,8 @@ app.use((req, res, next) => { res.header('Strict-Transport-Security', 'max-age=31536000; includeSubDomains; preload'); res.header('Cache-control', 'public, max-age=0'); res.header('Pragma', 'no-cache'); + res.setHeader('X-Frame-Options', 'DENY'); + res.setHeader('Content-Security-Policy', "frame-ancestors 'none';"); next(); }); From 4242acb378ab704fcf909d27da7f1311f782c8c5 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Mon, 5 Sep 2022 11:37:55 +1000 Subject: [PATCH 03/21] Enable multi-round design challenges in WM https://topcoder.atlassian.net/browse/PROD-2894 --- config/constants/development.js | 3 +- config/constants/production.js | 3 +- .../ChallengeType-Field.module.scss | 55 +++++++ .../ChallengeType-Field/index.js | 48 +++++++ .../ChallengeEditor/ChallengeView/index.js | 14 +- .../CheckpointPrizes-Field.module.scss | 39 +++++ .../CheckpointPrizes-Field/index.js | 90 +++++++++--- .../Description-Field/index.js | 24 +++- .../RoundType-Field.module.scss | 134 ++++++++++++++++++ .../ChallengeEditor/RoundType-Field/index.js | 47 ++++++ src/components/ChallengeEditor/index.js | 35 ++++- src/config/constants.js | 27 +++- 12 files changed, 491 insertions(+), 28 deletions(-) create mode 100644 src/components/ChallengeEditor/ChallengeType-Field/ChallengeType-Field.module.scss create mode 100644 src/components/ChallengeEditor/ChallengeType-Field/index.js create mode 100644 src/components/ChallengeEditor/RoundType-Field/RoundType-Field.module.scss create mode 100644 src/components/ChallengeEditor/RoundType-Field/index.js diff --git a/config/constants/development.js b/config/constants/development.js index 2efc33f9..a33a7f9e 100644 --- a/config/constants/development.js +++ b/config/constants/development.js @@ -43,5 +43,6 @@ module.exports = { // if idle for this many minutes, show user a prompt saying they'll be logged out IDLE_TIMEOUT_MINUTES: 10, // duration to show the prompt saying user will be logged out, before actually logging out the user - IDLE_TIMEOUT_GRACE_MINUTES: 5 + IDLE_TIMEOUT_GRACE_MINUTES: 5, + MULTI_ROUND_CHALLENGE_TEMPLATE_ID: 'd4201ca4-8437-4d63-9957-3f7708184b07' } diff --git a/config/constants/production.js b/config/constants/production.js index 4040c262..eaa09aac 100644 --- a/config/constants/production.js +++ b/config/constants/production.js @@ -41,5 +41,6 @@ module.exports = { FILE_PICKER_REGION: 'us-east-1', FILE_PICKER_CNAME: 'fs.topcoder.com', IDLE_TIMEOUT_MINUTES: 10, - IDLE_TIMEOUT_GRACE_MINUTES: 5 + IDLE_TIMEOUT_GRACE_MINUTES: 5, + MULTI_ROUND_CHALLENGE_TEMPLATE_ID: 'd4201ca4-8437-4d63-9957-3f7708184b07' } diff --git a/src/components/ChallengeEditor/ChallengeType-Field/ChallengeType-Field.module.scss b/src/components/ChallengeEditor/ChallengeType-Field/ChallengeType-Field.module.scss new file mode 100644 index 00000000..f6707a0c --- /dev/null +++ b/src/components/ChallengeEditor/ChallengeType-Field/ChallengeType-Field.module.scss @@ -0,0 +1,55 @@ +@import "../../../styles/includes"; + +.row { + box-sizing: border-box; + display: flex; + flex-direction: row; + margin: 30px 30px 0 30px; + align-content: space-between; + justify-content: flex-start; + + .field { + @include upto-sm { + display: block; + padding-bottom: 10px; + } + + label { + @include roboto-bold(); + + font-size: 16px; + line-height: 19px; + font-weight: 500; + color: $tc-gray-80; + } + + &.col1 { + max-width: 185px; + min-width: 185px; + margin-right: 14px; + white-space: nowrap; + display: flex; + align-items: center; + flex-grow: 1; + + span { + color: $tc-red; + } + } + + &.col2.error { + color: $tc-red; + margin-top: -25px; + } + &.col2 { + align-self: flex-end; + width: 80%; + margin-bottom: auto; + margin-top: auto; + display: flex; + flex-direction: row; + max-width: 600px; + min-width: 600px; + } + } +} diff --git a/src/components/ChallengeEditor/ChallengeType-Field/index.js b/src/components/ChallengeEditor/ChallengeType-Field/index.js new file mode 100644 index 00000000..bafa1f0a --- /dev/null +++ b/src/components/ChallengeEditor/ChallengeType-Field/index.js @@ -0,0 +1,48 @@ +import _ from 'lodash' +import React from 'react' +import PropTypes from 'prop-types' +import Select from '../../Select' +import cn from 'classnames' +import styles from './ChallengeType-Field.module.scss' + +const ChallengeTypeField = ({ types, onUpdateSelect, challenge, disabled }) => { + return ( + <> +
+
+ +
+
+ onChange(e.target.value, amount)} /> - onChange(number, e.target.value)} /> + <> +
+
+ +
-
+ { + readOnly ? ( +
+ ${amount} for each submission up to {number} submissions +
+ ) : ( +
+
+ Pay +
+
+
+
+ +
+ onChange(number, e.target.value)} /> +
+
+
+ for each submission up to +
+
+ e.target.checked && onUpdateOthers({ field: 'roundType', value: ROUND_TYPES.SINGLE_ROUND })} /> + +
+
+ e.target.checked && onUpdateOthers({ field: 'roundType', value: ROUND_TYPES.TWO_ROUNDS })} /> + +
+ +
+
+ + + ) +} + +RoundTypeField.propTypes = { + roundType: PropTypes.string, + onUpdateOthers: PropTypes.func.isRequired +} + +export default RoundTypeField diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index a64eb95b..64df5910 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -24,11 +24,14 @@ import { REVIEW_TYPES, MILESTONE_STATUS, PHASE_PRODUCT_CHALLENGE_ID_FIELD, - QA_TRACK_ID + QA_TRACK_ID, DESIGN_CHALLENGE_TYPES, ROUND_TYPES, + MULTI_ROUND_CHALLENGE_TEMPLATE_ID } from '../../config/constants' import { PrimaryButton, OutlineButton } from '../Buttons' import TrackField from './Track-Field' import TypeField from './Type-Field' +import RoundTypeField from './RoundType-Field' +import ChallengeTypeField from './ChallengeType-Field' import ChallengeNameField from './ChallengeName-Field' import CopilotField from './Copilot-Field' import ReviewTypeField from './ReviewType-Field' @@ -59,6 +62,7 @@ import { getResourceRoleByName } from '../../util/tc' import { isBetaMode } from '../../util/cookie' import MilestoneField from './Milestone-Field' import DiscussionField from './Discussion-Field' +import CheckpointPrizesField from './CheckpointPrizes-Field' const theme = { container: styles.modalContainer @@ -945,7 +949,7 @@ class ChallengeEditor extends Component { async createNewChallenge () { if (!this.props.isNew) return const { metadata, createChallenge, projectDetail } = this.props - const { showDesignChallengeWarningModel, challenge: { name, trackId, typeId, milestoneId } } = this.state + const { showDesignChallengeWarningModel, challenge: { name, trackId, typeId, milestoneId, roundType, challengeType } } = this.state const { timelineTemplates } = metadata const isDesignChallenge = trackId === DES_TRACK_ID const isChallengeType = typeId === CHALLENGE_TYPE_ID @@ -967,6 +971,13 @@ class ChallengeEditor extends Component { const defaultTemplate = avlTemplates && avlTemplates.length > 0 ? avlTemplates[0] : STD_DEV_TIMELINE_TEMPLATE const isTask = _.find(metadata.challengeTypes, { id: typeId, isTask: true }) const tags = trackId === QA_TRACK_ID ? ['QA'] : [] + if (challengeType) { + tags.push(challengeType) + } + let timelineTemplateId = defaultTemplate.id + if (roundType === ROUND_TYPES.TWO_ROUNDS) { + timelineTemplateId = MULTI_ROUND_CHALLENGE_TEMPLATE_ID + } const newChallenge = { status: 'New', @@ -979,7 +990,7 @@ class ChallengeEditor extends Component { reviewType: isTask || isDesignChallenge ? REVIEW_TYPES.INTERNAL : REVIEW_TYPES.COMMUNITY }, descriptionFormat: 'markdown', - timelineTemplateId: defaultTemplate.id, + timelineTemplateId, terms: [{ id: DEFAULT_TERM_UUID, roleId: SUBMITTER_ROLE_UUID }], groups: [], milestoneId, @@ -1544,12 +1555,25 @@ class ChallengeEditor extends Component { const currentChallengeId = this.getCurrentChallengeId() const showTimeline = false // disables the timeline for time being https://github.com/topcoder-platform/challenge-engine-ui/issues/706 const copilotResources = metadata.members || challengeResources + const isDesignChallenge = challenge.trackId === DES_TRACK_ID + const isChallengeType = challenge.typeId === CHALLENGE_TYPE_ID + const showRoundType = isDesignChallenge && isChallengeType + const showCheckpointPrizes = challenge.timelineTemplateId === MULTI_ROUND_CHALLENGE_TEMPLATE_ID + const challengeForm = isNew ? (
+ { + showRoundType && ( + <> + + + + ) + } {projectDetail.version === 'v4' && } {useTask && ()} @@ -1707,6 +1731,11 @@ class ChallengeEditor extends Component { removeAttachment={removeAttachment} />} + { + showCheckpointPrizes && ( + + ) + }
diff --git a/src/config/constants.js b/src/config/constants.js index b05d9e10..14cd0e39 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -17,7 +17,8 @@ export const { DS_TRACK_ID, QA_TRACK_ID, CHALLENGE_TYPE_ID, - SEGMENT_API_KEY + SEGMENT_API_KEY, + MULTI_ROUND_CHALLENGE_TEMPLATE_ID } = process.env export const CREATE_FORUM_TYPE_IDS = typeof process.env.CREATE_FORUM_TYPE_IDS === 'string' ? process.env.CREATE_FORUM_TYPE_IDS.split(',') : process.env.CREATE_FORUM_TYPE_IDS @@ -158,6 +159,19 @@ export const REVIEW_TYPES = { COMMUNITY: 'COMMUNITY' } +export const ROUND_TYPES = { + 'SINGLE_ROUND': 'Single round', + 'TWO_ROUNDS': 'Two rounds' +} + +export const DESIGN_CHALLENGE_TYPES = [ + 'Application Front-End Design', + 'Print/Presentation', + 'Web Design', + 'Widget or Mobile Screen Design', + 'Wireframes' +] + // List of subtracks that should be considered as Marathon Matches export const MARATHON_MATCH_SUBTRACKS = [ 'DEVELOP_MARATHON_MATCH' @@ -274,3 +288,14 @@ export const MILESTONE_STATUS = { COMPLETED: 'completed', CANCELLED: 'cancelled' } + +export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '## Challenge Introduction\n' + + '\n' + + '## Round 1 Requirements\n' + + '\n' + + '## Round 2 Requirements\n' + + '\n' + + '## Challenge Description' + +export const MAX_CHECKPOINT_PRIZE_COUNT = 5 +export const DEFAULT_CHECKPOINT_PRIZE = 50 From c67dcc6bc8e4dbf020b197af2d7ea869d39b0231 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 9 Sep 2022 16:00:55 +1000 Subject: [PATCH 04/21] Multi-round UAT fixes https://github.com/topcoder-platform/work-manager/issues/1414 --- .../CheckpointPrizes-Field.module.scss | 9 ++- .../CheckpointPrizes-Field/index.js | 66 +++++++++---------- src/components/ChallengeEditor/index.js | 10 +-- src/components/Select/styles.js | 2 +- src/config/constants.js | 3 +- 5 files changed, 43 insertions(+), 47 deletions(-) diff --git a/src/components/ChallengeEditor/CheckpointPrizes-Field/CheckpointPrizes-Field.module.scss b/src/components/ChallengeEditor/CheckpointPrizes-Field/CheckpointPrizes-Field.module.scss index b0e91d99..87b76a27 100644 --- a/src/components/ChallengeEditor/CheckpointPrizes-Field/CheckpointPrizes-Field.module.scss +++ b/src/components/ChallengeEditor/CheckpointPrizes-Field/CheckpointPrizes-Field.module.scss @@ -50,7 +50,7 @@ width: 271px; } input:last-of-type { - width: 187px; + width: 70px; margin-right: 10px; } } @@ -63,13 +63,12 @@ } .dollarIcon { - margin-left: 10px; color: $tc-black; cursor: pointer; } .checkpointPrizeContainer { - margin: 30px 0 0 60px; + margin: 0 0 0 60px; } .checkpointLabel { @@ -100,3 +99,7 @@ width: 50px; border-right-width: 0; } + +.checkpointSelect { + max-width: 85px; +} \ No newline at end of file diff --git a/src/components/ChallengeEditor/CheckpointPrizes-Field/index.js b/src/components/ChallengeEditor/CheckpointPrizes-Field/index.js index b240e447..5a17c63d 100644 --- a/src/components/ChallengeEditor/CheckpointPrizes-Field/index.js +++ b/src/components/ChallengeEditor/CheckpointPrizes-Field/index.js @@ -9,7 +9,8 @@ import { PRIZE_SETS_TYPE, CHALLENGE_PRIZE_TYPE, MAX_CHECKPOINT_PRIZE_COUNT, - DEFAULT_CHECKPOINT_PRIZE + DEFAULT_CHECKPOINT_PRIZE, + DEFAULT_CHECKPOINT_PRIZE_COUNT } from '../../../config/constants' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faDollarSign } from '@fortawesome/free-solid-svg-icons' @@ -19,7 +20,7 @@ const CheckpointPrizesField = ({ challenge, onUpdateOthers, readOnly }) => { const type = PRIZE_SETS_TYPE.CHECKPOINT_PRIZES const prizeSets = _.get(challenge, 'prizeSets') || [] const checkpointPrize = prizeSets.find(p => p.type === type) || { type: PRIZE_SETS_TYPE.CHECKPOINT_PRIZES, prizes: [], 'description': 'Checkpoint Prizes' } - const number = _.get(checkpointPrize, 'prizes.length') || MAX_CHECKPOINT_PRIZE_COUNT + const number = _.get(checkpointPrize, 'prizes.length') || DEFAULT_CHECKPOINT_PRIZE_COUNT const amount = _.get(checkpointPrize, 'prizes.length') ? checkpointPrize.prizes[0].value : DEFAULT_CHECKPOINT_PRIZE // update the check point prize with default values if it's not already defined @@ -39,42 +40,41 @@ const CheckpointPrizesField = ({ challenge, onUpdateOthers, readOnly }) => {
-
- { - readOnly ? ( -
+ { + readOnly ? ( +
${amount} for each submission up to {number} submissions -
- ) : ( -
-
- Pay
-
-
-
- + ) : ( +
+
+ Pay   +
+
+
+
+ +
+ onChange(number, e.target.value)} />
- onChange(number, e.target.value)} /> +
+
+ for each submission up to   +
+
+ ({ label: v, value: v }))} - value={{ label: number, value: number }} - isClearable={false} - onChange={e => onChange(e.value, amount)} - isDisabled={false} - /> -
- -
- ) - } + ) + } +
) } diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 64df5910..b9fdcd2f 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -949,17 +949,9 @@ class ChallengeEditor extends Component { async createNewChallenge () { if (!this.props.isNew) return const { metadata, createChallenge, projectDetail } = this.props - const { showDesignChallengeWarningModel, challenge: { name, trackId, typeId, milestoneId, roundType, challengeType } } = this.state + const { challenge: { name, trackId, typeId, milestoneId, roundType, challengeType } } = this.state const { timelineTemplates } = metadata const isDesignChallenge = trackId === DES_TRACK_ID - const isChallengeType = typeId === CHALLENGE_TYPE_ID - - if (!showDesignChallengeWarningModel && isDesignChallenge && isChallengeType) { - this.setState({ - showDesignChallengeWarningModel: true - }) - return - } // indicate that creating process has started this.setState({ isSaving: true }) diff --git a/src/components/Select/styles.js b/src/components/Select/styles.js index b52249ad..c7869fe3 100644 --- a/src/components/Select/styles.js +++ b/src/components/Select/styles.js @@ -55,7 +55,7 @@ export default { paddingLeft: '10px', border: 'none', input: { - width: 'auto !important', + width: '100% !important', height: 'auto !important', lineHeight: 'normal !important' } diff --git a/src/config/constants.js b/src/config/constants.js index 14cd0e39..2b177589 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -297,5 +297,6 @@ export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '## Challenge Introduction\n' '\n' + '## Challenge Description' -export const MAX_CHECKPOINT_PRIZE_COUNT = 5 +export const MAX_CHECKPOINT_PRIZE_COUNT = 8 export const DEFAULT_CHECKPOINT_PRIZE = 50 +export const DEFAULT_CHECKPOINT_PRIZE_COUNT = 5 From c69cea680b2f621003755782543f928e3c82b13a Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 9 Sep 2022 19:00:19 +1000 Subject: [PATCH 05/21] =?UTF-8?q?At=20UAT=20request,=20remove=20=E2=80=9CP?= =?UTF-8?q?ay=E2=80=9D=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ChallengeEditor/CheckpointPrizes-Field/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/ChallengeEditor/CheckpointPrizes-Field/index.js b/src/components/ChallengeEditor/CheckpointPrizes-Field/index.js index 5a17c63d..dda04a45 100644 --- a/src/components/ChallengeEditor/CheckpointPrizes-Field/index.js +++ b/src/components/ChallengeEditor/CheckpointPrizes-Field/index.js @@ -47,9 +47,6 @@ const CheckpointPrizesField = ({ challenge, onUpdateOthers, readOnly }) => {
) : (
-
- Pay   -
From 119c21552be1ce384a7745bfebb70d7366fb32b5 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 9 Sep 2022 19:16:22 +1000 Subject: [PATCH 06/21] Test for direct handle input when assigning in WM https://github.com/topcoder-platform/work-manager/issues/1415 --- config/constants/development.js | 2 +- config/constants/production.js | 2 +- .../SelectUserAutocomplete/index.js | 20 +++++++++++-------- src/services/user.js | 12 ++++++++++- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/config/constants/development.js b/config/constants/development.js index a33a7f9e..f7fc8bc7 100644 --- a/config/constants/development.js +++ b/config/constants/development.js @@ -5,7 +5,7 @@ module.exports = { ACCOUNTS_APP_CONNECTOR_URL: `https://accounts-auth0.${DOMAIN}`, ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`, COMMUNITY_APP_URL: `https://www.${DOMAIN}`, - MEMBER_API_URL: `${DEV_API_HOSTNAME}/v4/members`, + MEMBER_API_URL: `${DEV_API_HOSTNAME}/v5/members`, MEMBER_API_V3_URL: `${DEV_API_HOSTNAME}/v3/members`, CHALLENGE_API_URL: `${DEV_API_HOSTNAME}/v5/challenges`, CHALLENGE_TIMELINE_TEMPLATES_URL: `${DEV_API_HOSTNAME}/v5/timeline-templates`, diff --git a/config/constants/production.js b/config/constants/production.js index eaa09aac..7bb881b6 100644 --- a/config/constants/production.js +++ b/config/constants/production.js @@ -5,7 +5,7 @@ module.exports = { ACCOUNTS_APP_CONNECTOR_URL: process.env.ACCOUNTS_APP_CONNECTOR_URL || `https://accounts-auth0.${DOMAIN}`, ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`, COMMUNITY_APP_URL: `https://www.${DOMAIN}`, - MEMBER_API_URL: `${PROD_API_HOSTNAME}/v4/members`, + MEMBER_API_URL: `${PROD_API_HOSTNAME}/v5/members`, MEMBER_API_V3_URL: `${PROD_API_HOSTNAME}/v3/members`, CHALLENGE_API_URL: `${PROD_API_HOSTNAME}/v5/challenges`, CHALLENGE_TIMELINE_TEMPLATES_URL: `${PROD_API_HOSTNAME}/v5/timeline-templates`, diff --git a/src/components/SelectUserAutocomplete/index.js b/src/components/SelectUserAutocomplete/index.js index 3217718f..4dcfec9e 100644 --- a/src/components/SelectUserAutocomplete/index.js +++ b/src/components/SelectUserAutocomplete/index.js @@ -7,7 +7,7 @@ import React, { useState, useCallback } from 'react' import PropTypes from 'prop-types' import Select from '../Select' -import { suggestProfiles } from '../../services/user' +import { suggestProfiles, fetchProfileV5 } from '../../services/user' import _ from 'lodash' import { AUTOCOMPLETE_MIN_LENGTH, AUTOCOMPLETE_DEBOUNCE_TIME_MS } from '../../config/constants' @@ -27,13 +27,17 @@ export default function SelectUserAutocomplete (props) { return } - suggestProfiles(inputValue).then((suggestions) => { - const suggestedOptions = suggestions.map((user) => ({ - label: user.handle, - value: user.userId.toString() - })) - setOptions(suggestedOptions) - }) + Promise.all([suggestProfiles(inputValue), fetchProfileV5(inputValue)]).then( + ([suggestions, user]) => { + const suggestedOptions = suggestions.map((u) => ({ + label: u.handle, + value: u.userId.toString() + })) + if (user && !_.find(suggestions, u => u.userId === user.userId)) { + suggestedOptions.push({ label: user.handle, value: user.userId.toString() }) + } + setOptions(suggestedOptions) + }) }, AUTOCOMPLETE_DEBOUNCE_TIME_MS), []) // debounce, to reduce API calling rate return ( diff --git a/src/services/user.js b/src/services/user.js index 8a42a9da..fe01af32 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -1,6 +1,6 @@ import _ from 'lodash' import { axiosInstance } from './axiosWithAuth' -const { MEMBER_API_V3_URL } = process.env +const { MEMBER_API_URL, MEMBER_API_V3_URL } = process.env /** * Api request for fetching user profile @@ -11,6 +11,16 @@ export async function fetchProfile (handle) { return _.get(response, 'data.result.content') } +/** + * Api request for fetching user profile v5 + * @returns {Promise<*>} + */ +export async function fetchProfileV5 (handle) { + const response = await axiosInstance.get(`${MEMBER_API_URL}?handle=${handle}`) + const data = _.get(response, 'data') + return data.length ? data[0] : undefined +} + /** * Api request for fetching user profile * @returns {Promise<*>} From e29a344cbf5e2dbee75899c21ece54eb33ae01dc Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 9 Sep 2022 19:31:01 +1000 Subject: [PATCH 07/21] Remove redundant challenge introduction --- src/config/constants.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/config/constants.js b/src/config/constants.js index 2b177589..7e2c69e0 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -289,13 +289,11 @@ export const MILESTONE_STATUS = { CANCELLED: 'cancelled' } -export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '## Challenge Introduction\n' + +export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '\n\n### Round 1 Requirements\n' + '\n' + - '## Round 1 Requirements\n' + + '### Round 2 Requirements\n' + '\n' + - '## Round 2 Requirements\n' + - '\n' + - '## Challenge Description' + '### Challenge Description' export const MAX_CHECKPOINT_PRIZE_COUNT = 8 export const DEFAULT_CHECKPOINT_PRIZE = 50 From b8b57b785a8566a44bb459fb582fcee12bd4a807 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 9 Sep 2022 19:32:44 +1000 Subject: [PATCH 08/21] UAT feedback on multi-round template --- src/config/constants.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config/constants.js b/src/config/constants.js index 7e2c69e0..f11f5f85 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -289,11 +289,11 @@ export const MILESTONE_STATUS = { CANCELLED: 'cancelled' } -export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '\n\n### Round 1 Requirements\n' + +export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '\n\n### ROUND 1\n' + '\n' + - '### Round 2 Requirements\n' + + '### ROUND 2\n' + '\n' + - '### Challenge Description' + '### CHALLENGE DESCRIPTION' export const MAX_CHECKPOINT_PRIZE_COUNT = 8 export const DEFAULT_CHECKPOINT_PRIZE = 50 From 8e7d2866b34ccffc5df2c2f001efd5fa21b0ca59 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 9 Sep 2022 19:34:51 +1000 Subject: [PATCH 09/21] Additional UAT feedback --- src/config/constants.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/constants.js b/src/config/constants.js index f11f5f85..ccbf2418 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -290,9 +290,9 @@ export const MILESTONE_STATUS = { } export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '\n\n### ROUND 1\n' + - '\n' + + '**Submit your initial designs for checkpoint feedback**\n\n' + '### ROUND 2\n' + - '\n' + + '**Submit your final designs with all checkpoint feedback implemented**\n\n' + '### CHALLENGE DESCRIPTION' export const MAX_CHECKPOINT_PRIZE_COUNT = 8 From 22079588f4cb210d52d035d7e35a62f8010b2d8c Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 15 Sep 2022 17:30:52 +1000 Subject: [PATCH 10/21] Use v5 autocomplete endpoint for handle search in assignee dropdown --- src/components/SelectUserAutocomplete/index.js | 4 ++-- src/services/user.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/SelectUserAutocomplete/index.js b/src/components/SelectUserAutocomplete/index.js index 4dcfec9e..7c87f729 100644 --- a/src/components/SelectUserAutocomplete/index.js +++ b/src/components/SelectUserAutocomplete/index.js @@ -7,7 +7,7 @@ import React, { useState, useCallback } from 'react' import PropTypes from 'prop-types' import Select from '../Select' -import { suggestProfiles, fetchProfileV5 } from '../../services/user' +import { suggestProfilesV5, fetchProfileV5 } from '../../services/user' import _ from 'lodash' import { AUTOCOMPLETE_MIN_LENGTH, AUTOCOMPLETE_DEBOUNCE_TIME_MS } from '../../config/constants' @@ -27,7 +27,7 @@ export default function SelectUserAutocomplete (props) { return } - Promise.all([suggestProfiles(inputValue), fetchProfileV5(inputValue)]).then( + Promise.all([suggestProfilesV5(inputValue), fetchProfileV5(inputValue)]).then( ([suggestions, user]) => { const suggestedOptions = suggestions.map((u) => ({ label: u.handle, diff --git a/src/services/user.js b/src/services/user.js index fe01af32..fc7bd888 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -59,3 +59,12 @@ export async function suggestProfiles (partialHandle) { const response = await axiosInstance.get(`${MEMBER_API_V3_URL}/_suggest/${encodeURIComponent(partialHandle)}`) return _.get(response, 'data.result.content') } + +/** + * Api request for finding (suggesting) users by the part of the handle + * @returns {Promise<*>} + */ +export async function suggestProfilesV5 (partialHandle) { + const response = await axiosInstance.get(`${MEMBER_API_URL}/autocomplete?term=${encodeURIComponent(partialHandle)}`) + return _.get(response, 'data') +} From f7507e131b03d6f10f24ed2bb5805af64ad274c4 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 23 Sep 2022 17:06:06 +1000 Subject: [PATCH 11/21] Add data dashboard flag to display when creating a DS challenge https://github.com/topcoder-platform/work-manager/issues/1418 --- .../ChallengeEditor/ChallengeView/index.js | 13 ++++- src/components/ChallengeEditor/index.js | 56 ++++++++++++++++++- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/src/components/ChallengeEditor/ChallengeView/index.js b/src/components/ChallengeEditor/ChallengeView/index.js index 41df052b..f07d8edb 100644 --- a/src/components/ChallengeEditor/ChallengeView/index.js +++ b/src/components/ChallengeEditor/ChallengeView/index.js @@ -24,7 +24,8 @@ import { REVIEW_TYPES, CONNECT_APP_URL, PHASE_PRODUCT_CHALLENGE_ID_FIELD, - MULTI_ROUND_CHALLENGE_TEMPLATE_ID + MULTI_ROUND_CHALLENGE_TEMPLATE_ID, + DS_TRACK_ID } from '../../../config/constants' import PhaseInput from '../../PhaseInput' import CheckpointPrizesField from '../CheckpointPrizes-Field' @@ -98,6 +99,9 @@ const ChallengeView = ({ const isTask = _.get(challenge, 'task.isTask', false) const phases = _.get(challenge, 'phases', []) const showCheckpointPrizes = _.get(challenge, 'timelineTemplateId') === MULTI_ROUND_CHALLENGE_TEMPLATE_ID + const isDataScience = challenge.trackId === DS_TRACK_ID + const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' }) + const useDashboard = useDashboardData ? useDashboardData.value : true return (
@@ -140,6 +144,13 @@ const ChallengeView = ({ Challenge Name: {challenge.name}
+ {isDataScience && ( +
+
+ Show data dashboard: {useDashboard ? 'Yes' : 'No'} +
+
+ )} {isTask && } + { + isDataScience && ( +
+
+ +
+
+ this.onUpdateMetadata('show_data_dashboard', e.target.checked)} + /> +
+
+ ) + } {projectDetail.version === 'v4' && } {useTask && ()}
@@ -1600,6 +1634,24 @@ class ChallengeEditor extends Component {
+ { + isDataScience && ( +
+
+ +
+
+ this.onUpdateMetadata('show_data_dashboard', e.target.checked)} + /> +
+
+ ) + } {isTask && ( Date: Wed, 5 Oct 2022 09:33:02 +1100 Subject: [PATCH 12/21] Sort work type drop down --- src/components/ChallengeEditor/Type-Field/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ChallengeEditor/Type-Field/index.js b/src/components/ChallengeEditor/Type-Field/index.js index e92ae5c0..abe41c78 100644 --- a/src/components/ChallengeEditor/Type-Field/index.js +++ b/src/components/ChallengeEditor/Type-Field/index.js @@ -6,6 +6,7 @@ import cn from 'classnames' import styles from './Type-Field.module.scss' const TypeField = ({ types, onUpdateSelect, challenge, disabled }) => { + types = _.sortBy(types, ['name']) return ( <>
From 6ecbc74b9acbfb6fa64d92770da3159583393fb5 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Wed, 5 Oct 2022 09:54:48 +1100 Subject: [PATCH 13/21] Only show dashboard checkbox for DS challenges and dev / MM https://github.com/topcoder-platform/work-manager/issues/1420 --- config/constants/development.js | 1 + config/constants/production.js | 1 + src/components/ChallengeEditor/index.js | 16 ++++++++++++---- src/config/constants.js | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/config/constants/development.js b/config/constants/development.js index f7fc8bc7..ce1d31e1 100644 --- a/config/constants/development.js +++ b/config/constants/development.js @@ -34,6 +34,7 @@ module.exports = { DS_TRACK_ID: 'c0f5d461-8219-4c14-878a-c3a3f356466d', QA_TRACK_ID: '36e6a8d0-7e1e-4608-a673-64279d99c115', CHALLENGE_TYPE_ID: '927abff4-7af9-4145-8ba1-577c16e64e2e', + MARATHON_TYPE_ID: '929bc408-9cf2-4b3e-ba71-adfbf693046c', SEGMENT_API_KEY: 'QBtLgV8vCiuRX1lDikbMjcoe9aCHkF6n', CREATE_FORUM_TYPE_IDS: ['927abff4-7af9-4145-8ba1-577c16e64e2e', 'dc876fa4-ef2d-4eee-b701-b555fcc6544c', 'ecd58c69-238f-43a4-a4bb-d172719b9f31'], FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY, diff --git a/config/constants/production.js b/config/constants/production.js index 7bb881b6..bdda6b30 100644 --- a/config/constants/production.js +++ b/config/constants/production.js @@ -34,6 +34,7 @@ module.exports = { DS_TRACK_ID: 'c0f5d461-8219-4c14-878a-c3a3f356466d', QA_TRACK_ID: '36e6a8d0-7e1e-4608-a673-64279d99c115', CHALLENGE_TYPE_ID: '927abff4-7af9-4145-8ba1-577c16e64e2e', + MARATHON_TYPE_ID: '929bc408-9cf2-4b3e-ba71-adfbf693046c', SEGMENT_API_KEY: 'QSQAW5BWmZfLoKFNRgNKaqHvLDLJoGqF', CREATE_FORUM_TYPE_IDS: ['927abff4-7af9-4145-8ba1-577c16e64e2e', 'dc876fa4-ef2d-4eee-b701-b555fcc6544c', 'ecd58c69-238f-43a4-a4bb-d172719b9f31'], FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY, diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 0c119845..c7b85176 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -20,7 +20,9 @@ import { MESSAGE, COMMUNITY_APP_URL, DES_TRACK_ID, + DEV_TRACK_ID, CHALLENGE_TYPE_ID, + MARATHON_TYPE_ID, REVIEW_TYPES, MILESTONE_STATUS, PHASE_PRODUCT_CHALLENGE_ID_FIELD, @@ -955,6 +957,10 @@ class ChallengeEditor extends Component { const { timelineTemplates } = metadata const isDesignChallenge = trackId === DES_TRACK_ID const isDataScience = trackId === DS_TRACK_ID + const isChallengeType = typeId === CHALLENGE_TYPE_ID + const isDevChallenge = trackId === DEV_TRACK_ID + const isMM = typeId === MARATHON_TYPE_ID + const showDashBoard = (isDataScience && isChallengeType) || (isDevChallenge && isMM) // indicate that creating process has started this.setState({ isSaving: true }) @@ -1012,7 +1018,7 @@ class ChallengeEditor extends Component { newChallenge.discussions = discussions } } - if (isDataScience) { + if (showDashBoard) { if (!newChallenge.metadata) { newChallenge.metadata = [] } @@ -1561,10 +1567,12 @@ class ChallengeEditor extends Component { const showTimeline = false // disables the timeline for time being https://github.com/topcoder-platform/challenge-engine-ui/issues/706 const copilotResources = metadata.members || challengeResources const isDesignChallenge = challenge.trackId === DES_TRACK_ID + const isDevChallenge = challenge.trackId === DEV_TRACK_ID + const isMM = challenge.typeId === MARATHON_TYPE_ID const isChallengeType = challenge.typeId === CHALLENGE_TYPE_ID const showRoundType = isDesignChallenge && isChallengeType const showCheckpointPrizes = challenge.timelineTemplateId === MULTI_ROUND_CHALLENGE_TEMPLATE_ID - const isDataScience = challenge.trackId === DS_TRACK_ID + const showDashBoard = (challenge.trackId === DS_TRACK_ID && isChallengeType) || (isDevChallenge && isMM) const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' }) const useDashboard = useDashboardData ? useDashboardData.value : true @@ -1584,7 +1592,7 @@ class ChallengeEditor extends Component { } { - isDataScience && ( + showDashBoard && (
@@ -1635,7 +1643,7 @@ class ChallengeEditor extends Component { { - isDataScience && ( + showDashBoard && (
diff --git a/src/config/constants.js b/src/config/constants.js index ccbf2418..daf0f8b0 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -17,6 +17,7 @@ export const { DS_TRACK_ID, QA_TRACK_ID, CHALLENGE_TYPE_ID, + MARATHON_TYPE_ID, SEGMENT_API_KEY, MULTI_ROUND_CHALLENGE_TEMPLATE_ID } = process.env From a4ec8810f8a70556a6f93cf0cc708bb70281bec0 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Oct 2022 16:36:56 +1100 Subject: [PATCH 14/21] Test fix for private scrolling https://github.com/topcoder-platform/work-manager/issues/1421 --- .../Description-Field/Description-Field.module.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ChallengeEditor/Description-Field/Description-Field.module.scss b/src/components/ChallengeEditor/Description-Field/Description-Field.module.scss index f303a246..98153c43 100644 --- a/src/components/ChallengeEditor/Description-Field/Description-Field.module.scss +++ b/src/components/ChallengeEditor/Description-Field/Description-Field.module.scss @@ -13,7 +13,7 @@ overflow: auto; &.isPrivate { - max-height: 205px; + max-height: 400px; } :global { From 73d8d4678be02fca7893e7ab01fa85eb69480d92 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Oct 2022 18:38:26 +1100 Subject: [PATCH 15/21] =?UTF-8?q?Rename=20=E2=80=9CWork=20Type=E2=80=9D=20?= =?UTF-8?q?to=20=E2=80=9CDomain=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/topcoder-platform/work-manager/issues/1422 --- src/components/ChallengeEditor/Track-Field/index.js | 4 ++-- .../page-objects/create-challenge/create-challenge.helper.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ChallengeEditor/Track-Field/index.js b/src/components/ChallengeEditor/Track-Field/index.js index ee7f9771..7d9b4cd1 100644 --- a/src/components/ChallengeEditor/Track-Field/index.js +++ b/src/components/ChallengeEditor/Track-Field/index.js @@ -16,7 +16,7 @@ const TrackField = ({ challenge, tracks, onUpdateOthers, disabled }) => { <>
- +
{ @@ -27,7 +27,7 @@ const TrackField = ({ challenge, tracks, onUpdateOthers, disabled }) => { { challenge.submitTriggered && !challenge.trackId &&
- Work Type is required field + Domain is a required field
} diff --git a/test-automation/page-objects/create-challenge/create-challenge.helper.ts b/test-automation/page-objects/create-challenge/create-challenge.helper.ts index 111ccdbb..fbee651b 100644 --- a/test-automation/page-objects/create-challenge/create-challenge.helper.ts +++ b/test-automation/page-objects/create-challenge/create-challenge.helper.ts @@ -33,12 +33,12 @@ export class CreateChallengePageHelper { // Click Work Type Button await this.createChallengePageObject.workTypeButton(data.workType[0]).click(); - logger.info(`Clicked on Work Type button: ${data.workType[0]}`); + logger.info(`Clicked on Domain button: ${data.workType[0]}`); // Click Work Form Input and Select Format from the list await this.createChallengePageObject.workFormatInput.click(); await CommonHelper.searchTextFromListAndClick(await this.createChallengePageObject.workFormatList, workFormat); - logger.info(`Selected Work Type: ${workFormat} from the list`); + logger.info(`Selected Work Format: ${workFormat} from the list`); // Specify Work Name const workName = CommonHelper.appendDate(`${data.workType[0]}${workFormat}${data.automation}`); From 997ae90acaf1e93363d1f0cb3402c60fe9d45d40 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Oct 2022 18:57:40 +1100 Subject: [PATCH 16/21] =?UTF-8?q?Consistency=20for=20=E2=80=9CDomain?= =?UTF-8?q?=E2=80=9D=20naming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ChallengeEditor/ChallengeView/index.js | 2 +- src/components/ChallengeEditor/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ChallengeEditor/ChallengeView/index.js b/src/components/ChallengeEditor/ChallengeView/index.js index f07d8edb..fae88c61 100644 --- a/src/components/ChallengeEditor/ChallengeView/index.js +++ b/src/components/ChallengeEditor/ChallengeView/index.js @@ -128,7 +128,7 @@ const ChallengeView = ({
}
- Track: + Domain: { }} />
diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index c7b85176..b81b9b04 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -1630,7 +1630,7 @@ class ChallengeEditor extends Component {
- Track: + Domain: { }} />
From 8bdb9ca38c206e79e481e354ffcacc4da31deab6 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Wed, 12 Oct 2022 11:27:57 +1100 Subject: [PATCH 17/21] Limit work formats based on selected Domain (Work Type) https://github.com/topcoder-platform/work-manager/issues/1424 --- config/constants/development.js | 1 + config/constants/production.js | 1 + src/components/ChallengeEditor/index.js | 7 +++++-- src/config/constants.js | 4 +++- src/util/tc.js | 21 +++++++++++++++++++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/config/constants/development.js b/config/constants/development.js index ce1d31e1..df892660 100644 --- a/config/constants/development.js +++ b/config/constants/development.js @@ -33,6 +33,7 @@ module.exports = { DES_TRACK_ID: '5fa04185-041f-49a6-bfd1-fe82533cd6c8', DS_TRACK_ID: 'c0f5d461-8219-4c14-878a-c3a3f356466d', QA_TRACK_ID: '36e6a8d0-7e1e-4608-a673-64279d99c115', + CP_TRACK_ID: '9d6e0de8-df14-4c76-ba0a-a9a8cb03a4ea', CHALLENGE_TYPE_ID: '927abff4-7af9-4145-8ba1-577c16e64e2e', MARATHON_TYPE_ID: '929bc408-9cf2-4b3e-ba71-adfbf693046c', SEGMENT_API_KEY: 'QBtLgV8vCiuRX1lDikbMjcoe9aCHkF6n', diff --git a/config/constants/production.js b/config/constants/production.js index bdda6b30..0ac72c1e 100644 --- a/config/constants/production.js +++ b/config/constants/production.js @@ -33,6 +33,7 @@ module.exports = { DES_TRACK_ID: '5fa04185-041f-49a6-bfd1-fe82533cd6c8', DS_TRACK_ID: 'c0f5d461-8219-4c14-878a-c3a3f356466d', QA_TRACK_ID: '36e6a8d0-7e1e-4608-a673-64279d99c115', + CP_TRACK_ID: '9d6e0de8-df14-4c76-ba0a-a9a8cb03a4ea', CHALLENGE_TYPE_ID: '927abff4-7af9-4145-8ba1-577c16e64e2e', MARATHON_TYPE_ID: '929bc408-9cf2-4b3e-ba71-adfbf693046c', SEGMENT_API_KEY: 'QSQAW5BWmZfLoKFNRgNKaqHvLDLJoGqF', diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index b81b9b04..e6436898 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -29,6 +29,7 @@ import { QA_TRACK_ID, DESIGN_CHALLENGE_TYPES, ROUND_TYPES, MULTI_ROUND_CHALLENGE_TEMPLATE_ID, DS_TRACK_ID } from '../../config/constants' +import { getDomainTypes, getResourceRoleByName } from '../../util/tc' import { PrimaryButton, OutlineButton } from '../Buttons' import TrackField from './Track-Field' import TypeField from './Type-Field' @@ -60,7 +61,7 @@ import AssignedMemberField from './AssignedMember-Field' import Tooltip from '../Tooltip' import CancelDropDown from './Cancel-Dropdown' import UseSchedulingAPIField from './UseSchedulingAPIField' -import { getResourceRoleByName } from '../../util/tc' + import { isBetaMode } from '../../util/cookie' import MilestoneField from './Milestone-Field' import DiscussionField from './Discussion-Field' @@ -1575,13 +1576,15 @@ class ChallengeEditor extends Component { const showDashBoard = (challenge.trackId === DS_TRACK_ID && isChallengeType) || (isDevChallenge && isMM) const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' }) const useDashboard = useDashboardData ? useDashboardData.value : true + const workTypes = getDomainTypes(challenge.trackId) + const filteredTypes = metadata.challengeTypes.filter(type => workTypes.includes(type.abbreviation)) const challengeForm = isNew ? (
- + { showRoundType && ( <> diff --git a/src/config/constants.js b/src/config/constants.js index daf0f8b0..a37f2768 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -16,6 +16,7 @@ export const { DES_TRACK_ID, DS_TRACK_ID, QA_TRACK_ID, + CP_TRACK_ID, CHALLENGE_TYPE_ID, MARATHON_TYPE_ID, SEGMENT_API_KEY, @@ -137,7 +138,8 @@ export const CHALLENGE_TRACKS = { DESIGN: DES_TRACK_ID, DEVELOP: DEV_TRACK_ID, DATA_SCIENCE: DS_TRACK_ID, - QA: QA_TRACK_ID + QA: QA_TRACK_ID, + COMPETITIVE_PROGRAMMING: CP_TRACK_ID } // List of challenge phase statuses diff --git a/src/util/tc.js b/src/util/tc.js index 2fa28003..b97b2adc 100644 --- a/src/util/tc.js +++ b/src/util/tc.js @@ -121,6 +121,27 @@ export function fixedTrack (track, subTrack) { : track } +/** + * Given challenge domain (track), returns its corresponding challenge types + * @param {String} trackId challenge trackId + */ +export const getDomainTypes = (trackId) => { + switch (trackId) { + case CHALLENGE_TRACKS.DEVELOP: + return ['CH', 'F2F', 'TSK', 'SKL', 'PC', 'RDM'] + case CHALLENGE_TRACKS.DATA_SCIENCE: + return ['CH', 'F2F', 'TSK', 'SKL', 'PC', 'MA'] + case CHALLENGE_TRACKS.QA: + return ['CH', 'F2F', 'TSK', 'SKL', 'PC'] + case CHALLENGE_TRACKS.DESIGN: + return ['CH', 'F2F', 'TSK', 'SKL', 'PC'] + case CHALLENGE_TRACKS.COMPETITIVE_PROGRAMMING: + return ['CH', 'F2F', 'SKL', 'PC', 'MM', 'RDM'] + default: + return [] + } +} + /** * Checks if role is present in allowed roles * @param roles From 4aad155c1f5127bf4eb26d8e541e37de28ca553f Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 13 Oct 2022 18:49:28 +1100 Subject: [PATCH 18/21] =?UTF-8?q?Don=E2=80=99t=20allow=20develop=20/=20RDM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/tc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/tc.js b/src/util/tc.js index b97b2adc..9760a5de 100644 --- a/src/util/tc.js +++ b/src/util/tc.js @@ -128,7 +128,7 @@ export function fixedTrack (track, subTrack) { export const getDomainTypes = (trackId) => { switch (trackId) { case CHALLENGE_TRACKS.DEVELOP: - return ['CH', 'F2F', 'TSK', 'SKL', 'PC', 'RDM'] + return ['CH', 'F2F', 'TSK', 'SKL', 'PC'] case CHALLENGE_TRACKS.DATA_SCIENCE: return ['CH', 'F2F', 'TSK', 'SKL', 'PC', 'MA'] case CHALLENGE_TRACKS.QA: From 0c4387d7affb19edbd7d219c8a4caa101aebe96a Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 15 Dec 2022 13:04:41 +1100 Subject: [PATCH 19/21] Deploy new multiround-only branch --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d96a6c9..ab1d4882 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,7 +150,7 @@ workflows: context : org-global filters: &filters-dev branches: - only: ['develop'] + only: develop, multiround # Production builds are exectuted only on tagged commits to the # master branch. From bf88a5b605f9301beb716add083dc9efac516646 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 15 Dec 2022 13:05:34 +1100 Subject: [PATCH 20/21] typo --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab1d4882..a5443d24 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,7 +150,7 @@ workflows: context : org-global filters: &filters-dev branches: - only: develop, multiround + only: ['develop', 'multiround'] # Production builds are exectuted only on tagged commits to the # master branch. From c866c57c75565d07e8dce77460eb1fa23a43d423 Mon Sep 17 00:00:00 2001 From: Gunasekar-K Date: Fri, 9 Dec 2022 10:48:01 +0530 Subject: [PATCH 21/21] Update config.yml --- .circleci/config.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a5443d24..803b34a7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,7 @@ parameters: defaults: &defaults docker: - - image: circleci/python:2.7-stretch-browsers + - image: cimg/python:3.11.0-browsers test_defaults: &test_defaults docker: @@ -19,8 +19,10 @@ install_dependency: &install_dependency name: Installation of build and deployment dependencies. command: | sudo apt install jq - sudo pip install awscli --upgrade - sudo pip install docker-compose + sudo apt update + sudo apt install python3-pip + sudo pip3 install awscli --upgrade + sudo pip3 install docker-compose install_test_dependency: &install_test_dependency name: Installation of build and deployment dependencies.