Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit project #196

Merged
merged 86 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
19d7502
paar fixes alvast
DRIESASTER Apr 27, 2024
e7244ce
almost
DRIESASTER Apr 27, 2024
21b95d3
files uploaden werkt
DRIESASTER Apr 29, 2024
385c070
formatting fixes
DRIESASTER Apr 29, 2024
8347bc2
Merge branch 'dev' into create_project_fixes
DRIESASTER Apr 29, 2024
8bc6d02
bugfixes + added date fields in db
DRIESASTER May 2, 2024
c464723
formatting
DRIESASTER May 2, 2024
12debbc
Merge branch 'dev' into create_project_fixes
DRIESASTER May 2, 2024
c5161cb
background container gone + no instructors found fix
DRIESASTER May 5, 2024
6d0be0e
format
DRIESASTER May 5, 2024
146a15c
basic
DRIESASTER May 6, 2024
3d8a0f4
temp
DRIESASTER May 6, 2024
be39aa8
begint ergens op te trekken
DRIESASTER May 7, 2024
7eb8355
update werkt!
DRIESASTER May 9, 2024
d4aca38
small change
DRIESASTER May 9, 2024
4118629
Merge branch 'dev' into create_project_fixes
DRIESASTER May 9, 2024
c21f95b
Merge branch 'create_project_fixes' into edit_project
DRIESASTER May 9, 2024
210519e
looking good
DRIESASTER May 9, 2024
0d0e761
edit fixes (almost there)
DRIESASTER May 10, 2024
e32f0ee
files werken
DRIESASTER May 10, 2024
9d0a622
edit (improvements)
DRIESASTER May 11, 2024
20fba3f
updates
DRIESASTER May 12, 2024
a92f4aa
Merge remote-tracking branch 'origin/edit_project' into edit_project
DRIESASTER May 12, 2024
ecc38de
filestructure visible
DRIESASTER May 12, 2024
994b6f7
werkt
DRIESASTER May 12, 2024
652f1b2
af?
DRIESASTER May 12, 2024
d0704ce
Merge branch 'dev' into edit_project
DRIESASTER May 12, 2024
5c9d742
remove empty alembic revisions
reyniersbram May 12, 2024
b47a2db
docker terug ok
DRIESASTER May 13, 2024
607a322
alert
DRIESASTER May 13, 2024
a875d86
route fix
DRIESASTER May 13, 2024
3e1fce1
Merge remote-tracking branch 'origin/edit_project' into edit_project
DRIESASTER May 13, 2024
e01ac3e
Merge branch 'dev' into edit_project
DRIESASTER May 13, 2024
4d588e6
linter
DRIESASTER May 13, 2024
5096f0d
add publish_date to mock projects
reyniersbram May 16, 2024
21bf7b9
reroute
DRIESASTER May 16, 2024
5b808dc
Merge remote-tracking branch 'origin/edit_project' into edit_project
DRIESASTER May 16, 2024
1438842
bijna
DRIESASTER May 16, 2024
453304a
requirements
DRIESASTER May 16, 2024
3b904e7
editfiles werkt
DRIESASTER May 16, 2024
dc32d29
Merge branch 'dev' into edit_project
DRIESASTER May 17, 2024
9abfe8a
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA…
DRIESASTER May 17, 2024
65cce88
few fixes
DRIESASTER May 18, 2024
0fbeff0
small time fix
DRIESASTER May 18, 2024
8611181
i18n
DRIESASTER May 18, 2024
af1b36e
Merge branch 'dev' into edit_project
DRIESASTER May 18, 2024
a4c5d23
format
DRIESASTER May 18, 2024
cac4038
formatting
DRIESASTER May 18, 2024
5b03ad9
final
DRIESASTER May 18, 2024
939d5a6
final
DRIESASTER May 18, 2024
3e7b315
Merge branch 'dev' into edit_project
reyniersbram May 19, 2024
532482b
Merge branch 'dev' into edit_project
DRIESASTER May 19, 2024
8445c42
vage fixes
DRIESASTER May 19, 2024
f5e6ff1
Merge remote-tracking branch 'origin/edit_project' into edit_project
DRIESASTER May 19, 2024
c282d60
vage fixes 2
DRIESASTER May 19, 2024
12c2998
tijd update nu ook
DRIESASTER May 19, 2024
fa39167
test fix
DRIESASTER May 19, 2024
426f6f8
format
DRIESASTER May 19, 2024
2c87b56
schema optional added
DRIESASTER May 19, 2024
6e86cd4
Merge branch 'dev' into edit_project
DRIESASTER May 20, 2024
dc66f0d
fix voor tests not found
DRIESASTER May 20, 2024
815aa3d
bram requests xoxo
DRIESASTER May 20, 2024
6643475
whoops
DRIESASTER May 20, 2024
18caa76
Update frontend/src/components/RequirementsInput.vue
DRIESASTER May 20, 2024
979cc72
Update frontend/src/components/RequirementsInput.vue
DRIESASTER May 20, 2024
0c7c095
Update frontend/src/queries/Project.ts
DRIESASTER May 20, 2024
fe138a0
Update frontend/src/queries/Project.ts
DRIESASTER May 20, 2024
d800d90
Update frontend/src/components/RequirementsInput.vue
DRIESASTER May 20, 2024
1def3c0
Update frontend/src/services/project.ts
DRIESASTER May 20, 2024
6e54506
Update frontend/src/components/project/DatePicker.vue
DRIESASTER May 20, 2024
cda3ea9
fixes
DRIESASTER May 20, 2024
330bf99
Merge remote-tracking branch 'origin/edit_project' into edit_project
DRIESASTER May 20, 2024
a630739
loading fix
DRIESASTER May 20, 2024
607153b
Update frontend/src/components/project/DatePicker.vue
DRIESASTER May 20, 2024
93964d1
fixes vooral cleanup
DRIESASTER May 20, 2024
6219dba
Merge remote-tracking branch 'origin/edit_project' into edit_project
DRIESASTER May 20, 2024
fd1ecea
fixes vooral cleanup
DRIESASTER May 20, 2024
a833f1c
fixes vooral cleanup
DRIESASTER May 20, 2024
ada4bae
Revert "upgrade @vue/test-utils (#181)"
DRIESASTER May 20, 2024
d9a0a64
luxon weg?
DRIESASTER May 20, 2024
e49a433
luxon echt weg?
DRIESASTER May 20, 2024
3e4d692
luxon echt echt weg?
DRIESASTER May 20, 2024
7a48a68
renaming + unused gone
DRIESASTER May 20, 2024
fda6d1d
Merge branch 'dev' into edit_project
DRIESASTER May 20, 2024
2ea6979
some small fixes
reyniersbram May 20, 2024
4dd6ff5
bramfixes
DRIESASTER May 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

