diff --git a/uvdat/core/rest/project.py b/uvdat/core/rest/project.py
index 448f943c..96de476b 100644
--- a/uvdat/core/rest/project.py
+++ b/uvdat/core/rest/project.py
@@ -2,10 +2,11 @@
from django.http import HttpResponse
from rest_framework.decorators import action
from rest_framework.viewsets import ModelViewSet
+from rest_framework.response import Response
-from uvdat.core.models import Project
+from uvdat.core.models import Dataset, Project
from uvdat.core.rest.access_control import GuardianFilter, GuardianPermission
-from uvdat.core.rest.serializers import ProjectSerializer
+from uvdat.core.rest.serializers import DatasetSerializer, ProjectSerializer
from uvdat.core.tasks.osmnx import load_roads
@@ -21,6 +22,21 @@ def perform_create(self, serializer):
user: User = self.request.user
project.set_permissions(owner=user)
+ def partial_update(self, request, id):
+ project = self.get_object()
+ project.datasets.set(
+ Dataset.objects.filter(
+ id__in=request.data.get('dataset_ids')
+ )
+ )
+ project.save()
+ response = ProjectSerializer(project).data
+ response.update(datasets=[
+ DatasetSerializer(dataset).data
+ for dataset in project.datasets.all()
+ ])
+ return Response(response, status=200)
+
@action(detail=True, methods=['get'])
def regions(self, request, **kwargs):
project = self.get_object()
diff --git a/web/src/App.vue b/web/src/App.vue
index 15c01dec..75a93fc2 100644
--- a/web/src/App.vue
+++ b/web/src/App.vue
@@ -8,6 +8,7 @@ import {
availableProjects,
currentChart,
currentSimulationType,
+ projectConfigMode,
} from "./store";
import { oauthClient, logout } from "./api/auth";
import { loadProjects } from "./storeFunctions";
@@ -16,6 +17,7 @@ import MainDrawerContents from "./components/MainDrawerContents.vue";
import OptionsDrawerContents from "./components/OptionsDrawerContents.vue";
import ChartJS from "./components/ChartJS.vue";
import SimulationsPanel from "./components/SimulationsPanel.vue";
+import ProjectConfig from "./components/ProjectConfig.vue";
export default defineComponent({
components: {
@@ -24,6 +26,7 @@ export default defineComponent({
OptionsDrawerContents,
ChartJS,
SimulationsPanel,
+ ProjectConfig,
},
setup() {
const drawer = ref(true);
@@ -54,6 +57,7 @@ export default defineComponent({
showError,
currentChart,
currentSimulationType,
+ projectConfigMode,
};
},
});
@@ -94,7 +98,10 @@ export default defineComponent({