Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id AEF3DE00ADD; Mon, 23 Nov 2015 03:42:01 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [74.125.82.48 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 4FF81E0059B for ; Mon, 23 Nov 2015 03:42:00 -0800 (PST) Received: by wmec201 with SMTP id c201so101089235wme.1 for ; Mon, 23 Nov 2015 03:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=t0YUVnlYYwtMdBybtYlG+kcuGvK7jytPrAJ6dJEB6A0=; b=S6z5/SPBsnMzwdniqm/QulHBbdDJv2Kf6XK4nrNJPf04/OcLAxxf7Vqoswncw2Uadk Hzl1AwBzNlymM7Tm+GZ/msM8JbGeNMEHOP4czULqiBwOlhhiJyY4Oz7MqTkfFS4qpQmx ewiWVgYOAWnp+umJMOq1gHpEu4pFY2/0EGkk9yt5iYWnZfLHFFWyRH4J/At5eO2rCgE2 NQx770e6MYIyOVG9rp8tcz3sf6YVAZWQqXapJ3nkkqoTI7ClQKZy0jz4YQA7yvvbCuLc AJOyyDRydXMkrI5ZWZlTX6GitCl+MYyERv695vKGH9U08ZrZg5bOu8qt/2nLJ04Ky02m 8x7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=t0YUVnlYYwtMdBybtYlG+kcuGvK7jytPrAJ6dJEB6A0=; b=ZxxNiW/upMmYLzNSa2osGGIYzoxwe4cp+qtjqx693MWbOqqlqOkfmZtUA7ja8RW/3R WyL7Pg47doU9YNhk7+NW1bwRswVBLoZpcX4836YliRCU9tvfTjO5WfU5sS06msRbVQjs LAf1dFk/d+5WC1EoNFiZ/zIYMXStFS65BcnLGmBG00mKLVzbXT3vVVbzWORHfhddc2Jc 8rnb1Kf5cQ2zZqBAU3xX8itROffxHYvSx5rNVcmDu1Bg1oTWw6zQTxE4bmYdvaR8kXV7 +QOmMDkPl/k9OCbXS69V8lva6N0fPC4RCTVj2S0L/PNG48deeHdrs3svJ1xzJBX2Agyp 7MgA== X-Gm-Message-State: ALoCoQmGX2HmGIgrkvAMrTS9evEt/uspz2PQlSAoXdhJY0RsAx4+eBLhroRXuTGNS4sEJwtgesgH X-Received: by 10.28.96.193 with SMTP id u184mr6874891wmb.64.1448278919074; Mon, 23 Nov 2015 03:41:59 -0800 (PST) Received: from dorado.Home ([90.199.203.61]) by smtp.gmail.com with ESMTPSA id l20sm12918063wmd.20.2015.11.23.03.41.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 03:41:58 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Mon, 23 Nov 2015 11:41:48 +0000 Message-Id: <1448278908-29158-1-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.5.0 Subject: [[PATCH v2]] toaster: projectconf Add feature for free form IMAGE_FSTYPES X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 11:42:01 -0000 Add feature to the projectconf page to allow free form input of IMAGE_FSTYPES. Sometimes a recipe can provide an IMAGE_FSTYPE that isn't in the normal image_types class. So would need to be specified manually. [YOCTO #7828] Signed-off-by: Michael Wood --- .../toaster/toastergui/templates/projectconf.html | 128 +++++++++++++++------ 1 file changed, 95 insertions(+), 33 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html b/bitbake/lib/toaster/toastergui/templates/projectconf.html index 30fd03e..13f9c66 100644 --- a/bitbake/lib/toaster/toastergui/templates/projectconf.html +++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html @@ -36,18 +36,36 @@ IMAGE_FSTYPES -
- {{fstypes}} - -
+ + +
+ + +
+ + {% endif %} {% if image_install_append_defined %} @@ -305,20 +323,41 @@ return true; } - // Test to insure at least one FS Type is checked + var fsTypesInput = $("#new-image-fstype-input"); + var invalidCharsMsg = $("#invalid-chars-in-fstype-msg"); + var fsTypesControl = $("#fstypes-control-validation"); + var noFsType = $('#fstypes-error-message'); + var fsTypesApplyBtn = $("#apply-change-image_fstypes"); + + /* Validation of fstypes */ function enableFsTypesSave() { - var any_checked = 0; - $(".fs-checkbox-fstypes:checked").each(function(){ - any_checked = 1; - }); - if ( 0 == any_checked ) { - $("#apply-change-image_fstypes").attr("disabled","disabled"); - $('#fstypes-error-message').show(); - } - else { - $("#apply-change-image_fstypes").removeAttr("disabled"); - $('#fstypes-error-message').hide(); - } + var valid_input = false; + var valid_checkboxes = false; + var anyChecked = $(".fs-checkbox-fstypes:checked").length; + + /* No underscores allowed */ + if (fsTypesInput.val().match(/\_/)) { + invalidCharsMsg.show(); + fsTypesControl.addClass("error"); + valid_input = false; + } else { + fsTypesControl.removeClass("error"); + invalidCharsMsg.hide(); + valid_input = true; + } + + if (!anyChecked && !fsTypesInput.val()){ + noFsType.show(); + valid_checkboxes = false; + } else { + noFsType.hide(); + valid_checkboxes = true; + } + + if (valid_checkboxes == false || valid_input == false) + fsTypesApplyBtn.attr("disabled","disabled"); + else + fsTypesApplyBtn.removeAttr("disabled"); } // Preset or reset the Package Class checkbox labels @@ -597,17 +636,37 @@ } }); - $('#apply-change-image_fstypes').click(function(){ - // extract the selected fstypes and sort them - var fstypes_array = []; - var checkboxes = document.getElementsByClassName('fs-checkbox-fstypes'); - $(".fs-checkbox-fstypes:checked").each(function(){ - fstypes_array.push($(this).val()); - }); - fstypes_array.sort(); + fsTypesInput.on('input', function(){ + enableFsTypesSave(); + }); + + fsTypesApplyBtn.click(function(e){ + e.preventDefault(); + + var fstypes = ''; + // extract the selected fstypes and sort them + var fstypes_array = []; + var checkboxes = document.getElementsByClassName('fs-checkbox-fstypes'); + $(".fs-checkbox-fstypes:checked").each(function(){ + fstypes_array.push($(this).val()); + }); + fstypes_array.sort(); + + /* If we have a value in our enter own image type input and it + * isn't already selected add it to the fstypes value + */ + if (fsTypesInput.val()){ + var inputFsTypes = fsTypesInput.val().split(" "); + + for (var type in inputFsTypes){ + if (fstypes_array.indexOf(inputFsTypes[type].trim()) === -1) + { + fstypes += inputFsTypes[type]+' '; + } + } + } // now make a string of them - var fstypes = ''; for (var i = 0, length = fstypes_array.length; i < length; i++) { fstypes += fstypes_array[i] + ' '; } @@ -620,6 +679,9 @@ $("#change-image_fstypes-form").slideUp(function() { $('#image_fstypes, #change-image_fstypes-icon').show(); }); + + + fsTypesInput.val(""); }); {% endif %} -- 2.5.0