Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 05550E00BE3; Tue, 8 Dec 2015 13:17:52 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,URI_NOVOWEL autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.181 listed in list.dnswl.org] * 0.5 URI_NOVOWEL URI: URI hostname has long non-vowel sequence * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 126B9E00B3A for ; Tue, 8 Dec 2015 13:17:13 -0800 (PST) Received: by pfu207 with SMTP id 207so17953367pfu.2 for ; Tue, 08 Dec 2015 13:17:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NYif3/VhWwAiweyb8znvlGkyeiXvJUUqgTAtpMwl/Yk=; b=1sf8nnDZwQGZg889TjfoONvUkWlYU7091t4IC+eRrCgj/+CU77P0OKYICrsL+/GZ99 1izyS3fHeswZ+McpMwBObl5wHYGKgeSqL8feITMLkzaD8mDrRunDIQ6/Z1JoqJKIkwYf 2/Bs84JNJUDc95R5b3EOXfTe7hA+x/wj62jNLIOodZH20vSwW7LvbN1zofiPDxRoXrUD ITm/xUu5iorwqnBEGR2eJARHt/jscDaQjzjnvzTy3wDGbV2SSqHID35+4n/DPftCNHb5 U4bH42jrk2oGsvr9+GnlEYdfq3bhb84dFFo9uiPPogyoKR/QGAui/Kzs8Sn3H8nCJCp5 HxQw== 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=NYif3/VhWwAiweyb8znvlGkyeiXvJUUqgTAtpMwl/Yk=; b=b2MiXRTT3ZdDWNA9sWzJTjovOj73nfAmvHdo1+2IwhcnxXBK5M3+M5n4vTb3uBjG/V OLx6/vHErqoISDvEJu66ihNPy3uwrzmHF+qTKFUqWsJOwbfh1sxiIRxxH2RGXKq4zRhU SdJ3twaMYvtJOZV5ZZn/mX/aE6jGH/9EjuemF9vAZhipgEa7vMKnu+kxiiJJeOi1BPXk TD55ExE8DV+IKfkmQNi+Ar3QV80YVM48jEowT7n7/pu+1Ylx35u0jvM94/PMf+huxSj7 w27uMbwHSW53YTYHGYfv0FWPzX32yIAduk0F5QbdiD1AyEdpNIsfeQFpd+WdYog5ngml TcZQ== X-Gm-Message-State: ALoCoQkllbnZ6IjfRR62HrocXnKfYKqgk1rAu/KPv5F8G1gCqhEZSdysHTG7vFF6o7r+oZ0Cbz+/21PulhWS2CMA5D2rZ5Q5tw== X-Received: by 10.98.12.205 with SMTP id 74mr7855277pfm.53.1449609433337; Tue, 08 Dec 2015 13:17:13 -0800 (PST) Received: from draco.ger.corp.intel.com ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id v64sm6675766pfi.50.2015.12.08.13.17.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 13:17:11 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 8 Dec 2015 21:16:01 +0000 Message-Id: <1449609380-11073-16-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> References: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 15/34] toaster: Continue front end features to custom image recipe page. 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, 08 Dec 2015 21:17:52 -0000 Continuation of the work on the custom image recipe page, this brings in: - Basic notification of having added/removed a package. - Connect up Build button - Download recipe feature - No packages states - Project bread crumb - Display additional recipe metadata - Update accessors for recipe object inheritance changes [YOCTO #8082] Signed-off-by: Michael Wood --- .../toaster/toastergui/static/js/customrecipe.js | 34 +++-- .../toaster/toastergui/templates/customrecipe.html | 146 ++++++++++++--------- .../toastergui/templates/pkg_add_rm_btn.html | 4 +- 3 files changed, 114 insertions(+), 70 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js index 4f6b304..4cd9382 100644 --- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js +++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js @@ -3,6 +3,7 @@ function customRecipePageInit(ctx) { var urlParams = libtoaster.parseUrlParams(); + var customiseTable = $("#selectpackagestable"); (function notificationRequest(){ if (urlParams.hasOwnProperty('notify') && urlParams.notify === 'new'){ @@ -10,7 +11,7 @@ function customRecipePageInit(ctx) { } })(); - $("#recipeselection").on('table-done', function(e, total, tableParams){ + customiseTable.on('table-done', function(e, total, tableParams){ /* Table is done so now setup the click handler for the package buttons */ $(".add-rm-package-btn").click(function(e){ e.preventDefault(); @@ -21,30 +22,45 @@ function customRecipePageInit(ctx) { function addRemovePackage(pkgBtn, tableParams){ var pkgBtnData = pkgBtn.data(); var method; - var buttonToShow; + var msg = "You have "; if (pkgBtnData.directive == 'add') { method = 'PUT'; - buttonToShow = '#package-rm-btn-' + pkgBtnData.package; + msg += "added 1 package to "+ctx.recipe.name+":"; } else if (pkgBtnData.directive == 'remove') { method = 'DELETE'; - buttonToShow = '#package-add-btn-' + pkgBtnData.package; + msg += "removed 1 package from "+ctx.recipe.name+":"; } else { throw("Unknown package directive: should be add or remove"); } + msg += ' ' + pkgBtnData.name + ''; + $.ajax({ type: method, url: pkgBtnData.packageUrl, headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, success: function(data){ - /* Invalidate the Add | Rm package table's current cache */ + if (data.error !== 'ok'){ + console.warn(data.error); + return; + } + /* Reload and Invalidate the Add | Rm package table's current data */ tableParams.nocache = true; - $.get(ctx.tableApiUrl, tableParams); - /* Swap the buttons around */ - pkgBtn.hide(); - $(buttonToShow).show(); + customiseTable.trigger('reload', [tableParams]); + + libtoaster.showChangeNotification(msg); } }); } + + /* Trigger a build of your custom image */ + $(".build-custom-image").click(function(){ + libtoaster.startABuild(libtoaster.ctx.projectBuildsUrl, + libtoaster.ctx.projectId, + ctx.recipe.name, + function(){ + window.location.replace(libtoaster.ctx.projectBuildsUrl); + }); + }); } diff --git a/bitbake/lib/toaster/toastergui/templates/customrecipe.html b/bitbake/lib/toaster/toastergui/templates/customrecipe.html index 823bbd8..743625c 100644 --- a/bitbake/lib/toaster/toastergui/templates/customrecipe.html +++ b/bitbake/lib/toaster/toastergui/templates/customrecipe.html @@ -4,13 +4,29 @@ {% load static %} {% block pagecontent %} -{% include "projecttopbar.html" %} +
+ +