Skip to content

Conversation

@tchoumi313
Copy link
Contributor

@tchoumi313 tchoumi313 commented Nov 17, 2025

Summary by CodeRabbit

  • New Features

    • Added localized "Select..." placeholder text (English and French) for select/autocomplete fields.
  • Improvements

    • Autocomplete/select fields now use the localized placeholder by default.
    • Table search input is shown only when the table contains rows to avoid an empty search UI.
  • Style

    • Placeholder text now appears italicized with an updated placeholder color.

✏️ Tip: You can customize this high-level summary in your review settings.

@tchoumi313 tchoumi313 self-assigned this Nov 17, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Walkthrough

Added selectPlaceholder translations (EN/FR). AutocompleteSelect gains an optional placeholder prop (defaults to the translation), switches to $effect for post-load value sync, forwards the placeholder to MultiSelect and adds italic placeholder styling. ModelTable hides Search when no rows exist.

Changes

Cohort / File(s) Summary
Translation Files
frontend/messages/en.json, frontend/messages/fr.json
Added selectPlaceholder key (value "Select..." in English) and adjusted surrounding JSON to insert the new entry.
AutocompleteSelect Component
frontend/src/lib/components/Forms/AutocompleteSelect.svelte
Added public `placeholder?: string
ModelTable Components
frontend/src/lib/components/ModelTable/ModelTable.svelte, frontend/src/lib/components/ModelTable/Search.svelte
Added derived showSearch = searchEnabled && rows.length > 0 and render Search only when true; added CSS to italicize and recolor the Search input placeholder.
Type annotation relaxations
enterprise/frontend/src/routes/(app)/(internal)/settings/+page.svelte, frontend/src/lib/components/Forms/ModelForm/AppliedControlPolicyForm.svelte, frontend/src/lib/components/Forms/ModelForm/ComplianceAssessmentForm.svelte, frontend/src/lib/components/Settings/WebhooksSettings.svelte
Relaxed parameter types from Record<string, any> to Record in several predicates/handlers; no runtime behavior changes.

Sequence Diagram(s)

sequenceDiagram
    participant Parent
    participant AutocompleteSelect
    participant MultiSelect
    participant User

    Parent->>AutocompleteSelect: pass props (may include placeholder)
    AutocompleteSelect->>AutocompleteSelect: placeholder ||= m.selectPlaceholder()
    AutocompleteSelect->>MultiSelect: forward { value, placeholder, --sms-placeholder-color }
    MultiSelect->>User: render input with placeholder (styled italic)
    User->>MultiSelect: interact / open / type
Loading
sequenceDiagram
    participant User
    participant ModelTable
    participant Search

    Note over ModelTable: rows change or search setting toggled
    ModelTable->>ModelTable: compute showSearch = searchEnabled && rows.length > 0
    alt showSearch true
        ModelTable->>Search: render
        User->>Search: type query
        Search->>ModelTable: emit search event
    else showSearch false
        Note over ModelTable: Search not rendered
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify $effect() timing vs previous run() to ensure no regressions in value sync.
  • Confirm placeholder propagation and CSS variable (--sms-placeholder-color) interactions with MultiSelect and no conflicts with global styles.
  • Confirm showSearch updates correctly when rows array mutates and that Search isn't unexpectedly hidden.
  • Spot-check loosened type annotations for places that may rely on specific key shapes.

Possibly related PRs

Suggested reviewers

  • eric-intuitem
  • nas-tabchiche

Poem

🐰 A tiny label hops into view, soft and bright,
"Select..." in English and French — a polite little light.
When rows are empty the search will quietly hide,
Placeholders lean italic, a gentle guide.
~CodeRabbit

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: adding placeholder support to selectors for empty lists of applied controls, which aligns with the PR's primary changes across translation files and selector components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch CA-1383-add-a-placeholder-in-empty-lists-of-applied-controls-in-selectors

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b12378 and d2d4721.

📒 Files selected for processing (8)
  • enterprise/frontend/src/routes/(app)/(internal)/settings/+page.svelte (1 hunks)
  • frontend/messages/en.json (1 hunks)
  • frontend/messages/fr.json (1 hunks)
  • frontend/src/lib/components/Forms/AutocompleteSelect.svelte (5 hunks)
  • frontend/src/lib/components/Forms/ModelForm/AppliedControlPolicyForm.svelte (2 hunks)
  • frontend/src/lib/components/Forms/ModelForm/ComplianceAssessmentForm.svelte (1 hunks)
  • frontend/src/lib/components/ModelTable/ModelTable.svelte (2 hunks)
  • frontend/src/lib/components/Settings/WebhooksSettings.svelte (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • frontend/messages/en.json
  • frontend/messages/fr.json
  • frontend/src/lib/components/ModelTable/ModelTable.svelte
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build_community_frontend
  • GitHub Check: build_enterprise_frontend
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: lint-community (22)
  • GitHub Check: Analyze (python)
🔇 Additional comments (7)
frontend/src/lib/components/Forms/ModelForm/ComplianceAssessmentForm.svelte (1)

125-127: Snippet typing change is consistent and safe

Relaxing the optionSnippet parameter from Record<string, any> to Record keeps runtime behavior the same and aligns with the broader typing changes in this PR. No issues from this change alone.

frontend/src/lib/components/Settings/WebhooksSettings.svelte (1)

144-156: Type relaxation in events filter is fine

Switching the filter predicate parameter from Record<string, any> to Record is a typing-only change and doesn’t alter how event models are filtered by e?.events?.length > 0. Looks good.

frontend/src/lib/components/Forms/ModelForm/AppliedControlPolicyForm.svelte (1)

344-345: Integration-related Record typings now consistent

Using bare Record for the ITS/M integration some(...) guard and the syncMappings.filter(...) callback keeps behavior identical while aligning with the wider typing changes in the PR. No functional concerns here.

Also applies to: 403-405

frontend/src/lib/components/Forms/AutocompleteSelect.svelte (3)

28-45: Placeholder prop + default integration looks good

Adding placeholder?: string | null with a default of m.selectPlaceholder() is a clean way to localize the empty-state label without affecting existing call sites. The prop is optional, backwards compatible, and consistent with the new translation keys.

Also applies to: 77-93


452-464: Verify MultiSelect placeholder and CSS variable support

Forwarding {placeholder} and setting --sms-placeholder-color on <MultiSelect> should give you the desired UX, assuming the pinned svelte-multiselect version treats placeholder as the input’s placeholder and respects that CSS variable.

Please double-check the component’s API/docs for the current version to ensure both props are recognized and won’t be ignored or misinterpreted.


560-564: Scoped placeholder styling now avoids global side effects

Using .control :global(input::placeholder) correctly scopes the italic placeholder style to inputs within this component’s .control wrapper, addressing the previous overly broad :global(.control input::placeholder) selector. This is a good balance between styling and isolation.

enterprise/frontend/src/routes/(app)/(internal)/settings/+page.svelte (1)

103-105: Jira integration guard typing change is harmless

Updating the some callback parameter to Record keeps the Jira integration enabled-state check exactly the same at runtime while aligning with the other type relaxations in this PR.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
frontend/messages/en.json (1)

2673-2675: i18n key added — looks good.

The new key selectExistingAppliedControls aligns with usages and keeps wording consistent with “applied controls.”

Consider adding this key to other locales (or confirm fallback behavior is acceptable).

frontend/messages/fr.json (1)

2673-2675: French translation added — looks good.

Wording aligns with existing terminology for “Mesures appliquées.”

Optionally replace "..." with the single-character ellipsis “…” for typographic consistency.

frontend/src/lib/components/Forms/AutocompleteSelect.svelte (1)

43-44: Consider using undefined instead of null for optional placeholder prop.

The svelte-multiselect version in use is 11.1.1, which supports the placeholder prop. The code correctly forwards the prop to the MultiSelect component (line 462).

However, the current implementation uses null as the default (line 92), which explicitly passes a value to the child component. Using undefined instead would omit the prop entirely, allowing MultiSelect's own defaults to apply—a cleaner Svelte pattern:

  • Line 43: Change placeholder?: string | null; to placeholder?: string | undefined;
  • Line 92: Change placeholder = null, to placeholder = undefined,
  • Line 462: Change {placeholder} to {placeholder ?? undefined} (optional, for clarity)

This is a minor refinement; the current code functions correctly.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1feab40 and a7ab7ea.

📒 Files selected for processing (10)
  • frontend/messages/en.json (1 hunks)
  • frontend/messages/fr.json (1 hunks)
  • frontend/src/lib/components/Forms/AutocompleteSelect.svelte (3 hunks)
  • frontend/src/lib/components/Forms/ModelForm/FindingForm.svelte (1 hunks)
  • frontend/src/lib/components/Forms/ModelForm/SecurityExceptionForm.svelte (1 hunks)
  • frontend/src/lib/components/Forms/ModelForm/StakeholderForm.svelte (1 hunks)
  • frontend/src/lib/components/Forms/ModelForm/TaskTemplateForm.svelte (1 hunks)
  • frontend/src/lib/components/Forms/ModelForm/VulnerabilitiesForm.svelte (1 hunks)
  • frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte (2 hunks)
  • frontend/src/routes/(app)/(third-party)/requirement-assessments/[id=uuid]/edit/+page.svelte (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: build_enterprise_frontend
  • GitHub Check: build_community_frontend
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: Analyze (python)
🔇 Additional comments (7)
frontend/src/lib/components/Forms/ModelForm/SecurityExceptionForm.svelte (1)

157-158: LGTM — consistent placeholder usage.

Matches the new i18n key and improves UX for empty selections.

frontend/src/lib/components/Forms/ModelForm/StakeholderForm.svelte (1)

300-301: LGTM — placeholder wired correctly.

Consistent with other forms and the new component prop.

frontend/src/lib/components/Forms/ModelForm/TaskTemplateForm.svelte (1)

272-272: LGTM! Nice UX improvement.

Adding the placeholder provides helpful guidance for users when selecting applied controls.

frontend/src/routes/(app)/(third-party)/requirement-assessments/[id=uuid]/edit/+page.svelte (1)

533-533: LGTM! Placeholder improves user experience.

The placeholder text provides clear guidance for users when selecting applied controls in the requirement assessment form.

frontend/src/lib/components/Forms/ModelForm/VulnerabilitiesForm.svelte (1)

77-77: LGTM! Consistent with the placeholder enhancement.

The placeholder provides helpful context for users selecting applied controls in the vulnerabilities form.

frontend/src/lib/components/Forms/ModelForm/FindingForm.svelte (1)

160-160: LGTM! Placeholder enhances usability.

The placeholder text helps guide users when selecting applied controls for findings.

frontend/src/routes/(app)/(internal)/risk-scenarios/[id=uuid]/edit/+page.svelte (1)

307-307: LGTM! Placeholders improve the risk scenario editing experience.

Both applied controls fields (existing controls and extra controls) now have helpful placeholder text to guide users when the fields are empty.

Also applies to: 384-384

@nas-tabchiche nas-tabchiche changed the title feat: added placeholder support to empty lists of applied controls in selector feat: add placeholder support to empty lists of applied controls in selector Nov 18, 2025
tchoumi313 and others added 3 commits November 20, 2025 12:43
Copy link
Collaborator

@eric-intuitem eric-intuitem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are a few changes to complete this:
1/ Do it for all similar fields, using a generic message "Select..."
2/ The message should be in italics and/or gray, to make clear it's a placeholder
3/ Hide the "search" field when the list is empty (most users imagine the search field can be used to search for candidate objects).

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/lib/components/Forms/AutocompleteSelect.svelte (1)

462-463: Consider using a theme variable for placeholder color.

The hardcoded color #9ca3af (gray-400) works but could become inconsistent if the theme changes. Consider using a CSS variable from your design system.

For example:

-			--sms-placeholder-color="#9ca3af"
+			--sms-placeholder-color="var(--color-surface-500)"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7ab7ea and 0e2726b.

📒 Files selected for processing (4)
  • frontend/messages/en.json (1 hunks)
  • frontend/messages/fr.json (1 hunks)
  • frontend/src/lib/components/Forms/AutocompleteSelect.svelte (5 hunks)
  • frontend/src/lib/components/ModelTable/ModelTable.svelte (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/messages/en.json
  • frontend/messages/fr.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: build_community_frontend
  • GitHub Check: build_enterprise_frontend
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: Analyze (python)
🔇 Additional comments (4)
frontend/src/lib/components/Forms/AutocompleteSelect.svelte (2)

43-43: LGTM! Placeholder prop properly implemented.

The placeholder prop is correctly typed as optional with null support, and the default value uses the translation function for proper internationalization.

Also applies to: 92-92


376-384: Review the behavioral change from run() to $effect() in the value synchronization effect.

The change from run() to $effect() represents a fundamental shift in timing: run() executes as a pre-update effect during initialization, while $effect() runs during the normal effect phase after state changes. This affects when selectedValues are synchronized to $value.

The concern is valid:

  • Initial value setting may be delayed or not occur before first render
  • External value changes (e.g., form reset) may not propagate correctly if the effect doesn't run at the expected time
  • The internal update gate (isInternalUpdate) prevents loops, but the new timing could introduce edge cases

Confirm through manual testing:

  1. Initial form load with pre-selected values
  2. Form reset / external value changes
  3. Multiple selections with dynamic option loading
  4. All current usage contexts work as expected
frontend/src/lib/components/ModelTable/ModelTable.svelte (2)

229-230: LGTM! Clear improvement to UX.

Hiding the search field when the table is empty prevents user confusion. The derived value correctly combines the search flag with row presence, and the comment clearly explains the intent.


477-479: LGTM! Conditional rendering correctly uses the derived value.

The change from {#if search} to {#if showSearch} correctly implements the new behavior of hiding search on empty tables.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
frontend/src/lib/components/ModelTable/Search.svelte (1)

32-37: Consider using a CSS variable or theme token instead of a hardcoded color.

The hardcoded color #9ca3af may break theme consistency, especially in dark mode. Since the project uses design system classes (e.g., bg-surface-50) and AutocompleteSelect uses a CSS variable (--sms-placeholder-color) for placeholder styling, consider following the same pattern here.

Apply this diff to use a more maintainable approach:

 <style>
 	#search-input::placeholder {
 		font-style: italic;
-		color: #9ca3af;
+		color: var(--placeholder-color, #9ca3af);
 	}
 </style>

Alternatively, if your design system provides a semantic color token (e.g., text-gray-400 equivalent as a CSS variable), use that instead.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e2726b and 2e84f52.

📒 Files selected for processing (2)
  • frontend/src/lib/components/Forms/AutocompleteSelect.svelte (5 hunks)
  • frontend/src/lib/components/ModelTable/Search.svelte (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/lib/components/Forms/AutocompleteSelect.svelte
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: build_enterprise_frontend
  • GitHub Check: build_community_frontend
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: Analyze (python)

@tchoumi313 tchoumi313 force-pushed the CA-1383-add-a-placeholder-in-empty-lists-of-applied-controls-in-selectors branch from d2d4721 to cb11fd8 Compare December 1, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants