aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-09-30 14:53:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-16 14:59:59 +0100
commitef6fc2bc1a4eeafdf5eda112ffb72bfed24b85d5 (patch)
treeb68bc4a1d3253a2db1dbb8c15bfd3030ab74894d /bitbake
parent7467b6802d64e12710510d8e4653da15d12d7089 (diff)
downloadopenembedded-core-contrib-ef6fc2bc1a4eeafdf5eda112ffb72bfed24b85d5.tar.gz
bitbake: toaster: Replace "Run again" button with help text for cli builds
It's not possible to run a command-line build again, as Toaster doesn't have access to the data used for that build. Replace the "Run again" button with an icon which pops up some help text to that effect. Add test to check that the run again button is hidden and the help icon displayed instead for command-line builds. [YOCTO #8231] (Bitbake rev: b67ac9e7cbab50951847dd1a63b12f41bb345dbb) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/static/css/default.css5
-rw-r--r--bitbake/lib/toaster/toastergui/templates/mrb_section.html41
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py33
3 files changed, 65 insertions, 14 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css b/bitbake/lib/toaster/toastergui/static/css/default.css
index 06d9976557..bc8a97bedc 100644
--- a/bitbake/lib/toaster/toastergui/static/css/default.css
+++ b/bitbake/lib/toaster/toastergui/static/css/default.css
@@ -15,6 +15,8 @@
/* Styles for the help information */
.get-help { color: #CCCCCC; }
.get-help:hover, .icon-plus-sign:hover { color: #999999; cursor: pointer; }
+.get-help-green { color: #468847; }
+.get-help-green:hover { color: #347132; cursor: pointer; }
.get-help-blue { color: #3A87AD; }
.get-help-blue:hover { color: #005580; cursor: pointer; }
.get-help-yellow { color: #C09853; }
@@ -161,6 +163,9 @@ table { table-layout: fixed; word-wrap: break-word; }
.project-name .label { font-weight: normal; margin-bottom: 5px; margin-left: -15px; padding: 5px; }
.project-name .label > a { color: #fff; font-weight: normal; }
+/* styles for showing help icons next to command-line builds */
+.build-result .get-help-green, .build-result .get-help-red, .build-result .get-help-blue { margin-right: 35px; margin-top: 8px; font-size: 16px; }
+
/* Remove bottom margin for forms inside modal dialogs */
#dependencies-modal-form { margin-bottom: 0px; }
diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
index ad90e82ee3..5e96b39121 100644
--- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
+++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
@@ -18,7 +18,7 @@
{% endif %}
<div id="latest-builds">
{% for build in mru %}
- <div class="alert {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%}
+ <div id="build-result-{{ build.id }}" class="alert build-result {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%}
{% if mrb_type != 'project' %}
project-name">
<span class="label {%if build.outcome == build.SUCCEEDED%}label-success{%elif build.outcome == build.FAILED%}label-important{%else%}label-info{%endif%}">
@@ -81,24 +81,37 @@
</div>
<div class="lead ">
<span class="lead">
- Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a>
+ Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a>
</span>
- <button class="btn
+ {% if build.project.is_default %}
+ <i class="pull-right icon-question-sign get-help
{% if build.outcome == build.SUCCEEDED %}
- btn-success
+ get-help-green
{% elif build.outcome == build.FAILED %}
- btn-danger
+ get-help-red
{% else %}
- 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 bpurl %}{{bpurl|json}},
- {{build.target_set.all|get_tasks|json}})'>
+ get-help-blue
+ {% endif %}
+ " title="Builds in this project cannot be started from Toaster: they are started from the command line">
+ </i>
+ {% else %}
+ <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 'projectbuilds' build.project.id as bpi %}{{bpi|json}},
+ {{build.project.name|json}},
+ {% url 'project' build.project.id as bpurl %}{{bpurl|json}},
+ {{build.target_set.all|get_tasks|json}})'>
- Run again
- </button>
+ Run again
+ </button>
+ {% endif %}
</div>
{%endif%}
{%if build.outcome == build.IN_PROGRESS %}
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index d278d63aa1..c725fc827d 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -38,6 +38,7 @@ import json
import re
PROJECT_NAME = "test project"
+CLI_BUILDS_PROJECT_NAME = 'Command line builds'
class ViewTests(TestCase):
"""Tests to verify view APIs."""
@@ -658,6 +659,12 @@ class AllBuildsPageTests(TestCase):
bitbake_version=bbv)
self.project1 = Project.objects.create_project(name=PROJECT_NAME,
release=release)
+ self.default_project = Project.objects.create_project(
+ name=CLI_BUILDS_PROJECT_NAME,
+ release=release
+ )
+ self.default_project.is_default = True
+ self.default_project.save()
# parameters for builds to associate with the projects
now = timezone.now()
@@ -669,6 +676,13 @@ class AllBuildsPageTests(TestCase):
"outcome": Build.SUCCEEDED
}
+ self.default_project_build_success = {
+ "project": self.default_project,
+ "started_on": now,
+ "completed_on": now,
+ "outcome": Build.SUCCEEDED
+ }
+
def test_show_tasks_in_allbuilds(self):
""" Task should be shown as suffix on build name """
build = Build.objects.create(**self.project1_build_success)
@@ -678,6 +692,23 @@ class AllBuildsPageTests(TestCase):
result = re.findall('bash:clean', response.content, re.MULTILINE)
self.assertEqual(len(result), 3)
+ def test_no_run_again_for_cli_build(self):
+ """ "Run again" button should not be shown for command-line builds """
+ build = Build.objects.create(**self.default_project_build_success)
+ url = reverse("all-builds")
+ response = self.client.get(url, follow=True)
+ soup = BeautifulSoup(response.content)
+
+ element_id = 'build-result-%d' % build.id
+
+ # shouldn't see a run again button for command-line builds
+ run_again_button = soup.select('#%s button' % element_id)
+ self.assertEqual(len(run_again_button), 0)
+
+ # should see a help icon for command-line builds
+ help_icon = soup.select('#%s i.get-help-green' % element_id)
+ self.assertEqual(len(help_icon), 1)
+
class ProjectPageTests(TestCase):
""" Test project data at /project/X/ is displayed correctly """
CLI_BUILDS_PROJECT_NAME = 'Command line builds'
@@ -707,3 +738,5 @@ class ProjectPageTests(TestCase):
response = self.client.get(url, follow=True)
self.assertEqual(response.status_code, 200)
+
+