Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 15387E00B52; Fri, 20 Nov 2015 01:26:34 -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.65 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 7BB3CE00B2E for ; Fri, 20 Nov 2015 01:26:32 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 20 Nov 2015 01:26:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,321,1444719600"; d="scan'208";a="690290417" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga003.jf.intel.com with ESMTP; 20 Nov 2015 01:26:31 -0800 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.163]) by IRSMSX102.ger.corp.intel.com ([169.254.2.251]) with mapi id 14.03.0248.002; Fri, 20 Nov 2015 09:26:29 +0000 From: "Barros Pena, Belen" To: "Wood, Michael G" , "toaster@yoctoproject.org" Thread-Topic: [Toaster] [PATCH] toaster: projectconf Add feature for free form IMAGE_FSTYPES Thread-Index: AQHRI3WIkrg8oQLQnk2WOoTJEfd96A== Date: Fri, 20 Nov 2015 09:26:28 +0000 Message-ID: References: <1447958304-4961-1-git-send-email-michael.g.wood@intel.com> In-Reply-To: <1447958304-4961-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.252.23.209] MIME-Version: 1.0 Subject: Re: [PATCH] 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: Fri, 20 Nov 2015 09:26:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable On 19/11/2015 18:38, "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 works fine overall: the issues below are mostly related to the validation behaviour and the text here and there. * We should remove the placeholder text from the free text input field now that we have a label; the placeholder text of the search field for the known image types should now say: "Search known image types" * The free text field validation is not firing on key up (only on submit). Same happens for the checkboxes for the known image types: validation doesn't seem to kick on click sometimes. For example: 1. Click the 'change' icon for the IMAGE_FSTYPES variable 2. Type 'ext3' in the free text field > You should see the message telling you that the image type is already selected, but the message does not appear until you click 'save'. So, do that. 3. Now deselect the ext3 checkbox in the list of known image types: the message should disappear, but it doesn't do so until you click 'save'. * When a validation message appears we should apply the error styles to the free text input field, so that both the label and the field become red like the error message * The validation message "This image type already exists: select it from the list above." should be replaced with "This image type is already selected in the list above", since you can type the names of existing image types as long as they are not already selected on the list (the point is to prevent you from adding the same one twice inadvertently. If you type the same image type twice in the free text field, well, on your head be it: you are up to something strange). * The validation message: "You must select at least one image type" should be replaced with: "You must select at least one image type.
Choose from the list of known ones or type your own" * Only one validation message can appear below the free text field at any given time. To see what I mean, you can do the following: 1. Click the 'change' icon for the IMAGE_FSTYPES variable 2. Type 'ext3' in the free text field 3. Click 'save' > the "This image type already exists" appears 4. Now deselect all checkboxes in the list of know image types > the "You must select at least one image type" message appears on top of the previous one.=20 The message in 3 above should have disappeared the moment I deselected the checkbox for ext3. Also, the message in 4 should never appear while there are some characters in the free text field. * 'Save' button should always be disabled when there are no checkboxes selected and the free text field is empty. In some cases this doesn't happen. For example: 1. Click the 'change' icon for the IMAGE_FSTYPES variable 2. Deselect all checkboxes > the "You must select at least one image type" message appears 3. Type something in the free text field > the message disappears and the 'save' button is enabled. So far, so good 4. Delete what you typed in the free text field > the 'save' button remains enabled, and if you click you have saved and empty value, which should never happen Thanks! Bel=E9n > >Signed-off-by: Michael Wood >--- > .../toaster/toastergui/templates/projectconf.html | 95 >+++++++++++++++++----- > 1 file changed, 75 insertions(+), 20 deletions(-) > >diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html >b/bitbake/lib/toaster/toastergui/templates/projectconf.html >index 30fd03e..13dde78 100644 >--- a/bitbake/lib/toaster/toastergui/templates/projectconf.html >+++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html >@@ -36,18 +36,35 @@ > 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 image types" class=3D"span4"> >+
>+
>+
>+ >+ placeholder=3D"Add an image type"> >
>- 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 >+

>+

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

>+

id=3D"exists-fstype-msg"> >+ This image type already exists: select it from the >list above. >+

>+
>+ >+ >+
>+ >+
> {% endif %} >=20 > {% if image_install_append_defined %} >@@ -597,17 +614,52 @@ > } > }); >=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(); >+ var fsTypesInput =3D $("#new-image-fstype-input"); >+ var fsTypesApplyBtn =3D $('#apply-change-image_fstypes'); >+ var invalidCharsMsg =3D $("#invalid-chars-in-fstype-msg"); >+ >+ fsTypesInput.on('input', function(){ >+ if ($(this).val()) { >+ fsTypesApplyBtn.removeAttr('disabled'); >+ $("#fstypes-error-message").hide(); >+ } >+ invalidCharsMsg.hide(); >+ }); >+ >+ 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 (fsTypesInput.val().length !=3D=3D 0) { >+ var existsMsg =3D $("#exists-fstype-msg"); >+ >+ /* No whitespace or underscores allowed */ >+ if (fsTypesInput.val().match(/\_/)) { >+ invalidCharsMsg.show(); >+ return; >+ } else { >+ invalidCharsMsg.hide(); >+ } >+ >+ if (fstypes_array.indexOf(fsTypesInput.val()) !=3D=3D -1)= { >+ existsMsg.show(); >+ return; >+ } else { >+ existsMsg.hide(); >+ } >+ >+ fstypes +=3D fsTypesInput.val()+' '; >+ } >=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 +672,9 @@ > $("#change-image_fstypes-form").slideUp(function() { > $('#image_fstypes, >#change-image_fstypes-icon').show(); > }); >+ >+ >+ fsTypesInput.val(""); > }); > {% endif %} >=20 >--=20 >2.1.4 > >--=20 >_______________________________________________ >toaster mailing list >toaster@yoctoproject.org >https://lists.yoctoproject.org/listinfo/toaster