summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/base.js12
-rw-r--r--bitbake/lib/toaster/toastergui/templates/mrb_section.html4
-rw-r--r--bitbake/lib/toaster/toastergui/templates/projecttopbar.html80
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py41
4 files changed, 94 insertions, 43 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/base.js b/bitbake/lib/toaster/toastergui/static/js/base.js
index 895e61b2aa..6042a96ee4 100644
--- a/bitbake/lib/toaster/toastergui/static/js/base.js
+++ b/bitbake/lib/toaster/toastergui/static/js/base.js
@@ -6,6 +6,7 @@ function basePageInit(ctx) {
6 var newBuildTargetInput; 6 var newBuildTargetInput;
7 var newBuildTargetBuildBtn; 7 var newBuildTargetBuildBtn;
8 var projectNameForm = $("#project-name-change-form"); 8 var projectNameForm = $("#project-name-change-form");
9 var projectNameContainer = $("#project-name-container");
9 var projectName = $("#project-name"); 10 var projectName = $("#project-name");
10 var projectNameFormToggle = $("#project-change-form-toggle"); 11 var projectNameFormToggle = $("#project-change-form-toggle");
11 var projectNameChangeCancel = $("#project-name-change-cancel"); 12 var projectNameChangeCancel = $("#project-name-change-cancel");
@@ -23,24 +24,21 @@ function basePageInit(ctx) {
23 /* Project name change functionality */ 24 /* Project name change functionality */
24 projectNameFormToggle.click(function(e){ 25 projectNameFormToggle.click(function(e){
25 e.preventDefault(); 26 e.preventDefault();
26 27 projectNameContainer.hide();
27 $(this).add(projectName).hide();
28 projectNameForm.fadeIn(); 28 projectNameForm.fadeIn();
29 }); 29 });
30 30
31 projectNameChangeCancel.click(function(e){ 31 projectNameChangeCancel.click(function(e){
32 e.preventDefault(); 32 e.preventDefault();
33
34 projectNameForm.hide(); 33 projectNameForm.hide();
35 projectName.add(projectNameFormToggle).fadeIn(); 34 projectNameContainer.fadeIn();
36 }); 35 });
37 36
38 $("#project-name-change-btn").click(function(e){ 37 $("#project-name-change-btn").click(function(e){
39 var newProjectName = $("#project-name-change-input").val(); 38 var newProjectName = $("#project-name-change-input").val();
40 39
41 libtoaster.editCurrentProject({ projectName: newProjectName },function (){ 40 libtoaster.editCurrentProject({ projectName: newProjectName }, function (){
42 41 projectName.html(newProjectName);
43 projectName.text(newProjectName);
44 libtoaster.ctx.projectName = newProjectName; 42 libtoaster.ctx.projectName = newProjectName;
45 projectNameChangeCancel.click(); 43 projectNameChangeCancel.click();
46 }); 44 });
diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
index b29f650f5d..53f40d0f14 100644
--- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
+++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
@@ -8,6 +8,10 @@
8 {%if mrb_type == 'project' %} 8 {%if mrb_type == 'project' %}
9 <h2> 9 <h2>
10 Latest project builds 10 Latest project builds
11
12 {% if project.is_default %}
13 <i class="icon-question-sign get-help heading-help" title="" data-original-title="Builds in this project cannot be started from Toaster: they are started from the command line"></i>
14 {% endif %}
11 </h2> 15 </h2>
12 {% else %} 16 {% else %}
13 <div class="page-header"> 17 <div class="page-header">
diff --git a/bitbake/lib/toaster/toastergui/templates/projecttopbar.html b/bitbake/lib/toaster/toastergui/templates/projecttopbar.html
index a3d1b88edf..ee86b5481d 100644
--- a/bitbake/lib/toaster/toastergui/templates/projecttopbar.html
+++ b/bitbake/lib/toaster/toastergui/templates/projecttopbar.html
@@ -5,8 +5,14 @@
5 5
6<!-- project name --> 6<!-- project name -->
7<div class="page-header"> 7<div class="page-header">
8 <h1><span id="project-name">{{project.name}}</span> 8 <h1 id="project-name-container">
9 <span id="project-name">{{project.name}}</span>
10
9 <i class="icon-pencil" data-original-title="" id="project-change-form-toggle" title=""></i> 11 <i class="icon-pencil" data-original-title="" id="project-change-form-toggle" title=""></i>
12
13 {% if project.is_default %}
14 <i class="icon-question-sign get-help heading-help" title="" data-original-title="This project shows information about the builds you start from the command line while Toaster is running"></i>
15 {% endif %}
10 </h1> 16 </h1>
11 <form id="project-name-change-form" style="margin-bottom: 0px; display: none;"> 17 <form id="project-name-change-form" style="margin-bottom: 0px; display: none;">
12 <div class="input-append"> 18 <div class="input-append">
@@ -17,38 +23,40 @@
17 </form> 23 </form>
18</div> 24</div>
19 25
20<div id="project-topbar"> 26{% if not project.is_default %}
21 <ul class="nav nav-pills"> 27 <div id="project-topbar">
22 <li> 28 <ul class="nav nav-pills">
23 <a href="{% url 'projectbuilds' project.id %}"> 29 <li>
24 Builds (<span class="total-builds">0</span>) 30 <a href="{% url 'projectbuilds' project.id %}">
25 </a> 31 Builds (<span class="total-builds">0</span>)
26 </li> 32 </a>
27 <li id="topbar-configuration-tab"> 33 </li>
28 <a href="{% url 'project' project.id %}"> 34 <li id="topbar-configuration-tab">
29 Configuration 35 <a href="{% url 'project' project.id %}">
30 </a> 36 Configuration
31 </li> 37 </a>
32 <li> 38 </li>
33 <a href="{% url 'importlayer' project.id %}"> 39 <li>
34 Import layer 40 <a href="{% url 'importlayer' project.id %}">
35 </a> 41 Import layer
36 </li> 42 </a>
37 {% if CUSTOM_IMAGE %} 43 </li>
38 <li> 44 {% if CUSTOM_IMAGE %}
39 <a href="{% url 'newcustomimage' project.id %}"> 45 <li>
40 New custom image 46 <a href="{% url 'newcustomimage' project.id %}">
41 </a> 47 New custom image
42 </li> 48 </a>
43 {% endif %} 49 </li>
44 <li class="pull-right"> 50 {% endif %}
45 <form class="form-inline" style="margin-bottom:0px;"> 51 <li class="pull-right">
46 <i class="icon-question-sign get-help heading-help" data-placement="left" title="" data-original-title="Type the name of one or more recipes you want to build, separated by a space. You can also specify a task by appending a semicolon and a task name to the recipe name, like so: <code>busybox:clean</code>"></i> 52 <form class="form-inline" style="margin-bottom:0px;">
47 <div class="input-append"> 53 <i class="icon-question-sign get-help heading-help" data-placement="left" title="" data-original-title="Type the name of one or more recipes you want to build, separated by a space. You can also specify a task by appending a semicolon and a task name to the recipe name, like so: <code>busybox:clean</code>"></i>
48 <input id="build-input" type="text" class="input-xlarge input-lg build-target-input" placeholder="Type the recipe you want to build" autocomplete="off" disabled> 54 <div class="input-append">
49 <button id="build-button" class="btn btn-primary btn-large build-button" data-project-id="{{project.id}}" disabled>Build</button> 55 <input id="build-input" type="text" class="input-xlarge input-lg build-target-input" placeholder="Type the recipe you want to build" autocomplete="off" disabled>
50 </div> 56 <button id="build-button" class="btn btn-primary btn-large build-button" data-project-id="{{project.id}}" disabled>Build</button>
51 </form> 57 </div>
52 </li> 58 </form>
53 </ul> 59 </li>
54</div> 60 </ul>
61 </div>
62{% endif %}
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 3753748b75..4b93415e1e 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -596,8 +596,18 @@ class ProjectBuildsPageTests(TestCase):
596 bitbake_version=bbv) 596 bitbake_version=bbv)
597 self.project1 = Project.objects.create_project(name=PROJECT_NAME, 597 self.project1 = Project.objects.create_project(name=PROJECT_NAME,
598 release=release) 598 release=release)
599 self.project1.save()
600
599 self.project2 = Project.objects.create_project(name=PROJECT_NAME, 601 self.project2 = Project.objects.create_project(name=PROJECT_NAME,
600 release=release) 602 release=release)
603 self.project2.save()
604
605 self.default_project = Project.objects.create_project(
606 name=CLI_BUILDS_PROJECT_NAME,
607 release=release
608 )
609 self.default_project.is_default = True
610 self.default_project.save()
601 611
602 # parameters for builds to associate with the projects 612 # parameters for builds to associate with the projects
603 now = timezone.now() 613 now = timezone.now()
@@ -630,6 +640,13 @@ class ProjectBuildsPageTests(TestCase):
630 "outcome": Build.IN_PROGRESS 640 "outcome": Build.IN_PROGRESS
631 } 641 }
632 642
643 self.default_project_build_success = {
644 "project": self.default_project,
645 "started_on": now,
646 "completed_on": now,
647 "outcome": Build.SUCCEEDED
648 }
649
633 def _get_rows_for_project(self, project_id): 650 def _get_rows_for_project(self, project_id):
634 """ Helper to retrieve HTML rows for a project """ 651 """ Helper to retrieve HTML rows for a project """
635 url = reverse("projectbuilds", args=(project_id,)) 652 url = reverse("projectbuilds", args=(project_id,))
@@ -681,6 +698,30 @@ class ProjectBuildsPageTests(TestCase):
681 result = re.findall('^ +bash:clean$', response.content, re.MULTILINE) 698 result = re.findall('^ +bash:clean$', response.content, re.MULTILINE)
682 self.assertEqual(len(result), 2) 699 self.assertEqual(len(result), 2)
683 700
701 def test_cli_builds_hides_tabs(self):
702 """
703 Display for command line builds should hide tabs;
704 note that the latest builds section is already tested in
705 AllBuildsPageTests, as the template is the same
706 """
707 url = reverse("projectbuilds", args=(self.default_project.id,))
708 response = self.client.get(url, follow=True)
709 soup = BeautifulSoup(response.content)
710 tabs = soup.select('#project-topbar')
711 self.assertEqual(len(tabs), 0,
712 'should be no top bar shown for command line builds')
713
714 def test_non_cli_builds_has_tabs(self):
715 """
716 Non-command-line builds projects should show the tabs
717 """
718 url = reverse("projectbuilds", args=(self.project1.id,))
719 response = self.client.get(url, follow=True)
720 soup = BeautifulSoup(response.content)
721 tabs = soup.select('#project-topbar')
722 self.assertEqual(len(tabs), 1,
723 'should be a top bar shown for non-command-line builds')
724
684class AllBuildsPageTests(TestCase): 725class AllBuildsPageTests(TestCase):
685 """ Tests for all builds page /builds/ """ 726 """ Tests for all builds page /builds/ """
686 727