Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 83AE6E00D68; Thu, 22 Sep 2016 09:56: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=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW 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.220.44 listed in list.dnswl.org] * -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-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 12F4FE00B1A for ; Thu, 22 Sep 2016 09:56:23 -0700 (PDT) Received: by mail-pa0-f44.google.com with SMTP id qn7so13569594pac.3 for ; Thu, 22 Sep 2016 09:56:23 -0700 (PDT) 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=+h3aRaRDOMLiv/4SGfKUx/DGqqcrvP/Plj0D7UnGqmY=; b=OsJzdnDway/jYbRejDumcjPI1/bfkhREVWo+hIGDIKDBIH1TG7BQ21GnC9B8hVt4Yh Zrbx3Id5qlJvu+QKI4deo6Sm796wjRJqFETZcDRIcwA089RRdD+efxytBDVYL0Bw0k48 GGZkHqXWRAOFjnZUFl8cjflBOQA4K1rkTXXBAqrko+2AL7WXhSo/9bd8DEUgDl6CftTk bVL9CkHRwEI0yZ6W+swo45HZ0JpgUNMj5DMWAvvEAFxAupmSH0CnPukl7d0aME2xmyOd 3t5+YF0k/FKIGdjcb+JKhY0SF1WlwMVM1+sZBBEb6YoTp1bjBQVBtx3GX0wTx9G7QcuH Yleg== 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=+h3aRaRDOMLiv/4SGfKUx/DGqqcrvP/Plj0D7UnGqmY=; b=iXCli/BZTuW2+e4RdRgnm+ucvTGMvlaSCAnB7DI4S8UVWjpI9KWT7uYFctcEo1+TYl 1bAg2XJGL7nVYSgve7sOvZtTaFDQ3u5rqEyjbyk5OGIoqdxzr4zS6LasZMNp5VIDXwFa OPPxGVsCrhSbNV5utg/x2q8axIZfkXN6QxDxTUi1Z24mtqVNkIdnAn5atToKS1VGQUwD Zh1Q2Fm7CdTpTsH/jHbMDQzsEIkvpu+RJjcBWb/YV3mf/Hee4qQ0pdqrfa5790tWetkw yFGCkaJAqVKQEOCK7k9Kyo7Km+75U0TagMf4LaBqDwYRL+0Tvx1AaYQClzeEsM8R3A/B x7/g== X-Gm-Message-State: AE9vXwNsdmmXVnzUN/WvArNvxu3IMJzXH4w6B7VZKhKW+Qgl61hWXD3NIJ0IaRU80j3ksaNm X-Received: by 10.66.164.227 with SMTP id yt3mr4931026pab.117.1474563383289; Thu, 22 Sep 2016 09:56:23 -0700 (PDT) Received: from orion.ger.corp.intel.com ([192.55.55.41]) by smtp.gmail.com with ESMTPSA id uj8sm5458889pab.5.2016.09.22.09.56.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Sep 2016 09:56:22 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Thu, 22 Sep 2016 17:55:53 +0100 Message-Id: <1474563354-11878-10-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474563354-11878-1-git-send-email-michael.g.wood@intel.com> References: <1474563354-11878-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 09/10] toaster: customrecipe Add frontend feature to delete custom image recipe 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: Thu, 22 Sep 2016 16:56:41 -0000 [YOCTO #8132] Signed-off-by: Michael Wood --- .../toaster/toastergui/static/js/customrecipe.js | 32 ++++++++++++++++++++ .../toaster/toastergui/templates/customrecipe.html | 35 +++++++++++++++++++--- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js index 505a81c..9ea9602 100644 --- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js +++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js @@ -281,4 +281,36 @@ function customRecipePageInit(ctx) { window.location.replace(libtoaster.ctx.projectBuildsUrl); }); }); + + $("#delete-custom-recipe-confirmed").click(function(e){ + e.preventDefault(); + libtoaster.disableAjaxLoadingTimer(); + $(this).find('[data-role="submit-state"]').hide(); + $(this).find('[data-role="loading-state"]').show(); + $(this).attr("disabled", "disabled"); + + $.ajax({ + type: 'DELETE', + url: ctx.recipe.xhrCustomRecipeUrl, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function (data) { + if (data.error !== "ok") { + console.warn(data.error); + } else { + var msg = $('You have deleted 1 custom image: '); + msg.find("#deleted-custom-image-name").text(ctx.recipe.name); + + libtoaster.setNotification("custom-image-recipe-deleted", + msg.html()); + + window.location.replace(data.gotoUrl); + } + }, + error: function (data) { + console.warn(data); + } + }); + }); + + } diff --git a/bitbake/lib/toaster/toastergui/templates/customrecipe.html b/bitbake/lib/toaster/toastergui/templates/customrecipe.html index 8b61fb7..945fc97 100644 --- a/bitbake/lib/toaster/toastergui/templates/customrecipe.html +++ b/bitbake/lib/toaster/toastergui/templates/customrecipe.html @@ -28,6 +28,7 @@ includedPackagesCount: {{recipe.includes_set.count}}, baseRecipeId: {{recipe.base_recipe.pk}}, xhrPackageListUrl: "{% url 'xhr_customrecipe_packages' recipe.pk %}", + xhrCustomRecipeUrl: "{% url 'xhr_customrecipe_id' recipe.pk %}", } }; @@ -39,6 +40,32 @@ } }); + + + + + -- 2.7.4