From bf7d1c076faa1f6a9a64474da9f67bf41bafab6a Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Tue, 13 Feb 2024 12:22:52 +0100 Subject: [PATCH 1/5] Hide "learn more" if no threat or security function is attached to requirement --- .../compliance-assessments/[id=uuid]/TreeViewItemContent.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte index 24bda2ce2..d02394015 100644 --- a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte +++ b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte @@ -84,7 +84,7 @@ {content} {/if} - {#if threats || security_functions} + {#if (threats && threats.length > 0) || (security_functions && security_functions.length > 0)}
Date: Tue, 13 Feb 2024 13:40:24 +0100 Subject: [PATCH 2/5] Fix percentage computations --- .../[id=uuid]/+page.svelte | 13 +--- .../[id=uuid]/TreeViewItemContent.svelte | 73 +++++++++++-------- .../compliance-assessments/[id=uuid]/types.ts | 11 +++ 3 files changed, 56 insertions(+), 41 deletions(-) create mode 100644 frontend/src/routes/(app)/compliance-assessments/[id=uuid]/types.ts diff --git a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/+page.svelte index 5a4be3880..a481c98ad 100644 --- a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/+page.svelte +++ b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/+page.svelte @@ -11,6 +11,7 @@ import DonutChart from '$lib/components/Chart/DonutChart.svelte'; import { URL_MODEL_MAP } from '$lib/utils/crud'; + import type { Node } from './types'; export let data: PageData; breadcrumbObject.set(data.compliance_assessment); @@ -27,18 +28,6 @@ `change_${requirementAssessmentModel.name}` ); - interface Node { - urn: string; - parent_urn: string | null; - name: string; - node_content: string; - assessable: boolean; - style: string; - description: string | null; - children?: Record; - status?: string; // Assuming that the status field exists in nodes similar to leaves - } - const countStatus = ( node: Node, statusCounts: Record = {} diff --git a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte index d02394015..3345a64ae 100644 --- a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte +++ b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte @@ -1,17 +1,36 @@
@@ -154,22 +177,14 @@ {#if hasChildren}
{#each orderedStatusPercentages as sp} - {#if complianceColorMap[sp.status] === '#000000'} -
- {sp.percentage.display}% -
- {:else} -
- {sp.percentage.display}% - -
- {/if} +
+ {sp.percentage.display}% +
{/each}
{/if} diff --git a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/types.ts b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/types.ts new file mode 100644 index 000000000..b4d98dc89 --- /dev/null +++ b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/types.ts @@ -0,0 +1,11 @@ +export interface Node { + name: string; + description?: string; + urn: string; + parent_urn?: string; + node_content: string; + assessable: boolean; + style: string; + children?: Record; + status?: string; // Assuming that the status field exists in nodes similar to leaves +} From ff82acf85603f5cc705cdc73b32964f5ad7e74c4 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Tue, 13 Feb 2024 13:40:28 +0100 Subject: [PATCH 3/5] chore: cleanup --- .../compliance-assessments/[id=uuid]/TreeViewItemLead.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemLead.svelte b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemLead.svelte index 4106c9430..f0326df86 100644 --- a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemLead.svelte +++ b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/TreeViewItemLead.svelte @@ -1,5 +1,4 @@ -
-
+
+
- {#if !hasChildren && canEditRequirementAssessment} - + {#if assessable && canEditRequirementAssessment} + {content} @@ -111,9 +109,17 @@
(showInfo = !showInfo)} - on:keydown={(_) => (showInfo = !showInfo)} + class="select-none text-sm hover:text-primary-400 {classesShowInfoText(showInfo)}" + on:click={(e) => { + e.preventDefault(); + showInfo = !showInfo; + }} + on:keydown={(e) => { + if (e.key === 'Enter') { + e.preventDefault(); + showInfo = !showInfo; + } + }} > Learn more
@@ -175,7 +181,7 @@ {/if}
{#if hasChildren} -
+
{#each orderedStatusPercentages as sp}