Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id D0FD0E00BC4; Tue, 8 Dec 2015 13:17:58 -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.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.45 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-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 01CDBE00B77 for ; Tue, 8 Dec 2015 13:17:42 -0800 (PST) Received: by pacwq6 with SMTP id wq6so17741397pac.1 for ; Tue, 08 Dec 2015 13:17:41 -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=SOXpdssCZp/gk9Wq1QrTyAkSNy582JvP0JykBenz2yU=; b=x/jcYgOqw3GevOVRCGoqm+6iqLW9wAvvW8fVJbXpJYYTeDJ03tiYCiAVnvAqCpFJ8d YHGqS1Tkg3gRgJi72CmSu1xs0V5yVKE1wUQ0ZSjMl9D0c4rzQplkxpXfrvulVDVPXQrj 7pzIQkFb7iK143hGV8wbyhmi5cr8NrmlJb6rP/0SoGjRkY/rT94ULsFVt+XLjztUfCa5 J/63sEZ7wGUUBd2Z9h+QoDqkHYie07d0yJTw5wIT+FBH66UaPJcmTdMUbUxzJ1xrIZeI 1kgF6XY8wb6SjrJbKhlw61thUm0NQQQnItv/BeKgviHpKkzpegf2r8u2HlMy/qHtWLnb VB8g== 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=SOXpdssCZp/gk9Wq1QrTyAkSNy582JvP0JykBenz2yU=; b=LS+4uNNxtnCDg87yJnsnpC18jW+CDIylHLldcgGePPznPt4VoE6gUENXxCph/yrrTc wLm2d/igP/rdtRem36jmRmn54sjFqORfLRoixYa/nRjiRVUD9UgNRv8AJw6BbDfEGOfC DqDruOZaccZ5vj/SDIn/IIEl8InOMZzVyDNzDZybXJD8tTbqfvz1jSTHlNGs8BA5owdY nJNQGPzOV8dPA6WXPrtadJJTFdRnUkErhGoVSiab9O32hdZRgFlXVZxCSzCsxE+g0XhB o6Ica/2Fw69mESr0KQlNV9vU3tpVhSdcJe4ONiiJTKaCrk6l1hyfoxFCblUji4LqZU7Y epMw== X-Gm-Message-State: ALoCoQkSAZ75iHdB2jeXJsSahMaT79Z6YtUpP1pkCBVYUZqT/2SEmG2EXdtbH5w+gRdUnNpSLeD7gLfUE5WdeeWT9VaQTnPPOA== X-Received: by 10.67.5.69 with SMTP id ck5mr2929843pad.125.1449609461830; Tue, 08 Dec 2015 13:17:41 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 13:17:40 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 8 Dec 2015 21:16:11 +0000 Message-Id: <1449609380-11073-26-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 25/34] toaster: newcustomimage_modal use libtoaster method for new CustomRecipe 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:58 -0000 Use libtoaster.createCustomRecipe rather than own implementation of this function. Signed-off-by: Michael Wood --- .../toastergui/static/js/newcustomimage_modal.js | 36 +++++----------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js index 71a28f7..16e42b3 100644 --- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js +++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js @@ -1,7 +1,7 @@ "use strict"; /* Used for the newcustomimage_modal actions */ -function newCustomImageModalInit(ctx){ +function newCustomImageModalInit(){ var newCustomImgBtn = $("#create-new-custom-image-btn"); var imgCustomModal = $("#new-custom-image-modal"); @@ -13,36 +13,16 @@ function newCustomImageModalInit(ctx){ var baseRecipeId = imgCustomModal.data('recipe'); if (name.length > 0) { - createCustomRecipe(name, baseRecipeId); imgCustomModal.modal('hide'); + libtoaster.createCustomRecipe(name, baseRecipeId, function(ret) { + if (ret.error !== "ok") { + console.warn(ret.error); + } else { + window.location.replace(ret.url + '?notify=new'); + } + }); } else { console.warn("TODO No name supplied"); } }); - - function createCustomRecipe(name, baseRecipeId){ - var data = { - 'name' : name, - 'project' : libtoaster.ctx.projectId, - 'base' : baseRecipeId, - }; - - $.ajax({ - type: "POST", - url: ctx.xhrCustomRecipeUrl, - data: data, - headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, - success: function (ret) { - if (ret.error !== "ok") { - console.warn(ret.error); - } else { - window.location.replace(ret.url + '?notify=new'); - } - }, - error: function (ret) { - console.warn("Call failed"); - console.warn(ret); - } - }); - } } -- 2.1.4