Skip to content

Commit

Permalink
Fix risk scenario tag translation
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurswag committed Sep 11, 2024
1 parent 65cfd11 commit 0e97a4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
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 0e97a4a

Please sign in to comment.