diff --git a/backend/core/views.py b/backend/core/views.py
index ba3aadc7f..a2cbf9ddf 100644
--- a/backend/core/views.py
+++ b/backend/core/views.py
@@ -356,7 +356,7 @@ class AssetViewSet(BaseModelViewSet):
"""
model = Asset
- filterset_fields = ["folder", "parent_assets", "type", "risk_scenarios"]
+ filterset_fields = ["folder", "parent_assets", "type", "risk_scenarios", "ebios_rm_studies"]
search_fields = ["name", "description", "business_value"]
@action(detail=False, name="Get type choices")
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 27c0b9b69..0d2c5a4b7 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -920,5 +920,7 @@
"ebiosWs5_4": "Assess and document residual risks",
"ebiosWs5_5": "Establish risk monitoring framework",
"activity": "Activity",
- "ebiosRmMatrixHelpText": "Risk matrix used as a reference for the study. Defaults to `urn:intuitem:risk:library:risk-matrix-4x4-ebios-rm`"
+ "ebiosRmMatrixHelpText": "Risk matrix used as a reference for the study. Defaults to `urn:intuitem:risk:library:risk-matrix-4x4-ebios-rm`",
+ "activityOne": "Activity 1",
+ "activityTwo": "Activity 2"
}
diff --git a/frontend/src/lib/components/Forms/ModelForm.svelte b/frontend/src/lib/components/Forms/ModelForm.svelte
index 4634dedaf..b0eba843d 100644
--- a/frontend/src/lib/components/Forms/ModelForm.svelte
+++ b/frontend/src/lib/components/Forms/ModelForm.svelte
@@ -256,7 +256,7 @@
{:else if URLModel === 'filtering-labels'}
{:else if URLModel === 'ebios-rm'}
-
+
{/if}
{#if closeModal}
diff --git a/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte b/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte
index dfc7279c3..ee0efe3d4 100644
--- a/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte
+++ b/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte
@@ -13,44 +13,99 @@
export let cacheLocks: Record
= {};
export let formDataCache: Record = {};
export let initialData: Record = {};
+ export let context: string;
-
-
-
-
-
\ No newline at end of file
+{#if context !== 'ebiosRmStudy'}
+
+
+
+
+{:else if context === 'ebiosRmStudy'}
+
+
{m.activityOne()}
+
+
+
+
+
+
+
+{/if}
\ No newline at end of file
diff --git a/frontend/src/lib/utils/crud.ts b/frontend/src/lib/utils/crud.ts
index 0614ef137..a357918ca 100644
--- a/frontend/src/lib/utils/crud.ts
+++ b/frontend/src/lib/utils/crud.ts
@@ -577,14 +577,19 @@ export const URL_MODEL_MAP: ModelMap = {
},
'ebios-rm': {
name: 'ebiosrmstudy',
- localName: 'ebiosRMStudy',
- localNamePlural: 'ebiosRMStudies',
- verboseName: 'Ebios RM Study',
- verboseNamePlural: 'Ebios RM Studies',
+ localName: 'ebiosRMstudy',
+ localNamePlural: 'ebiosRMstudy',
+ verboseName: 'Ebios RMstudy',
+ verboseNamePlural: 'Ebios RMstudy',
foreignKeyFields: [
- { field: 'risk_matrix', urlModel: 'risk-matrices' }
+ { field: 'risk_matrix', urlModel: 'risk-matrices' },
+ { field: 'risk_matrix', urlModel: 'risk-matrices' },
+ { field: 'assets', urlModel: 'assets' },
+ { field: 'authors', urlModel: 'users', urlParams: 'is_third_party=false' },
+ { field: 'reviewers', urlModel: 'users', urlParams: 'is_third_party=false' },
+ { field: 'folder', urlModel: 'folders', urlParams: 'content_type=DO' }
]
- }
+ },
};
export const CUSTOM_ACTIONS_COMPONENT = Symbol('CustomActions');
diff --git a/frontend/src/lib/utils/schemas.ts b/frontend/src/lib/utils/schemas.ts
index a316b8acf..9ba921ca8 100644
--- a/frontend/src/lib/utils/schemas.ts
+++ b/frontend/src/lib/utils/schemas.ts
@@ -1,5 +1,4 @@
// schema for the validation of forms
-import { risk } from '$paraglide/messages';
import { z, type AnyZodObject } from 'zod';
const toArrayPreprocessor = (value: unknown) => {
@@ -371,10 +370,15 @@ export const vulnerabilitySchema = baseNamedObject({
filtering_labels: z.string().optional().array().optional()
});
-export const ebiosRMStudySchema = baseNamedObject({
+export const ebiosRMSchema = baseNamedObject({
version: z.string().optional().default('0.1'),
ref_id: z.string().default(''),
risk_matrix: z.string().optional(),
+ authors: z.array(z.string().optional()).optional(),
+ reviewers: z.array(z.string().optional()).optional(),
+ observation: z.string().optional().nullable(),
+ assets: z.string().uuid().optional().array().optional(),
+ folder: z.string()
});
const SCHEMA_MAP: Record = {
@@ -402,7 +406,7 @@ const SCHEMA_MAP: Record = {
solutions: solutionSchema,
vulnerabilities: vulnerabilitySchema,
'filtering-labels': FilteringLabelSchema,
- 'ebios-rm': ebiosRMStudySchema
+ 'ebios-rm': ebiosRMSchema,
};
export const modelSchema = (model: string) => {
diff --git a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.svelte
index 0a2a227a7..5fc3cff1a 100644
--- a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.svelte
+++ b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.svelte
@@ -13,7 +13,7 @@
const dummydata = {
ws1: [
{ title: safeTranslate(m.ebiosWs1_1()), status: 'done', href: `${$page.url.pathname}/workshop-one/ebios-rm-study?next=${$page.url.pathname}` },
- { title: safeTranslate(m.ebiosWs1_2()), status: 'done', href: '#' },
+ { title: safeTranslate(m.ebiosWs1_2()), status: 'done', href: `${$page.url.pathname}/workshop-one/ebios-rm-study?next=${$page.url.pathname}` },
{ title: safeTranslate(m.ebiosWs1_3()), status: 'to_do', href: '#' },
{ title: safeTranslate(m.ebiosWs1_4()), status: 'to_do', href: '#' }
],
diff --git a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/+page.server.ts b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/+page.server.ts
index 2e6137307..6a52baaa7 100644
--- a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/+page.server.ts
+++ b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/+page.server.ts
@@ -1,30 +1,22 @@
import { BASE_API_URL } from '$lib/utils/constants';
import {
- getModelInfo,
- urlParamModelForeignKeyFields,
- urlParamModelSelectFields
+ getModelInfo
} from '$lib/utils/crud';
import { modelSchema } from '$lib/utils/schemas';
-import type { ModelInfo } from '$lib/utils/types';
import { superValidate } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
-import { z } from 'zod';
-import type { PageServerLoad } from './$types';
+import type { PageServerLoad, Actions } from './$types';
+import { defaultWriteFormAction } from '$lib/utils/actions';
-export const load: LayoutServerLoad = async (event) => {
+export const load: PageServerLoad = async (event) => {
const URLModel = 'ebios-rm';
const schema = modelSchema(URLModel);
- // const objectEndpoint = `${BASE_API_URL}/${URLModel}/${event.params.id}/object/`;
- const object = {
- version: '1.0',
- status: '',
- authors: '',
- reviewers: '',
- observation: ''
- };
+ const objectEndpoint = `${BASE_API_URL}/${URLModel}/${event.params.id}/object/`;
+ const objectResponse = await event.fetch(objectEndpoint);
+ const object = await objectResponse.json();
const form = await superValidate(object, zod(schema), { errors: false });
- const model = getModelInfo(URLModel!);
+ const model = getModelInfo(URLModel);
const foreignKeyFields = model.foreignKeyFields;
const selectFields = model.selectFields;
@@ -66,4 +58,10 @@ export const load: LayoutServerLoad = async (event) => {
model.foreignKeys = foreignKeys;
model.selectOptions = selectOptions;
return { form, model, object, foreignKeys, selectOptions, URLModel };
+};
+
+export const actions: Actions = {
+ default: async (event) => {
+ return defaultWriteFormAction({ event, urlModel: 'ebios-rm', action: 'edit' });
+ }
};
\ No newline at end of file
diff --git a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/+page.svelte b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/+page.svelte
index ffe13f1db..955c5068f 100644
--- a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/+page.svelte
+++ b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-one/ebios-rm-study/+page.svelte
@@ -1,7 +1,6 @@
@@ -13,6 +12,6 @@
selectOptions={data.selectOptions}
foreignKeys={data.foreignKeys}
model={data.model}
- context="edit"
+ context="ebiosRmStudy"
/>