[Toaster] [PATCH] toaster: layerdetails Fix back button tab behaviour
Smith, Elliot
elliot.smith at intel.com
Mon Sep 21 01:35:17 PDT 2015
Hello Brian.
This is because Toaster does some redirects internally which aren't fixed
by this patch (they would require some substantial refactoring which can't
really be done while the image customisation branch is pending, as the IC
branch changes views.py significantly).
What happens is that Toaster uses RedirectExceptions to control transitions
between some pages, but not pages using ToasterTables. Bug 8252 only refers
to ToasterTable back button behaviour, not the behaviour of these other
pages. I think we need a separate "refactor all pages which don't use
ToasterTable" issue for those; I'll raise it.
Elliot
On 20 September 2015 at 21:27, Brian Avery <avery.brian at gmail.com> wrote:
> Hi,
>
> I'm confused. If I Navigate as follows, it fails (i think):
> start: http://192.168.168.66:8005/toastergui/project/2/
> click Recipes, takes me to :
>
> http://192.168.168.66:8005/toastergui/project/2/recipes/?limit=25&page=1&orderby=name&
> click Back , takes me to :
> http://192.168.168.66:8005/toastergui/project/2/recipes/
> click Back again, takes me to:
> http://192.168.168.66:8005/toastergui/project/2/
> click Forward, takes me to:
>
> http://192.168.168.66:8005/toastergui/project/2/recipes/?limit=25&page=1&orderby=name&
> click Back, takes me to:
> http://192.168.168.66:8005/toastergui/project/2/recipes/
> click Back again, takes me to:
> http://192.168.168.66:8005/toastergui/project/2/
>
> ---
>
> Seems like 1 forward == two backs. Is it my browser is chrome on the
> mac, though I saw the same behaviour with firefox on ubuntu.
>
> -b
>
> On Wed, Sep 16, 2015 at 4:32 AM, Michael Wood <michael.g.wood at intel.com>
> wrote:
> > This completes the behaviour fix of the back button in the layerdetails
> > page as we not only have parameters in our history we also have the hash
> > to indicate which tab is active. As we pop our history we need to show
> > the corresponding tab.
> >
> > [YOCTO #8252]
> >
> > Signed-off-by: Michael Wood <michael.g.wood at intel.com>
> > ---
> > .../toaster/toastergui/static/js/layerdetails.js | 28
> ++++++++++++++++++----
> > 1 file changed, 23 insertions(+), 5 deletions(-)
> >
> > diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
> b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
> > index 000e803..8817b47 100644
> > --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
> > +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
> > @@ -7,6 +7,9 @@ function layerDetailsPageInit (ctx) {
> > var layerDepsList = $("#layer-deps-list");
> > var currentLayerDepSelection;
> > var addRmLayerBtn = $("#add-remove-layer-btn");
> > + var targetTab = $("#targets-tab");
> > + var machineTab = $("#machines-tab");
> > + var detailsTab = $("#details-tab");
> >
> > /* setup the dependencies typeahead */
> > libtoaster.makeTypeahead(layerDepInput,
> libtoaster.ctx.layersTypeAheadUrl, { include_added: "true" },
> function(item){
> > @@ -15,6 +18,21 @@ function layerDetailsPageInit (ctx) {
> > layerDepBtn.removeAttr("disabled");
> > });
> >
> > + $(window).on('hashchange', function(e){
> > + switch(window.location.hash){
> > + case '#machines':
> > + machineTab.tab('show');
> > + break;
> > + case '#recipes':
> > + targetTab.tab('show');
> > + break;
> > + default:
> > + detailsTab.tab('show');
> > + break;
> > + }
> > + });
> > +
> > +
> > $(".breadcrumb li:first a").click(function(e){
> > e.preventDefault();
> > /* By default this link goes to the project configuration page.
> However
> > @@ -143,7 +161,7 @@ function layerDetailsPageInit (ctx) {
> > addRmLayerBtn.removeClass("btn-danger");
> > }
> >
> > - $("#details-tab").on('show', function(){
> > + detailsTab.on('show', function(){
> > if (!ctx.layerVersion.inCurrentPrj)
> > defaultAddBtnText();
> >
> > @@ -174,7 +192,7 @@ function layerDetailsPageInit (ctx) {
> > $("#no-recipes-yet").hide();
> > }
> >
> > - $("#targets-tab").removeClass("muted");
> > + targetTab.removeClass("muted");
> > if (window.location.hash === "#recipes"){
> > /* re run the machinesTabShow to update the text */
> > targetsTabShow();
> > @@ -189,7 +207,7 @@ function layerDetailsPageInit (ctx) {
> > else
> > $("#no-machines-yet").hide();
> >
> > - $("#machines-tab").removeClass("muted");
> > + machineTab.removeClass("muted");
> > if (window.location.hash === "#machines"){
> > /* re run the machinesTabShow to update the text */
> > machinesTabShow();
> > @@ -202,7 +220,7 @@ function layerDetailsPageInit (ctx) {
> >
> > });
> >
> > - $("#targets-tab").on('show', targetsTabShow);
> > + targetTab.on('show', targetsTabShow);
> >
> > function machinesTabShow(){
> > if (!ctx.layerVersion.inCurrentPrj) {
> > @@ -219,7 +237,7 @@ function layerDetailsPageInit (ctx) {
> > window.location.hash = "machines";
> > }
> >
> > - $("#machines-tab").on('show', machinesTabShow);
> > + machineTab.on('show', machinesTabShow);
> >
> > $(".pagesize").change(function(){
> > var search = libtoaster.parseUrlParams();
> > --
> > 2.1.4
> >
> > --
> > _______________________________________________
> > toaster mailing list
> > toaster at yoctoproject.org
> > https://lists.yoctoproject.org/listinfo/toaster
> --
> _______________________________________________
> toaster mailing list
> toaster at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster
>
--
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/toaster/attachments/20150921/1ee84627/attachment.html>
More information about the toaster
mailing list