Skip to content

FIX: 13552: fix menu system config value regexes#13890

Open
Pa-Touche wants to merge 4 commits intodevelopmentfrom
fix/13552-menu-color-subtitle
Open

FIX: 13552: fix menu system config value regexes#13890
Pa-Touche wants to merge 4 commits intodevelopmentfrom
fix/13552-menu-color-subtitle

Conversation

@Pa-Touche
Copy link
Copy Markdown
Contributor

@Pa-Touche Pa-Touche commented Mar 31, 2026

Fixes #13552

Summary by CodeRabbit

  • Bug Fixes
    • Menu background and subtitle color settings now accept hexadecimal colors with or without a leading “#”, improving validation and display consistency.
    • Validation message examples updated to reflect the accepted formats.
    • Database migration applied to update stored validation patterns for menu color settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9073a770-6c61-45d7-86b4-58dae3432ddb

📥 Commits

Reviewing files that changed from the base of the PR and between 6dc608d and a06f002.

📒 Files selected for processing (1)
  • sormas-backend/src/main/resources/sql/sormas_schema.sql
🚧 Files skipped from review as they are similar to previous changes (1)
  • sormas-backend/src/main/resources/sql/sormas_schema.sql

📝 Walkthrough

Walkthrough

Updated menu color handling and validation: normalized hex color inputs to accept values with or without a leading #, adjusted validation message text, and added a DB migration updating regexes and inserting a new schema version.

Changes

Cohort / File(s) Summary
Validation message
sormas-api/src/main/resources/validations.properties
Clarified systemConfigurationValueValidationInvalidBackgroundColor to state hex colors may include an optional # and added an example without the hash.
Database migration
sormas-backend/src/main/resources/sql/sormas_schema.sql
Added two UPDATE statements changing value_pattern for MENU_BACKGROUND_COLOR and MENU_SUBTITLE, and inserted a new schema_version record (version_number = 617, comment #13552 - FIX menu regexes).
UI color normalization
sormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java
Added HASH constant, introduced addHashIfMissing(String), and updated determineActualColor(String) to normalize color strings by prepending # when missing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • SORMAS-Project#13788: Overlapping changes to Menu.determineActualColor/addHashIfMissing, MENU_BACKGROUND_COLOR regex updates, and the validation message text.

Suggested reviewers

  • raulbob
  • obinna-h-n

Poem

🐇 I hop through code with nimble paws,
I add a hash to mend the flaws.
Colors now show clear and bright,
Hash or not — the menu's right.
Cheers from this happy, coding hare!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive Changes partially address #13552 by fixing validation regexes for menu color/subtitle, but the PR does not fully implement the feature (missing system configuration UI, persistence, permissions, and styling adjustments). Clarify whether this PR is a partial fix for regex validation only, or if additional commits are pending to complete the full feature implementation from issue #13552.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing menu system configuration value regexes (issue #13552).
Description check ✅ Passed The description follows the repository template and includes the required issue reference (Fixes #13552), though it lacks additional context.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing menu system configuration value regexes (#13552); no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/13552-menu-color-subtitle

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.

@Pa-Touche Pa-Touche force-pushed the fix/13552-menu-color-subtitle branch from 329a392 to 6dc608d Compare March 31, 2026 07:02
Copy link
Copy Markdown

@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)
sormas-api/src/main/resources/validations.properties (1)

333-333: Add a 3-digit hexadecimal example without the # prefix for consistency.

The validation regex correctly allows hex colors with or without the # prefix (via the #? quantifier in the pattern). The message examples show both 6-digit and 3-digit formats with the hash, plus a 6-digit format without it. Consider adding 4AA to the examples to demonstrate that 3-digit hex values work without the hash as well, making the message more complete.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@sormas-api/src/main/resources/validations.properties` at line 333, Update the
validation message for systemConfigurationValueValidationInvalidBackgroundColor
to include a 3-digit hexadecimal example without the hash (e.g., "4AA") so the
examples cover 6-digit and 3-digit formats both with and without "#" — modify
the string value for systemConfigurationValueValidationInvalidBackgroundColor to
append or replace examples accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@sormas-backend/src/main/resources/sql/sormas_schema.sql`:
- Around line 15471-15473: The value_pattern for config_key
'MENU_BACKGROUND_COLOR' currently uses alternation without grouping which allows
partial matches (e.g., "defaultABC"); update the regex stored in the
value_pattern column of systemconfigurationvalue so the entire alternation is
enclosed in a single anchored group (wrap the predefined-names alternative and
the hex-color alternative together between ^ and $ or use a non-capturing group)
so that only exact matches for the named colors or full hex colors are accepted.

---

Nitpick comments:
In `@sormas-api/src/main/resources/validations.properties`:
- Line 333: Update the validation message for
systemConfigurationValueValidationInvalidBackgroundColor to include a 3-digit
hexadecimal example without the hash (e.g., "4AA") so the examples cover 6-digit
and 3-digit formats both with and without "#" — modify the string value for
systemConfigurationValueValidationInvalidBackgroundColor to append or replace
examples accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 23c425ea-6b99-4d70-87fd-7d25eb89e7a2

📥 Commits

Reviewing files that changed from the base of the PR and between 2100265 and 6dc608d.

📒 Files selected for processing (3)
  • sormas-api/src/main/resources/validations.properties
  • sormas-backend/src/main/resources/sql/sormas_schema.sql
  • sormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java

@Pa-Touche Pa-Touche changed the title FIX: 13788: fix menu system config value regexes FIX: 13552: fix menu system config value regexes Mar 31, 2026
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.

Add an option to visually distinguish different system types

1 participant