summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith H <sujith.h@gmail.com>2015-12-24 13:36:14 +0000
committerSujith H <sujith.h@gmail.com>2016-01-09 16:28:53 +0000
commit9f29d2664c5a72d41dd74bb8c154649f2959b569 (patch)
treeae9bd2b18b4e612d03f0ffd642cb67fc27159e28
parent8a03bdd2d7487dc8fe23f565ff483f2adb34de6d (diff)
downloadpoky-contrib-sujith/toaster-build-cancel11.tar.gz
poky-contrib-sujith/toaster-build-cancel11.tar.bz2
poky-contrib-sujith/toaster-build-cancel11.zip
toaster: add cancel button to UIsujith/toaster-build-cancel11
Add cancel button to UI. This button appears when the build is in progress. So when this button gets clicked cancelBuild function gets called with appropriate arguments. The cancel button would be visible only when the bitbake task executes. [YOCTO #6787] Signed-off-by: Sujith H <sujith.h@gmail.com>
-rw-r--r--bitbake/lib/toaster/toastergui/templates/mrb_section.html24
1 files changed, 10 insertions, 14 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
index 99502200d44..f643403a42e 100644
--- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
+++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
@@ -123,7 +123,16 @@
<div style="width: {{build.completeper}}%;" class="bar"></div>
</div>
</div>
- <div class="lead pull-right">{{build.completeper}}% of tasks complete</div>
+ <div class="lead ">{{build.completeper}}% of tasks complete</div>
+ {%if build.get_tasks.0 %}
+ <button id="cancel-build-btn" class="btn btn-info pull-right"
+ onclick='cancelBuild({% 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}}, {{build.id|json}})'>
+ Cancel
+ </button>
+ {%endif%}
{%endif%}
</div>
</div>
@@ -141,19 +150,6 @@ function scheduleBuild(url, projectName, projectUrl, buildlist) {
}, null);
}
-$(document).ready(function(){
-
- $(".cancel-build-btn").click(function (){
- var url = $(this).data('request-url');
- var buildIds = $(this).data('build-id');
- var btn = $(this);
-
- libtoaster.cancelABuild(url, buildIds, function(){
- btn.parents(".alert").fadeOut();
- }, null);
- });
-});
-
function cancelBuild(url, projectName, projectUrl, buildlist, buildId) {
console.log("cancelBuild");
libtoaster.cancelABuild(url, buildId, function(){