Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id A33A4E00D79; Mon, 4 Jul 2016 13:56:47 -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.192.182 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-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 57939E00D72 for ; Mon, 4 Jul 2016 13:56:44 -0700 (PDT) Received: by mail-pf0-f182.google.com with SMTP id t190so63797523pfb.3 for ; Mon, 04 Jul 2016 13:56:44 -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=h1FuUc3aEXT4OJqk9i9jP1vPCcBKbsuSdv1NlSU0azo=; b=P9n1aAqdiv1CvBx2P8T4icKDau1eKjySwFklVEDky7fc3AzX93Nphavo6nPO04vozQ 3PYjniCcYIy0zVB7Y1kR9Z3vyfGqZ/HJAJgkE9JUp1SdBEsmaqN5QLkueQ8Px4pIO9QA q2jKvLHLtpx1nVPZhHjwSslnOMP2j1N+9NXirSsWO3Rt2WNajHnjSXwnmP0KaE7FBN8G G9Z7ku4m2d0UNdUypydNIDfxm+xa2Y4yUhC81NcsiN3fDGySqBXUeCBvlGsG6njR38fO WgoEI+hs9bBFBoxYQ5affpRJ2PL8qGR42PEqLHVnxcqbmjZs0FICZbF/7I18F4TsfHbq DQUg== 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=h1FuUc3aEXT4OJqk9i9jP1vPCcBKbsuSdv1NlSU0azo=; b=UdVbVj3XDyoR4Xz0blQ/TptIaiDWKmuF7p40+3hlHQORMh826wAeZGQ06JPKZY/JFP 6j3cLve3e5VTRIvoF+sU/NjOF8j+ic6iHC/dcLBWH8/9sdCAxFbfEEFXUwmOn342lqnX anhkwU0SFIJ+AbN01brA/csgS3Sr0nvw+UZlNG3BzT2daePOOgAddjl0fs3gkQhi1d0y Vvr3MazJPg5vP0+SnGi14ZMAwTJFfwaweeryYONMVB582nxXyEMFX/9kOyTx/F91TwbX oyOCt2w038gvhX7OIzCdmtKlPpYXF8q4AOof13DW+ctNz8P5fIP4q5nY9gIOQLKITn7a phYg== X-Gm-Message-State: ALyK8tKJ0DTKiDmIjKODIh3zjqKOJnZxOtJxJfOO7RlhSNvwo6Q0v7SgOBgvVTfT3+iLfEdm X-Received: by 10.98.53.6 with SMTP id c6mr25813254pfa.47.1467665804314; Mon, 04 Jul 2016 13:56:44 -0700 (PDT) Received: from orion.ger.corp.intel.com (fmdmzpr04-ext.fm.intel.com. [192.55.55.39]) by smtp.gmail.com with ESMTPSA id b71sm7213602pfc.51.2016.07.04.13.56.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Jul 2016 13:56:43 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Mon, 4 Jul 2016 21:56:24 +0100 Message-Id: <1467665785-13108-4-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467665785-13108-1-git-send-email-michael.g.wood@intel.com> References: <1467665785-13108-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 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: Mon, 04 Jul 2016 20:56:47 -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 | 18 +++++++++++++++++- bitbake/lib/toaster/toastergui/urls.py | 2 +- 4 files changed, 56 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..2994ee5 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