diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java b/sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java index ebc166eab95..950cfc14c65 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java @@ -1173,6 +1173,7 @@ public interface Strings { String infoSyncUsers = "infoSyncUsers"; String infoSystemConfigurationValueDescriptionEmailSenderAddress = "infoSystemConfigurationValueDescriptionEmailSenderAddress"; String infoSystemConfigurationValueDescriptionEmailSenderName = "infoSystemConfigurationValueDescriptionEmailSenderName"; + String infoSystemConfigurationValueDescriptionMenuBackgroundColor = "infoSystemConfigurationValueDescriptionMenuBackgroundColor"; String infoSystemConfigurationValueDescriptionSmsAuthKey = "infoSystemConfigurationValueDescriptionSmsAuthKey"; String infoSystemConfigurationValueDescriptionSmsAuthSecret = "infoSystemConfigurationValueDescriptionSmsAuthSecret"; String infoSystemConfigurationValueDescriptionSmsSenderName = "infoSystemConfigurationValueDescriptionSmsSenderName"; diff --git a/sormas-api/src/main/resources/strings.properties b/sormas-api/src/main/resources/strings.properties index 3d394e17124..d490292afa0 100644 --- a/sormas-api/src/main/resources/strings.properties +++ b/sormas-api/src/main/resources/strings.properties @@ -2018,6 +2018,7 @@ infoSystemConfigurationValueDescriptionSmsSenderName=Name that will be set as th infoSystemConfigurationValueDescriptionSmsAuthKey=SORMAS supports the delivery of SMS notifications via Vonage (https://www.vonage.com/communications-apis/). You need to specify a valid authentication key and secret in order to use this feature. SORMAS will not attempt to send out SMS if these properties are left empty. infoSystemConfigurationValueDescriptionSmsAuthSecret=Secret for SMS authentication. infoSystemConfigurationValueDescriptionUseDeterminedVaccinationStatus=Use automatic vaccination status. The status will be derived from vaccination data. +infoSystemConfigurationValueDescriptionMenuBackgroundColor=Allows to change background color of the menu to distinguish between different SORMAS instances. notificationCannotCreate=Cannot Create Or Edit Notification notificationCreationNotAllowedWithoutSurveillanceReport=Notifier creation or modification is not allowed when a surveillance report already exists for this case. diff --git a/sormas-api/src/main/resources/validations.properties b/sormas-api/src/main/resources/validations.properties index e4b5a628975..00c7618f90e 100644 --- a/sormas-api/src/main/resources/validations.properties +++ b/sormas-api/src/main/resources/validations.properties @@ -330,5 +330,5 @@ systemConfigurationValueValidationNotAValidEmailsenderName = Value is not a vali systemConfigurationValueValidationNotAValidSmsSenderName = Value is not a valid name. Name should contain only letters and numbers without spaces & special characters. For more info please see https://developer.vonage.com/en/messaging/sms/guides/custom-sender-id . smsAuthKeyValueValidation = SMS Auth key value is not valid smsAuthSecretValueValidation = SMS Auth secret value is not valid -systemConfigurationValueValidationInvalidBackgroundColor = Pre-defined values are: green, red, indigo, gray, default (case-sensitive) otherwise must match hexadecimal format, example: #dd2b0e or #4AA +systemConfigurationValueValidationInvalidBackgroundColor = Pre-defined values are: green, red, indigo, gray, default (case-sensitive) otherwise must match hexadecimal format (with or without hash "#"), example: #dd2b0e or #4AA or dd2b0e systemConfigurationValueValidationMenuSubtitle = Can be empty or up to 16 (any) characters. Can be used to define name of the environment: PRODUCTION - TEST etc. diff --git a/sormas-backend/src/main/resources/sql/sormas_schema.sql b/sormas-backend/src/main/resources/sql/sormas_schema.sql index 312be0de5ef..145e21dbba8 100644 --- a/sormas-backend/src/main/resources/sql/sormas_schema.sql +++ b/sormas-backend/src/main/resources/sql/sormas_schema.sql @@ -15770,4 +15770,17 @@ UPDATE diseaseconfiguration SET exposurecategories = 'VECTOR_BORNE' WHERE diseas INSERT INTO schema_version (version_number, comment) VALUES (622, '#13887 default disease exposure category configuration'); --- *** Insert new sql commands BEFORE this line. Remember to always consider _history tables. *** +-- updated regexes for MENU system config values +UPDATE systemconfigurationvalue +SET value_pattern = '^(default|red|green|indigo|gray)$|^(#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}))$', +value_description = 'i18n/infoSystemConfigurationValueDescriptionMenuBackgroundColor', +validation_message = 'i18n/systemConfigurationValueValidationInvalidBackgroundColor' +WHERE config_key = 'MENU_BACKGROUND_COLOR'; + +UPDATE systemconfigurationvalue +SET value_pattern = '^[\w\s]{0,16}$' +WHERE config_key = 'MENU_SUBTITLE'; + +INSERT INTO schema_version (version_number, comment) VALUES (623, '#13552 - FIX menu regexes'); + +-- *** Insert new sql commands BEFORE this line. Remember to always consider _history tables. *** \ No newline at end of file diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java index 0dad140391f..177b24d8b11 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java @@ -75,6 +75,8 @@ public class Menu extends CssLayout { private static final String COLOR_BACKGROUND_STYLE_NAME = "color-background"; private static final String MENU_SUBTITLE_STYLE_NAME = "menu-subtitle"; private static final String TOP_MENU_CONTAINER_STYLE_NAME = "top-menu-container"; + private static final String HASH = "#"; + private final Navigator navigator; private final Map viewButtons = new HashMap<>(); @@ -214,11 +216,18 @@ private static void defineMenuSubtitleIfSystemConfigured(VerticalLayout topConta actualColorBackgroundColor = "#737278"; break; default: - actualColorBackgroundColor = backgroundColor; + actualColorBackgroundColor = addHashIfMissing(backgroundColor); } return actualColorBackgroundColor; } + private static String addHashIfMissing(String backgroundColor) { + if (!StringUtils.startsWith(backgroundColor, HASH)) { + return HASH + backgroundColor; + } + return backgroundColor; + } + private void showSettingsPopup() { Window window = VaadinUiUtil.createPopupWindow();