Skip to content

Commit

Permalink
feat: add EN translations in remediation plan
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene committed Feb 27, 2024
1 parent e82663b commit 2ece457
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
3 changes: 2 additions & 1 deletion frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,6 @@
"inconsistenciesFoundComposer": "Found {count} inconsistenc{plural}. For more details, check",
"current": "Current",
"residual": "Residual",
"jumpToRiskAssessment": "Jump to risk assessment"
"jumpToRiskAssessment": "Jump to risk assessment",
"additionalMeasures": "Additional measures"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BASE_API_URL } from '$lib/utils/constants';
import type { UUID } from 'crypto';

import type { PageServerLoad } from './$types';

Expand All @@ -9,11 +8,12 @@ export const load = (async ({ fetch, params }) => {

const res = await fetch(endpoint);
const risk_assessment = await res.json();
const folder = await fetch(`${BASE_API_URL}/folders/${risk_assessment.project.id.folder}/`).then(
const project = await fetch(`${BASE_API_URL}/projects/${risk_assessment.project.id}/`).then(
(res) => res.json()
);
const folder = await fetch(`${BASE_API_URL}/folders/${project.folder.id}/`).then(
(res) => res.json()
);

risk_assessment.folder = folder;

return { URLModel, risk_assessment };
}) satisfies PageServerLoad;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import * as m from '$paraglide/messages.js';
export let data;
Expand All @@ -21,35 +22,40 @@
'on hold': 'bg-red-200',
done: 'bg-success-200'
};
return map[treatment.toLowerCase()] ?? 'bg-gray-200';
if (treatment !== null){
return map[treatment.toLowerCase()];
} else {
return 'bg-gray-200';
}
};
</script>

<div class="bg-white p-2 m-2 shadow rounded-lg space-x-2 flex flex-row justify-center">
<p class="font-semibold text-lg">
Domain: <a
{m.domain()}: <a
class="unstyled text-primary-500 hover:text-primary-700 cursor-pointer"
href="/folders/{data.risk_assessment.folder.id}/">{data.risk_assessment.folder.str}</a
href="/folders/{data.risk_assessment.folder.id}/">{data.risk_assessment.folder.name}</a
>
</p>
<p>/</p>
<p class="font-semibold text-lg">
Project: <a
{m.project()}: <a
class="unstyled text-primary-500 hover:text-primary-700 cursor-pointer"
href="/projects/{data.risk_assessment.project.id}/">{data.risk_assessment.project.str}</a
>
</p>
<p>/</p>
<p class="font-semibold text-lg">
Risk assessment: <a
{m.riskAssessment()}: <a
class="unstyled text-primary-500 hover:text-primary-700 cursor-pointer"
href="/risk-assessments/{data.risk_assessment.id}/"
>{data.risk_assessment.name} - {data.risk_assessment.version}</a
>
</p>
</div>

<p class="p-2 m-2 text-lg font-semibold">Associated risk scenarios:</p>
<p class="p-2 m-2 text-lg font-semibold">{m.associatedRiskScenarios()}:</p>

<div class="bg-white p-2 m-2 shadow overflow-hidden rounded-lg flex">
<table class="w-full p-2 mt-2">
Expand All @@ -69,27 +75,27 @@
</tr>
{#if scenario.existing_measures}
<tr>
<td class="text-md pl-6 pb-3 font-medium" colspan="9"> Existing measures: </td>
<td class="text-md pl-6 pb-3 font-medium" colspan="9"> {m.existingMeasures()}: </td>
</tr>
<tr>
<td class="text-sm pl-6 pb-3" colspan="9"> lorem ipsum </td>
<td class="text-sm pl-6 pb-3" colspan="9"> {scenario.existing_measures} </td>
</tr>
{/if}

{#if scenario.security_measures.length > 0}
<tr>
<td class="text-md pl-6 pb-3 font-medium" colspan="9"> Additional measures: </td>
<td class="text-md pl-6 pb-3 font-medium" colspan="9"> {m.additionalMeasures()}: </td>
</tr>
<tr class="text-sm uppercase">
<td class="px-2 text-center">#</td>
<td class="px-2 font-semibold">Name</td>
<td class="px-2 font-semibold">Description</td>
<td class="px-2 font-semibold">Type</td>
<td class="px-2 font-semibold">Security function</td>
<td class="px-2 font-semibold">ETA</td>
<td class="px-2 font-semibold">Effort</td>
<td class="px-2 font-semibold text-center">Link</td>
<td class="px-2 font-semibold text-center">Status</td>
<td class="px-2 font-semibold">{m.name()}</td>
<td class="px-2 font-semibold">{m.description()}</td>
<td class="px-2 font-semibold">{m.type()}</td>
<td class="px-2 font-semibold">{m.securityFunction()}</td>
<td class="px-2 font-semibold">{m.eta()}</td>
<td class="px-2 font-semibold">{m.effort()}</td>
<td class="px-2 font-semibold text-center">{m.link()}</td>
<td class="px-2 font-semibold text-center">{m.status()}</td>
</tr>
{#each scenario.security_measures as measure, index}
<tr
Expand Down Expand Up @@ -119,7 +125,7 @@
{#if !scenario.existing_measures && !(scenario.security_measures.length > 0)}
<tr>
<td colspan="9" class="p-2 text-left">
<i class="fas fa-exclamation-circle" /> No associated measure
<i class="fas fa-exclamation-circle" /> {m.noSecurityMeasureYet()}
</td>
</tr>
{/if}
Expand Down

0 comments on commit 2ece457

Please sign in to comment.