Skip to content

Commit

Permalink
Merge pull request #80 from intuitem/fix-policies-page
Browse files Browse the repository at this point in the history
Fix policies page
  • Loading branch information
Mohamed-Hacene authored Feb 26, 2024
2 parents cba204c + f98c933 commit 27fe975
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 5 deletions.
2 changes: 2 additions & 0 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"addDomain": "New domain",
"addProject": "New project",
"addUser": "New user",
"addPolicy": "New policy",
"associatedThreats": "Associated threats",
"associatedSecurityFunctions": "Associated security functions",
"associatedSecurityMeasures": "Associated security measures",
Expand Down Expand Up @@ -42,6 +43,7 @@
"securityMeasures": "Security measures",
"assets": "Assets",
"asset": "Asset",
"policy": "Policy",
"policies": "Policies",
"riskMatrices": "Risk matrices",
"riskAssessments": "Risk assessments",
Expand Down
2 changes: 2 additions & 0 deletions frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"addDomain": "Ajouter un domaine",
"addProject": "Ajouter un projet",
"addUser": "Ajouter un utilisateur",
"addPolicy": "Ajouter une politique",
"associatedThreats": "Menaces associées",
"associatedSecurityFunctions": "Fonctions de sécurité associées",
"associatedSecurityMeasures": "Mesures de sécurité associées",
Expand Down Expand Up @@ -42,6 +43,7 @@
"securityMeasures": "Mesures de sécurité",
"assets": "Biens sensibles",
"asset": "Bien sensible",
"policy": "Politique",
"policies": "Politiques",
"riskMatrices": "Matrices de risque",
"riskAssessments": "Évaluations de risque",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/Forms/ModelForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
suggestions: suggestions['security_function']
})}
field="security_function"
label="Security function"
label={m.securityFunction()}
on:change={async (e) => {
if (e.detail) {
await fetch(`/security-functions/${e.detail}`)
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/components/Forms/Select.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
{...$constraints}
{...$$restProps}
>
{#if !$constraints?.required}
<option value="">--</option>
{#if !$constraints?.required && !options.find((o) => o.label === '--')}
<option value={undefined} selected>--</option>
{/if}
{#each options as option}
<option value={option.value} style="background-color: {color_map[option.value]}"
Expand Down
20 changes: 20 additions & 0 deletions frontend/src/lib/utils/crud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,26 @@ export const URL_MODEL_MAP: ModelMap = {
{ field: 'folder' }
]
},
policies: {
name: 'securitymeasure',
localName: 'policy',
localNamePlural: 'policies',
localFrGender: 'f',
verboseName: 'Policy',
verboseNamePlural: 'Policies',
foreignKeyFields: [
{ field: 'security_function', urlModel: 'security-functions' },
{ field: 'folder', urlModel: 'folders' },
{ field: 'evidences', urlModel: 'evidences' }
],
selectFields: [{ field: 'status' }, { field: 'effort' }],
filters: [
{ field: 'security_function' },
{ field: 'status' },
{ field: 'effort' },
{ field: 'folder' }
]
},
'risk-acceptances': {
name: 'riskacceptance',
localName: 'riskAcceptance',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/utils/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export function localItems(languageTag: string): LocalItems {
addDomain: m.addDomain({ languageTag: languageTag }),
addProject: m.addProject({ languageTag: languageTag }),
addUser: m.addUser({ languageTag: languageTag }),
addPolicy: m.addPolicy({ languageTag: languageTag }),
associatedThreats: m.associatedThreats({ languageTag: languageTag }),
associatedSecurityFunctions: m.associatedSecurityFunctions({ languageTag: languageTag }),
associatedSecurityMeasures: m.associatedSecurityMeasures({ languageTag: languageTag }),
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/utils/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ export const RiskScenarioSchema = baseNamedObject({

export const SecurityMeasureSchema = baseNamedObject({
category: z.string().optional(),
status: z.string().optional(),
status: z.string().optional().nullable(),
evidences: z.string().optional().array().optional(),
eta: z.string().optional().nullable(),
expiry_date: z.string().optional().nullable(),
link: z.string().url().optional().nullable(),
effort: z.string().optional(),
effort: z.string().optional().nullable(),
folder: z.string(),
security_function: z.string().optional()
});
Expand Down

0 comments on commit 27fe975

Please sign in to comment.