Skip to content

Commit

Permalink
feat: hide suggest controls checkbox in audit creation form if no sug…
Browse files Browse the repository at this point in the history
…gestions
  • Loading branch information
Mohamed-Hacene committed Oct 9, 2024
1 parent 3abd931 commit 8d1c388
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ class Meta:
class FrameworkReadSerializer(ReferentialSerializer):
folder = FieldsRelatedField()
library = FieldsRelatedField(["name", "id"])
reference_controls = FieldsRelatedField(many=True)

class Meta:
model = Framework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
export let initialData: Record<string, any> = {};
export let object: any = {};
export let context: string;
let suggestions = false;
</script>

{#if context === 'fromBaseline' && initialData.baseline}
Expand Down Expand Up @@ -72,6 +74,7 @@
model.selectOptions['selected_implementation_groups'] = implementation_groups.map(
(group) => ({ label: group.name, value: group.ref_id })
);
suggestions = r['reference_controls'].length > 0;
});
}
}}
Expand Down Expand Up @@ -131,7 +134,7 @@
cacheLock={cacheLocks['observation']}
bind:cachedValue={formDataCache['observation']}
/>
{#if context === 'create'}
{#if context === 'create' && suggestions}
<Checkbox
{form}
field="create_applied_controls_from_suggestions"
Expand Down

0 comments on commit 8d1c388

Please sign in to comment.