Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id EC29FE00854; Fri, 13 Mar 2015 08:13:26 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.24 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 9ED2BE003A8 for ; Fri, 13 Mar 2015 08:13:24 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 13 Mar 2015 08:11:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,395,1422950400"; d="scan'208";a="698324130" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga002.jf.intel.com with ESMTP; 13 Mar 2015 08:13:25 -0700 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.236]) by IRSMSX103.ger.corp.intel.com ([169.254.3.247]) with mapi id 14.03.0195.001; Fri, 13 Mar 2015 15:13:22 +0000 From: "Barros Pena, Belen" To: "Wood, Michael G" , "toaster@yoctoproject.org" Thread-Topic: [Toaster] [review-request][PATCH] bitbake: toaster: Add cancel build to latest build section Thread-Index: AQHQXaA+rKFkMFxRwkS8aLf5zLTXJA== Date: Fri, 13 Mar 2015 15:13:22 +0000 Message-ID: References: <1426257281-26689-1-git-send-email-michael.g.wood@intel.com> In-Reply-To: <1426257281-26689-1-git-send-email-michael.g.wood@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.8.150116 x-originating-ip: [10.237.224.151] MIME-Version: 1.0 Subject: Re: [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 15:13:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-ID: <3AB4C1C28107574DBC5F7B105B973C0C@intel.com> Content-Transfer-Encoding: quoted-printable On 13/03/2015 14:34, "Michael Wood" wrote: >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] The UI looks good. Thanks! Bel=E9n > >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 =3D (function (){ > } }); > } >=20 >+ /* 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 !=3D=3D "ok") { >+ console.warn(_data.error); >+ } else { >+ if (onsuccess !=3D=3D 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 =3D (function (){ > return { > reload_params : reload_params, > startABuild : _startABuild, >+ cancelABuild : _cancelABuild, > makeTypeahead : _makeTypeahead, > getProjectInfo: _getProjectInfo, > getLayerDepsForProject : _getLayerDepsForProject, >diff --git=20 >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 %} >=20 > {%if mru|length > 0%} >+{# Template provides the latest builds section requires mru in the >context which can be added from _managed_get_latest_builds #} >
>

> Latest builds >@@ -119,6 +120,7 @@ >
Build queued > is available" class=3D"icon-question-sign get-help get-help-blue >heading-help" data-toggle=3D"tooltip"> >
>+ >=20 > {% elif buildrequest.state =3D=3D buildrequest.REQ_CREATED %} >=20 >@@ -156,37 +158,25 @@ >=20 > >=20 >diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html >b/bitbake/lib/toaster/toastergui/templates/mrb_section.html >index 432955a..c7bddf0 100644 >--- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html >+++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html >@@ -50,9 +50,6 @@ > pull-right{%endif%}"> > Build time: {{ >build.timespent|sectohms }} > >- {% if MANAGED and build.project %} >- build.SUCCEEDED%}btn-success{%elif build.outcome =3D=3D >build.FAILED%}btn-danger{%else%}btn-info{%endif%} pull-right" >onclick=3D"scheduleBuild({% url 'xhr_projectbuild' build.project.id as >bpi%}{{bpi|json}}, {{build.project.name|json}}, >{{build.get_sorted_target_list|mapselect:'target'|json}})">Run again >- {% endif %} >

> {%endif%} > {%if build.outcome =3D=3D build.IN_PROGRESS %} >@@ -68,41 +65,5 @@ >=20 > {% endfor %} > >- >- >- > {%endif%} >=20 >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 %} >=20 >=20 >- {% include "mrb_section.html" %} >+ {% include "managed_mrb_section.html" %} >=20 >=20 >
>diff --git a/bitbake/lib/toaster/toastergui/views.py >b/bitbake/lib/toaster/toastergui/views.py >index 8034cfc..4a334f9 100755 >--- a/bitbake/lib/toaster/toastergui/views.py >+++ b/bitbake/lib/toaster/toastergui/views.py >@@ -1866,8 +1866,7 @@ if toastermain.settings.MANAGED: >=20 > # build view-specific information; this is rendered specifically >in the builds page, at the top of the page (i.e. Recent builds) > # most recent build is like projects' most recent builds, but >across all projects >- build_mru =3D BuildRequest.objects.all() >- build_mru =3D >list(build_mru.filter(Q(state__lt=3DBuildRequest.REQ_COMPLETED) or >Q(state=3DBuildRequest.REQ_DELETED)).order_by("-pk")) + >list(build_mru.filter(state__in=3D[BuildRequest.REQ_COMPLETED, >BuildRequest.REQ_FAILED]).order_by("-pk")[:3]) >+ build_mru =3D _managed_get_latest_builds() >=20 > fstypes_map =3D {}; > for build_request in build_info: >@@ -3101,6 +3100,12 @@ if toastermain.settings.MANAGED: > } > return render(request, "unavailable_artifact.html", context) >=20 >+ # This returns the mru object that is needed for the >+ # managed_mrb_section.html template >+ def _managed_get_latest_builds(): >+ build_mru =3D BuildRequest.objects.all() >+ build_mru =3D >list(build_mru.filter(Q(state__lt=3DBuildRequest.REQ_COMPLETED) or >Q(state=3DBuildRequest.REQ_DELETED)).order_by("-pk")) + >list(build_mru.filter(state__in=3D[BuildRequest.REQ_COMPLETED, >BuildRequest.REQ_FAILED]).order_by("-pk")[:3]) >+ return build_mru >=20 >=20 > def projects(request): >@@ -3124,7 +3129,7 @@ if toastermain.settings.MANAGED: > project_info =3D _build_page_range(Paginator(queryset, pagesize), >request.GET.get('page', 1)) >=20 > # build view-specific information; this is rendered specifically >in the builds page, at the top of the page (i.e. Recent builds) >- build_mru =3D Build.objects.order_by("-started_on")[:3] >+ build_mru =3D _managed_get_latest_builds() >=20 > # translate the project's build target strings > fstypes_map =3D {}; >--=20 >2.1.0 > >--=20 >_______________________________________________ >toaster mailing list >toaster@yoctoproject.org >https://lists.yoctoproject.org/listinfo/toaster