Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 64570E00CD8; Wed, 16 Sep 2015 04:32:33 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.212.178 listed in list.dnswl.org] Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id A84A9E00BF6 for ; Wed, 16 Sep 2015 04:32:30 -0700 (PDT) Received: by wicfx3 with SMTP id fx3so65977403wic.0 for ; Wed, 16 Sep 2015 04:32:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4wxkr3n3s4NHUVZq6W21UsaesEoiNWUqweX/TLtYMzU=; b=XkCZK5U4J9+65HLKaR32jEvGqdAXdhnTd8jgOv3f7gG7o3HFTa5Dxd98f0eIVeOvxP MBX8AwuY0vyARGdcBzYCUP+G0DfOt548TSTg0dl9lvvQ+y9DgisbLPGhjzyejdSs7ZaM KhBLGjCHAvy8L/MayhoXjEdCdhvwiNTZPAHH8FccOAl9UbRP9py9D/UMcY32AHLQM14E DuLWv9RxUv4Xku1WlvjANtiTYSQn0f+dJp+NJW+AcpiGZwidxGg2JpH+iAR8ik+p0QWI htx33I/TttcF/P4ulyczb8lMbg9cFSHIlf/vX2Ra92iUu6JJBxf1CnakfiunqTV4/ixV P8ew== X-Gm-Message-State: ALoCoQkLgG8JhK/Tqi2BLylSxMCYbjW8r93pVTdWbL2u2Bnyh66Z7Kr6larvzrhjJfi6FcHCB9DL X-Received: by 10.194.95.71 with SMTP id di7mr52241631wjb.125.1442403149210; Wed, 16 Sep 2015 04:32:29 -0700 (PDT) Received: from draco.icx.intel.com ([83.217.123.106]) by smtp.gmail.com with ESMTPSA id uc12sm4044276wib.13.2015.09.16.04.32.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Sep 2015 04:32:28 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Wed, 16 Sep 2015 12:32:24 +0100 Message-Id: <1442403144-6452-1-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442243364-14257-3-git-send-email-elliot.smith@intel.com> References: <1442243364-14257-3-git-send-email-elliot.smith@intel.com> Subject: [PATCH] toaster: layerdetails Fix back button tab behaviour 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: Wed, 16 Sep 2015 11:32:33 -0000 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 --- .../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