Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 8A115E00B20; Thu, 26 Nov 2015 07:00:36 -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 * [192.55.52.115 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 4D37FE00ADF for ; Thu, 26 Nov 2015 07:00:34 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 26 Nov 2015 07:00:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,347,1444719600"; d="scan'208";a="860302365" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by fmsmga002.fm.intel.com with ESMTP; 26 Nov 2015 07:00:33 -0800 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.163]) by IRSMSX152.ger.corp.intel.com ([169.254.6.143]) with mapi id 14.03.0248.002; Thu, 26 Nov 2015 15:00:30 +0000 From: "Barros Pena, Belen" To: "Smith, Elliot" Thread-Topic: [Toaster] [[PATCH v2]] toaster: projectconf Add feature for free form IMAGE_FSTYPES Thread-Index: AQHRJru9iI/iX5UAfkWVytSaQPSPuZ6uX+EAgAAJCIA= Date: Thu, 26 Nov 2015 15:00:29 +0000 Message-ID: References: <1448278908-29158-1-git-send-email-michael.g.wood@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.5.8.151023 x-originating-ip: [10.237.224.34] MIME-Version: 1.0 Cc: "toaster@yoctoproject.org" 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: Thu, 26 Nov 2015 15:00:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: <71D233CE2157E341A73603D0AD9434EC@intel.com> Content-Transfer-Encoding: quoted-printable On 26/11/2015 14:28, "Smith, Elliot" wrote: >On 24 November 2015 at 13:26, Barros Pena, Belen > wrote: > >On 23/11/2015 11:41, "toaster-bounces@yoctoproject.org on behalf of >Michael Wood" michael.g.wood@intel.com> 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. > > > > >It works correctly, but there is one issue: if you enter an invalid >string as the image type (e.g. btrfss) and want to correct it, there's no >way to delete it from the list. Heh, well spotted. Didn't think of this one :/ > > >Perhaps a button to set the list back to the defaults, or to remove any >invalid types ("cleanup")? This would be a possible solution, but it seems a bit clunky when you just want to remove an extra 's' from an image type that you typed by mistake. > > >Alternatively, add the user's custom image type to the checkbox list; if >they uncheck it, is disappears from the list. This was the initial solution, but having it disappearing from the list when you unchecked it is not the behaviour you expect from checkboxes, and it does feel quite weird. A solution would be to store the value you type in the free text field somewhere, so that it appears back there when you click the 'change' button and you can edit it. I know we cannot store the value in the database (the list of image types is currently hardcoded in views.py), but maybe it's enough to store it for the session. You are bound to realise quite soon if you typed something wrong. Michael: is this possible? Thanks! Bel=E9n > > >Elliot >=20 > > 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= #v >>a >>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}} >>+ = >>+ >style=3D"display:none;"> >>+ >>+ >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 %} >> >> {% if image_install_append_defined %} >>@@ -305,20 +323,41 @@ >> return true; >> } >> >>- // 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 ) { >>- >>$("#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"); >> } >> >> // 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 =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]+' '; >>+ } >>+ } >>+ } >> >> // 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 %} >> >>-- >>2.5.0 >> >>-- >>_______________________________________________ >>toaster mailing list >>toaster@yoctoproject.org >>https://lists.yoctoproject.org/listinfo/toaster > >-- >_______________________________________________ >toaster mailing list >toaster@yoctoproject.org >https://lists.yoctoproject.org/listinfo/toaster > > > > > > > > > >--=20 >Elliot Smith >Software Engineer >Intel Open Source Technology Centre > > > >