diff --git a/backend/core/helpers.py b/backend/core/helpers.py index 46d1aa852..6d39a9801 100644 --- a/backend/core/helpers.py +++ b/backend/core/helpers.py @@ -230,15 +230,19 @@ def get_sorted_requirement_nodes_rec( for requirement_node in requirement_nodes if requirement_node.parent_urn == node.urn ] + req_as = requirement_assessment_from_requirement_id[str(node.id)] result[str(node.id)] = { "urn": node.urn, "parent_urn": node.parent_urn, "ref_id": node.ref_id, "name": node.name, "node_content": node.display_long, - "style": "node", "assessable": node.assessable, "description": node.description, + "ra_id": str(req_as.id), + "status": req_as.status, + "status_display": req_as.get_status_display(), + "status_i18n": camel_case(req_as.status), "children": get_sorted_requirement_nodes_rec( requirement_nodes, requirements_assessed, children ), @@ -263,7 +267,6 @@ def get_sorted_requirement_nodes_rec( "status": req_as.status, "status_display": req_as.get_status_display(), "status_i18n": camel_case(req_as.status), - "style": "leaf", "threats": ThreatReadSerializer( req.threats.all(), many=True ).data, diff --git a/frontend/src/routes/(app)/requirement-assessments/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/requirement-assessments/[id=uuid]/+page.svelte index 756a9e9c7..71fbfba73 100644 --- a/frontend/src/routes/(app)/requirement-assessments/[id=uuid]/+page.svelte +++ b/frontend/src/routes/(app)/requirement-assessments/[id=uuid]/+page.svelte @@ -39,9 +39,19 @@ if (nextValue) window.location.href = nextValue; } - const title = - (data.parent.display_short ? data.parent.display_short + ': ' : '') + - data.requirement.display_short; + const child_pattern = (data.requirement.ref_id ? 2 : 0) + (data.requirement.name ? 1 : 0) + const child_title: string = + child_pattern == 3 ? `${data.requirement.ref_id} - ${data.requirement.name}` : + child_pattern == 2 ? data.requirement.ref_id : + child_pattern == 1 ? data.requirement.name : ''; + + const parent_pattern = (data.parent.ref_id ? 2 : 0) + (data.parent.name ? 1 : 0) + const parent_title: string = + parent_pattern == 3 ? `${data.parent.ref_id} - ${data.parent.name}` : + parent_pattern == 2 ? data.parent.ref_id : + parent_pattern == 1 ? data.parent.name : ''; + + const title = parent_pattern + child_title; breadcrumbObject.set({ id: data.requirementAssessment.id, name: title ?? 'Requirement assessment',