Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id E9538E00D13; Mon, 18 Jul 2016 08:35:57 -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.93 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id E4643E00D03 for ; Mon, 18 Jul 2016 08:35:50 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 18 Jul 2016 08:35:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,384,1464678000"; d="scan'208";a="848515468" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by orsmga003.jf.intel.com with ESMTP; 18 Jul 2016 08:35:48 -0700 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.97]) by IRSMSX152.ger.corp.intel.com ([169.254.6.247]) with mapi id 14.03.0248.002; Mon, 18 Jul 2016 16:35:46 +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: AQHR4QoN6QUAgOnXEkiiYJDbkKMHYA== Date: Mon, 18 Jul 2016 15:35:46 +0000 Message-ID: References: <1468592531-25757-1-git-send-email-elliot.smith@intel.com> In-Reply-To: <1468592531-25757-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.5.160527 x-originating-ip: [10.252.24.164] 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: Mon, 18 Jul 2016 15:35:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: <39754710FC68544CB7905AA17E8C357D@intel.com> Content-Transfer-Encoding: quoted-printable On 15/07/2016 15:22, "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 works nicely. The problem is: I am seeing both the button spinner *and* the loading notification spinner. I guess it should be one or the other: showing both seems overkill. Could we hide loading-notification whenever the spinner inside the button is being shown? Thanks! Bel=E9n > >Signed-off-by: Elliot Smith >--- > .../lib/toaster/toastergui/static/css/default.css | 12 +++++++++ > .../toastergui/static/js/newcustomimage_modal.js | 29 >+++++++++++++++++++--- > .../toastergui/templates/newcustomimage_modal.html | 7 +++++- > 3 files changed, 44 insertions(+), 4 deletions(-) > >diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css >b/bitbake/lib/toaster/toastergui/static/css/default.css >index 0d3570a..96eedfc 100644 >--- a/bitbake/lib/toaster/toastergui/static/css/default.css >+++ b/bitbake/lib/toaster/toastergui/static/css/default.css >@@ -249,6 +249,18 @@ code { color: #333; background-color: transparent; } > /* Style the special no results message in the custom image details page >*/ > [id^=3D"no-results-special-"] > .alert-warning > ol { margin-top: 10px; } >=20 >+/* style the loading spinner in the new custom image dialog */ >+#create-new-custom-image-btn [data-role=3D"loading-state"] { >+ padding-left: 16px; >+} >+ >+/* icon has to be absolutely positioned, otherwise the spin animation >doesn't work */ >+#create-new-custom-image-btn [data-role=3D"loading-state"] .icon-spinner = { >+ position: absolute; >+ left: 26px; >+ bottom: 26px; >+} >+ > /* Style the content of modal dialogs */ > .modal-footer { text-align: left; } > .date-filter-controls { margin-top: 10px; } >diff --git=20 >a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js >b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js >index 8356c02..442fe30 100644 >--- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js >+++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js >@@ -25,7 +25,11 @@ function newCustomImageModalInit(){ > var duplicateNameMsg =3D "An image with this name already exists. Image >names must be unique."; > var duplicateImageInProjectMsg =3D "An image with this name already >exists in this project." > var invalidBaseRecipeIdMsg =3D "Please select an image to customise."; >-=09 >+ >+ // set button to "submit" state and enable text entry so user can >+ // enter the custom recipe name >+ showSubmitState(); >+ > /* capture clicks on radio buttons inside the modal; when one is >selected, > * set the recipe on the modal > */ >@@ -40,6 +44,9 @@ function newCustomImageModalInit(){ > }); >=20 > newCustomImgBtn.click(function(e){ >+ // disable the button and text entry >+ showLoadingState(); >+ > e.preventDefault(); >=20 > var baseRecipeId =3D imgCustomModal.data('recipe'); >@@ -69,12 +76,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(); >@@ -167,6 +191,5 @@ function newCustomImageModalSetRecipes(baseRecipes) { >=20 > // show the radio button container > imageSelector.show(); >- =20 >- }=09 >+ } > } >diff --git=20 >a/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html >b/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html >index 5caa683..d448d3a 100644 >--- a/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html >+++ b/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html >@@ -48,7 +48,12 @@ > >=20 >
>- >+ >
> > >--=20 >2.7.4 > >--=20 >_______________________________________________ >toaster mailing list >toaster@yoctoproject.org >https://lists.yoctoproject.org/listinfo/toaster