From 70e7da7925715bb420d6aae29a15765526eda774 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Mon, 21 Jul 2025 19:01:56 +0200 Subject: [PATCH 1/4] fix: autocomplete options consistency --- .../risk-scenarios/[id=uuid]/edit/+page.svelte | 15 --------------- .../[id=uuid]/edit/+page.svelte | 6 ------ 2 files changed, 21 deletions(-) diff --git a/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte b/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte index 67d3b21e36..276a130ea3 100644 --- a/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte @@ -193,18 +193,12 @@ classes: 'text-blue-500' }} field="assets" - optionsDetailedUrlParameters={[ - ['scope_folder_id', page.data.scenario.perimeter.folder.id] - ]} label={m.assets()} /> @@ -508,9 +505,6 @@ {form} optionsEndpoint="evidences" optionsExtraFields={[['folder', 'str']]} - optionsDetailedUrlParameters={[ - ['scope_folder_id', page.data.requirementAssessment.folder.id] - ]} field="evidences" /> {/key} From 8d3ccaecada62da2faac3b5fa25ec1f8682df146 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Tue, 22 Jul 2025 10:32:32 +0200 Subject: [PATCH 2/4] Revert "fix: autocomplete options consistency" This reverts commit 70e7da7925715bb420d6aae29a15765526eda774. --- .../risk-scenarios/[id=uuid]/edit/+page.svelte | 15 +++++++++++++++ .../[id=uuid]/edit/+page.svelte | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte b/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte index 276a130ea3..67d3b21e36 100644 --- a/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte @@ -193,12 +193,18 @@ classes: 'text-blue-500' }} field="assets" + optionsDetailedUrlParameters={[ + ['scope_folder_id', page.data.scenario.perimeter.folder.id] + ]} label={m.assets()} /> @@ -505,6 +508,9 @@ {form} optionsEndpoint="evidences" optionsExtraFields={[['folder', 'str']]} + optionsDetailedUrlParameters={[ + ['scope_folder_id', page.data.requirementAssessment.folder.id] + ]} field="evidences" /> {/key} From b1a2a75f7397f9d164c5f10fb91a4186ec3d4cb0 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Tue, 22 Jul 2025 10:47:47 +0200 Subject: [PATCH 3/4] pass scope folder through ebios rm edit and risk assessment detail --- .../src/lib/components/Forms/ModelForm.svelte | 202 ++++++++++++++---- .../Forms/ModelForm/EbiosRmForm.svelte | 10 +- .../Forms/ModelForm/RiskScenarioForm.svelte | 12 +- .../ebios-rm-study/edit/+page.svelte | 2 + .../risk-assessments/[id=uuid]/+page.svelte | 1 + 5 files changed, 187 insertions(+), 40 deletions(-) diff --git a/frontend/src/lib/components/Forms/ModelForm.svelte b/frontend/src/lib/components/Forms/ModelForm.svelte index 2f4ed0e694..9f6079ecdb 100644 --- a/frontend/src/lib/components/Forms/ModelForm.svelte +++ b/frontend/src/lib/components/Forms/ModelForm.svelte @@ -294,6 +294,7 @@ {formDataCache} {initialData} {object} + {...rest} /> {:else if URLModel === 'risk-assessments'} {:else if URLModel === 'threats'} - + {:else if URLModel === 'risk-scenarios'} - + {:else if URLModel === 'applied-controls' || URLModel === 'policies'} {:else if URLModel === 'vulnerabilities'} - + {:else if URLModel === 'risk-acceptances'} {:else if URLModel === 'reference-controls'} - + {:else if URLModel === 'evidences'} - + {:else if URLModel === 'compliance-assessments'} {:else if URLModel === 'campaigns'} - + {:else if URLModel === 'assets'} - + {:else if URLModel === 'requirement-assessments'} - + {:else if URLModel === 'entities'} - + {:else if URLModel === 'entity-assessments'} - + {:else if URLModel === 'solutions'} - + {:else if URLModel === 'representatives'} - + {:else if URLModel === 'frameworks'} - + {:else if URLModel === 'users'} - + {:else if URLModel === 'sso-settings'} - + {:else if URLModel === 'general-settings'} - + {:else if URLModel === 'feature-flags'} - + {:else if URLModel === 'filtering-labels'} - + {:else if URLModel === 'business-impact-analysis'} {:else if URLModel === 'asset-assessments'} - + {:else if URLModel === 'escalation-thresholds'} {:else if URLModel === 'processings'} - + {:else if URLModel === 'purposes'} - + {:else if URLModel === 'personal-data'} - + {:else if URLModel === 'data-subjects'} - + {:else if URLModel === 'data-recipients'} - + {:else if URLModel === 'data-contractors'} - + {:else if URLModel === 'data-transfers'} - + {:else if URLModel === 'ebios-rm'} - + {:else if URLModel === 'feared-events'} - + {:else if URLModel === 'ro-to'} - + {:else if URLModel === 'stakeholders'} - + {:else if URLModel === 'strategic-scenarios'} - + {:else if URLModel === 'attack-paths'} {:else if URLModel === 'operational-scenarios'} {:else if URLModel === 'security-exceptions'} - + {:else if URLModel === 'findings'} - + {:else if URLModel === 'findings-assessments'} - + {:else if URLModel === 'incidents'} - + {:else if URLModel === 'timeline-entries'} {:else if URLModel === 'task-templates'} - + {:else if URLModel === 'task-nodes'} - + {:else if URLModel === 'elementary-actions'} - + {:else if URLModel === 'operating-modes'} {:else if URLModel === 'kill-chains'} {/if}
diff --git a/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte b/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte index 992442c91b..93793e08a2 100644 --- a/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte +++ b/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte @@ -15,6 +15,7 @@ formDataCache?: Record; initialData?: Record; context: string; + [key: string]: any; } let { @@ -23,7 +24,8 @@ cacheLocks = {}, formDataCache = $bindable({}), initialData = {}, - context + context, + ...rest }: Props = $props(); let activeActivity: string | null = $state(null); @@ -163,6 +165,9 @@ optionsEndpoint="assets" optionsLabelField="auto" optionsExtraFields={[['folder', 'str']]} + optionsDetailedUrlParameters={[ + rest?.scopeFolder?.id ? ['scope_folder_id', rest.scopeFolder.id] : ['', undefined] + ]} optionsInfoFields={{ fields: [ { @@ -201,6 +206,9 @@ {form} optionsEndpoint="assets" optionsExtraFields={[['folder', 'str']]} + optionsDetailedUrlParameters={[ + rest?.scopeFolder?.id ? ['scope_folder_id', rest.scopeFolder.id] : ['', undefined] + ]} optionsInfoFields={{ fields: [ { diff --git a/frontend/src/lib/components/Forms/ModelForm/RiskScenarioForm.svelte b/frontend/src/lib/components/Forms/ModelForm/RiskScenarioForm.svelte index 400b63a4e4..c75083b106 100644 --- a/frontend/src/lib/components/Forms/ModelForm/RiskScenarioForm.svelte +++ b/frontend/src/lib/components/Forms/ModelForm/RiskScenarioForm.svelte @@ -12,6 +12,7 @@ formDataCache?: Record; initialData?: Record; updated_fields?: Set; + [key: string]: any; } let { @@ -20,7 +21,8 @@ cacheLocks = {}, formDataCache = $bindable({}), initialData = {}, - updated_fields = new Set() + updated_fields = new Set(), + ...rest }: Props = $props(); async function fetchDefaultRefId(riskAssessmentId: string) { @@ -41,6 +43,8 @@ console.error('Error fetching default ref_id:', error); } } + + const scopeFolder = $derived(rest?.scopeFolder || { id: '' });
@@ -16,5 +17,6 @@ selectOptions={data.selectOptions} model={data.model} context="ebiosRmStudy" + scopeFolder={data.data.folder} />
diff --git a/frontend/src/routes/(app)/(internal)/risk-assessments/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/(internal)/risk-assessments/[id=uuid]/+page.svelte index a7aca67d65..3e1de7ffbc 100644 --- a/frontend/src/routes/(app)/(internal)/risk-assessments/[id=uuid]/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/risk-assessments/[id=uuid]/+page.svelte @@ -44,6 +44,7 @@ props: { form: data.scenarioCreateForm, model: data.scenarioModel, + scopeFolder: data.risk_assessment.folder, debug: false } }; From bbaefb99073c87a9407cf41f38929d3afcfda975 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Tue, 22 Jul 2025 10:57:37 +0200 Subject: [PATCH 4/4] chore: remove debug logs --- .../[id=uuid]/workshop-1/ebios-rm-study/edit/+page.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-1/ebios-rm-study/edit/+page.svelte b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-1/ebios-rm-study/edit/+page.svelte index f72b0a73a9..c76b53e56f 100644 --- a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-1/ebios-rm-study/edit/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/workshop-1/ebios-rm-study/edit/+page.svelte @@ -6,7 +6,6 @@ } let { data }: Props = $props(); - console.log('data', data);