```sh
# Create a python virtual environment
python -m venv venv
python3.12 -m venv venv
# Activate the environment
source venv/bin/activate
# Install dependencies
Expand Down
5 changes: 1 addition & 4 deletions backend/src/docker_tests/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

def get_docker_client() -> Generator[DockerClient, Any, None]:
"""Creates docker client, which is closed afterwards"""
try:
client = docker.from_env()
except DockerException:
raise DockerDeamonNotFound()
client = docker.DockerClient(base_url='unix://var/run/docker.sock')
DRIESASTER marked this conversation as resolved.
Show resolved Hide resolved

try:
yield client
Expand Down
2 changes: 2 additions & 0 deletions backend/src/project/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class ProjectBase(BaseModel):
is_visible: bool = Field(default=True)
DRIESASTER marked this conversation as resolved.
Show resolved Hide resolved
capacity: int = Field(gt=0)
requirements: List[Requirement] = []
enroll_deadline: Optional[datetime]
publish_date: datetime
DRIESASTER marked this conversation as resolved.
Show resolved Hide resolved


class ProjectCreate(ProjectBase):
Expand Down
9 changes: 9 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@vueup/vue-quill": "^1.2.0",
"@vueuse/core": "^10.9.0",
"clonedeep": "^2.0.0",
"luxon": "^3.4.4",
"pinia": "^2.1.7",
"roboto-fontface": "*",
"vue": "^3.4.15",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
onBeforeMount(() => {
const { locale } = useI18n();
const { selectedLocale } = useLocale();
const { storedTheme } = useThemeStore();

Check warning on line 33 in frontend/src/App.vue

View workflow job for this annotation

GitHub Actions / Run linters

'storedTheme' is assigned a value but never used
const theme = useTheme();

Check warning on line 34 in frontend/src/App.vue

View workflow job for this annotation

GitHub Actions / Run linters

'theme' is assigned a value but never used
locale.value = selectedLocale;
theme.global.name.value = storedTheme;
// theme.global.name.value = storedTheme;
});
</script>

Expand Down
47 changes: 38 additions & 9 deletions frontend/src/components/project/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,58 @@
></v-text-field>
</template>
<v-date-picker v-model="date" no-title></v-date-picker>
<v-time-picker v-model="time" format="24hr"></v-time-picker>
DRIESASTER marked this conversation as resolved.
Show resolved Hide resolved
</v-menu>
</template>

<script setup lang="ts">
import { ref, computed } from "vue";
import { ref, watch, computed, defineProps, defineEmits } from "vue";
DRIESASTER marked this conversation as resolved.
Show resolved Hide resolved
import { VTimePicker } from "vuetify/labs/VTimePicker";

const date = defineModel<Date>({});

defineProps<{
// Define props and emits
const props = defineProps<{
modelValue: Date;
label: string;
}>();
const emit = defineEmits(["update:modelValue"]);

const menuVisible = ref(false);
const date = ref(new Date(props.modelValue || Date.now()));
const time = ref(formatTime(props.modelValue || new Date()));
watch(
() => props.modelValue,
(newValue) => {
if (newValue) {
date.value = new Date(newValue);
}
},
{ immediate: true }
);
function formatTime(date: Date): string {
return `${date.getHours().toString().padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}`;
}

watch(
[date, time],
() => {
const [hours, minutes] = time.value.split(":").map(Number);
const updatedDate = new Date(date.value);
updatedDate.setHours(hours, minutes, 0, 0);
emit("update:modelValue", new Date(updatedDate));
},
{ deep: true }
);

// Computed to format the date as ISO string (just the date part)
const displayDate = computed(() => {
if (date.value) {
const selectedDate = new Date(date.value.getTime());
selectedDate.setMinutes(selectedDate.getMinutes() - selectedDate.getTimezoneOffset());
return selectedDate.toISOString().substring(0, 10);
if (date.value && time.value) {
const selectedDate = new Date(date.value);
const [hours, minutes] = time.value.split(":").map(Number);
selectedDate.setHours(hours, minutes);
return `${selectedDate.getFullYear()}-${(selectedDate.getMonth() + 1).toString().padStart(2, "0")}-${selectedDate.getDate().toString().padStart(2, "0")} ${selectedDate.getHours().toString().padStart(2, "0")}:${selectedDate.getMinutes().toString().padStart(2, "0")}`;
}
return "";
});
const displayTime = computed(() => time.value);

Check warning on line 70 in frontend/src/components/project/DatePicker.vue

View workflow job for this annotation

GitHub Actions / Run linters

'displayTime' is assigned a value but never used

function toggleDatePicker() {
menuVisible.value = !menuVisible.value;
Expand Down
91 changes: 91 additions & 0 deletions frontend/src/components/project/DisplayTestFiles.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<template>
<v-card class="file-display-container" outlined>
<v-card-title> Project Files </v-card-title>
<v-card-text>
<v-treeview v-model="tree" :items="treeItems" activatable hoverable open-on-click>
<template v-slot:prepend="{ item }">
<v-icon>{{ getFileIcon(item.title) }}</v-icon>
</template>
</v-treeview>
</v-card-text>
</v-card>
</template>

<script setup>
import { computed, ref } from "vue";
import { VTreeview } from "vuetify/labs/VTreeview";

const props = defineProps({
files: Array,
});

const tree = ref([]);
const treeItems = computed(() => {
const rootNode = {};
props.files.forEach((file) => {
const parts = file.filename.split("/").filter(Boolean);
let current = rootNode;

parts.forEach((part, index) => {
if (!current[part]) {
current[part] = {
_isFile: index === parts.length - 1,
children: {},
title: part,
};
}
if (index === parts.length - 1) {
current[part]._isFile = true;
current[part].title = parts.slice(-1)[0];
current[part].id = file.path;
current[part].children = undefined;
} else {
current = current[part].children;
}
});
});
return buildTree(rootNode);
});

function buildTree(node, path = "") {
const result = [];
Object.keys(node).forEach((key) => {
if (!node[key]._isFile && node[key].children) {
const fullPath = path ? `${path}/${key}` : key;
result.push({
title: node[key].title,
id: fullPath,
children: buildTree(node[key].children, fullPath),
});
} else if (node[key]._isFile) {
result.push({
title: node[key].title,
id: node[key].id,
});
}
});
return result;
}

const icons = ref({
html: "mdi-language-html5",
js: "mdi-nodejs",
json: "mdi-code-json",
md: "mdi-language-markdown",
pdf: "mdi-file-pdf-box",
png: "mdi-file-image",
txt: "mdi-file-document-outline",
xls: "mdi-file-excel",
folder: "mdi-folder",
folderOpen: "mdi-folder-open",
});

function getFileIcon(filename) {
const extension = filename.split(".").pop();
if (extension === filename) {
return "mdi-folder";
} else {
return icons.value[extension] || "mdi-file";
}
}
</script>
25 changes: 15 additions & 10 deletions frontend/src/components/project/RadiobuttonList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
v-model="radio_date"
label="Group Selection Deadline"
></DatePicker>
<!-- Numeric input for Capacity -->
<v-text-field
v-if="selectedOption === 'student' || selectedOption === 'random'"
v-model="capacity"
Expand Down Expand Up @@ -45,22 +44,28 @@ defineProps<{

const isToggled = ref(true);
const selectedOption = ref(model);
const radio_date = ref(new Date());
const radio_date = ref<Date | null>(null);
const capacity = ref(1); // Default capacity

const emit = defineEmits<{
(e: "update:radio_date", value: Date): void;
(e: "update:radio_date", value: Date | null): void;
(e: "update:capacity", value: number): void;
}>();

watch(capacity, (newCapacity) => {
emit("update:capacity", newCapacity);
});

watch(selectedOption, (newValue) => {
if (newValue === "course") {
capacity.value = 1; // Reset capacity when 'student' is not selected
emit("update:capacity", capacity.value);
if (newValue === "student") {
// Ensure radio_date can be set
radio_date.value = new Date(); // or keep the existing date
} else {
// Reset radio_date when 'student' is not selected
radio_date.value = null;
}
emit("update:radio_date", radio_date.value);

// Adjust capacity based on the selected option
if (newValue !== "student" && newValue !== "random") {
capacity.value = 1; // Reset capacity
}
emit("update:capacity", capacity.value);
});
</script>
2 changes: 2 additions & 0 deletions frontend/src/models/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export default interface Project {
requirements: [];
description: string;
capacity: number;
enroll_deadline: Date;
publish_date: Date;
}

export interface ProjectForm {
Expand Down
Loading
Loading