[Kimchi-devel] [PATCH][Kimchi] Fix typo and integer values validation in Guest edit UI

Socorro Stoppler socorro at linux.vnet.ibm.com
Tue Apr 26 15:18:59 UTC 2016


Reviewed-by: Socorro Stoppler <socorro at linux.vnet.ibm.com>
Tested-by: Socorro Stoppler <socorro at linux.vnet.ibm.com>

On 04/26/2016 07:50 AM, Rodrigo Trujillo wrote:
> - UI was measuring string values instead of integer values, this was
>    causing errors;
> - Changes typo in error return: thEn by thAn.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.guest_edit_main.js | 4 ++--
>   ui/pages/i18n.json.tmpl             | 4 ++--
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
> index ef6d650..66edbcb 100644
> --- a/ui/js/src/kimchi.guest_edit_main.js
> +++ b/ui/js/src/kimchi.guest_edit_main.js
> @@ -746,14 +746,14 @@ kimchi.guest_edit_main = function() {
>           }
>
>           // Test memory values before submit. Avoid requests we know are going to fail
> -        if ($('#guest-edit-memory-textbox').val() > $('#guest-edit-max-memory-textbox').val()) {
> +        if (parseInt($('#guest-edit-memory-textbox').val()) > parseInt($('#guest-edit-max-memory-textbox').val())) {
>               wok.message.error(i18n['KCHVM0002E'], '#alert-modal-container');
>               $(saveButton).prop('disabled', false);
>               return;
>           }
>
>           // Test CPU values before submit. Avoid requests we know are going to fail
> -        if ($('#guest-edit-cores-textbox').val() > $('#guest-edit-max-processor-textbox').val()) {
> +        if (parseInt($('#guest-edit-cores-textbox').val()) > parseInt($('#guest-edit-max-processor-textbox').val())) {
>               wok.message.error(i18n['KCHVM0003E'], '#alert-modal-container');
>               $(saveButton).prop('disabled', false);
>               return;
> diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
> index cb7b2a8..8da568a 100644
> --- a/ui/pages/i18n.json.tmpl
> +++ b/ui/pages/i18n.json.tmpl
> @@ -66,8 +66,8 @@
>       "KCHVM6009M": "$_("This virtual machine is not persistent. Power Off will delete it. Continue?")",
>
>       "KCHVM0001E": "$_("Input is not a number")",
> -    "KCHVM0002E": "$_("Memory value cannot be higher then Max Memory value")",
> -    "KCHVM0003E": "$_("Current CPUs value cannot be higher then Max CPU value")",
> +    "KCHVM0002E": "$_("Memory value cannot be higher than Max Memory value")",
> +    "KCHVM0003E": "$_("Current CPUs value cannot be higher than Max CPU value")",
>
>       "KCHVMCD6001M": "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")",
>       "KCHVMCD6003M": "$_("Attaching...")",




More information about the Kimchi-devel mailing list