Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 9751CE00C60; Wed, 6 Jul 2016 07:43:17 -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.49 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-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id CFABDE00DED for ; Wed, 6 Jul 2016 07:43:15 -0700 (PDT) Received: by mail-pa0-f49.google.com with SMTP id bz2so77174037pad.1 for ; Wed, 06 Jul 2016 07:43:15 -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=Snm284OpWgfPpni+i8V97W4Gech5ZBE+McewneSt+ME=; b=tNgsJkaUe5LGVz2JI/1LzM5u1rT/kk2NXwJ+OOIln4/XkUv/N6QBiYiOBabzcFLCmY B50O3AyOHFYyZq0QoTZoFuf1T88GNhYMO9wpbEWhg3G0x+iToDYKLET+f5mdnzBcmk4J l4o+XJJ1kpXEwje2h0SIwXtnjk9hwb8S+RnymNf2RA/dhw3fMNibWdmT3WLxDOuDKHK3 hRnaHAMZT8nBAMu12Wax+7qmOC6iCEgBGC2gsQERE+DSOGOgt2uHrXNG7jn1KS5H5/cM cBOYW6GWE/xnXAf91UDX3vH4tmDz2C1MCcYktHYViyLIirke0E/x6Rs69zWh+QeXzf/Y PYhQ== 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=Snm284OpWgfPpni+i8V97W4Gech5ZBE+McewneSt+ME=; b=lDYGwiwVBN6KF2/0vOcoFHgkCdXe8DDolMOw1HFW6i049tx5/Dbd4czuvJRKy5BYVs W2S7qlns9OWAllkXtD+fuBmbv71sYMf2So7OGCiUYHH7UkEnnFxoyTDFOdTFVtgoMPxQ zL2zyhoT5+L42MiRh4Az4WDteCalO5O51RUcyeWZUbUuSqBmADCx0MFHBfC7rOpg3/C4 azcxuLUcz2V/4cI2YHDfj90KUdTiGCEqErRTsQMZJShHsIhXoqIYzWVCBQ3wSFlZQCpn Uolc/Y+bjWb8QEalmBc++/22nm1VmxYY7gSYkcjIPPNQpQfqOrMrh/rCvZXtSFYaff2Z OoBA== X-Gm-Message-State: ALyK8tKqUq7eQvUM+0On2oRz4Ya4K+iIJBEmc2ku+J7RLh53C7bSfEHp3nkyNMieR73fwgex X-Received: by 10.66.47.133 with SMTP id d5mr42130895pan.48.1467816195347; Wed, 06 Jul 2016 07:43:15 -0700 (PDT) Received: from orion.ger.corp.intel.com ([192.55.54.44]) by smtp.gmail.com with ESMTPSA id 77sm4929347pfp.66.2016.07.06.07.43.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Jul 2016 07:43:14 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Wed, 6 Jul 2016 15:42:58 +0100 Message-Id: <1467816179-16083-4-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467816179-16083-1-git-send-email-michael.g.wood@intel.com> References: <1467816179-16083-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH v2 3/4] toaster: add Layer delete front end feature to layerdetails 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, 06 Jul 2016 14:43:17 -0000 Add the front end feature to delete a layer from the layer details page. [YOCO #9184] Signed-off-by: Michael Wood --- .../lib/toaster/toastergui/static/js/layerdetails.js | 20 ++++++++++++++++++++ .../lib/toaster/toastergui/static/js/projectpage.js | 18 ++++++++++++++++++ .../toaster/toastergui/templates/layerdetails.html | 20 +++++++++++++++++++- bitbake/lib/toaster/toastergui/urls.py | 2 +- 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index a56087b..683486e 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js @@ -397,6 +397,26 @@ function layerDetailsPageInit (ctx) { $(this).parents("form").submit(); }); + $("#layer-delete-confirmed").click(function(){ + $.cookie("layer-deleted", ctx.layerVersion.name, { path: '/'}); + + $.ajax({ + type: "DELETE", + url: ctx.xhrUpdateLayerUrl, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function(data) { + if (data.error != "ok") { + console.warn(data.error); + } else { + window.location = data.redirect + "?notify=layer-deleted"; + } + }, + error: function(data) { + console.warn("Call failed"); + console.warn(data); + } + }); + }); layerDepsList.find(".glyphicon-trash").click(layerDepRemoveClick); layerDepsList.find("a").tooltip(); diff --git a/bitbake/lib/toaster/toastergui/static/js/projectpage.js b/bitbake/lib/toaster/toastergui/static/js/projectpage.js index 6d92490..df79849 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectpage.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectpage.js @@ -58,12 +58,30 @@ function projectPageInit(ctx) { case 'layer-imported': layerImportedNotification(); break; + case 'layer-deleted': + layerDeletedNotification(); default: break; } } })(); + /* Layer deleted notification */ + function layerDeletedNotification(){ + var layer = $.cookie("layer-deleted"); + + if (!layer) + return; + + var message = "You have deleted 1 layer from your "; + message += "project: " + layer + ""; + + libtoaster.showChangeNotification(message); + + $.removeCookie("layer-deleted", { path: "/"}); + } + + /* Layer imported notification */ function layerImportedNotification(){ var imported = $.cookie("layer-imported-alert"); diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index 143ec25..4b51d1a 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html @@ -6,6 +6,20 @@ {% block title %} {{layerversion.layer.name}} - {{project.name}} - Toaster {% endblock %} {% block pagecontent %} + +
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 15b1063..1c0ccbb 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py @@ -191,7 +191,7 @@ urlpatterns = patterns('toastergui.views', url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'), - url(r'^xhr_layer/(?P\d+)$', + url(r'^xhr_layer/(?P\d+)/(?P\d+)$', api.XhrLayer.as_view(), name='xhr_layer'), -- 2.7.4