Skip to content

Commit

Permalink
Simplify audit action plan for usability (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-smith authored Dec 16, 2024
1 parent 1915255 commit 711daf5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 150 deletions.
14 changes: 2 additions & 12 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2072,14 +2072,7 @@ def action_plan(self, request, pk):
object_type=ComplianceAssessment,
)
if UUID(pk) in viewable_objects:
response = {
"none": [],
"to_do": [],
"in_progress": [],
"on_hold": [],
"active": [],
"deprecated": [],
}
response = []
compliance_assessment_object: ComplianceAssessment = self.get_object()
requirement_assessments_objects = (
compliance_assessment_object.get_requirement_assessments(
Expand All @@ -2101,10 +2094,7 @@ def action_plan(self, request, pk):
.filter(applied_controls=applied_control["id"])
.count()
)
if applied_control["status"] == "--":
response["none"].append(applied_control)
else:
response[applied_control["status"].lower()].append(applied_control)
response.append(applied_control)

return Response(response)

Expand Down
2 changes: 1 addition & 1 deletion frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@
"noThreatsMapped": "No threats mapped. Consider attaching threats to your risk scenarios for a better overview.",
"actionPlan": "Action plan",
"noStatus": "No status",
"actionPlanHelpText": "Separated by status and sorted by eta",
"actionPlanHelpText": "The counter represents the number of associated requirements.",
"matchingRequirements": "Matching requirements",
"asZIP": "as ZIP",
"incoming": "Incoming",
Expand Down
3 changes: 2 additions & 1 deletion frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@
"noThreatsMapped": "Aucune menace n'a été attachée. Pensez à lier les menaces à vos scénarios de risque pour une meilleure visibilité.",
"actionPlan": "Plan d'action",
"noStatus": "Pas de statut",
"actionPlanHelpText": "Séparé par statut et trié par ETA",
"actionPlanHelpText": "Le compteur correspond aux nombres d'exigences liées",
"matchingRequirements": "Exigences associées",
"asZIP": "en ZIP",
"incoming": "En approche",
Expand Down Expand Up @@ -876,6 +876,7 @@
"ssoSettingsUpdated": "Paramètres SSO mis à jour",
"scoreSemiColon": "Score:",
"mappingInferenceHelpText": "Ces variables sont fixes et ne changeront pas en fonction de la source.",
"priority": "Priorité",
"ebiosWs1": "Atelier 1 : Cadrage et Socle de sécurité",
"ebiosWs2": "Atelier 2 : Sources de risque",
"ebiosWs3": "Atelier 3 : Scénarios stratégiques",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
const appliedControlsHead = {
name: 'name',
status: 'status',
priority: 'priority',
category: 'category',
csf_function: 'csfFunction',
Expand All @@ -24,6 +25,7 @@
};
const appliedControlsColums = [
'name',
'status',
'priority',
'category',
'csf_function',
Expand All @@ -34,35 +36,10 @@
'requirements_count'
];
const toDoAppliedControls: TableSource = {
const AppliedControls: TableSource = {
head: appliedControlsHead,
body: tableSourceMapper(data.actionPlan.to_do, appliedControlsColums),
meta: data.actionPlan.to_do
};
const inProgressAppliedControls: TableSource = {
head: appliedControlsHead,
body: tableSourceMapper(data.actionPlan.in_progress, appliedControlsColums),
meta: data.actionPlan.in_progress
};
const onHoldAppliedControls: TableSource = {
head: appliedControlsHead,
body: tableSourceMapper(data.actionPlan.on_hold, appliedControlsColums),
meta: data.actionPlan.on_hold
};
const activeAppliedControls: TableSource = {
head: appliedControlsHead,
body: tableSourceMapper(data.actionPlan.active, appliedControlsColums),
meta: data.actionPlan.active
};
const deprecatedAppliedControls: TableSource = {
head: appliedControlsHead,
body: tableSourceMapper(data.actionPlan.deprecated, appliedControlsColums),
meta: data.actionPlan.deprecated
};
const noneAppliedControls: TableSource = {
head: appliedControlsHead,
body: tableSourceMapper(data.actionPlan.none, appliedControlsColums),
meta: data.actionPlan.none
body: tableSourceMapper(data.actionPlan, appliedControlsColums),
meta: data.actionPlan
};
</script>

Expand Down Expand Up @@ -102,113 +79,13 @@
</p>
</div>
<div class="">
<TabGroup>
<Tab
bind:group={tabSet}
class="border-x border-t border-gray-300"
active="bg-blue-200 border-b-2 border-blue-500"
name="to_do"
value={0}>{m.toDo()}</Tab
>
<Tab
bind:group={tabSet}
class="border-x border-t border-gray-300"
active="bg-violet-400 border-b-2 border-blue-500"
name="in_progress"
value={1}>{m.inProgress()}</Tab
>
<Tab
bind:group={tabSet}
class="border-x border-t border-gray-300"
active="bg-orange-300 border-b-2 border-blue-500"
name="on_hold"
value={2}>{m.onHold()}</Tab
>
<Tab
bind:group={tabSet}
class="border-x border-t border-gray-300"
active="bg-green-200 border-b-2 border-green-500"
name="active"
value={3}>{m.active()}</Tab
>
<Tab
bind:group={tabSet}
class="border-x border-t border-gray-300"
active="bg-red-300 border-b-2 border-red-600"
name="deprecated"
value={4}>{m.deprecated()}</Tab
>
<Tab
bind:group={tabSet}
class="border-x border-t border-gray-300"
active="bg-gray-300 border-b-2 border-gray-600"
name="noStatus"
value={5}>{m.noStatus()}</Tab
>
<svelte:fragment slot="panel">
<div class="p-2">
{#if tabSet === 0}
<ModelTable
URLModel="applied-controls"
source={toDoAppliedControls}
search={true}
rowsPerPage={true}
orderBy={{ identifier: 'eta', direction: 'desc' }}
tags={false}
/>
{/if}
{#if tabSet === 1}
<ModelTable
URLModel="applied-controls"
source={inProgressAppliedControls}
search={true}
rowsPerPage={true}
orderBy={{ identifier: 'eta', direction: 'desc' }}
tags={false}
/>
{/if}
{#if tabSet === 2}
<ModelTable
URLModel="applied-controls"
source={onHoldAppliedControls}
search={true}
rowsPerPage={true}
orderBy={{ identifier: 'eta', direction: 'desc' }}
tags={false}
/>
{/if}
{#if tabSet === 3}
<ModelTable
URLModel="applied-controls"
source={activeAppliedControls}
search={true}
rowsPerPage={true}
orderBy={{ identifier: 'eta', direction: 'desc' }}
tags={false}
/>
{/if}
{#if tabSet === 4}
<ModelTable
URLModel="applied-controls"
source={deprecatedAppliedControls}
search={true}
rowsPerPage={true}
orderBy={{ identifier: 'eta', direction: 'desc' }}
tags={false}
/>
{/if}
{#if tabSet === 5}
<ModelTable
URLModel="applied-controls"
source={noneAppliedControls}
search={true}
rowsPerPage={true}
orderBy={{ identifier: 'eta', direction: 'desc' }}
tags={false}
/>
{/if}
</div>
</svelte:fragment>
</TabGroup>
<ModelTable
URLModel="applied-controls"
source={AppliedControls}
search={true}
rowsPerPage={true}
orderBy={{ identifier: 'eta', direction: 'desc' }}
tags={false}
/>
</div>
</div>

0 comments on commit 711daf5

Please sign in to comment.