diff --git a/backend/ebios_rm/models.py b/backend/ebios_rm/models.py index c5720da37..a16407ebb 100644 --- a/backend/ebios_rm/models.py +++ b/backend/ebios_rm/models.py @@ -188,6 +188,10 @@ def selected_attack_path_count(self): def operational_scenario_count(self): return self.operational_scenarios.count() + @property + def applied_control_count(self): + return AppliedControl.objects.filter(stakeholders__ebios_rm_study=self).count() + def update_workshop_step_status(self, workshop: int, step: int, new_status: str): if workshop < 1 or workshop > 5: raise ValueError("Workshop must be between 1 and 5") diff --git a/backend/ebios_rm/serializers.py b/backend/ebios_rm/serializers.py index c6290b51e..dabc081b3 100644 --- a/backend/ebios_rm/serializers.py +++ b/backend/ebios_rm/serializers.py @@ -42,6 +42,7 @@ class EbiosRMStudyReadSerializer(BaseModelSerializer): selected_roto_count = serializers.IntegerField() selected_attack_path_count = serializers.IntegerField() operational_scenario_count = serializers.IntegerField() + applied_control_count = serializers.IntegerField() class Meta: model = EbiosRMStudy diff --git a/frontend/messages/en.json b/frontend/messages/en.json index a20f52f19..63c1ad667 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -958,6 +958,8 @@ "highlyRelevant": "Highly relevant", "roTo": "RO/TO", "roToCouple": "RO/TO couple", + "roToCouples": "RO/TO couples", + "selectedRoToCouples": "Selected RO/TO couples", "addRoto": "Add RO/TO couple", "organizedCrime": "Organized crime", "terrorist": "Terrorist", @@ -980,6 +982,7 @@ "addAttackPath": "Add attack path", "attackPath": "Attack path", "attackPaths": "Attack paths", + "selectedAttackPaths": "Selected attack paths", "currentCriticality": "Current criticality", "residualCriticality": "Residual criticality", "notSelected": "Not selected", diff --git a/frontend/messages/fr.json b/frontend/messages/fr.json index d7d20ba34..9d7cec4a5 100644 --- a/frontend/messages/fr.json +++ b/frontend/messages/fr.json @@ -958,6 +958,8 @@ "highlyRelevant": "Très pertinent", "roTo": "SR/OV", "roToCouple": "Couple SR/OV", + "roToCouples": "Couples SR/OV", + "selectedRoToCouples": "Couples SR/OV sélectionnés", "addRoto": "Ajouter un couple SR/OV", "organizedCrime": "Crime organisé", "terrorist": "Terroriste", @@ -980,6 +982,7 @@ "addAttackPath": "Ajouter un chemin d'attaque", "attackPath": "Chemin d'attaque", "attackPaths": "Chemins d'attaque", + "selectedAttackPaths": "Chemins d'attaque sélectionnés", "currentCriticality": "Criticité actuelle", "residualCriticality": "Criticité résiduelle", "notSelected": "Non retenu", diff --git a/frontend/src/lib/components/DataViz/Card.svelte b/frontend/src/lib/components/DataViz/Card.svelte index 70898b93d..58184f473 100644 --- a/frontend/src/lib/components/DataViz/Card.svelte +++ b/frontend/src/lib/components/DataViz/Card.svelte @@ -5,8 +5,8 @@ export let label: string; export let href: string = '#'; // export let help: string; - export let icon: string; - export let section: string; + export let icon: string = ''; + export let section: string = ''; export let emphasis: boolean = false; let cEmphasis = ''; if (emphasis) { @@ -15,20 +15,41 @@ export let customClass: string = ''; - -
- - {section} +{#if href && href !== '#'} + +
+ {#if icon} + + {/if} + {#if section} + {section} + {/if} +
+
+

{count}

+
{label}
+
+
+{:else} +
+
+ {#if icon} + + {/if} + {#if section} + {section} + {/if} +
+
+

{count}

+
{label}
+
-
-

{count}

-
{label}
-
- +{/if}