-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c96b6b
commit 2dd31a2
Showing
16 changed files
with
208 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...end/ebios_rm/migrations/0007_remove_attackpath_ro_to_couple_strategicscenario_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Generated by Django 5.1.4 on 2024-12-17 18:10 | ||
|
||
import django.db.models.deletion | ||
import iam.models | ||
import uuid | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ebios_rm', '0006_alter_attackpath_stakeholders'), | ||
('iam', '0010_user_preferences'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='attackpath', | ||
name='ro_to_couple', | ||
), | ||
migrations.CreateModel( | ||
name='StrategicScenario', | ||
fields=[ | ||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), | ||
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), | ||
('is_published', models.BooleanField(default=False, verbose_name='published')), | ||
('name', models.CharField(max_length=200, verbose_name='Name')), | ||
('description', models.TextField(blank=True, null=True, verbose_name='Description')), | ||
('ref_id', models.CharField(blank=True, max_length=100)), | ||
('ebios_rm_study', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='strategic_scenarios', to='ebios_rm.ebiosrmstudy', verbose_name='EBIOS RM study')), | ||
('folder', models.ForeignKey(default=iam.models.Folder.get_root_folder_id, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_folder', to='iam.folder')), | ||
('ro_to_couple', models.ForeignKey(help_text='RO/TO couple from which the attach path is derived', on_delete=django.db.models.deletion.CASCADE, to='ebios_rm.roto', verbose_name='RO/TO couple')), | ||
], | ||
options={ | ||
'verbose_name': 'Strategic Scenario', | ||
'verbose_name_plural': 'Strategic Scenarios', | ||
'ordering': ['created_at'], | ||
}, | ||
), | ||
migrations.AddField( | ||
model_name='attackpath', | ||
name='strategic_scenario', | ||
field=models.ForeignKey(default='', help_text='Strategic scenario from which the attack path is derived', on_delete=django.db.models.deletion.CASCADE, related_name='attack_paths', to='ebios_rm.strategicscenario', verbose_name='Strategic scenario'), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
frontend/src/lib/components/Forms/ModelForm/StrategicScenarioForm.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script lang="ts"> | ||
import AutocompleteSelect from '$lib/components/Forms/AutocompleteSelect.svelte'; | ||
import { getOptions } from '$lib/utils/crud'; | ||
import type { CacheLock, ModelInfo } from '$lib/utils/types'; | ||
import * as m from '$paraglide/messages.js'; | ||
import type { SuperValidated } from 'sveltekit-superforms'; | ||
import TextField from '../TextArea.svelte'; | ||
export let form: SuperValidated<any>; | ||
export let model: ModelInfo; | ||
export let cacheLocks: Record<string, CacheLock> = {}; | ||
export let formDataCache: Record<string, any> = {}; | ||
export let initialData: Record<string, any> = {}; | ||
export let context: string; | ||
</script> | ||
|
||
{#if context !== 'edit'} | ||
<AutocompleteSelect | ||
{form} | ||
options={getOptions({ objects: model.foreignKeys['ro_to_couple'], label: 'str' })} | ||
field="ro_to_couple" | ||
cacheLock={cacheLocks['ro_to_couple']} | ||
bind:cachedValue={formDataCache['ro_to_couple']} | ||
label={m.roToCouple()} | ||
hidden={initialData.ro_to_couple} | ||
/> | ||
{/if} | ||
<TextField | ||
{form} | ||
field="ref_id" | ||
label={m.refId()} | ||
cacheLock={cacheLocks['ref_id']} | ||
bind:cachedValue={formDataCache['ref_id']} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.