From: Michael Wood <michael.g.wood@intel.com>
To: "toaster@yoctoproject.org" <toaster@yoctoproject.org>
Subject: Re: [PATCH 10/11] toaster: mrb_section template Add build cancel button
Date: Thu, 25 Feb 2016 18:26:57 +0000 [thread overview]
Message-ID: <56CF4771.1030402@intel.com> (raw)
In-Reply-To: <1456424485-6566-11-git-send-email-michael.g.wood@intel.com>
Typo in this patch is fixed in branch michaelw/sujith/build-cancel
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=michaelw/sujith/build-cancel
- <i class="icon-question-sign get-help get-help-blue pull-right"
title="" data-original-title="Builds in this project cannot be cancelled
from Toaster: they can only be cancalled from the command line"></i>
+ <i class="icon-question-sign get-help get-help-blue pull-right"
title="" data-original-title="Builds in this project cannot be cancelled
from Toaster: they can only be cancelled from the command line"></i>
On 25/02/16 18:21, Michael Wood wrote:
> Add the cancel build button to the mrb section template and add the event
> handlers to cancelABuild.
> Also clean up the calls to startABuild to use the updated libtoaster methods
> and to make the code consistent with it's cancelABuild counterpart.
>
> Co-Author: Sujith H <sujith.h@gmail.com>
>
> Signed-off-by: Michael Wood <michael.g.wood@intel.com>
> ---
> .../toaster/toastergui/templates/mrb_section.html | 102 ++++++++++++++-------
> 1 file changed, 71 insertions(+), 31 deletions(-)
>
> diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
> index 551e341..647f49b 100644
> --- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
> +++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
> @@ -99,7 +99,7 @@
> " title="Builds in this project cannot be started from Toaster: they are started from the command line">
> </i>
> {% else %}
> - <button class="btn
> + <button class="run-again-btn btn
> {% if build.outcome == build.SUCCEEDED %}
> btn-success
> {% elif build.outcome == build.FAILED %}
> @@ -108,10 +108,9 @@
> btn-info
> {%endif%}
> pull-right"
> - onclick='scheduleBuild({% url 'projectbuilds' build.project.id as bpi %}{{bpi|json}},
> - {{build.project.name|json}},
> - {% url 'project' build.project.id as purl %}{{purl|json}},
> - {{build.target_set.all|get_tasks|json}})'>
> + data-request-url="{% url 'xhr_buildrequest' build.project.pk %}"
> + data-target='{{build.target_set.all|get_tasks|json}}'>
> +
>
> Rebuild
> </button>
> @@ -119,46 +118,87 @@
> </div>
> {%endif%}
> {%if build.outcome == build.IN_PROGRESS %}
> - <div class="span4 offset1">
> - <div class="progress" id="build-pc-done-title-{{build.pk}}" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete">
> - <div id="build-pc-done-bar-{{build.pk}}" style="width: {{build.completeper}}%;" class="bar"></div>
> - </div>
> - </div>
> - <div class="lead pull-right"><span id="build-pc-done-{{build.pk}}">{{build.completeper}}</span>% of tasks complete</div>
> - {%endif%}
> - </div>
> + <div class="span4" style="display:none" id="cancelling-msg-{{build.buildrequest.pk}}">
> + <p class="lead">Cancelling the build ...</p>
> + </div>
> + <div class="span4 offset1 progress-info">
> + <div class="progress" id="build-pc-done-title-{{build.pk}}" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete">
> + <div id="build-pc-done-bar-{{build.pk}}" style="width: {{build.completeper}}%;" class="bar"></div>
> + </div>
> </div>
> + <div class="lead span3 progress-info"><span id="build-pc-done-{{build.pk}}">{{build.completeper}}</span>% of tasks complete</div>
> + {# No build cancel for command line builds project #}
> + {% if build.project.is_default %}
> + <i class="icon-question-sign get-help get-help-blue pull-right" title="" data-original-title="Builds in this project cannot be cancelled from Toaster: they can only be cancalled from the command line"></i>
> + {% else %}
> + <div class="lead pull-right progress-info">
> + <button class="cancel-build-btn btn btn-info pull-right"
> + data-buildrequest-id={{build.buildrequest.pk}}
> + data-request-url="{% url 'xhr_buildrequest' build.project.pk %}" >
> + Cancel
> + </button>
> + </div>
> + {% endif %}
> +
> + {%endif%} {# end if in progress #}
> +
> + {% if build.outcome == build.CANCELLED %}
> + <div class="span4">
> + <p class="lead">Build cancelled</p>
> + </div>
> + <button class="btn btn-info pull-right run-again-btn"
> + data-request-url="{% url 'xhr_buildrequest' build.project.pk %}"
> + data-target='{{build.target_set.all|get_tasks|json}}'>
> + Run again
> +
> + </button>
> + {% endif %}
> + </div>
> +</div>
>
> {% endfor %}
> </div>
>
> <script>
>
> -function scheduleBuild(url, projectName, projectUrl, buildlist) {
> - console.log("scheduleBuild");
> - libtoaster.startABuild(url, null, buildlist.join(" "), function(){
> - console.log("reloading page");
> - window.location.reload();
> - }, null);
> -}
> -
> $(document).ready(function(){
> + {%if mrb_type == 'project' %}
> + var projectBuilds = true;
> + {% else %}
> + var projectBuilds = false;
> + {% endif %}
> +
> + $(".cancel-build-btn").click(function(e){
> + e.preventDefault();
>
> - $(".cancel-build-btn").click(function (){
> var url = $(this).data('request-url');
> - var buildIds = $(this).data('build-id');
> - var btn = $(this);
> + var buildReqIds = $(this).data('buildrequest-id');
> + var banner = $(this).parents(".alert");
> +
> + banner.find(".progress-info").fadeOut(function(){
> + $("#cancelling-msg-" + buildReqIds).show();
> + libtoaster.cancelABuild(url, buildReqIds, function(){
> + if (projectBuilds == false){
> + /* the all builds page is not 'self updating' like thei
> + * project Builds
> + */
> + window.location.reload();
> + }
> + }, null);
> + });
> + });
> +
> + $(".run-again-btn").click(function(e){
> + e.preventDefault();
>
> - libtoaster.cancelABuild(url, buildIds, function(){
> - btn.parents(".alert").fadeOut();
> + var url = $(this).data('request-url');
> + var target = $(this).data('target');
> +
> + libtoaster.startABuild(url, target, function(){
> + window.location.reload();
> }, null);
> });
>
> - {%if mrb_type == 'project' %}
> - var projectBuilds = true;
> - {% else %}
> - var projectBuilds = false;
> - {% endif %}
>
> var progressTimer;
>
next prev parent reply other threads:[~2016-02-25 18:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 18:21 [PATCH 00/11] Build cancellation Michael Wood
2016-02-25 18:21 ` [PATCH 01/11] toaster: bldcontrol Add forceShutDown function to BitbakeController Michael Wood
2016-02-25 18:21 ` [PATCH 02/11] toaster: Move xhr calls for starting and stopping builds Michael Wood
2016-02-25 18:21 ` [PATCH 03/11] toaster: xhr Update the implementation of the build cancellation request Michael Wood
2016-02-25 18:21 ` [PATCH 04/11] toaster: libtoaster Update implementation of startABuild and cancelABuild Michael Wood
2016-02-26 11:55 ` Smith, Elliot
2016-02-25 18:21 ` [PATCH 05/11] toaster: update BuildEnvironmentController and BitbakeController Michael Wood
2016-02-25 18:21 ` [PATCH 06/11] toaster: models Add cancelled state to build outcome Michael Wood
2016-02-25 18:21 ` [PATCH 07/11] toaster: bldcontrol models Add a cancelling state the BuildRequest Michael Wood
2016-02-25 18:21 ` [PATCH 08/11] buildinfohelper: Add handler for cancelling a build Michael Wood
2016-02-25 18:21 ` [PATCH 09/11] toaster: tables BuildsTable exclude cancelled builds Michael Wood
2016-02-25 18:21 ` [PATCH 10/11] toaster: mrb_section template Add build cancel button Michael Wood
2016-02-25 18:26 ` Michael Wood [this message]
2016-02-25 18:21 ` [PATCH 11/11] toaster: models Exclude the CANCELLED builds from get_number_of_builds Michael Wood
2016-02-26 13:26 ` [PATCH 00/11] Build cancellation Smith, Elliot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56CF4771.1030402@intel.com \
--to=michael.g.wood@intel.com \
--cc=toaster@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.