Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Validate inserted values in numeric global settings #10279

Merged

Conversation

bernardodemarco
Copy link
Collaborator

Description

Currently, when changing the Decimal, Number and Range global settings values through the UI, CloudStack does not validate if the inserted values are numeric. Additionally, when letters are entered in the inputs, a message indicating that the setting value was successfully updated is returned to the operators, which does not effectively happen.

Therefore, this PR proposes to verify the values that are entered in those input fields. If non-numeric values are inserted, they will be ignored. Furthermore, it is still possible to use special keys, such as Ctrl and Alt, in order to make use of keyboard shortcuts.

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)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

How Has This Been Tested?

  • Verified that in Decimal and Range global settings it is only possible to enter digits and the period (.) character.
  • Verified that in Number global settings it is only possible to enter digits.
  • Verified that in Decimal, Number and Range global settings it is still possible to make use of keyboard shortcuts with special keys.

@bernardodemarco
Copy link
Collaborator Author

@blueorangutan ui

@blueorangutan
Copy link

@bernardodemarco a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 15.14%. Comparing base (0a77eb7) to head (cf6398f).
Report is 3 commits behind head on 4.19.

Additional details and impacted files
@@            Coverage Diff            @@
##               4.19   #10279   +/-   ##
=========================================
  Coverage     15.14%   15.14%           
- Complexity    11283    11284    +1     
=========================================
  Files          5408     5408           
  Lines        473823   473832    +9     
  Branches      57824    57829    +5     
=========================================
+ Hits          71764    71775   +11     
+ Misses       394037   394033    -4     
- Partials       8022     8024    +2     
Flag Coverage Δ
uitests 4.29% <ø> (-0.01%) ⬇️
unittests 15.87% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blueorangutan
Copy link

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/10279 (QA-JID-533)

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm and tested in QA, one minor nit: the period is not localised (Dutch uses comma ','. and this is not allowed in decimal fields like overprovisioning.

@bernardodemarco
Copy link
Collaborator Author

clgtm and tested in QA, one minor nit: the period is not localised (Dutch uses comma ','. and this is not allowed in decimal fields like overprovisioning.

@DaanHoogland, thanks for testing.

Yes, Portuguese also uses comma. However, the backend has a validation that does not accept it, for example:

(acs-all-in-one) 🙉 > update configuration name="cpu.overprovisioning.factor" value="2,55"
🙈 Error: (HTTP 431, error code 4350) Value [2,55] is not a valid [class java.lang.Float].

@DaanHoogland
Copy link
Contributor

clgtm and tested in QA, one minor nit: the period is not localised (Dutch uses comma ','. and this is not allowed in decimal fields like overprovisioning.

@DaanHoogland, thanks for testing.

Yes, Portuguese also uses comma. However, the backend has a validation that does not accept it, for example:

(acs-all-in-one) 🙉 > update configuration name="cpu.overprovisioning.factor" value="2,55"
🙈 Error: (HTTP 431, error code 4350) Value [2,55] is not a valid [class java.lang.Float].

yes, no issue with this PR for sure, just a remark/not to self to maybe deal with in the future (or not)

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm. Tested and works as expected.

@vishesh92 vishesh92 merged commit 6f03f9e into apache:4.19 Jan 30, 2025
25 checks passed
rg9975 pushed a commit to rg9975/cloudstack that referenced this pull request Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants