]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: insure IMAGE_INSTALL_append values have a space prefix
authorDavid Reyna <David.Reyna@windriver.com>
Thu, 12 Mar 2015 23:56:12 +0000 (16:56 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 21 Mar 2015 00:00:02 +0000 (00:00 +0000)
When the IMAGE_INSTALL_append value is not empty, it must have a space prefix
in order for the "append" operator to concatenate the values correctly, so we
enforce it in this variable's submit javascript.

[YOCTO #7394]

Signed-off-by: David Reyna <David.Reyna@windriver.com>
lib/toaster/toastergui/templates/projectconf.html

index ffdf760dab3795832638216f33b0ff95a3287acc..d8ead8199b888ffd600cb976b7fec6c97481d2e7 100644 (file)
             // re-assert the event handlers
         }
 
-       /* ensure cookie exists {% csrf_token %} */
+        /* ensure cookie exists {% csrf_token %} */
         function postEditAjaxRequest(reqdata) {
             var ajax = $.ajax({
                     type:"POST",
             // change IMAGE_INSTALL_append variable
             $('#change-image_install-icon').click(function() {
                 // preset the edit value
-                var current_val = $("span#image_install").text();
+                var current_val = $("span#image_install").text().trim();
                 if (current_val == "Not set") {
                     current_val="";
                     $("#apply-change-image_install").attr("disabled","disabled");
+                } else {
+                    // insure these non-empty values have single space prefix
+                    current_val=" " + current_val;
                 }
                 $("input#new-image_install").val(current_val);
 
             });
 
             $("#new-image_install").on('input', function(){
-                if ($(this).val().length == 0) {
+                if ($(this).val().trim().length == 0) {
                     $("#apply-change-image_install").attr("disabled","disabled");
                 }
                 else {
             });
 
             $('#apply-change-image_install').click(function(){
-                var name = $('#new-image_install').val();
-                postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+name});
-                $('#image_install').text(name);
+                // insure these non-empty values have single space prefix
+                var value = " " + $('#new-image_install').val().trim();
+                postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+value});
+                $('#image_install').text(value);
                 $('#image_install').removeClass('muted');
                 $("#change-image_install-form").slideUp(function () {
                     $('#image_install, #change-image_install-icon').show();
-                    if (name.length > -1) {
+                    if (value.length > -1) {
                         $('#delete-image_install-icon').show();
                         setDeleteTooltip($('#delete-image_install-icon'));
                     }