summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
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 @@
15/* Styles for the help information */ 15/* Styles for the help information */
16.get-help { color: #CCCCCC; } 16.get-help { color: #CCCCCC; }
17.get-help:hover, .icon-plus-sign:hover { color: #999999; cursor: pointer; } 17.get-help:hover, .icon-plus-sign:hover { color: #999999; cursor: pointer; }
18.get-help-green { color: #468847; }
19.get-help-green:hover { color: #347132; cursor: pointer; }
18.get-help-blue { color: #3A87AD; } 20.get-help-blue { color: #3A87AD; }
19.get-help-blue:hover { color: #005580; cursor: pointer; } 21.get-help-blue:hover { color: #005580; cursor: pointer; }
20.get-help-yellow { color: #C09853; } 22.get-help-yellow { color: #C09853; }
@@ -161,6 +163,9 @@ table { table-layout: fixed; word-wrap: break-word; }
161.project-name .label { font-weight: normal; margin-bottom: 5px; margin-left: -15px; padding: 5px; } 163.project-name .label { font-weight: normal; margin-bottom: 5px; margin-left: -15px; padding: 5px; }
162.project-name .label > a { color: #fff; font-weight: normal; } 164.project-name .label > a { color: #fff; font-weight: normal; }
163 165
166/* styles for showing help icons next to command-line builds */
167.build-result .get-help-green, .build-result .get-help-red, .build-result .get-help-blue { margin-right: 35px; margin-top: 8px; font-size: 16px; }
168
164/* Remove bottom margin for forms inside modal dialogs */ 169/* Remove bottom margin for forms inside modal dialogs */
165#dependencies-modal-form { margin-bottom: 0px; } 170#dependencies-modal-form { margin-bottom: 0px; }
166 171
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 @@
18 {% endif %} 18 {% endif %}
19 <div id="latest-builds"> 19 <div id="latest-builds">
20 {% for build in mru %} 20 {% for build in mru %}
21 <div class="alert {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%} 21 <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%}
22 {% if mrb_type != 'project' %} 22 {% if mrb_type != 'project' %}
23 project-name"> 23 project-name">
24 <span class="label {%if build.outcome == build.SUCCEEDED%}label-success{%elif build.outcome == build.FAILED%}label-important{%else%}label-info{%endif%}"> 24 <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 @@
81 </div> 81 </div>
82 <div class="lead "> 82 <div class="lead ">
83 <span class="lead"> 83 <span class="lead">
84 Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a> 84 Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a>
85 </span> 85 </span>
86 <button class="btn 86 {% if build.project.is_default %}
87 <i class="pull-right icon-question-sign get-help
87 {% if build.outcome == build.SUCCEEDED %} 88 {% if build.outcome == build.SUCCEEDED %}
88 btn-success 89 get-help-green
89 {% elif build.outcome == build.FAILED %} 90 {% elif build.outcome == build.FAILED %}
90 btn-danger 91 get-help-red
91 {% else %} 92 {% else %}
92 btn-info 93 get-help-blue
93 {%endif%} 94 {% endif %}
94 pull-right" 95 " title="Builds in this project cannot be started from Toaster: they are started from the command line">
95 onclick='scheduleBuild({% url 'projectbuilds' build.project.id as bpi %}{{bpi|json}}, 96 </i>
96 {{build.project.name|json}}, 97 {% else %}
97 {% url 'project' build.project.id as bpurl %}{{bpurl|json}}, 98 <button class="btn
98 {{build.target_set.all|get_tasks|json}})'> 99 {% if build.outcome == build.SUCCEEDED %}
100 btn-success
101 {% elif build.outcome == build.FAILED %}
102 btn-danger
103 {% else %}
104 btn-info
105 {%endif%}
106 pull-right"
107 onclick='scheduleBuild({% url 'projectbuilds' build.project.id as bpi %}{{bpi|json}},
108 {{build.project.name|json}},
109 {% url 'project' build.project.id as bpurl %}{{bpurl|json}},
110 {{build.target_set.all|get_tasks|json}})'>
99 111
100 Run again 112 Run again
101 </button> 113 </button>
114 {% endif %}
102 </div> 115 </div>
103 {%endif%} 116 {%endif%}
104 {%if build.outcome == build.IN_PROGRESS %} 117 {%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
38import re 38import re
39 39
40PROJECT_NAME = "test project" 40PROJECT_NAME = "test project"
41CLI_BUILDS_PROJECT_NAME = 'Command line builds'
41 42
42class ViewTests(TestCase): 43class ViewTests(TestCase):
43 """Tests to verify view APIs.""" 44 """Tests to verify view APIs."""
@@ -658,6 +659,12 @@ class AllBuildsPageTests(TestCase):
658 bitbake_version=bbv) 659 bitbake_version=bbv)
659 self.project1 = Project.objects.create_project(name=PROJECT_NAME, 660 self.project1 = Project.objects.create_project(name=PROJECT_NAME,
660 release=release) 661 release=release)
662 self.default_project = Project.objects.create_project(
663 name=CLI_BUILDS_PROJECT_NAME,
664 release=release
665 )
666 self.default_project.is_default = True
667 self.default_project.save()
661 668
662 # parameters for builds to associate with the projects 669 # parameters for builds to associate with the projects
663 now = timezone.now() 670 now = timezone.now()
@@ -669,6 +676,13 @@ class AllBuildsPageTests(TestCase):
669 "outcome": Build.SUCCEEDED 676 "outcome": Build.SUCCEEDED
670 } 677 }
671 678
679 self.default_project_build_success = {
680 "project": self.default_project,
681 "started_on": now,
682 "completed_on": now,
683 "outcome": Build.SUCCEEDED
684 }
685
672 def test_show_tasks_in_allbuilds(self): 686 def test_show_tasks_in_allbuilds(self):
673 """ Task should be shown as suffix on build name """ 687 """ Task should be shown as suffix on build name """
674 build = Build.objects.create(**self.project1_build_success) 688 build = Build.objects.create(**self.project1_build_success)
@@ -678,6 +692,23 @@ class AllBuildsPageTests(TestCase):
678 result = re.findall('bash:clean', response.content, re.MULTILINE) 692 result = re.findall('bash:clean', response.content, re.MULTILINE)
679 self.assertEqual(len(result), 3) 693 self.assertEqual(len(result), 3)
680 694
695 def test_no_run_again_for_cli_build(self):
696 """ "Run again" button should not be shown for command-line builds """
697 build = Build.objects.create(**self.default_project_build_success)
698 url = reverse("all-builds")
699 response = self.client.get(url, follow=True)
700 soup = BeautifulSoup(response.content)
701
702 element_id = 'build-result-%d' % build.id
703
704 # shouldn't see a run again button for command-line builds
705 run_again_button = soup.select('#%s button' % element_id)
706 self.assertEqual(len(run_again_button), 0)
707
708 # should see a help icon for command-line builds
709 help_icon = soup.select('#%s i.get-help-green' % element_id)
710 self.assertEqual(len(help_icon), 1)
711
681class ProjectPageTests(TestCase): 712class ProjectPageTests(TestCase):
682 """ Test project data at /project/X/ is displayed correctly """ 713 """ Test project data at /project/X/ is displayed correctly """
683 CLI_BUILDS_PROJECT_NAME = 'Command line builds' 714 CLI_BUILDS_PROJECT_NAME = 'Command line builds'
@@ -707,3 +738,5 @@ class ProjectPageTests(TestCase):
707 response = self.client.get(url, follow=True) 738 response = self.client.get(url, follow=True)
708 739
709 self.assertEqual(response.status_code, 200) 740 self.assertEqual(response.status_code, 200)
741
742