Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 5F39CE0087C; Fri, 13 Mar 2015 07:34:52 -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,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.212.172 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 931B1E00871 for ; Fri, 13 Mar 2015 07:34:47 -0700 (PDT) Received: by wibbs8 with SMTP id bs8so6774637wib.0 for ; Fri, 13 Mar 2015 07:34:46 -0700 (PDT) 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; bh=IMiDIzFtKMw95j4Vi4UYZRpDQ0pfJfHu2qHppFglFIU=; b=E1olVr1xhZkam3HI75mJqh+G7ChztcOP6C2FMl3LLUkwqrN0xa8FQv+QTHGMEBUMN9 e0sBSU9mY20AJOmRNnlMdVYW/kgAXYfAR3JeHI/jzshalrQLtheuRejdQw+15qT1ZGFX cK4iJ6B+cK+ro7XLm/1zuMK5R7O41YLvBzYQE97JlwuuXA6L2CFkljRa2fX7lbutcyM6 efTIG8udWUKxYOca4YqbJR15JSxDjZbIHTl5mdmTuYOIZB1Bo4Z1IJGI6eqwwmKoviE3 mjuSoIGy3CRW4+UNKSYZYDXJW74s/KTmUUqbuNOa1cXeFPQUYNY4t3JhJ+XCoy/J+0vz /EXg== X-Gm-Message-State: ALoCoQkWCJcWPVXF80yz9zA7ctCenjpQbESKz0yPep+xi/arU+9Yj+bLsyOJewjmKm+09N7Pwez0 X-Received: by 10.194.60.104 with SMTP id g8mr95760420wjr.96.1426257286081; Fri, 13 Mar 2015 07:34:46 -0700 (PDT) Received: from draco.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id a13sm3066936wjx.30.2015.03.13.07.34.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Mar 2015 07:34:45 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Fri, 13 Mar 2015 14:34:41 +0000 Message-Id: <1426257281-26689-1-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.0 Subject: [review-request][PATCH] bitbake: toaster: Add cancel build to latest build section 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: Fri, 13 Mar 2015 14:34:52 -0000 Add this functionality to the common managed_mrb_section Make sure we are using the correct version of this template in the projects template and remove now redundant code. [YOCTO #7351] Signed-off-by: Michael Wood --- .../lib/toaster/toastergui/static/js/libtoaster.js | 28 +++++++++++++++ .../toastergui/templates/managed_mrb_section.html | 42 +++++++++------------- .../toaster/toastergui/templates/mrb_section.html | 39 -------------------- .../lib/toaster/toastergui/templates/projects.html | 2 +- bitbake/lib/toaster/toastergui/views.py | 11 ++++-- 5 files changed, 53 insertions(+), 69 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index 3832066..fcf82ac 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js @@ -93,6 +93,33 @@ var libtoaster = (function (){ } }); } + /* cancelABuild: + * url: xhr_projectbuild + * builds_ids: space separated list of build request ids + * onsuccess: callback for successful execution + * onfail: callback for failed execution + */ + function _cancelABuild(url, build_ids, onsuccess, onfail){ + $.ajax( { + type: "POST", + url: url, + data: { 'buildCancel': build_ids }, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function (_data) { + if (_data.error !== "ok") { + console.warn(_data.error); + } else { + if (onsuccess !== undefined) onsuccess(_data); + } + }, + error: function (_data) { + console.warn("Call failed"); + console.warn(_data); + if (onfail) onfail(data); + } + }); + } + /* Get a project's configuration info */ function _getProjectInfo(url, projectId, onsuccess, onfail){ $.ajax({ @@ -197,6 +224,7 @@ var libtoaster = (function (){ return { reload_params : reload_params, startABuild : _startABuild, + cancelABuild : _cancelABuild, makeTypeahead : _makeTypeahead, getProjectInfo: _getProjectInfo, getLayerDepsForProject : _getLayerDepsForProject, diff --git a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html index d6e32f8..471df1c 100644 --- a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html +++ b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html @@ -3,6 +3,7 @@ {% load humanize %} {%if mru|length > 0%} +{# Template provides the latest builds section requires mru in the context which can be added from _managed_get_latest_builds #} {%endif%} {%if build.outcome == build.IN_PROGRESS %} @@ -68,41 +65,5 @@ {% endfor %} - - - {%endif%} diff --git a/bitbake/lib/toaster/toastergui/templates/projects.html b/bitbake/lib/toaster/toastergui/templates/projects.html index 88d5bd3..88ee4bc 100644 --- a/bitbake/lib/toaster/toastergui/templates/projects.html +++ b/bitbake/lib/toaster/toastergui/templates/projects.html @@ -7,7 +7,7 @@ {% block pagecontent %} - {% include "mrb_section.html" %} + {% include "managed_mrb_section.html" %}