Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix policies page #80

Merged
merged 4 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading