Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 8860DE00B1E; Tue, 24 May 2016 04:12:41 -0700 (PDT) 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 46221E00B04 for ; Tue, 24 May 2016 04:12:37 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 24 May 2016 04:12:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,359,1459839600"; d="scan'208";a="987587529" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by fmsmga002.fm.intel.com with ESMTP; 24 May 2016 04:12:33 -0700 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.117]) by irsmsx105.ger.corp.intel.com ([169.254.7.27]) with mapi id 14.03.0248.002; Tue, 24 May 2016 12:12:30 +0100 From: "Barros Pena, Belen" To: "Smith, Elliot" , "toaster@yoctoproject.org" Thread-Topic: [Toaster] [PATCH] toaster: show loading spinner after creating custom image Thread-Index: AQHRta0plAUU7A6CiUu9QESJchJq7g== Date: Tue, 24 May 2016 11:12:29 +0000 Message-ID: References: <1464019696-22832-1-git-send-email-elliot.smith@intel.com> In-Reply-To: <1464019696-22832-1-git-send-email-elliot.smith@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.6.4.160422 x-originating-ip: [10.237.224.34] MIME-Version: 1.0 Subject: Re: [PATCH] toaster: show loading spinner after creating custom image 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 May 2016 11:12:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: <937902F888D1674E8CBDB3D6A59A672E@intel.com> Content-Transfer-Encoding: quoted-printable On 23/05/2016 17:08, "toaster-bounces@yoctoproject.org on behalf of Elliot Smith" wrote: >Creating a custom image through the "New custom image" dialog >can sometimes result in a long pause between pressing the button >to create the image, and being transferred to the page showing >details of its content. This can make it appear as though pressing >the button had no effect. > >To prevent this from happening, disable the button and text box >in the new custom image dialog after the "Create image" button is >pressed. Also show a loading spinner and "loading..." text on >the button to make it clear that the application is still responding. > >[YOCTO #9475] This looks ok to me. Thanks! Bel=E9n > >Signed-off-by: Elliot Smith >--- > .../lib/toaster/toastergui/static/css/default.css | 10 ++++++++++ > .../toastergui/static/js/newcustomimage_modal.js | 22 >++++++++++++++++++++++ > .../toastergui/templates/newcustomimage_modal.html | 7 ++++++- > 3 files changed, 38 insertions(+), 1 deletion(-) > >diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css >b/bitbake/lib/toaster/toastergui/static/css/default.css >index b024d96..07c1078 100644 >--- a/bitbake/lib/toaster/toastergui/static/css/default.css >+++ b/bitbake/lib/toaster/toastergui/static/css/default.css >@@ -294,6 +294,16 @@ thead .add-del-layers { width: 124px; } > box-shadow: 0 0 10px #3a87ad; > } >=20 >+/* position loading spinner and text in create custom image dialog */ >+#create-new-custom-image-btn [data-role=3D"loading-state"] { >+ padding-left: 10px; >+} >+ >+#create-new-custom-image-btn [data-role=3D"loading-state"] .icon-spinner = { >+ position: absolute; >+ left: 26px; >+} >+ > /* Copied in from newer version of Font-Awesome 4.3.0 */ > .fa-spin { > -webkit-animation: fa-spin 2s infinite linear; >diff --git=20 >a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js >b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js >index cb9ed4d..a9a0ddd 100644 >--- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js >+++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js >@@ -26,6 +26,9 @@ function newCustomImageModalInit(){ > var duplicateImageInProjectMsg =3D "An image with this name already >exists in this project." > var invalidBaseRecipeIdMsg =3D "Please select an image to customise."; >=20 >+ // set button to "show submit state" and enable text entry >+ showSubmitState(); >+ > // capture clicks on radio buttons inside the modal; when one is >selected, > // set the recipe on the modal > imgCustomModal.on("click", "[name=3D'select-image']", function (e) { >@@ -36,6 +39,8 @@ function newCustomImageModalInit(){ > }); >=20 > newCustomImgBtn.click(function(e){ >+ showLoadingState(); >+ > e.preventDefault(); >=20 > var baseRecipeId =3D imgCustomModal.data('recipe'); >@@ -62,12 +67,29 @@ function newCustomImageModalInit(){ > } > } else { > imgCustomModal.modal('hide'); >+ imgCustomModal.one('hidden.bs.modal', showSubmitState); > window.location.replace(ret.url + '?notify=3Dnew'); > } > }); > } > }); >=20 >+ // enable text entry, show "Create image" button text >+ function showSubmitState() { >+ newCustomImgBtn.find('[data-role=3D"loading-state"]').hide(); >+ newCustomImgBtn.find('[data-role=3D"submit-state"]').show(); >+ newCustomImgBtn.removeAttr('disabled'); >+ nameInput.removeAttr('disabled'); >+ } >+ >+ // disable text entry, show "Creating image..." button text >+ function showLoadingState() { >+ newCustomImgBtn.find('[data-role=3D"submit-state"]').hide(); >+ newCustomImgBtn.find('[data-role=3D"loading-state"]').show(); >+ newCustomImgBtn.attr('disabled', 'disabled'); >+ nameInput.attr('disabled', 'disabled'); >+ } >+ > function showNameError(text){ > invalidNameHelp.text(text); > invalidNameHelp.show(); >diff --git=20 >a/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html >b/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html >index caeb302..1d7cbd4 100644 >--- a/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html >+++ b/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html >@@ -43,6 +43,11 @@ > >=20 >
>- >+ >
> >--=20 >1.9.3 > >--------------------------------------------------------------------- >Intel Corporation (UK) Limited >Registered No. 1134945 (England) >Registered Office: Pipers Way, Swindon SN3 1RJ >VAT No: 860 2173 47 > >This e-mail and any attachments may contain confidential material for >the sole use of the intended recipient(s). Any review or distribution >by others is strictly prohibited. If you are not the intended >recipient, please contact the sender and delete all copies. > >--=20 >_______________________________________________ >toaster mailing list >toaster@yoctoproject.org >https://lists.yoctoproject.org/listinfo/toaster