@@ -20,6 +20,7 @@ import {
20
20
MESSAGE ,
21
21
COMMUNITY_APP_URL ,
22
22
DES_TRACK_ID ,
23
+ DS_TRACK_ID ,
23
24
CHALLENGE_TYPE_ID ,
24
25
REVIEW_TYPES ,
25
26
MILESTONE_STATUS ,
@@ -33,6 +34,7 @@ import TypeField from './Type-Field'
33
34
import RoundTypeField from './RoundType-Field'
34
35
import ChallengeTypeField from './ChallengeType-Field'
35
36
import ChallengeNameField from './ChallengeName-Field'
37
+ import ShowDataDashboardField from './ShowDataDashboard-Field'
36
38
import CopilotField from './Copilot-Field'
37
39
import ReviewTypeField from './ReviewType-Field'
38
40
import TermsField from './Terms-Field'
@@ -91,7 +93,13 @@ class ChallengeEditor extends Component {
91
93
showDesignChallengeWarningModel : false ,
92
94
hasValidationErrors : false ,
93
95
challenge : {
94
- ...dropdowns [ 'newChallenge' ]
96
+ ...dropdowns [ 'newChallenge' ] ,
97
+ metadata : [
98
+ {
99
+ 'name' : 'show_data_dashboard' ,
100
+ 'value' : true
101
+ }
102
+ ]
95
103
} ,
96
104
draftChallenge : { data : { id : null } } ,
97
105
currentTemplate : null ,
@@ -949,9 +957,10 @@ class ChallengeEditor extends Component {
949
957
async createNewChallenge ( ) {
950
958
if ( ! this . props . isNew ) return
951
959
const { metadata, createChallenge, projectDetail } = this . props
952
- const { challenge : { name, trackId, typeId, milestoneId, roundType, challengeType } } = this . state
960
+ const { challenge : { name, trackId, typeId, milestoneId, roundType, challengeType, challengeMetadata } } = this . state
953
961
const { timelineTemplates } = metadata
954
962
const isDesignChallenge = trackId === DES_TRACK_ID
963
+ const isDataScienceChallenge = trackId === DS_TRACK_ID
955
964
956
965
// indicate that creating process has started
957
966
this . setState ( { isSaving : true } )
@@ -1009,6 +1018,9 @@ class ChallengeEditor extends Component {
1009
1018
newChallenge . discussions = discussions
1010
1019
}
1011
1020
}
1021
+ if ( isDataScienceChallenge ) {
1022
+ newChallenge . metadata = challengeMetadata
1023
+ }
1012
1024
try {
1013
1025
const action = await createChallenge ( newChallenge , projectDetail . id )
1014
1026
if ( isTask ) {
@@ -1548,6 +1560,9 @@ class ChallengeEditor extends Component {
1548
1560
const showTimeline = false // disables the timeline for time being https://github.com/topcoder-platform/challenge-engine-ui/issues/706
1549
1561
const copilotResources = metadata . members || challengeResources
1550
1562
const isDesignChallenge = challenge . trackId === DES_TRACK_ID
1563
+ const isDataScienceChallenge = challenge . trackId === DS_TRACK_ID
1564
+ console . log ( _ . find ( challenge . metadata , { name : 'show_data_dashboard' } ) )
1565
+ const showDataDashboard = _ . find ( challenge . metadata , { name : 'show_data_dashboard' } )
1551
1566
const isChallengeType = challenge . typeId === CHALLENGE_TYPE_ID
1552
1567
const showRoundType = isDesignChallenge && isChallengeType
1553
1568
const showCheckpointPrizes = challenge . timelineTemplateId === MULTI_ROUND_CHALLENGE_TEMPLATE_ID
@@ -1567,6 +1582,7 @@ class ChallengeEditor extends Component {
1567
1582
)
1568
1583
}
1569
1584
< ChallengeNameField challenge = { challenge } onUpdateInput = { this . onUpdateInput } />
1585
+ { isDataScienceChallenge && < ShowDataDashboardField value = { showDataDashboard . value } onUpdateInput = { this . onUpdateMetadata } /> }
1570
1586
{ projectDetail . version === 'v4' && < MilestoneField milestones = { activeProjectMilestones } onUpdateSelect = { this . onUpdateSelect } projectId = { projectDetail . id } selectedMilestoneId = { selectedMilestoneId } /> }
1571
1587
{ useTask && ( < DiscussionField hasForum = { hasForum } toggleForum = { this . toggleForumOnCreate } /> ) }
1572
1588
</ div >
0 commit comments