Skip to content

Commit

Permalink
change: Add fold lines, length limits and modify page element layout
Browse files Browse the repository at this point in the history
  • Loading branch information
meua committed Jan 10, 2024
1 parent c849bce commit ce45c11
Show file tree
Hide file tree
Showing 16 changed files with 280 additions and 264 deletions.
4 changes: 2 additions & 2 deletions apps/challenges/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, *args, **kwargs):
self._original_evaluation_script = self.evaluation_script
self._original_approved_by_admin = self.approved_by_admin

title = models.CharField(max_length=100, db_index=True)
title = models.CharField(max_length=100, db_index=True, unique=True)
short_description = models.TextField(null=True, blank=True)
description = models.TextField(null=True, blank=True)
terms_and_conditions = models.TextField(null=True, blank=True)
Expand Down Expand Up @@ -100,7 +100,7 @@ def __init__(self, *args, **kwargs):
default=8, verbose_name="EC2 storage (GB)"
)
ephemeral_storage = models.PositiveIntegerField(
default=20, verbose_name="Ephemeral Storage (GB)"
default=21, verbose_name="Ephemeral Storage (GB)"
)
featured = models.BooleanField(
default=False, verbose_name="Featured", db_index=True
Expand Down
30 changes: 28 additions & 2 deletions apps/challenges/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4449,6 +4449,11 @@ def create_or_update_challenge(request, challenge_host_team_pk):

challenge_pk = request.data.get("id")
if not challenge_pk:
if Challenge.objects.filter(title=request.data.get("title")).exists():
response_data = {
"error": "The challenge title already exists. Please choose a different title."
}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
data = request.data.copy()
data["is_docker_based"] = True
data["enable_forum"] = True
Expand Down Expand Up @@ -4481,6 +4486,11 @@ def create_or_update_challenge(request, challenge_host_team_pk):
}
return Response(response_data, status=status.HTTP_404_NOT_FOUND)
challenge.title = request.data.get("title")
if Challenge.objects.filter(title=challenge.title).exclude(id=challenge_pk).exists():
response_data = {
"error": "The challenge title already exists. Please choose a different title."
}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
challenge.short_description = request.data.get("short_description")
challenge.description = request.data.get("description")
challenge.evaluation_details = request.data.get("evaluation_details")
Expand All @@ -4489,7 +4499,11 @@ def create_or_update_challenge(request, challenge_host_team_pk):
challenge.leaderboard_description = request.data.get("leaderboard_description")
challenge.start_date = datetime.strptime(request.data.get("start_date"), "%Y-%m-%dT%H:%M:%S%z")
challenge.end_date = datetime.strptime(request.data.get("end_date"), "%Y-%m-%dT%H:%M:%S%z")
challenge.image = simple_image_url(request.data.get("image"))
image = request.data.get("image")
if isinstance(image, str):
challenge.image = simple_image_url(image)
else:
challenge.image = image
published = request.data.get("published")
if published is not None:
published = published.lower() == 'true'
Expand Down Expand Up @@ -4533,6 +4547,12 @@ def create_or_update_challenge_phase(request, challenge_host_team_pk, challenge_
challenge_phase_pk = request.data.get("id")
if not challenge_phase_pk:
try:
codename = request.data["codename"]
if ChallengePhase.objects.filter(challenge=challenge, codename=codename).exists():
response_data = {
"error": f"A ChallengePhase with the codename '{codename}' already exists for the given challenge."
}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
with transaction.atomic():
request.data["slug"] = "{}-{}-{}".format(
challenge.title.split(" ")[0].lower(),
Expand Down Expand Up @@ -4585,6 +4605,13 @@ def create_or_update_challenge_phase(request, challenge_host_team_pk, challenge_
except ChallengePhase.DoesNotExist:
response_data = {"error": "Challenge Phase does not exist"}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
codename = request.data["codename"]
if ChallengePhase.objects.filter(challenge=challenge, codename=codename).exclude(id=challenge_phase_pk).exists():
response_data = {
"error": f"A ChallengePhase with the codename '{codename}' already exists for the given challenge."
}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
challenge_phase.codename = codename
challenge_phase.name = request.data.get("name")
challenge_phase.description = request.data.get("description")
challenge_phase.leaderboard_public = request.data.get("leaderboard_public")
Expand All @@ -4593,7 +4620,6 @@ def create_or_update_challenge_phase(request, challenge_host_team_pk, challenge_
challenge_phase.start_date = datetime.strptime(request.data.get("start_date"), "%Y-%m-%dT%H:%M:%S%z")
challenge_phase.end_date = datetime.strptime(request.data.get("start_date"), "%Y-%m-%dT%H:%M:%S%z")
challenge_phase.test_annotation_file = request.data.get("test_annotation_file")
challenge_phase.codename = request.data.get("codename")
challenge_phase.max_submissions_per_day = request.data.get("max_submissions_per_day")
challenge_phase.max_submissions_per_month = request.data.get("max_submissions_per_month")
challenge_phase.max_submissions = request.data.get("max_submissions")
Expand Down
2 changes: 1 addition & 1 deletion apps/jobs/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_or_create_sqs_queue(queue_name, challenge=None):
)

if queue_name == "":
queue_name = "evalai_submission_queue"
queue_name = "arena"

# Check if the queue exists. If not, then create one.
try:
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const toolbarConfig = {
};
const editorConfig = {
placeholder: '',
maxLength: 5000,
MENU_CONF: {
uploadImage: {
server: import.meta.env.VITE_APP_BASE_API + '/api/web/upload_image/',
Expand Down
40 changes: 19 additions & 21 deletions frontend/src/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ export default {
},
participate: {
continue: 'Continue',
accept_text1: 'please accept the',
accept_text2: 'rules and terms',
accept_text3: 'in order to participate.',
accept_text: 'Please read and accept the rules and conditions.',
accept_label: 'I accept the terms and conditions.',
},
submission: {
Expand Down Expand Up @@ -282,17 +280,17 @@ export default {
editChall: 'Edit Challenge',
title: 'Title',
titlePH: 'Autonomous Driving Algorithms Challenge',
shortDesc: 'Short_description',
shortDesc: 'Short description',
shortDescPH: 'Autonomous Driving Algorithm Challenge for each submission',
desc: 'Description',
evaluation: 'Evaluation_details',
termsConditions: 'Terms_and_conditions',
evaluation: 'Evaluation details',
termsConditions: 'Terms and conditions',
image: 'Image',
imagePH: 'Please upload logo jpg format is supported',
SubmiGuide: 'Submission_guidelines',
lbDesc: 'Leaderboard_description',
startDate: 'Start_date',
endDate: 'End_date',
SubmiGuide: 'Submission guidelines',
lbDesc: 'Leaderboard description',
startDate: 'Start date',
endDate: 'End date',
published: 'Published',
createSuccess: 'Contest creation success',
updateSuccess: 'Challenge updated successfully!',
Expand All @@ -302,18 +300,18 @@ export default {
editPhase: 'Edit Phase',
name: 'Name',
desc: 'Description',
lbPublic: 'Leaderboard_public',
isPublic: 'Is_public',
isSubmiPublic: 'Is_submission_public',
startDate: 'Start_date',
endDate: 'End_date',
lbPublic: 'Leaderboard public',
isPublic: 'Is public',
isSubmiPublic: 'Is submission public',
startDate: 'Start date',
endDate: 'End date',
codename: 'Codename',
maxSubmiPerDay: 'Max_submissions_per_day',
maxSubmiPerMonth: 'Max_submissions_per_month',
maxSubmissions: 'Max_submissions',
isRestrictedToSelectOneSubmission: 'Is_restricted_to_select_one_submission',
isPartialSubmissionEvaluationEnabled: 'Is_partial_submission_evaluation_enabled',
allowedSubmissionFileTypes: 'Allowed_submission_file_types',
maxSubmiPerDay: 'Max submissions perday',
maxSubmiPerMonth: 'Max submissions per month',
maxSubmissions: 'Max submissions',
isRestrictedToSelectOneSubmission: 'Is restricted to select onesubmission',
isPartialSubmissionEvaluationEnabled: 'Is partial submission evaluation enabled',
allowedSubmissionFileTypes: 'Allowed submission file types',
createSuccess: 'Phase creation successfully!',
updateSuccess: 'Phase updated successfully!',
},
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ export default {
},
participate: {
continue: '继续',
accept_text1: '请接受',
accept_text2: '规则和条款',
accept_text3: '才能参加比赛。',
accept_text: '请阅读并接受规则和条件。',
accept_label: '我接受条款和条件',
},
submission: {
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ router.beforeEach((to, from, next) => {
.then((res) => {
next({ path: '/' });
})
.catch((err) => {
next({ path: '/' });
});
});
} else if (to.path.startsWith('/host')) {
if (store.state.isHost === 1) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default createStore({
removeToken();
removeJwtToken();
commit('clearStore');
reject(error);
resolve();
});
});
},
Expand Down
23 changes: 23 additions & 0 deletions frontend/src/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,29 @@ body {
}
}

// 折叠面板
.el-collapse.oa-collapse {
border: none;
margin-top: -16px;
// margin-bottom: 24px;
--el-collapse-border-color: rgba(67, 77, 96, 0.6);
.el-collapse-item__header {
font-size: 14px;
font-weight: 700;
}
.el-collapse-item__wrap {
border-bottom-color: rgba(67, 77, 96, 0.6);
}
.el-collapse-item:nth-last-child(1) {
.el-collapse-item__wrap {
border-bottom: none;
}
.el-collapse-item__header {
border-bottom-color: transparent;
}
}
}

// 已选择项tag框
.custom-selected-tag {
&.el-tag {
Expand Down
12 changes: 4 additions & 8 deletions frontend/src/views/challenge/Detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
<overview :detailInfo="detailInfo" :phases="phases"></overview>
</el-tab-pane>
<el-tab-pane :label="$t('challenge.participate')" name="participate" v-if="!teamDetail">
<participate :challengeId="challengeId" @callback="getPartTeam('submission')" @openTerm="openTerm"></participate>
<participate
:challengeId="challengeId"
:termsConditions="detailInfo.terms_and_conditions"
@callback="getPartTeam('submission')"></participate>
</el-tab-pane>
<el-tab-pane :label="$t('challenge.submission')" name="submission" v-else>
<submission
Expand Down Expand Up @@ -81,13 +84,6 @@ const getPartTeam = (tabId) => {
});
};
const openTerm = () => {
activeName.value = 'overview';
setTimeout(() => {
let dom = document.querySelector('#term');
dom && dom.scrollIntoView();
}, 200);
};
const clearPartTeam = (tabId) => {
teamDetail.value = undefined;
activeName.value = tabId;
Expand Down
12 changes: 5 additions & 7 deletions frontend/src/views/challenge/Leaderboard.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<div class="title mb24">{{ $t('challenge.leaderboard') }}</div>
<div class="mb24">
<div v-html="description" class="editor-content-view"></div>
</div>
<el-collapse :model-value="['1']" class="oa-collapse">
<el-collapse-item :title="$t('challenge.leaderboard')" name="1">
<div v-html="description" class="editor-content-view"></div>
</el-collapse-item>
</el-collapse>

<div class="flex-center mb16">
<el-select v-model="curSplitId" :placeholder="$t('submission.phasePH')" @change="splitChange" style="width: 360px" class="mr16">
<el-option v-for="item in splits" :key="item.id" :label="getSplitLabel(item)" :value="item.id" />
</el-select>
<!-- <el-checkbox :label="$t('leaderboard.orderScore')" name="type" v-model="isByScore" @change="splitChange"></el-checkbox> -->

<el-select v-model="curOrderBy" :placeholder="$t('submission.orderPH')" @change="splitChange" style="width: 360px" class="mr16">
<el-option v-for="item in labels" :key="item" :label="item" :value="item" />
Expand All @@ -18,7 +18,6 @@
<el-table :data="leaderboardList" stripe style="width: 100%" header-cell-class-name="thBg">
<el-table-column fixed prop="rank" :label="$t('leaderboard.rank')" width="80" />
<el-table-column fixed sortable prop="submission__participant_team__team_name" :label="$t('leaderboard.team')" width="250" />
<!-- <el-table-column sortable prop="filtering_score" :label="$t('leaderboard.score')" /> -->
<el-table-column sortable :label="label" v-for="(label, i) in labels" :key="label" width="280">
<template #default="{ row }">
{{ row.result[i] }}
Expand All @@ -45,7 +44,6 @@ import { formatTime } from '@/utils/tool';
const props = defineProps(['challengeId', 'description']);
const curSplitId = ref('');
const splits = ref([]);
const isByScore = ref(false);
const curOrderBy = ref('');
const labels = ref([
'Driving score',
Expand Down
18 changes: 1 addition & 17 deletions frontend/src/views/challenge/Overview.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-collapse v-model="activeNames">
<el-collapse v-model="activeNames" class="oa-collapse">
<el-collapse-item :title="$t('overview.view.title')" name="1">
<div v-html="detailInfo.description" class="editor-content-view"></div>
</el-collapse-item>
Expand Down Expand Up @@ -67,20 +67,4 @@ const props = defineProps({
}
}
.el-collapse {
border: none;
margin-top: -16px;
}
:deep(.el-collapse-item__header) {
font-size: 14px;
font-weight: 700;
}
:deep(.el-collapse-item__wrap) {
border-bottom-color: rgba(67, 77, 96, 0.6);
}
.el-collapse-item:nth-last-child(1) {
:deep(.el-collapse-item__wrap) {
border-bottom: none;
}
}
</style>
Loading

0 comments on commit ce45c11

Please sign in to comment.