From 5df32c023381dd8e0383e2ffee35a1b486eefc35 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 2 Sep 2022 11:22:33 +1000 Subject: [PATCH 01/11] 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. # Conflicts: # src/components/ChallengesComponent/ChallengeList/index.js --- 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 fe617318..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: {activeProject.status}   Start Date: {billingStartDate}   End Date: {billingEndDate} + Billing Account: ACTIVE   Start Date: {billingStartDate}   End Date: {billingEndDate}
)} {!isBillingAccountLoading && !isBillingAccountLoadingFailed && isBillingAccountExpired && ( From fa6c713c9d679adcf299710944073a5851e93986 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 9 Sep 2022 19:16:22 +1000 Subject: [PATCH 02/11] 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 2efc33f9..4b8bb599 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 4040c262..bdcff87e 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 da525a21a782d666f9aa47d31008c8d77488ff13 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 15 Sep 2022 17:30:52 +1000 Subject: [PATCH 03/11] 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 9613fddf0a16d68c75bea863c1578e1a6a856970 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 23 Sep 2022 17:06:06 +1000 Subject: [PATCH 04/11] Add data dashboard flag to display when creating a DS challenge https://github.com/topcoder-platform/work-manager/issues/1418 # Conflicts: # src/components/ChallengeEditor/ChallengeView/index.js # src/components/ChallengeEditor/index.js --- .../ChallengeEditor/ChallengeView/index.js | 25 ++++- src/components/ChallengeEditor/index.js | 95 ++++++++++++++++--- 2 files changed, 108 insertions(+), 12 deletions(-) diff --git a/src/components/ChallengeEditor/ChallengeView/index.js b/src/components/ChallengeEditor/ChallengeView/index.js index f4bed266..f07d8edb 100644 --- a/src/components/ChallengeEditor/ChallengeView/index.js +++ b/src/components/ChallengeEditor/ChallengeView/index.js @@ -20,8 +20,15 @@ import AssignedMemberField from '../AssignedMember-Field' import { getResourceRoleByName } from '../../../util/tc' import { isBetaMode } from '../../../util/cookie' import { loadGroupDetails } from '../../../actions/challenges' -import { REVIEW_TYPES, CONNECT_APP_URL, PHASE_PRODUCT_CHALLENGE_ID_FIELD } from '../../../config/constants' +import { + REVIEW_TYPES, + CONNECT_APP_URL, + PHASE_PRODUCT_CHALLENGE_ID_FIELD, + MULTI_ROUND_CHALLENGE_TEMPLATE_ID, + DS_TRACK_ID +} from '../../../config/constants' import PhaseInput from '../../PhaseInput' +import CheckpointPrizesField from '../CheckpointPrizes-Field' const ChallengeView = ({ projectDetail, @@ -91,6 +98,10 @@ const ChallengeView = ({ const showTimeline = false // disables the timeline for time being https://github.com/topcoder-platform/challenge-engine-ui/issues/706 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 (
@@ -133,6 +144,13 @@ const ChallengeView = ({ Challenge Name: {challenge.name}
+ {isDataScience && ( +
+
+ Show data dashboard: {useDashboard ? 'Yes' : 'No'} +
+
+ )} {isTask && } } + { + showCheckpointPrizes && ( + + ) + } diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index a64eb95b..0c119845 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, DS_TRACK_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 @@ -594,6 +598,8 @@ class ChallengeEditor extends Component { submissionLimit.count = '' } existingMetadata.value = JSON.stringify(submissionLimit) + } else if (existingMetadata.name === 'show_data_dashboard') { + existingMetadata.value = Boolean(value) } else { existingMetadata.value = `${value}` } @@ -945,17 +951,10 @@ 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 { challenge: { name, trackId, typeId, milestoneId, roundType, challengeType, metadata: challengeMetadata } } = 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 - } + const isDataScience = trackId === DS_TRACK_ID // indicate that creating process has started this.setState({ isSaving: true }) @@ -967,6 +966,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 +985,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, @@ -1006,6 +1012,16 @@ class ChallengeEditor extends Component { newChallenge.discussions = discussions } } + if (isDataScience) { + if (!newChallenge.metadata) { + newChallenge.metadata = [] + } + let useDashboard = _.find(challengeMetadata, { name: 'show_data_dashboard' }) + if (useDashboard === undefined) { + useDashboard = { name: 'show_data_dashboard', value: true } + } + newChallenge.metadata.push(useDashboard) + } try { const action = await createChallenge(newChallenge, projectDetail.id) if (isTask) { @@ -1544,13 +1560,47 @@ 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 isDataScience = challenge.trackId === DS_TRACK_ID + const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' }) + const useDashboard = useDashboardData ? useDashboardData.value : true + const challengeForm = isNew ? (
+ { + showRoundType && ( + <> + + + + ) + } + { + isDataScience && ( +
+
+ +
+
+ this.onUpdateMetadata('show_data_dashboard', e.target.checked)} + /> +
+
+ ) + } {projectDetail.version === 'v4' && } {useTask && ()}
@@ -1584,6 +1634,24 @@ class ChallengeEditor extends Component { + { + isDataScience && ( +
+
+ +
+
+ this.onUpdateMetadata('show_data_dashboard', e.target.checked)} + /> +
+
+ ) + } {isTask && ( } + { + showCheckpointPrizes && ( + + ) + } From 37c6b2eaee1e2334c6572daba6af118834b8590d Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Wed, 5 Oct 2022 09:33:02 +1100 Subject: [PATCH 05/11] 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 70ea47d409721d3dbf151339fa0001c42ce88ecb Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Wed, 5 Oct 2022 09:54:48 +1100 Subject: [PATCH 06/11] Only show dashboard checkbox for DS challenges and dev / MM https://github.com/topcoder-platform/work-manager/issues/1420 # Conflicts: # src/config/constants.js --- config/constants/development.js | 1 + config/constants/production.js | 1 + src/components/ChallengeEditor/index.js | 16 +++++++++++---- src/config/constants.js | 27 ++++++++++++++++++++++++- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/config/constants/development.js b/config/constants/development.js index 4b8bb599..0d3f0d15 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 bdcff87e..d90f7944 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 b05d9e10..daf0f8b0 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -17,7 +17,9 @@ export const { DS_TRACK_ID, QA_TRACK_ID, CHALLENGE_TYPE_ID, - SEGMENT_API_KEY + MARATHON_TYPE_ID, + 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 +160,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 +289,13 @@ export const MILESTONE_STATUS = { COMPLETED: 'completed', CANCELLED: 'cancelled' } + +export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '\n\n### ROUND 1\n' + + '**Submit your initial designs for checkpoint feedback**\n\n' + + '### ROUND 2\n' + + '**Submit your final designs with all checkpoint feedback implemented**\n\n' + + '### CHALLENGE DESCRIPTION' + +export const MAX_CHECKPOINT_PRIZE_COUNT = 8 +export const DEFAULT_CHECKPOINT_PRIZE = 50 +export const DEFAULT_CHECKPOINT_PRIZE_COUNT = 5 From 081868ea6671808f2473ee56162813cf39f9dbe6 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Oct 2022 08:25:14 +1100 Subject: [PATCH 07/11] Remove some multi-round stuff. --- .circleci/config.yml | 2 +- .../ChallengeEditor/ChallengeView/index.js | 1 - src/components/ChallengeEditor/index.js | 5 +---- src/config/constants.js | 15 ++------------- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d96a6c9..ab65da7d 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', 'Oct_2022_Release'] # Production builds are exectuted only on tagged commits to the # master branch. diff --git a/src/components/ChallengeEditor/ChallengeView/index.js b/src/components/ChallengeEditor/ChallengeView/index.js index f07d8edb..b043852e 100644 --- a/src/components/ChallengeEditor/ChallengeView/index.js +++ b/src/components/ChallengeEditor/ChallengeView/index.js @@ -24,7 +24,6 @@ import { REVIEW_TYPES, CONNECT_APP_URL, PHASE_PRODUCT_CHALLENGE_ID_FIELD, - MULTI_ROUND_CHALLENGE_TEMPLATE_ID, DS_TRACK_ID } from '../../../config/constants' import PhaseInput from '../../PhaseInput' diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index c7b85176..1e9c5c77 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -27,7 +27,7 @@ import { MILESTONE_STATUS, PHASE_PRODUCT_CHALLENGE_ID_FIELD, QA_TRACK_ID, DESIGN_CHALLENGE_TYPES, ROUND_TYPES, - MULTI_ROUND_CHALLENGE_TEMPLATE_ID, DS_TRACK_ID + DS_TRACK_ID } from '../../config/constants' import { PrimaryButton, OutlineButton } from '../Buttons' import TrackField from './Track-Field' @@ -976,9 +976,6 @@ class ChallengeEditor extends Component { tags.push(challengeType) } let timelineTemplateId = defaultTemplate.id - if (roundType === ROUND_TYPES.TWO_ROUNDS) { - timelineTemplateId = MULTI_ROUND_CHALLENGE_TEMPLATE_ID - } const newChallenge = { status: 'New', diff --git a/src/config/constants.js b/src/config/constants.js index daf0f8b0..4f739caa 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -18,8 +18,7 @@ export const { QA_TRACK_ID, CHALLENGE_TYPE_ID, MARATHON_TYPE_ID, - SEGMENT_API_KEY, - MULTI_ROUND_CHALLENGE_TEMPLATE_ID + SEGMENT_API_KEY } = 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 @@ -288,14 +287,4 @@ export const MILESTONE_STATUS = { BLOCKED: 'paused', COMPLETED: 'completed', CANCELLED: 'cancelled' -} - -export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '\n\n### ROUND 1\n' + - '**Submit your initial designs for checkpoint feedback**\n\n' + - '### ROUND 2\n' + - '**Submit your final designs with all checkpoint feedback implemented**\n\n' + - '### CHALLENGE DESCRIPTION' - -export const MAX_CHECKPOINT_PRIZE_COUNT = 8 -export const DEFAULT_CHECKPOINT_PRIZE = 50 -export const DEFAULT_CHECKPOINT_PRIZE_COUNT = 5 +} \ No newline at end of file From fca82b5e3cc861aef2db64ebcdd06f328c649c91 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Oct 2022 13:56:17 +1100 Subject: [PATCH 08/11] Cleanup from multi-round stuff --- src/components/ChallengeEditor/ChallengeView/index.js | 6 ------ src/components/ChallengeEditor/index.js | 2 +- src/config/constants.js | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/ChallengeEditor/ChallengeView/index.js b/src/components/ChallengeEditor/ChallengeView/index.js index b043852e..71943e62 100644 --- a/src/components/ChallengeEditor/ChallengeView/index.js +++ b/src/components/ChallengeEditor/ChallengeView/index.js @@ -97,7 +97,6 @@ const ChallengeView = ({ const showTimeline = false // disables the timeline for time being https://github.com/topcoder-platform/challenge-engine-ui/issues/706 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 @@ -241,11 +240,6 @@ const ChallengeView = ({ readOnly />} - { - showCheckpointPrizes && ( - - ) - }
diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 1e9c5c77..9e01d996 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -26,7 +26,7 @@ import { REVIEW_TYPES, MILESTONE_STATUS, PHASE_PRODUCT_CHALLENGE_ID_FIELD, - QA_TRACK_ID, DESIGN_CHALLENGE_TYPES, ROUND_TYPES, + QA_TRACK_ID, DESIGN_CHALLENGE_TYPES, DS_TRACK_ID } from '../../config/constants' import { PrimaryButton, OutlineButton } from '../Buttons' diff --git a/src/config/constants.js b/src/config/constants.js index 4f739caa..65d26423 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -287,4 +287,4 @@ export const MILESTONE_STATUS = { BLOCKED: 'paused', COMPLETED: 'completed', CANCELLED: 'cancelled' -} \ No newline at end of file +} From 66398f434de0c6c4cb065ac8e52dba1555fea655 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Oct 2022 14:12:45 +1100 Subject: [PATCH 09/11] Additional lint fixes --- src/components/ChallengeEditor/ChallengeView/index.js | 1 - src/components/ChallengeEditor/index.js | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/components/ChallengeEditor/ChallengeView/index.js b/src/components/ChallengeEditor/ChallengeView/index.js index 71943e62..31578261 100644 --- a/src/components/ChallengeEditor/ChallengeView/index.js +++ b/src/components/ChallengeEditor/ChallengeView/index.js @@ -27,7 +27,6 @@ import { DS_TRACK_ID } from '../../../config/constants' import PhaseInput from '../../PhaseInput' -import CheckpointPrizesField from '../CheckpointPrizes-Field' const ChallengeView = ({ projectDetail, diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 9e01d996..d73e416a 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -64,7 +64,6 @@ 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 @@ -953,7 +952,7 @@ class ChallengeEditor extends Component { async createNewChallenge () { if (!this.props.isNew) return const { metadata, createChallenge, projectDetail } = this.props - const { challenge: { name, trackId, typeId, milestoneId, roundType, challengeType, metadata: challengeMetadata } } = this.state + const { challenge: { name, trackId, typeId, milestoneId, challengeType, metadata: challengeMetadata } } = this.state const { timelineTemplates } = metadata const isDesignChallenge = trackId === DES_TRACK_ID const isDataScience = trackId === DS_TRACK_ID @@ -1568,7 +1567,6 @@ class ChallengeEditor extends Component { 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 showDashBoard = (challenge.trackId === DS_TRACK_ID && isChallengeType) || (isDevChallenge && isMM) const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' }) const useDashboard = useDashboardData ? useDashboardData.value : true @@ -1780,11 +1778,6 @@ class ChallengeEditor extends Component { removeAttachment={removeAttachment} />} - { - showCheckpointPrizes && ( - - ) - }
From 5433e3b2bb2c1e4af3a63661f94827443ba5d2cf Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Oct 2022 14:26:30 +1100 Subject: [PATCH 10/11] Compilation error --- src/components/ChallengeEditor/index.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index d73e416a..0a47c039 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -32,7 +32,6 @@ import { 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' @@ -1577,14 +1576,6 @@ class ChallengeEditor extends Component {
- { - showRoundType && ( - <> - - - - ) - } { showDashBoard && ( From 0be54040c45d66359a6d7f6edee9c898bd32ea7e Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Oct 2022 14:45:36 +1100 Subject: [PATCH 11/11] Cleanup --- src/components/ChallengeEditor/index.js | 5 +---- src/config/constants.js | 13 ------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 0a47c039..84302707 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -26,13 +26,12 @@ import { REVIEW_TYPES, MILESTONE_STATUS, PHASE_PRODUCT_CHALLENGE_ID_FIELD, - QA_TRACK_ID, DESIGN_CHALLENGE_TYPES, + QA_TRACK_ID, DS_TRACK_ID } from '../../config/constants' import { PrimaryButton, OutlineButton } from '../Buttons' import TrackField from './Track-Field' import TypeField from './Type-Field' -import ChallengeTypeField from './ChallengeType-Field' import ChallengeNameField from './ChallengeName-Field' import CopilotField from './Copilot-Field' import ReviewTypeField from './ReviewType-Field' @@ -1561,11 +1560,9 @@ 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 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 showDashBoard = (challenge.trackId === DS_TRACK_ID && isChallengeType) || (isDevChallenge && isMM) const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' }) const useDashboard = useDashboardData ? useDashboardData.value : true diff --git a/src/config/constants.js b/src/config/constants.js index 65d26423..73da22e9 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -159,19 +159,6 @@ 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'