From 95698b3842cda452ba3ba6938c102ed07833a910 Mon Sep 17 00:00:00 2001 From: EwoutV Date: Tue, 21 May 2024 21:48:16 +0200 Subject: [PATCH] chore: PR comments --- backend/api/serializers/checks_serializer.py | 2 +- backend/api/tests/test_file_structure.py | 2 -- backend/api/views/project_view.py | 1 + frontend/src/assets/lang/app/en.json | 7 ++++++- frontend/src/assets/lang/app/nl.json | 7 ++++++- .../src/components/projects/ExtraChecksUpload.vue | 1 + frontend/src/components/projects/ProjectForm.vue | 2 +- .../components/projects/ProjectStructureTree.vue | 14 +++++++++----- frontend/src/views/authentication/LoginView.vue | 2 +- 9 files changed, 26 insertions(+), 12 deletions(-) diff --git a/backend/api/serializers/checks_serializer.py b/backend/api/serializers/checks_serializer.py index 4713c45d..289265df 100644 --- a/backend/api/serializers/checks_serializer.py +++ b/backend/api/serializers/checks_serializer.py @@ -99,7 +99,7 @@ def validate(self, attrs: dict) -> dict: data = super().validate(attrs) # Check if the docker image is provided - if not "docker_image" in self.initial_data: + if "docker_image" not in self.initial_data: raise serializers.ValidationError(_("extra_check.error.docker_image")) # Check if the docker image exists diff --git a/backend/api/tests/test_file_structure.py b/backend/api/tests/test_file_structure.py index 646bf5e2..be463dee 100644 --- a/backend/api/tests/test_file_structure.py +++ b/backend/api/tests/test_file_structure.py @@ -49,8 +49,6 @@ def test_parsing(self): content_json = json.loads(response.content.decode("utf-8")) - print(project, content_json) - self.assertEqual(len(content_json), 6) expected_project_url = settings.TESTING_BASE_LINK + reverse( diff --git a/backend/api/views/project_view.py b/backend/api/views/project_view.py index dc2243d9..42217e30 100644 --- a/backend/api/views/project_view.py +++ b/backend/api/views/project_view.py @@ -20,6 +20,7 @@ from rest_framework.response import Response from rest_framework.viewsets import GenericViewSet + # TODO: Error message when creating a project with wrongly formatted date looks a bit weird class ProjectViewSet(RetrieveModelMixin, UpdateModelMixin, diff --git a/frontend/src/assets/lang/app/en.json b/frontend/src/assets/lang/app/en.json index bf9b1062..dbcd356f 100644 --- a/frontend/src/assets/lang/app/en.json +++ b/frontend/src/assets/lang/app/en.json @@ -71,7 +71,12 @@ "noStudents": "No students in this group", "locked": "Closed", "unlocked": "Open", - "structureChecks": "Submission structure", + "structureChecks": { + "title": "Structure checks", + "placeholder": "Give a name to this folder", + "cancelSelection": "Deselect {0}", + "newFolder": "New folder" + }, "extraChecks": { "title": "Automatic checks on a submission", "empty": "No checks addeed", diff --git a/frontend/src/assets/lang/app/nl.json b/frontend/src/assets/lang/app/nl.json index 9fc87834..be118d94 100644 --- a/frontend/src/assets/lang/app/nl.json +++ b/frontend/src/assets/lang/app/nl.json @@ -60,7 +60,6 @@ "create": "Creƫer nieuw project", "save": "Project opslaan", "edit": "Project bewerken", - "structureChecks": "Indieningsstructuur", "name": "Projectnaam", "description": "Beschrijving", "startDate": "Start project", @@ -73,6 +72,12 @@ "noStudents": "Geen studenten in deze groep", "locked": "Gesloten", "unlocked": "Open", + "structureChecks": { + "title": "Indieningsstructuur", + "placeholder": "Geef deze nieuwe map een naam", + "cancelSelection": "Deselecteer {0}", + "newFolder": "Nieuwe map" + }, "extraChecks": { "title": "Automatische checks op een indiening", "add": "Nieuwe check", diff --git a/frontend/src/components/projects/ExtraChecksUpload.vue b/frontend/src/components/projects/ExtraChecksUpload.vue index 62a2f02c..667768f9 100644 --- a/frontend/src/components/projects/ExtraChecksUpload.vue +++ b/frontend/src/components/projects/ExtraChecksUpload.vue @@ -125,6 +125,7 @@ async function onDockerImageUpload(event: any): Promise { :icon="PrimeIcons.PLUS" :label="t('views.projects.extraChecks.add')" icon-pos="left" + rounded /> diff --git a/frontend/src/components/projects/ProjectForm.vue b/frontend/src/components/projects/ProjectForm.vue index 0c66a599..570db1e1 100644 --- a/frontend/src/components/projects/ProjectForm.vue +++ b/frontend/src/components/projects/ProjectForm.vue @@ -202,7 +202,7 @@ watchEffect(() => {
- +
diff --git a/frontend/src/components/projects/ProjectStructureTree.vue b/frontend/src/components/projects/ProjectStructureTree.vue index e1f9ca5c..0d5926e4 100644 --- a/frontend/src/components/projects/ProjectStructureTree.vue +++ b/frontend/src/components/projects/ProjectStructureTree.vue @@ -7,10 +7,14 @@ import { StructureCheck } from '@/types/StructureCheck.ts'; import { computed, ref } from 'vue'; import { type TreeNode } from 'primevue/treenode'; import { PrimeIcons } from 'primevue/api'; +import { useI18n } from 'vue-i18n'; /* Models */ const structureChecks = defineModel(); +/* Composables injections */ +const { t } = useI18n(); + /* State */ const selectedStructureCheck = ref(null); const editingStructureCheck = ref(null); @@ -99,7 +103,7 @@ function addStructureCheck(check: StructureCheck | null = null): void { hierarchy = selectedStructureCheck.value.getDirectoryHierarchy(); } - hierarchy.push('new'); + hierarchy.push(t('views.projects.structureChecks.placeholder')); structureChecks.value.push((editingStructureCheck.value = new StructureCheck('', hierarchy.join('/')))); } @@ -171,7 +175,7 @@ function newTreeNode(check: StructureCheck, key: string, label: string, leaf: bo class="w-full" :model-value="node.data.getObligatedExtensionList()" @update:model-value="node.data.setObligatedExtensionList($event)" - v-tooltip="'Verplichte extensies'" + v-tooltip="t('views.projects.structureChecks.obligatedExtensions')" > -