diff --git a/frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.html b/frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.html index 3087f6dc6b..2597442fd2 100644 --- a/frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.html +++ b/frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.html @@ -134,8 +134,26 @@
Challenge Settings
- - + + +
+
+ + +
+
Edit Phase @@ -200,7 +218,7 @@
Challenge Settings
-      +
diff --git a/frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.ts b/frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.ts index fcb7813f23..5191f0d3cd 100644 --- a/frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.ts +++ b/frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.ts @@ -929,6 +929,40 @@ export class ChallengesettingsComponent implements OnInit, OnDestroy { } } + /** + * Edit submission guidelines + */ + editSubmissionGuidelines() { + const SELF = this; + SELF.apiCall = (params) => { + const BODY = JSON.stringify(params); + SELF.apiService + .patchUrl(SELF.endpointsService.editChallengeDetailsURL(SELF.challenge.creator.id, SELF.challenge.id), BODY) + .subscribe( + (data) => { + SELF.challenge.submission_guidelines = data.submission_guidelines; + SELF.globalService.showToast('success', 'The submission guidelines are successfully updated!', 5); + }, + (err) => { + SELF.globalService.handleApiError(err, true); + SELF.globalService.showToast('error', err); + }, + () => {} + ); + }; + + const PARAMS = { + title: 'Edit Submission Guidelines', + label: 'submission_guidelines', + isEditorRequired: true, + editorContent: this.challenge.submission_guidelines, + confirm: 'Submit', + deny: 'Cancel', + confirmCallback: SELF.apiCall, + }; + SELF.globalService.showModal(PARAMS); + } + // Edit Leaderboard Details -> /** @@ -1047,7 +1081,44 @@ export class ChallengesettingsComponent implements OnInit, OnDestroy { () => this.logger.info('EDIT-LEADERBOARD-PRECISION-VALUE-FINISHED') ); } + + /** + * Edit leaderboard description of the challenge + */ + editLeaderboardDescription() { + const SELF = this; + SELF.apiCall = (params) => { + const BODY = JSON.stringify(params); + SELF.apiService + .patchUrl(SELF.endpointsService.editChallengeDetailsURL(SELF.challenge.creator.id, SELF.challenge.id), BODY) + .subscribe( + (data) => { + SELF.challenge.leaderboard_description = data.leaderboard_description; + SELF.globalService.showToast('success', 'The leaderboard description is successfully updated!', 5); + }, + (err) => { + SELF.globalService.handleApiError(err, true); + SELF.globalService.showToast('error', err); + }, + () => this.logger.info('Edit Leaderboard Description') + ); + }; + /** + * Parameters of the modal + */ + const PARAMS = { + title: 'Edit Leaderboard Description', + label: 'leaderboard_description', + isEditorRequired: true, + editorContent: this.challenge.leaderboard_description, + confirm: 'Submit', + deny: 'Cancel', + confirmCallback: SELF.apiCall, + }; + SELF.globalService.showModal(PARAMS); + } + // Edit Evaluation Script and Criteria -> /** diff --git a/frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.html b/frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.html index 262315e241..f42767d4d1 100644 --- a/frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.html +++ b/frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.html @@ -13,12 +13,7 @@
Submission Guidelines

-
- - diff --git a/frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.ts b/frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.ts index a98d0b70f1..91044fad98 100644 --- a/frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.ts +++ b/frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.ts @@ -93,11 +93,6 @@ export class ChallengesubmitComponent implements OnInit { */ submissionError = ''; - /** - * Guidelines text - */ - submissionGuidelines = ''; - /** * Stores the attributes format and phase ID for all the phases of a challenge. */ @@ -248,7 +243,6 @@ export class ChallengesubmitComponent implements OnInit { this.challengeService.currentChallenge.subscribe((challenge) => { this.challenge = challenge; this.isActive = this.challenge['is_active']; - this.submissionGuidelines = this.challenge['submission_guidelines']; if (this.challenge.cli_version !== null) { this.cliVersion = this.challenge.cli_version; } @@ -602,40 +596,6 @@ export class ChallengesubmitComponent implements OnInit { this.globalService.showToast('success', 'Command copied to clipboard'); } - /** - * Edit submission guidelines - */ - editSubmissionGuideline() { - const SELF = this; - SELF.apiCall = (params) => { - const BODY = JSON.stringify(params); - SELF.apiService - .patchUrl(SELF.endpointsService.editChallengeDetailsURL(SELF.challenge.creator.id, SELF.challenge.id), BODY) - .subscribe( - (data) => { - SELF.submissionGuidelines = data.submission_guidelines; - SELF.globalService.showToast('success', 'The submission guidelines is successfully updated!', 5); - }, - (err) => { - SELF.globalService.handleApiError(err, true); - SELF.globalService.showToast('error', err); - }, - () => {} - ); - }; - - const PARAMS = { - title: 'Edit Submission Guidelines', - label: 'submission_guidelines', - isEditorRequired: true, - editorContent: this.challenge.submission_guidelines, - confirm: 'Submit', - deny: 'Cancel', - confirmCallback: SELF.apiCall, - }; - SELF.globalService.showModal(PARAMS); - } - validateInput(inputValue) { const regex = new RegExp(/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/); const validExtensions = ['json', 'zip', 'txt', 'tsv', 'gz', 'csv', 'h5', 'npy'];