From 2fdc69cd2971ec65158360cd2c7e5e10e8463ddd Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene Date: Tue, 10 Dec 2024 20:03:23 +0100 Subject: [PATCH 01/10] feat: create ebios rm study detailed view --- backend/core/serializers.py | 8 + frontend/messages/en.json | 6 +- .../Forms/ModelForm/AssetForm.svelte | 12 ++ frontend/src/lib/utils/crud.ts | 6 +- frontend/src/lib/utils/load.ts | 2 +- frontend/src/lib/utils/schemas.ts | 3 +- .../ebios-rm-study/+page.server.ts | 71 ++----- .../workshop-one/ebios-rm-study/+page.svelte | 179 +++++++++++++++++- .../ebios-rm-study/edit/+page.server.ts | 65 +++++++ .../ebios-rm-study/edit/+page.svelte | 16 ++ 10 files changed, 297 insertions(+), 71 deletions(-) create mode 100644 frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/edit/+page.server.ts create mode 100644 frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/edit/+page.svelte diff --git a/backend/core/serializers.py b/backend/core/serializers.py index e55df2c53..6cdde1825 100644 --- a/backend/core/serializers.py +++ b/backend/core/serializers.py @@ -216,6 +216,14 @@ class Meta: class AssetWriteSerializer(BaseModelSerializer): + ebios_rm_studies = serializers.PrimaryKeyRelatedField( + many=True, + queryset=EbiosRMStudy.objects.all(), + required=False, + allow_null=True, + write_only=True, + ) + class Meta: model = Asset fields = "__all__" diff --git a/frontend/messages/en.json b/frontend/messages/en.json index a58960796..7b0b809c6 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -979,5 +979,9 @@ "attackPath": "Attack path", "attackPaths": "Attack paths", "currentCriticality": "Current criticality", - "residualCriticality": "Residual criticality" + "residualCriticality": "Residual criticality", + "ebiosRm": "Ebios RM", + "workshopOne": "Workshop 1", + "refIdSemiColon": "Refence ID:", + "addFearedEvent": "Add feared event" } diff --git a/frontend/src/lib/components/Forms/ModelForm/AssetForm.svelte b/frontend/src/lib/components/Forms/ModelForm/AssetForm.svelte index 6f3ad3e8e..4e924356b 100644 --- a/frontend/src/lib/components/Forms/ModelForm/AssetForm.svelte +++ b/frontend/src/lib/components/Forms/ModelForm/AssetForm.svelte @@ -187,3 +187,15 @@ label={m.labels()} allowUserOptions="append" /> +{#if initialData.ebios_rm_studies} +