Skip to content

Commit d5ee7a8

Browse files
fix: add background color to TLP badges and include TLP in job API. Closes #3150
- Added backgroundColor property to TLP badge component styling - Implemented accessible text color logic (black for CLEAR/GREEN/AMBER, white for RED) - Added tlp field to JobSerializer to return TLP value in job details API response - Fixed issue where TLP badges showed only borders without background colors on job report page
1 parent ce562a1 commit d5ee7a8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

api_app/serializers/job.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ class Meta:
507507
"tags",
508508
"comments",
509509
"status",
510+
"tlp",
510511
"pivots_to_execute",
511512
"analyzers_to_execute",
512513
"analyzers_requested",

frontend/src/components/common/TLPTag.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ export function TLPTag(props) {
1010
const badgeId = `tlptag-badge__${value}`;
1111
const color = TLPColors?.[value] || "#dfe1e2";
1212
const tooltipText = TLPDescriptions?.[value] || "invalid";
13+
const textColorMap = {
14+
CLEAR: "#000000",
15+
GREEN: "#000000",
16+
AMBER: "#000000",
17+
};
18+
const textColor = textColorMap[value] || "#FFFFFF";
1319

1420
return value ? (
1521
<Badge
@@ -18,7 +24,9 @@ export function TLPTag(props) {
1824
style={{
1925
borderRadius: 5,
2026
userSelect: "none",
27+
backgroundColor: color,
2128
border: `1px solid ${color}`,
29+
color: textColor,
2230
}}
2331
{...rest}
2432
>

0 commit comments

Comments
 (0)