Skip to content

Commit

Permalink
Merge pull request #816 from intuitem/fix/risk_scenario_tag_translation
Browse files Browse the repository at this point in the history
Fix risk scenario tag translation
  • Loading branch information
Mohamed-Hacene authored Sep 12, 2024
2 parents 4cd2173 + fb6a4b0 commit a816212
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions backend/app_tests/api/test_api_risk_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
"description": "acceptable risk",
"hexcolor": "#00FF00",
}
RISK_SCENARIO_TREATMENT_STATUS = ("accept", "Accept")
RISK_SCENARIO_TREATMENT_STATUS2 = ("mitigate", "Mitigate")
RISK_SCENARIO_TREATMENT_STATUS = ("accept", "accept")
RISK_SCENARIO_TREATMENT_STATUS2 = ("mitigate", "mitigate")
RISK_SCENARIO_JUSTIFICATION = "Test justification"


Expand Down
2 changes: 1 addition & 1 deletion backend/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class RiskScenarioReadSerializer(RiskScenarioWriteSerializer):
threats = FieldsRelatedField(many=True)
assets = FieldsRelatedField(many=True)

treatment = serializers.CharField(source="get_treatment_display")
treatment = serializers.CharField()

current_proba = serializers.JSONField(source="get_current_proba")
current_impact = serializers.JSONField(source="get_current_impact")
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/lib/utils/crud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,11 @@ export const FIELD_COLORED_TAG_MAP: FieldColoredTagMap = {
name: {
key: 'treatment',
values: {
Open: { text: 'open', cssClasses: 'badge bg-green-300' },
Mitigate: { text: 'mitigate', cssClasses: 'badge bg-lime-200' },
Accept: { text: 'accept', cssClasses: 'badge bg-green-200' },
Avoid: { text: 'avoid', cssClasses: 'badge bg-red-200' },
Transfer: { text: 'transfer', cssClasses: 'badge bg-yellow-300' }
open: { text: 'open', cssClasses: 'badge bg-green-300' },
mitigate: { text: 'mitigate', cssClasses: 'badge bg-lime-200' },
accept: { text: 'accept', cssClasses: 'badge bg-green-200' },
avoid: { text: 'avoid', cssClasses: 'badge bg-red-200' },
transfer: { text: 'transfer', cssClasses: 'badge bg-yellow-300' }
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
avoid: 'bg-red-200',
transfer: 'bg-violet-200'
};
return map[status.toLowerCase()] ?? 'bg-gray-200';
return map[status] ?? 'bg-gray-200';
};
const measureStatusColorMap = (treatment: string) => {
Expand Down Expand Up @@ -68,7 +68,7 @@
href="/risk-scenarios/{scenario.id}">{scenario.name}</a
>
<span class="badge {scenarioTreatmentColorMap(scenario.treatment)}"
>{scenario.treatment}</span
>{safeTranslate(scenario.treatment)}</span
>
</td>
</tr>
Expand Down

0 comments on commit a816212

Please sign in to comment.