bernardodemarco opened a new pull request, #9031:
URL: https://github.com/apache/cloudstack/pull/9031

   ### Description
   
   The global settings `*.smtp.useAuth` and `quota.usage.smtp.useStartTLS` are 
of boolean type, but the UI provides a standard text input field to manipulate 
them and does not perform any input validation. This PR, therefore, adds the 
toggle component to be rendered to manipulate these configurations.
   
   Besides that, the global settings `*.smtp.enabledSecurityProtocols` expect a 
white-space separated list of predefined values, but the UI also provides a 
text input field without any proper validation. As a consequence of that, this 
PR also adds a new component that enables operators to select and deselect 
values that belong to a list of predefined values.  
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [X] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [X] Minor
   
   ### Screenshots (if appropriate):
   
   <details>
       <summary>Available options to be selected - 
<code>*.smtp.enabledSecurityProtocols</code></summary>
   
   
![image](https://github.com/apache/cloudstack/assets/115510880/c394e949-5b90-4815-ab3d-6191e54334a2)
   </details>
   
   <details>
       <summary>Display of selected options - 
<code>*.smtp.enabledSecurityProtocols</code></summary>
   
   
![image](https://github.com/apache/cloudstack/assets/115510880/6287a1ec-ee2e-4095-908e-429e53d805e1)
   </details>
   
   ### How Has This Been Tested?
   
   #### Tests of `*.smtp.useAuth` and `quota.usage.smtp.useStartTLS`
   
   1. In order to test the boolean settings, I imagined a scenario prior to the 
proposed changes, in which the operator could change the settings' values 
without any validation.
   
   
   ```sql
   SELECT name, value
   FROM `cloud`.`configuration`
   WHERE name IN ("quota.usage.smtp.useAuth", "alert.smtp.useAuth", 
"project.smtp.useAuth", "quota.usage.smtp.useStartTLS");
   ```
   <details>
       <summary>Query output:</summary>
   
   | name | value |
   | - | - |
   | alert.smtp.useAuth | on |
   | project.smtp.useAuth | TRUE |
   | quota.usage.smtp.useAuth | 1 |
   | quota.usage.smtp.useStartTLS | false |
   </details>
   
   2. I verified the source code and the values of these settings are retrieved 
through `BooleanUtils.toBoolean(String)`. It returns `true` if the value is 
`true`, `y`, `t`, `1`, `on` or `yes` (case-insensitive).
   
       Hence, I executed the SQL query that has been added to the update 
script. The query converts the values that are interpreted as `true` to `true`. 
Values that are not interpreted as `true`, such as `false` and `0`, are 
converted to `false`. 
   
   <details>
       <summary>Normalization output:</summary>
   
   | name | value |
   | - | - |
   | alert.smtp.useAuth | true |
   | project.smtp.useAuth | true |
   | quota.usage.smtp.useAuth | true |
   | quota.usage.smtp.useStartTLS | false |
   
   </details>
   
   3. After this, I manipulated the settings through UI and I checked that when 
the toggle component was on, the parameter `value` was sent to the API as 
`true`. When the toggle was off, on the other hand, the parameter was sent as 
`false`. 
   
   #### Tests of `*.smtp.enabledSecurityProtocols`
   
   1. When the component is focused, all the available options are displayed to 
the operator.
   
   2. After selecting the desired options and confirming the update, the 
`value` parameter is sent to the API as a white-space separated list with the 
selected values.
   
   3. If no option is selected, `value` is sent as an empty string (`""`).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to