Skip to content

Commit

Permalink
chore: PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutV committed May 21, 2024
1 parent 9a34516 commit 0049d1e
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion backend/api/serializers/checks_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions backend/api/tests/test_file_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions backend/api/views/project_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/assets/lang/app/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/assets/lang/app/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"create": "Creëer nieuw project",
"save": "Project opslaan",
"edit": "Project bewerken",
"structureChecks": "Indieningsstructuur",
"name": "Projectnaam",
"description": "Beschrijving",
"startDate": "Start project",
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/projects/ExtraChecksUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ async function onDockerImageUpload(event: any): Promise<void> {
:icon="PrimeIcons.PLUS"
:label="t('views.projects.extraChecks.add')"
icon-pos="left"
rounded
/>

<!-- Dialog with a form to create a new extra check -->
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/projects/ProjectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ watchEffect(() => {
<!-- Define the submission structure checks -->
<div class="grid">
<div class="field col">
<label for="structure">{{ t('views.projects.structureChecks') }}</label>
<label for="structure">{{ t('views.projects.structureChecks.title') }}</label>
<ProjectStructureTree id="structure" v-model="form.structure_checks" />
</div>
</div>
Expand Down
20 changes: 15 additions & 5 deletions frontend/src/components/projects/ProjectStructureTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<StructureCheck[]>();
/* Composables injections */
const { t } = useI18n();
/* State */
const selectedStructureCheck = ref<StructureCheck | null>(null);
const editingStructureCheck = ref<StructureCheck | null>(null);
Expand Down Expand Up @@ -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('/'))));
}
Expand Down Expand Up @@ -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')"
>
<template #chip="{ value }">
{{ value }}
Expand All @@ -183,7 +187,7 @@ function newTreeNode(check: StructureCheck, key: string, label: string, leaf: bo
class="w-full"
:model-value="node.data.getBlockedExtensionList()"
@update:model-value="node.data.setBlockedExtensionList($event)"
v-tooltip="'Verboden extensies'"
v-tooltip="t('views.projects.structureChecks.blockedExtensions')"
>
<template #chip="{ value }">
{{ value }}
Expand Down Expand Up @@ -227,15 +231,21 @@ function newTreeNode(check: StructureCheck, key: string, label: string, leaf: bo
:icon="PrimeIcons.TIMES"
v-if="selectedStructureCheck !== null"
severity="contrast"
:label="'Deselecteer ' + selectedStructureCheck.path"
:label="t('views.projects.structureChecks.cancelSelection', [selectedStructureCheck.path])"
@click="
selectedStructureCheck = null;
editingStructureCheck = null;
"
outlined
rounded
/>
<Button label="Nieuwe map" :icon="PrimeIcons.FOLDER" @click="addStructureCheck()" outlined rounded link />
<Button
:label="t('views.projects.structureChecks.newFolder')"
:icon="PrimeIcons.FOLDER"
@click="addStructureCheck()"
outlined
rounded
/>
</div>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/authentication/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const { t } = useI18n();
</BaseLayout>
</template>

<style lang="scss">
<style lang="scss" scoped>
#wrapper {
min-height: calc(100vh - (150px + 173px + 7rem)) !important;
}
Expand Down

0 comments on commit 0049d1e

Please sign in to comment.