Skip to content

Commit

Permalink
updating links for compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-smith committed Nov 28, 2024
1 parent 17e159f commit d93ff1b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 32 deletions.
15 changes: 12 additions & 3 deletions backend/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
from iam.models import Folder, Permission, RoleAssignment, User
from library.helpers import get_referential_translation

from statistics import mean
import math

from .models import *
from .utils import camel_case

Expand Down Expand Up @@ -889,6 +892,10 @@ def viewable_items(model):

viewable_controls = viewable_items(AppliedControl)
controls_count = viewable_controls.count()
progress_avg = math.ceil(
mean([x.progress() for x in viewable_items(ComplianceAssessment)])
)

data = {
"controls": {
"total": controls_count,
Expand All @@ -908,17 +915,19 @@ def viewable_items(model):
"acceptances": viewable_items(RiskAcceptance).count(),
},
"compliance": {
"used_frameworks": viewable_items(ComplianceAssessment)
.values("framework_id")
.distinct()
.count(),
"audits": viewable_items(ComplianceAssessment).count(),
"active_audits": viewable_items(ComplianceAssessment)
.filter(status__in=["in_progress", "in_review", "done"])
.count(),
"evidences": viewable_items(Evidence).count(),
"compliant_items": viewable_items(RequirementAssessment)
.filter(result="compliant")
.count(),
"non_compliant_items": viewable_items(RequirementAssessment)
.filter(result="non_compliant")
.count(),
"progress_avg": progress_avg,
},
"audits_stats": build_audits_stats(user),
"csf_functions": csf_functions(user),
Expand Down
17 changes: 9 additions & 8 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -808,14 +808,15 @@
"sumpageToDo": "to do",
"sumpageInProgress": "in progress",
"sumpageOnHold": "on hold",
"sumpageActiveAudits": "active audits",
"sumpageCompliantItems": "compliant items",
"sumpageNonCompliantItems": "non compliant items",
"sumpageEvidences": "evidences",
"sumpageAssessments": "assessments",
"sumpageScenarios": "scenarios",
"sumpageMappedThreats": "mapped threats",
"sumpageRiskAccepted": "risks accepted",
"sumpageActiveAudits": "Active audits",
"sumpageCompliantItems": "Compliant items",
"sumpageNonCompliantItems": "Non compliant items",
"sumpageEvidences": "Evidences",
"sumpageAvgProgress": "Average progress",
"sumpageAssessments": "Assessments",
"sumpageScenarios": "Scenarios",
"sumpageMappedThreats": "Mapped threats",
"sumpageRiskAccepted": "Risks accepted",
"sumpageSectionControls": "controls",
"sumpageTitleComplianceOverview": "Compliance overview",
"sumpageTitleCurrentRisks": "Current risks",
Expand Down
31 changes: 16 additions & 15 deletions frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -791,21 +791,22 @@
"fillSSOSLOURLx509cert": "Option 2 : Remplissez l'URL SSO, l'URL SLO et le certificat x509",
"licenseAboutToExpireWarning": "Il reste {days_left} jours avant l'expiration de votre licence.",
"noExpirationDateSet": "Aucune date d'expiration définie",
"sumpageTotal": "total",
"sumpageActive": "actif",
"sumpageDeprecated": "obsolète",
"sumpageToDo": "à faire",
"sumpageInProgress": "en cours",
"sumpageOnHold": "en attente",
"sumpageActiveAudits": "audits actifs",
"sumpageCompliantItems": "items conformes",
"sumpageNonCompliantItems": "items non conformes",
"sumpageEvidences": "preuves",
"sumpageAssessments": "évaluations",
"sumpageScenarios": "scénarios",
"sumpageMappedThreats": "menaces mappées",
"sumpageRiskAccepted": "risques acceptés",
"sumpageSectionControls": "mesures",
"sumpageTotal": "Total",
"sumpageActive": "Actif",
"sumpageDeprecated": "Obsolète",
"sumpageToDo": "A faire",
"sumpageInProgress": "En cours",
"sumpageOnHold": "En attente",
"sumpageActiveAudits": "Audits actifs",
"sumpageCompliantItems": "Exigences conformes",
"sumpageNonCompliantItems": "Exigences non conformes",
"sumpageEvidences": "Preuves",
"sumpageAvgProgress": "Avancement moyenné",
"sumpageAssessments": "Evaluations",
"sumpageScenarios": "Scénarios",
"sumpageMappedThreats": "Menaces mappées",
"sumpageRiskAccepted": "Risques acceptés",
"sumpageSectionControls": "Mesures",
"sumpageTitleComplianceOverview": "Aperçu conformité",
"sumpageTitleCurrentRisks": "Risques actuels",
"sumpageTitleResidualRisks": "Risques résiduels",
Expand Down
22 changes: 16 additions & 6 deletions frontend/src/routes/(app)/(internal)/analytics/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,30 @@
/>
</div>
<!---->
<Card
count={metrics.compliance.used_frameworks}
label={m.usedFrameworks()}
href="/frameworks/"
help="this is interesting"
icon="fa-solid fa-list-check"
section={m.sumpageSectionCompliance()}
emphasis={true}
/>
<div></div>
<Card
count="{metrics.compliance.active_audits}/{metrics.compliance.audits}"
label={m.sumpageActiveAudits()}
href="#"
href="/compliance-assessments/"
help="this is interesting"
icon="fa-solid fa-list-check"
section={m.sumpageSectionCompliance()}
emphasis={true}
/>
<div></div>

<Card
count={metrics.compliance.compliant_items}
label={m.sumpageCompliantItems()}
href="#"
count="{metrics.compliance.progress_avg}%"
label={m.sumpageAvgProgress()}
href="/compliance-assessments/"
help="this is interesting"
icon="fa-solid fa-list-check"
section={m.sumpageSectionCompliance()}
Expand All @@ -230,7 +240,7 @@
<Card
count={metrics.compliance.evidences}
label={m.sumpageEvidences()}
href="#"
href="/evidences/"
help="this is interesting"
icon="fa-solid fa-list-check"
section={m.sumpageSectionCompliance()}
Expand Down

0 comments on commit d93ff1b

Please sign in to comment.