FIX: 13552: fix menu system config value regexes#13890
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughNormalized menu color inputs to accept hex values with or without a leading Changes
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 '#')
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
329a392 to
6dc608d
Compare
There was a problem hiding this comment.
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 adding4AAto 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
📒 Files selected for processing (3)
sormas-api/src/main/resources/validations.propertiessormas-backend/src/main/resources/sql/sormas_schema.sqlsormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java
…RMAS-Project into fix/13552-menu-color-subtitle
Fixes #13552
Summary by CodeRabbit
Bug Fixes
Documentation