Skip to content

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

Merged
Pa-Touche merged 11 commits into
developmentfrom
fix/13552-menu-color-subtitle
Apr 22, 2026
Merged

FIX: 13552: fix menu system config value regexes#13890
Pa-Touche merged 11 commits into
developmentfrom
fix/13552-menu-color-subtitle

Conversation

@Pa-Touche

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

Copy link
Copy Markdown
Contributor

Fixes #13552

Summary by CodeRabbit

  • Bug Fixes

    • Menu background and subtitle settings now accept hex colors with or without a leading “#”; inputs are normalized for consistent display.
    • Database migration updated stored validation patterns for these menu settings.
  • Documentation

    • Validation message and info text updated to reflect accepted color formats and to explain menu background customization.

@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Pa-Touche has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 36 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 41 minutes and 36 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 68135bbd-e2f6-4764-bb41-f5b0b550a5f9

📥 Commits

Reviewing files that changed from the base of the PR and between cfa042e and 9e8dfd8.

📒 Files selected for processing (2)
  • sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java
  • sormas-backend/src/main/resources/sql/sormas_schema.sql
📝 Walkthrough

Walkthrough

Normalized menu color inputs to accept hex values with or without a leading #, updated the validation message and i18n text, and added a DB migration tightening regexes for MENU_BACKGROUND_COLOR and MENU_SUBTITLE plus a new schema version.

Changes

Cohort / File(s) Summary
Validation message
sormas-api/src/main/resources/validations.properties
Clarified systemConfigurationValueValidationInvalidBackgroundColor to indicate hex colors may optionally include a leading # and added an example without the hash.
Database migration
sormas-backend/src/main/resources/sql/sormas_schema.sql
Updated value_pattern for config_key = 'MENU_BACKGROUND_COLOR' and config_key = 'MENU_SUBTITLE'; appended new schema_version row (version_number = 621, comment #13552 - FIX menu regexes). Minor trailing-whitespace cleanup in SQL blocks.
UI color normalization
sormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java
Added HASH constant and addHashIfMissing(String) helper; changed determineActualColor(String) to prepend # when missing while preserving keyword cases.
I18n key added
sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java, sormas-api/src/main/resources/strings.properties
Added new constant and string entry infoSystemConfigurationValueDescriptionMenuBackgroundColor; some line-wrapping of other constants.

Sequence Diagram(s)

sequenceDiagram
    participant AdminUI as "Admin UI"
    participant Backend as "Server / API"
    participant DB as "Database"
    participant ClientUI as "Client UI"

    AdminUI->>Backend: Submit MENU_BACKGROUND_COLOR value (e.g., "dd2b0e" or "#dd2b0e")
    Backend->>Backend: Validate against updated regex (allows optional '#', keywords)
    Backend->>DB: Persist config value
    DB-->>Backend: Ack
    ClientUI->>Backend: Request system config
    Backend->>DB: Read MENU_BACKGROUND_COLOR
    DB-->>Backend: Return stored value (e.g., "dd2b0e")
    Backend->>ClientUI: Return config value
    ClientUI->>ClientUI: determineActualColor -> addHashIfMissing -> render menu color (prepends '#')
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • raulbob
  • obinna-h-n
  • KarnaiahPesula

Poem

🐰 I nibble code with eager bite,
I add a hash to make it right.
Hex or hash, the menu gleams,
Distinctive colors, vivid dreams.
Hooray — a rabbit's joyful byte!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: fixing menu system configuration value regexes for issue #13552.
Description check ✅ Passed The description includes the required issue reference (#13552) but lacks context about the changes and rationale beyond the template.
Linked Issues check ✅ Passed The PR addresses issue #13552 objectives by fixing validation regexes for MENU_BACKGROUND_COLOR and MENU_SUBTITLE, adding support for optional hash in hex colors, and providing localization strings.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing menu configuration regexes, adding validation messages, and supporting color/subtitle customization as per issue #13552 requirements.

✏️ 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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

Comment thread sormas-backend/src/main/resources/sql/sormas_schema.sql
@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
@Pa-Touche Pa-Touche merged commit 72ac3ed into development Apr 22, 2026
7 of 10 checks passed
@Pa-Touche Pa-Touche deleted the fix/13552-menu-color-subtitle branch April 22, 2026 13:31
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

2 participants