From 4d177a38effb8d9e227539aa8919e5d98a1a260a Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene <90701924+Mohamed-Hacene@users.noreply.github.com> Date: Thu, 12 Dec 2024 22:30:21 +0100 Subject: [PATCH] Ca 701 workshop 1 ux (#1170) --- backend/core/serializers.py | 8 + frontend/messages/en.json | 8 + .../src/lib/components/Forms/ModelForm.svelte | 5 +- .../Forms/ModelForm/AssetForm.svelte | 12 + .../Forms/ModelForm/EbiosRmForm.svelte | 84 +++++-- .../Forms/ModelForm/FearedEventForm.svelte | 2 + .../Forms/ModelForm/RoToForm.svelte | 1 - .../lib/components/Modals/CreateModal.svelte | 2 + .../lib/components/Modals/UpdateModal.svelte | 67 ++++++ .../components/ModelTable/ModelTable.svelte | 9 +- frontend/src/lib/utils/crud.ts | 11 +- frontend/src/lib/utils/load.ts | 2 +- frontend/src/lib/utils/schemas.ts | 6 +- .../[id=uuid]/edit/+layout.server.ts | 5 +- .../(app)/(internal)/ebios-rm/+page.svelte | 3 +- .../ebios-rm/[id=uuid]/+page.svelte | 4 +- .../workshop-one/baseline/+page.server.ts | 30 ++- .../workshop-one/baseline/+page.svelte | 51 +++++ .../ebios-rm-study/+page.server.ts | 71 ++---- .../workshop-one/ebios-rm-study/+page.svelte | 211 +++++++++++++++++- .../ebios-rm-study/edit/+page.server.ts | 65 ++++++ .../ebios-rm-study/edit/+page.svelte | 17 ++ .../feared-events/+page.server.ts | 6 +- 23 files changed, 582 insertions(+), 98 deletions(-) create mode 100644 frontend/src/lib/components/Modals/UpdateModal.svelte 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 3fd17dcb7..43332b224 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 50fd4a9b8..e32bcdeea 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -980,5 +980,13 @@ "attackPaths": "Attack paths", "currentCriticality": "Current criticality", "residualCriticality": "Residual criticality", + "ebiosRm": "Ebios RM", + "workshopOne": "Workshop 1", + "refIdSemiColon": "Refence ID:", + "addFearedEvent": "Add feared event", + "addEbiosRMstudy": "Add Ebios RM Study", + "noAuthor": "No author assigned", + "noReviewer": "No reviewer assigned", + "selectAudit": "Select audit", "errorAssetGraphMustNotContainCycles": "The asset graph must not contain cycles." } diff --git a/frontend/src/lib/components/Forms/ModelForm.svelte b/frontend/src/lib/components/Forms/ModelForm.svelte index c4b150cde..e30978a25 100644 --- a/frontend/src/lib/components/Forms/ModelForm.svelte +++ b/frontend/src/lib/components/Forms/ModelForm.svelte @@ -58,6 +58,7 @@ export let suggestions: { [key: string]: any } = {}; export let cancelButton = true; export let duplicate = false; + export let customNameDescription = false; const URLModel = model.urlModel as urlModel; export let schema = modelSchema(URLModel); @@ -163,7 +164,7 @@ }} /> {/if} - {#if shape.name} + {#if shape.name && !customNameDescription} {/if} - {#if shape.description} + {#if shape.description && !customNameDescription}