From 998b4a3ad7ed789e484e30cde0c148d334418d92 Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene Date: Tue, 9 Apr 2024 22:36:05 +0200 Subject: [PATCH 1/2] fix: requirement assessed at top level --- backend/core/helpers.py | 5 +++++ frontend/src/lib/utils/helpers.ts | 9 +++++++++ .../frameworks/[id=uuid]/TreeViewItemContent.svelte | 7 ++----- .../requirement-assessments/[id=uuid]/+page.svelte | 11 +++++------ 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/backend/core/helpers.py b/backend/core/helpers.py index 46d1aa852..2a12568c2 100644 --- a/backend/core/helpers.py +++ b/backend/core/helpers.py @@ -230,11 +230,16 @@ 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)] if requirements_assessed else None result[str(node.id)] = { "urn": node.urn, "parent_urn": node.parent_urn, "ref_id": node.ref_id, "name": node.name, + "ra_id": str(req_as.id) if requirements_assessed else None, + "status": req_as.status if requirements_assessed else None, + "status_display": req_as.get_status_display() if requirements_assessed else None, + "status_i18n": camel_case(req_as.status) if requirements_assessed else None, "node_content": node.display_long, "style": "node", "assessable": node.assessable, diff --git a/frontend/src/lib/utils/helpers.ts b/frontend/src/lib/utils/helpers.ts index 579b66381..50f259b3e 100644 --- a/frontend/src/lib/utils/helpers.ts +++ b/frontend/src/lib/utils/helpers.ts @@ -15,3 +15,12 @@ export const isURL = (url: string) => { return false; } }; + +export function getRequirementTitle(ref_id: string, name: string) { + const pattern = (ref_id ? 2 : 0) + (name ? 1 : 0) + const title: string = + pattern == 3 ? `${ref_id} - ${name}` : + pattern == 2 ? ref_id : + pattern == 1 ? name : ''; + return title; +} \ No newline at end of file diff --git a/frontend/src/routes/(app)/frameworks/[id=uuid]/TreeViewItemContent.svelte b/frontend/src/routes/(app)/frameworks/[id=uuid]/TreeViewItemContent.svelte index 32542caaf..918370936 100644 --- a/frontend/src/routes/(app)/frameworks/[id=uuid]/TreeViewItemContent.svelte +++ b/frontend/src/routes/(app)/frameworks/[id=uuid]/TreeViewItemContent.svelte @@ -1,4 +1,5 @@
-

- {title} -

{data.requirement.urn} {#if data.requirement.description}

{data.requirement.description}

From 931b9367b0466a12725cfc8d64c47cb49b1c6d09 Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene Date: Tue, 9 Apr 2024 22:45:41 +0200 Subject: [PATCH 2/2] style: improve tree items display --- frontend/src/lib/components/TreeView/TreeViewItem.svelte | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/components/TreeView/TreeViewItem.svelte b/frontend/src/lib/components/TreeView/TreeViewItem.svelte index cca8ff441..c1e822fd6 100644 --- a/frontend/src/lib/components/TreeView/TreeViewItem.svelte +++ b/frontend/src/lib/components/TreeView/TreeViewItem.svelte @@ -389,17 +389,16 @@ {/if} {/if} - + +
+ +
{#if $$slots.lead && !hideLead}
{/if} - -
- -