-
Notifications
You must be signed in to change notification settings - Fork 315
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
feat: parametric ebios radar #1379
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ca27d05
starting point
ab-smith dcd31d9
feat: add ebios radar parameters in global settings
Mohamed-Hacene 13aa554
style: improve global settings display
Mohamed-Hacene 9440c8d
Merge branch 'CA-820-Add-general-setting-for-EBIOS-RM-stakeholder-cri…
Mohamed-Hacene 818b811
feat: link ebios radar parameters with component
Mohamed-Hacene 214f4c0
feat: update translations
Mohamed-Hacene 031b32b
feat: initialize/update global settings with default settings
Mohamed-Hacene cc634b1
chore: remove spaces
Mohamed-Hacene b3b6959
Better ingestion of the params
ab-smith 839e1b3
Limit the max radius for consistency with the scale
ab-smith 05d7954
values safeguards
ab-smith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 57 additions & 9 deletions
66
frontend/src/lib/components/Forms/ModelForm/GeneralSettingForm.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,69 @@ | ||
<script lang="ts"> | ||
import Select from '../Select.svelte'; | ||
import NumberField from '../NumberField.svelte'; | ||
import * as m from '$paraglide/messages'; | ||
import type { CacheLock, ModelInfo } from '$lib/utils/types'; | ||
import type { SuperForm } from 'sveltekit-superforms'; | ||
import { Accordion, AccordionItem } from '@skeletonlabs/skeleton'; | ||
|
||
export let form: SuperForm<any>; | ||
export let model: ModelInfo; | ||
export let cacheLocks: Record<string, CacheLock> = {}; | ||
export let formDataCache: Record<string, any> = {}; | ||
</script> | ||
|
||
<Select | ||
{form} | ||
field="security_objective_scale" | ||
cacheLock={cacheLocks['security_objective_scale']} | ||
bind:cachedValue={formDataCache['security_objective_scale']} | ||
options={model.selectOptions['security_objective_scale']} | ||
helpText={m.securityObjectiveScaleHelpText()} | ||
label={m.securityObjectiveScale()} | ||
/> | ||
<Accordion regionControl="font-bold"> | ||
<AccordionItem open> | ||
<svelte:fragment slot="summary"><i class="fa-solid fa-gem mr-2"></i>{m.asset()}</svelte:fragment | ||
> | ||
<svelte:fragment slot="content"> | ||
<Select | ||
{form} | ||
field="security_objective_scale" | ||
cacheLock={cacheLocks['security_objective_scale']} | ||
bind:cachedValue={formDataCache['security_objective_scale']} | ||
options={model.selectOptions['security_objective_scale']} | ||
helpText={m.securityObjectiveScaleHelpText()} | ||
label={m.securityObjectiveScale()} | ||
/> | ||
</svelte:fragment> | ||
</AccordionItem> | ||
<AccordionItem open> | ||
<svelte:fragment slot="summary" | ||
><i class="fa-solid fa-gopuram mr-2"></i>{m.ebiosRadarParameters()}</svelte:fragment | ||
> | ||
<svelte:fragment slot="content"> | ||
<NumberField | ||
{form} | ||
field="ebios_radar_max" | ||
label={m.max()} | ||
cacheLock={cacheLocks['ebios_radar_max']} | ||
bind:cachedValue={formDataCache['ebios_radar_max']} | ||
/> | ||
<NumberField | ||
{form} | ||
field="ebios_radar_green_zone_radius" | ||
label={m.greenZoneRadius()} | ||
step={0.1} | ||
cacheLock={cacheLocks['ebios_radar_green_zone_radius']} | ||
bind:cachedValue={formDataCache['ebios_radar_green_zone_radius']} | ||
/> | ||
<NumberField | ||
{form} | ||
field="ebios_radar_yellow_zone_radius" | ||
label={m.yellowZoneRadius()} | ||
step={0.1} | ||
cacheLock={cacheLocks['ebios_radar_yellow_zone_radius']} | ||
bind:cachedValue={formDataCache['ebios_radar_yellow_zone_radius']} | ||
/> | ||
<NumberField | ||
{form} | ||
field="ebios_radar_red_zone_radius" | ||
label={m.redZoneRadius()} | ||
step={0.1} | ||
cacheLock={cacheLocks['ebios_radar_red_zone_radius']} | ||
bind:cachedValue={formDataCache['ebios_radar_red_zone_radius']} | ||
/> | ||
</svelte:fragment> | ||
</AccordionItem> | ||
</Accordion> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Endpoint clarity for eBios radar parameters.
This action method clearly fetches only the relevant radar settings. Consider adding default fallback values (e.g.,
get("ebios_radar_max", 0)
) or explicit error handling for missing keys, ensuring robust responses in every scenario.