diff options
3 files changed, 25 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html index abcc0bb58f..c93c2af301 100644 --- a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html +++ b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html | |||
| @@ -54,7 +54,17 @@ | |||
| 54 | Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent|sectohms }}</a> | 54 | Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent|sectohms }}</a> |
| 55 | </span> | 55 | </span> |
| 56 | {% if build.project %} | 56 | {% if build.project %} |
| 57 | <button class="btn {%if build.outcome == build.SUCCEEDED%}btn-success{%elif build.outcome == build.FAILED%}btn-danger{%else%}btn-info{%endif%} pull-right" onclick='scheduleBuild({% url 'xhr_projectbuild' build.project.id as bpi%}{{bpi|json}}, {{build.project.name|json}}, {% url 'project' buildrequest.project.id as bpurl%}{{bpurl|json}}, {{build.get_sorted_target_list|mapselect:'target'|json}})'>Run again</button> | 57 | <button class="btn |
| 58 | {% if build.outcome == build.SUCCEEDED %} | ||
| 59 | btn-success | ||
| 60 | {% elif build.outcome == build.FAILED %} | ||
| 61 | btn-danger | ||
| 62 | {% else %} | ||
| 63 | btn-info | ||
| 64 | {%endif%} | ||
| 65 | pull-right" | ||
| 66 | {% include "runagain.html" %} | ||
| 67 | </button> | ||
| 58 | {% endif %} | 68 | {% endif %} |
| 59 | </div> | 69 | </div> |
| 60 | {%endif%} | 70 | {%endif%} |
| @@ -104,8 +114,10 @@ | |||
| 104 | <span class="lead{%if not MANAGED or not buildrequest.project%} pull-right{%endif%}"> | 114 | <span class="lead{%if not MANAGED or not buildrequest.project%} pull-right{%endif%}"> |
| 105 | Build time: {{ buildrequest.get_duration|sectohms }} | 115 | Build time: {{ buildrequest.get_duration|sectohms }} |
| 106 | </span> | 116 | </span> |
| 107 | <button class="btn btn-danger pull-right" onclick='scheduleBuild({% url 'xhr_projectbuild' buildrequest.project.id as bpi%}{{bpi|json}}, {{buildrequest.project.name|json}}, {% url 'project' buildrequest.project.id as bpurl%}{{bpurl|json}}, {{buildrequest.get_sorted_target_list|mapselect:'target'|json}})'>Run again</button> | ||
| 108 | 117 | ||
| 118 | <button class="btn btn-danger pull-right" | ||
| 119 | {% include "runagain.html" %} | ||
| 120 | </button> | ||
| 109 | </div> | 121 | </div> |
| 110 | 122 | ||
| 111 | 123 | ||
diff --git a/bitbake/lib/toaster/toastergui/templates/runagain.html b/bitbake/lib/toaster/toastergui/templates/runagain.html new file mode 100644 index 0000000000..a78c0ddc78 --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/runagain.html | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | {% load projecttags %} | ||
| 2 | onclick='scheduleBuild( | ||
| 3 | {% url 'xhr_projectbuild' buildrequest.project.id as bpi %}{{bpi|json}}, | ||
| 4 | {{buildrequest.project.name|json}}, | ||
| 5 | {% url 'project' buildrequest.project.id as bpurl %}{{bpurl|json}}, | ||
| 6 | {{buildrequest.brtarget_set.all|get_tasks|json}}) | ||
| 7 | '>Run again | ||
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index 1bc3bc2319..8028ae0022 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |||
| @@ -44,9 +44,10 @@ def sectohms(time): | |||
| 44 | return "%02d:%02d:%02d" % (hours, int((tdsec - (hours * 3600))/ 60), int(tdsec) % 60) | 44 | return "%02d:%02d:%02d" % (hours, int((tdsec - (hours * 3600))/ 60), int(tdsec) % 60) |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | @register.filter(name = 'mapselect') | 47 | @register.filter(name = 'get_tasks') |
| 48 | def mapselect(value, argument): | 48 | def get_tasks(queryset): |
| 49 | return map(lambda x: vars(x)[argument], value) | 49 | return list(target + ':' + task if task else target \ |
| 50 | for target, task in queryset.values_list('target', 'task')) | ||
| 50 | 51 | ||
| 51 | 52 | ||
| 52 | @register.filter(name = "json") | 53 | @register.filter(name = "json") |
