[Toaster] [review-request][PATCH 06/10] toaster: Show tooltip next to cli builds project name in all builds
Elliot Smith
elliot.smith at intel.com
Tue Oct 13 03:24:51 PDT 2015
In the all builds page, show an icon with tooltip next to the
command line builds project name.
[YOCTO #8231]
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
.../lib/toaster/toastergui/templates/builds.html | 11 ++++---
.../toaster/toastergui/templates/mrb_section.html | 2 +-
bitbake/lib/toaster/toastergui/tests.py | 37 +++++++++++++++++++---
3 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/bitbake/lib/toaster/toastergui/templates/builds.html b/bitbake/lib/toaster/toastergui/templates/builds.html
index 6fbaf98..566c279 100644
--- a/bitbake/lib/toaster/toastergui/templates/builds.html
+++ b/bitbake/lib/toaster/toastergui/templates/builds.html
@@ -63,10 +63,10 @@
{% include "basetable_top.html" %}
<!-- Table data rows; the order needs to match the order of "tablecols" definitions; and the <td class value needs to match the tablecols clclass value for show/hide buttons to work -->
{% for build in objects %}
- <tr class="data">
+ <tr class="data" data-table-build-result="{{ build.id }}">
<td class="outcome">
- <a href="{% url "builddashboard" build.id %}">{%if build.outcome == build.SUCCEEDED%}<i class="icon-ok-sign success"></i>{%elif build.outcome == build.FAILED%}<i class="icon-minus-sign error"></i>{%else%}{%endif%}</a>
- </td>
+ <a href="{% url "builddashboard" build.id %}">{%if build.outcome == build.SUCCEEDED%}<i class="icon-ok-sign success"></i>{%elif build.outcome == build.FAILED%}<i class="icon-minus-sign error"></i>{%else%}{%endif%}</a>
+ </td>
<td class="target">
{% for t in build.target_set.all %}
<a href="{% url "builddashboard" build.id %}">
@@ -104,8 +104,11 @@
<a href="{%url "builddashboard" build.id%}#images">{{fstypes|get_dict_value:build.id}}</a>
{% endif %}
</td>
- <td>
+ <td class="project-name">
<a href="{% project_url build.project %}">{{build.project.name}}</a>
+ {% if build.project.is_default %}
+ <i class="icon-question-sign get-help hover-help" title="" data-original-title="This project shows information about the builds you start from the command line while Toaster is running" style="visibility: hidden;"></i>
+ {% endif %}
</td>
</tr>
diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
index 53f40d0..55687a1 100644
--- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
+++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
@@ -22,7 +22,7 @@
{% endif %}
<div id="latest-builds">
{% for build in mru %}
- <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%}
+ <div data-latest-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%}">
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 0d56ab2..1e67d1a 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -760,7 +760,7 @@ class AllBuildsPageTests(TestCase):
""" Task should be shown as suffix on build name """
build = Build.objects.create(**self.project1_build_success)
Target.objects.create(build=build, target='bash', task='clean')
- url = reverse("all-builds")
+ url = reverse('all-builds')
response = self.client.get(url, follow=True)
result = re.findall('bash:clean', response.content, re.MULTILINE)
self.assertEqual(len(result), 3)
@@ -768,17 +768,44 @@ class AllBuildsPageTests(TestCase):
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")
+ url = reverse('all-builds')
response = self.client.get(url, follow=True)
soup = BeautifulSoup(response.content)
- element_id = 'build-result-%d' % build.id
+ attrs = {'data-latest-build-result': build.id}
+ result = soup.find('div', attrs=attrs)
# shouldn't see a run again button for command-line builds
- run_again_button = soup.select('#%s button' % element_id)
+ run_again_button = result.select('button')
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)
+ help_icon = result.select('i.get-help-green')
self.assertEqual(len(help_icon), 1)
+ def test_tooltips_on_project_name(self):
+ """
+ A tooltip should be present next to the command line
+ builds project name in the all builds page, but not for
+ other projects
+ """
+ build1 = Build.objects.create(**self.project1_build_success)
+ default_build = Build.objects.create(**self.default_project_build_success)
+
+ url = reverse('all-builds')
+ response = self.client.get(url, follow=True)
+ soup = BeautifulSoup(response.content)
+
+ # no help icon on non-default project name
+ result = soup.find('tr', attrs={'data-table-build-result': build1.id})
+ name = result.select('td.project-name')[0]
+ icons = name.select('i.get-help')
+ self.assertEqual(len(icons), 0,
+ 'should not be a help icon for non-cli builds name')
+
+ # help icon on default project name
+ result = soup.find('tr', attrs={'data-table-build-result': default_build.id})
+ name = result.select('td.project-name')[0]
+ icons = name.select('i.get-help')
+ self.assertEqual(len(icons), 1,
+ 'should be a help icon for cli builds name')
--
Elliot Smith
Software Engineer
Intel OTC
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the toaster
mailing list