Skip to content

Commit

Permalink
Merge branch 'main' into feat/auto-create-suggested-controls-in-audit
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-smith authored Sep 28, 2024
2 parents 3e9329f + 7cffc87 commit cc89100
Show file tree
Hide file tree
Showing 13 changed files with 10,139 additions and 157 deletions.
9,769 changes: 9,769 additions & 0 deletions backend/library/libraries/adobe-ccf-v5.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -747,5 +747,7 @@
"createAppliedControlsFromSuggestionsError": "An error occured while creating applied controls from the suggested reference controls",
"createAppliedControlsFromSuggestionsConfirmMessage": "{count} applied controls will be created from the suggested reference controls. Do you want to proceed?",
"theFollowingControlsWillBeAddedColon": "The following controls will be added:",
"ShowAllNodesMessage": "Show all nodes",
"ShowOnlyAssessable": "Only assessable nodes",
"NoPreviewMessage": "No preview available."
}
2 changes: 2 additions & 0 deletions frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -680,4 +680,6 @@
"createAppliedControlsFromSuggestionsError": "Une erreur s'est produite lors de la création des mesures appliquées depuis les suggestions",
"createAppliedControlsFromSuggestionsConfirmMessage": "{count} mesures appliquées seront créées à partir des suggestions. Voulez-vous continuer ?",
"theFollowingControlsWillBeAddedColon": "Les mesures suivantes seront appliquées :"
"ShowAllNodesMessage": "Tous les noeuds",
"ShowOnlyAssessable": "uniquement les nœuds évaluables",
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
{#if nodes && nodes.length > 0}
{#each nodes as node, i}
<TreeViewItem
class={node.contentProps.hidden === true ? 'hidden' : null}
bind:this={treeItems[i]}
bind:children={children[i]}
bind:group
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/routes/(app)/(internal)/libraries/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<ModelTable
source={data.storedLibrariesTable}
URLModel="libraries"
identifierField="urn"
pagination={false}
deleteForm={data.deleteForm}
/>
Expand All @@ -45,7 +44,6 @@
<ModelTable
source={data.loadedLibrariesTable}
URLModel="libraries"
identifierField="urn"
pagination={false}
deleteForm={data.deleteForm}
detailQueryParameter="loaded"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
const threats = data.requirement.threats;
const reference_controls = data.requirement.reference_controls;
const annotation = data.requirement.annotation;
const typical_evidence = data.requirement.typical_evidence;
const has_threats = threats && threats.length > 0;
const has_reference_controls = reference_controls && reference_controls.length > 0;
Expand Down Expand Up @@ -173,6 +174,17 @@
</p>
</div>
{/if}
{#if typical_evidence}
<div class="my-2">
<p class="font-medium">
<i class="fa-solid fa-pencil" />
{m.typicalEvidence()}
</p>
<p class="whitespace-pre-line py-1">
{typical_evidence}
</p>
</div>
{/if}
{#if mappingInference.result}
<div class="my-2">
<p class="font-medium">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
const threats = data.requirement.threats;
const reference_controls = data.requirement.reference_controls;
const annotation = data.requirement.annotation;
const typical_evidence = data.requirement.typical_evidence;
const has_threats = threats && threats.length > 0;
const has_reference_controls = reference_controls && reference_controls.length > 0;
Expand Down Expand Up @@ -310,6 +311,17 @@
</p>
</div>
{/if}
{#if typical_evidence}
<div class="my-2">
<p class="font-medium">
<i class="fa-solid fa-pencil" />
{m.typicalEvidence()}
</p>
<p class="whitespace-pre-line py-1">
{typical_evidence}
</p>
</div>
{/if}
{#if mappingInference.result}
<div class="my-2">
<p class="font-medium">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { page } from '$app/stores';
import RecursiveTreeView from '$lib/components/TreeView/RecursiveTreeView.svelte';
import { breadcrumbObject } from '$lib/utils/stores';
import { displayOnlyAssessableNodes } from './store';
import type {
ModalComponent,
ModalSettings,
Expand All @@ -10,7 +12,8 @@
ToastStore,
TreeViewNode
} from '@skeletonlabs/skeleton';
import { getModalStore, getToastStore, popup } from '@skeletonlabs/skeleton';
import { getModalStore, getToastStore, popup, SlideToggle } from '@skeletonlabs/skeleton';
import type { ActionData, PageData } from './$types';
import TreeViewItemContent from './TreeViewItemContent.svelte';
import TreeViewItemLead from './TreeViewItemLead.svelte';
Expand Down Expand Up @@ -72,10 +75,17 @@
function transformToTreeView(nodes: Node[]) {
return nodes.map(([id, node]) => {
node.resultCounts = countResults(node);
const hasAssessableChildren = Object.keys(node.children || {}).length > 0;
const hidden = !(!$displayOnlyAssessableNodes || node.assessable || hasAssessableChildren);
return {
id: id,
content: TreeViewItemContent,
contentProps: { ...node, canEditRequirementAssessment },
contentProps: {
...node,
canEditRequirementAssessment,
hidden
},
lead: TreeViewItemLead,
leadProps: {
statusI18n: node.status_i18n,
Expand All @@ -91,7 +101,7 @@
};
});
}
let treeViewNodes: TreeViewNode[] = transformToTreeView(Object.entries(tree));
const treeViewNodes: TreeViewNode[] = transformToTreeView(Object.entries(tree));
function assessableNodesCount(nodes: TreeViewNode[]): number {
let count = 0;
Expand Down Expand Up @@ -378,11 +388,39 @@
{assessableNodesCount(treeViewNodes)}
</span>
</h4>

<div class="flex items-center justify-center space-x-4">
{#if $displayOnlyAssessableNodes}
<p class="font-bold text-sm">{m.ShowAllNodesMessage()}</p>
{:else}
<p class="font-bold text-sm text-green-500">{m.ShowAllNodesMessage()}</p>
{/if}
<SlideToggle
name="questionnaireToggle"
class="flex flex-row items-center justify-center"
active="bg-primary-500"
background="bg-green-500"
bind:checked={$displayOnlyAssessableNodes}
on:click={() => ($displayOnlyAssessableNodes = !$displayOnlyAssessableNodes)}
>
{#if $displayOnlyAssessableNodes}
<p class="font-bold text-sm text-primary-500">{m.ShowOnlyAssessable()}</p>
{:else}
<p class="font-bold text-sm">{m.ShowOnlyAssessable()}</p>
{/if}
</SlideToggle>
</div>
<div class="flex items-center my-2 text-xs space-x-2 text-gray-500">
<i class="fa-solid fa-diagram-project" />
<p>{m.mappingInferenceTip()}</p>
</div>
<RecursiveTreeView nodes={treeViewNodes} bind:expandedNodes hover="hover:bg-initial" />
{#key $displayOnlyAssessableNodes}
<RecursiveTreeView
nodes={transformToTreeView(Object.entries(tree))}
bind:expandedNodes
hover="hover:bg-initial"
/>
{/key}
</div>
{/if}
</div>
Loading

0 comments on commit cc89100

Please sign in to comment.