Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 0B9D1E00B76; Tue, 24 Nov 2015 05:26:45 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.20 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 10045E00B46 for ; Tue, 24 Nov 2015 05:26:43 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 24 Nov 2015 05:26:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,338,1444719600"; d="scan'208";a="1548833" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by fmsmga004.fm.intel.com with ESMTP; 24 Nov 2015 05:26:39 -0800 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.163]) by IRSMSX154.ger.corp.intel.com ([169.254.12.98]) with mapi id 14.03.0248.002; Tue, 24 Nov 2015 13:26:34 +0000 From: "Barros Pena, Belen" To: "Wood, Michael G" , "toaster@yoctoproject.org" Thread-Topic: [Toaster] [[PATCH v2]] toaster: projectconf Add feature for free form IMAGE_FSTYPES Thread-Index: AQHRJru9iI/iX5UAfkWVytSaQPSPuQ== Date: Tue, 24 Nov 2015 13:26:34 +0000 Message-ID: References: <1448278908-29158-1-git-send-email-michael.g.wood@intel.com> In-Reply-To: <1448278908-29158-1-git-send-email-michael.g.wood@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.5.7.151005 x-originating-ip: [10.237.224.34] MIME-Version: 1.0 Subject: Re: [[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: Tue, 24 Nov 2015 13:26:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable On 23/11/2015 11:41, "toaster-bounces@yoctoproject.org on behalf of Michael Wood" wrote: >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] This seems to address all the issues from v1. Getting rid the 'already selected' error message by not duplicating any values works well. From my perspective, this is good to go. Thanks! Bel=E9n > >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 @@ > js-config-var-managed-name">IMAGE_FSTYPES > root file system images that you want to have created
href=3D'http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#= va >r-IMAGE_FSTYPES' target=3D'_blank'>Read more in the manual">
> >-
>- {{fstypes}} >- id=3D"change-image_fstypes-icon"> >-
style=3D"display:none;"> >- placeholder=3D"Search image types" class=3D"span4"> >-
>+
>+ {{fstypes}} >+ <= /i> >+ >+ >+ placeholder=3D"Search known image types" class=3D"span4"> >+
>+
>+
>+ id=3D"fstypes-control-validation"> >+ >+ >+ >+ >
>- id=3D"fstypes-error-message">You must select at least one image type >- >- >- >-
>+

id=3D"fstypes-error-message"> >+ You must select at least one image type.
>+ Choose from the list of known ones or type your >own. >+

>+

id=3D"invalid-chars-in-fstype-msg"> >+ A valid image type cannot include underscores. >+

>+
>+ >+ >+
>+ >+
> {% endif %} >=20 > {% if image_install_append_defined %} >@@ -305,20 +323,41 @@ > return true; > } >=20 >- // Test to insure at least one FS Type is checked >+ var fsTypesInput =3D $("#new-image-fstype-input"); >+ var invalidCharsMsg =3D $("#invalid-chars-in-fstype-msg"); >+ var fsTypesControl =3D $("#fstypes-control-validation"); >+ var noFsType =3D $('#fstypes-error-message'); >+ var fsTypesApplyBtn =3D $("#apply-change-image_fstypes"); >+ >+ /* Validation of fstypes */ > function enableFsTypesSave() { >- var any_checked =3D 0; >- $(".fs-checkbox-fstypes:checked").each(function(){ >- any_checked =3D 1; >- }); >- if ( 0 =3D=3D any_checked ) { >- =20 >$("#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 =3D false; >+ var valid_checkboxes =3D false; >+ var anyChecked =3D $(".fs-checkbox-fstypes:checked").length; >+ >+ /* No underscores allowed */ >+ if (fsTypesInput.val().match(/\_/)) { >+ invalidCharsMsg.show(); >+ fsTypesControl.addClass("error"); >+ valid_input =3D false; >+ } else { >+ fsTypesControl.removeClass("error"); >+ invalidCharsMsg.hide(); >+ valid_input =3D true; >+ } >+ >+ if (!anyChecked && !fsTypesInput.val()){ >+ noFsType.show(); >+ valid_checkboxes =3D false; >+ } else { >+ noFsType.hide(); >+ valid_checkboxes =3D true; >+ } >+ >+ if (valid_checkboxes =3D=3D false || valid_input =3D=3D false) >+ fsTypesApplyBtn.attr("disabled","disabled"); >+ else >+ fsTypesApplyBtn.removeAttr("disabled"); > } >=20 > // Preset or reset the Package Class checkbox labels >@@ -597,17 +636,37 @@ > } > }); >=20 >- $('#apply-change-image_fstypes').click(function(){ >- // extract the selected fstypes and sort them >- var fstypes_array =3D []; >- var checkboxes =3D >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 =3D ''; >+ // extract the selected fstypes and sort them >+ var fstypes_array =3D []; >+ var checkboxes =3D >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 =3D fsTypesInput.val().split(" "); >+ >+ for (var type in inputFsTypes){ >+ if (fstypes_array.indexOf(inputFsTypes[type].trim()) >=3D=3D=3D -1) >+ { >+ fstypes +=3D inputFsTypes[type]+' '; >+ } >+ } >+ } >=20 > // now make a string of them >- var fstypes =3D ''; > for (var i =3D 0, length =3D fstypes_array.length; i < >length; i++) { > fstypes +=3D fstypes_array[i] + ' '; > } >@@ -620,6 +679,9 @@ > $("#change-image_fstypes-form").slideUp(function() { > $('#image_fstypes, >#change-image_fstypes-icon').show(); > }); >+ >+ >+ fsTypesInput.val(""); > }); > {% endif %} >=20 >--=20 >2.5.0 > >--=20 >_______________________________________________ >toaster mailing list >toaster@yoctoproject.org >https://lists.yoctoproject.org/listinfo/toaster