summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-02-13 13:08:26 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-17 14:38:32 +0000
commit88f431cddfc80408a7fce3609ea5a1aa97cf0af4 (patch)
tree7ee683d7d2eadfa635bac705bf7eed8fc894c2ed /bitbake/lib
parent208f40dc0542e39b5664ffd957213020e05220b2 (diff)
downloadpoky-88f431cddfc80408a7fce3609ea5a1aa97cf0af4.tar.gz
bitbake: toasterui: empty state for pages
Toaster needs to properly prompt the user and display actionable help texts when the database is void of meaningful information. This patch brings in the "empty" states for pages. [YOCTO #6755] (Bitbake rev: 7cfe279bf77b59d5cbd20d8a93e1d33279bebc20) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/orm/models.py8
-rw-r--r--bitbake/lib/toaster/toastergui/static/img/toaster_1.7.pngbin0 -> 125151 bytes
-rw-r--r--bitbake/lib/toaster/toastergui/templates/landing.html55
-rw-r--r--bitbake/lib/toaster/toastergui/templates/machines.html29
-rw-r--r--bitbake/lib/toaster/toastergui/templates/managed_builds.html6
-rw-r--r--bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html5
-rw-r--r--bitbake/lib/toaster/toastergui/templates/project.html14
-rw-r--r--bitbake/lib/toaster/toastergui/templates/projectbuilds.html13
-rw-r--r--bitbake/lib/toaster/toastergui/templates/projectconf.html2
-rw-r--r--bitbake/lib/toaster/toastergui/templates/targets.html12
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py20
11 files changed, 135 insertions, 29 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 4bb84bd5ef..f70c0066ad 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -67,10 +67,14 @@ class ProjectManager(models.Manager):
67 67
68 68
69 for rdl in release.releasedefaultlayer_set.all(): 69 for rdl in release.releasedefaultlayer_set.all():
70 lv = Layer_Version.objects.filter(layer__name = rdl.layer_name, up_branch__name = release.branch_name)[0].get_equivalents_wpriority(prj)[0] 70 try:
71 ProjectLayer.objects.create( project = prj, 71 lv =Layer_Version.objects.filter(layer__name = rdl.layer_name, up_branch__name = release.branch_name)[0].get_equivalents_wpriority(prj)[0]
72 ProjectLayer.objects.create( project = prj,
72 layercommit = lv, 73 layercommit = lv,
73 optional = False ) 74 optional = False )
75 except IndexError:
76 # we may have no valid layer version objects, and that's ok
77 pass
74 78
75 return prj 79 return prj
76 80
diff --git a/bitbake/lib/toaster/toastergui/static/img/toaster_1.7.png b/bitbake/lib/toaster/toastergui/static/img/toaster_1.7.png
new file mode 100644
index 0000000000..7c303fd15e
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/static/img/toaster_1.7.png
Binary files differ
diff --git a/bitbake/lib/toaster/toastergui/templates/landing.html b/bitbake/lib/toaster/toastergui/templates/landing.html
index 071edf86ef..d5ae9f5e20 100644
--- a/bitbake/lib/toaster/toastergui/templates/landing.html
+++ b/bitbake/lib/toaster/toastergui/templates/landing.html
@@ -9,10 +9,12 @@
9 <div class="container-fluid"> 9 <div class="container-fluid">
10 <div class="row-fluid"> 10 <div class="row-fluid">
11 <!-- Empty - no data in database --> 11 <!-- Empty - no data in database -->
12 <div class="hero-unit span12"> 12 <div class="hero-unit span12" {%if MANAGED%}style="background-color: white"{%endif%}>
13 {% if not MANAGED %}
13 <button class="close" data-dismiss="alert" type="button"> 14 <button class="close" data-dismiss="alert" type="button">
14 × 15 ×
15 </button> 16 </button>
17 {% endif %}
16 <div class="row-fluid"> 18 <div class="row-fluid">
17 <div class="span6"> 19 <div class="span6">
18 <h1> 20 <h1>
@@ -29,22 +31,63 @@
29 </a> 31 </a>
30 build system. 32 build system.
31 </p> 33 </p>
34
35 {% if MANAGED %}
36
37 {% if lvs_nos %}
38 <p class="hero-actions">
39 <a class="btn btn-primary btn-large" href="{% url 'newproject' %}">
40 To start building, create your first Toaster project
41 </a>
42 </p>
43 {% else %}
44 <div class="alert alert-info">
45 <p>
46 Toaster has no layer information; without layer information, you cannot run builds. To generate layer information you can:
47 </p>
48 <ul>
49 <li> <a href="https://wiki.yoctoproject.org/wiki/Setting_up_a_hosted_managed_mode_for_Toaster#LayerSources">Configure a layer source</a>
50 </li>
51 <li> <a href="{% url 'newproject' %}">Create a project</a>, then import layers
52 </ul>
53 </div>
54 {% endif %}
55
56 <p style="margin-top: 2em">
57 <a href="https://www.yoctoproject.org/documentation/toaster-manual">
58 Read the Toaster manual
59 </a> <br/>
60 <a href="https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster">
61 Contribute to Toaster
62 </a>
63 </p>
64
65 {% else %}
66
32 <p class="hero-actions"> 67 <p class="hero-actions">
33 <a class="btn btn-primary btn-large" href="https://www.yoctoproject.org/documentation/toaster-manual"> 68 <a class="btn btn-primary btn-large" href="https://www.yoctoproject.org/documentation/toaster-manual">
34 Show me the manual 69 Show me the manual
35 </a> 70 </a>
36 <a class="btn btn-large" href="https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster"> 71 <a class="btn btn-large" href="https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster">
37 I want to contribute 72 I want to contribute
38 </a> 73 </a>
39 </p> 74 </p>
75
76 {% endif %}
40 </div> 77 </div>
41 <div class="span5"> 78 <div class="span5">
42 <a href="http://www.yoctoproject.org"> 79 <a href="http://www.yoctoproject.org">
43 <img alt="Yocto Project" class="thumbnail" src="/static/img/toaster.png"/> 80 {% if MANAGED %}
81 <img alt="Yocto Project" class="thumbnail" src="{% static 'img/toaster_1.7.png' %}"/>
82 {% else %}
83 <img alt="Yocto Project" class="thumbnail" src="{% static 'img/toaster.png' %}"/>
84 {% endif %}
44 </a> 85 </a>
45 </div> 86 </div>
46 </div> 87 </div>
47 </div> 88 </div>
89
90 {% if not MANAGED %}
48 <!-- Empty - no data in database --> 91 <!-- Empty - no data in database -->
49 <div class="page-header top-air"> 92 <div class="page-header top-air">
50 <h1> 93 <h1>
@@ -61,6 +104,8 @@
61 Hob 104 Hob
62 </a> 105 </a>
63 </div> 106 </div>
107 {% endif %}
108
64 </div> 109 </div>
65 110
66{% endblock %} 111{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/templates/machines.html b/bitbake/lib/toaster/toastergui/templates/machines.html
index 9b2a540f31..1057bdda3f 100644
--- a/bitbake/lib/toaster/toastergui/templates/machines.html
+++ b/bitbake/lib/toaster/toastergui/templates/machines.html
@@ -47,16 +47,25 @@
47 <button type="button" class="close" id="dismiss-alert">&times;</button> 47 <button type="button" class="close" id="dismiss-alert">&times;</button>
48 <span id="alert-msg"></span> 48 <span id="alert-msg"></span>
49</div> 49</div>
50{% if request.GET.search and objects.paginator.count == 0 %} 50{% if objects.paginator.count == 0 %}
51<div class="alert row-fluid"> 51 {% if request.GET.search %}
52<form class="navbar-search input-append pull-left" id="searchform"> 52 <div class="alert row-fluid">
53 <input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search machines" value="{{request.GET.search}}"><a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a> 53 <form class="navbar-search input-append pull-left" id="searchform">
54 <input type="hidden" name="orderby" value=""> 54 <input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search machines" value="{{request.GET.search}}"><a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>
55 <input type="hidden" name="page" value="1"> 55 <input type="hidden" name="orderby" value="">
56 <button class="btn" type="submit" value="Search">Search</button> 56 <input type="hidden" name="page" value="1">
57 <button type="submit" class="btn btn-link" id="show-all-btn">Show all machines</button> 57 <button class="btn" type="submit" value="Search">Search</button>
58 </form> 58 <button type="submit" class="btn btn-link" id="show-all-btn">Show all machines</button>
59 </div> 59 </form>
60 </div>
61 {% else %}
62 <div class="alert alert-info">
63 <p class="lead">
64 Toaster has no machine information. To fetch machine information you should <a href="https://wiki.yoctoproject.org/wiki/Setting_up_a_hosted_managed_mode_for_Toaster#LayerSources">configure a layer source</a>
65 </p>
66 </div>
67 {% endif %}
68
60{% else %} 69{% else %}
61 {% include "basetable_top.html" %} 70 {% include "basetable_top.html" %}
62 {% for o in objects %} 71 {% for o in objects %}
diff --git a/bitbake/lib/toaster/toastergui/templates/managed_builds.html b/bitbake/lib/toaster/toastergui/templates/managed_builds.html
index 183be760ae..121ad07898 100644
--- a/bitbake/lib/toaster/toastergui/templates/managed_builds.html
+++ b/bitbake/lib/toaster/toastergui/templates/managed_builds.html
@@ -25,6 +25,7 @@
25 25
26 {% if objects.paginator.count == 0 %} 26 {% if objects.paginator.count == 0 %}
27 <div class="row-fluid"> 27 <div class="row-fluid">
28 {% if request.GET.filter or request.GET.search %}
28 <div class="alert"> 29 <div class="alert">
29 <form class="no-results input-append" id="searchform"> 30 <form class="no-results input-append" id="searchform">
30 <input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>{% endif %} 31 <input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>{% endif %}
@@ -32,6 +33,11 @@
32 <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all builds</button> 33 <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all builds</button>
33 </form> 34 </form>
34 </div> 35 </div>
36 {% else %}
37 <div class="alert alert-info">
38 <p class="lead">Toaster has not recorded any builds yet. To run a build, <a href="{% url 'all-projects' %}">select the project</a> for which you want to build.
39 </div>
40 {% endif %}
35 </div> 41 </div>
36 42
37 43
diff --git a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html
index c7ae6fd142..6f31ee0239 100644
--- a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html
+++ b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html
@@ -3,12 +3,11 @@
3{% load humanize %} 3{% load humanize %}
4 4
5 5
6{%if mru.count > 0%} 6{%if len.mru > 0%}
7
8 <div class="page-header top-air"> 7 <div class="page-header top-air">
9 <h1> 8 <h1>
10 Latest builds 9 Latest builds
11 </h1> 10 </h1>
12 </div> 11 </div>
13 <div id="latest-builds"> 12 <div id="latest-builds">
14 {% for buildrequest in mru %}{% with build=buildrequest.build %} 13 {% for buildrequest in mru %}{% with build=buildrequest.build %}
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html
index 2c9cd8153c..7da2361460 100644
--- a/bitbake/lib/toaster/toastergui/templates/project.html
+++ b/bitbake/lib/toaster/toastergui/templates/project.html
@@ -16,6 +16,19 @@ vim: expandtab tabstop=2
16<script src="{% static "js/ui-bootstrap-tpls-0.11.0.js" %}"></script> 16<script src="{% static "js/ui-bootstrap-tpls-0.11.0.js" %}"></script>
17 17
18 18
19{% if lvs_nos == 0 %}
20<div class="alert alert-info">
21 <p>
22 Toaster has no layer information; without layer information, you cannot run builds.<br/> To generate layer information you can:
23 </p>
24 <ul>
25 <li> <a href="https://wiki.yoctoproject.org/wiki/Setting_up_a_hosted_managed_mode_for_Toaster#LayerSources">Configure a layer source</a>
26 </li>
27 <li> <a href="{% url 'importlayer' %}">Import a layer</a>
28 </ul>
29</div>
30
31{%else%}
19<div id="main" role="main" ng-app="project" ng-controller="prjCtrl" class="top-padded"> 32<div id="main" role="main" ng-app="project" ng-controller="prjCtrl" class="top-padded">
20 33
21 34
@@ -440,4 +453,5 @@ angular.element(document).ready(function() {
440 }); 453 });
441</script> 454</script>
442 455
456{% endif %} {# from lvs_nos check #}
443{% endblock %} 457{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/templates/projectbuilds.html b/bitbake/lib/toaster/toastergui/templates/projectbuilds.html
index 2a8bd58f34..02d166341f 100644
--- a/bitbake/lib/toaster/toastergui/templates/projectbuilds.html
+++ b/bitbake/lib/toaster/toastergui/templates/projectbuilds.html
@@ -9,8 +9,8 @@
9{% block projectinfomain %} 9{% block projectinfomain %}
10 <div class="page-header"> 10 <div class="page-header">
11 <h1> 11 <h1>
12 {% if objects.paginator.count == 0 %} 12 {% if objects.paginator.count == 0 and request.GET.filter or request.GET.search %}
13 No builds found 13 No builds found
14 14
15 {% else %} 15 {% else %}
16 {% if request.GET.filter or request.GET.search %} 16 {% if request.GET.filter or request.GET.search %}
@@ -25,6 +25,7 @@
25 25
26 26
27 {% if objects.paginator.count == 0 %} 27 {% if objects.paginator.count == 0 %}
28 {% if request.GET.filter or request.GET.search %}
28 <div class="row-fluid"> 29 <div class="row-fluid">
29 <div class="alert"> 30 <div class="alert">
30 <form class="no-results input-append" id="searchform"> 31 <form class="no-results input-append" id="searchform">
@@ -34,7 +35,13 @@
34 </form> 35 </form>
35 </div> 36 </div>
36 </div> 37 </div>
37 38 {% else %}
39 <div class="alert alert-info">
40 <p class="lead">
41 This project has no builds.
42 </p>
43 </div>
44 {% endif %}
38 45
39 {% else %} 46 {% else %}
40 47
diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html b/bitbake/lib/toaster/toastergui/templates/projectconf.html
index ec1fb9bd20..9cacce42d8 100644
--- a/bitbake/lib/toaster/toastergui/templates/projectconf.html
+++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html
@@ -52,7 +52,7 @@
52 <i class="icon-question-sign get-help" title="Specifies additional packages to install into an image. If your build creates more than one image, the packages will be installed in <strong>all of them</strong> <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#var-IMAGE_INSTALL' target='_blank'>Read more in the manual</a>"></i> 52 <i class="icon-question-sign get-help" title="Specifies additional packages to install into an image. If your build creates more than one image, the packages will be installed in <strong>all of them</strong> <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#var-IMAGE_INSTALL' target='_blank'>Read more in the manual</a>"></i>
53 </dt> 53 </dt>
54 <dd class="lead"> 54 <dd class="lead">
55 <span id="image_install">{% if image_install_append %}{{image_install_append}}{%else%}Not set{%endif%}</span> 55 <span id="image_install">{% if image_install_append %}{{image_install_append}}{%else%}<i>Not set</i>{%endif%}</span>
56 <i class="icon-pencil" id="change-image_install-icon"></i> 56 <i class="icon-pencil" id="change-image_install-icon"></i>
57 <i class="icon-trash" id="delete-image_install-icon" {% if image_install_append %}{%else%}style="display:none;"{%endif%}></i> 57 <i class="icon-trash" id="delete-image_install-icon" {% if image_install_append %}{%else%}style="display:none;"{%endif%}></i>
58 <form id="change-image_install-form" style="display:none;"> 58 <form id="change-image_install-form" style="display:none;">
diff --git a/bitbake/lib/toaster/toastergui/templates/targets.html b/bitbake/lib/toaster/toastergui/templates/targets.html
index 6cd9391323..234159a687 100644
--- a/bitbake/lib/toaster/toastergui/templates/targets.html
+++ b/bitbake/lib/toaster/toastergui/templates/targets.html
@@ -25,6 +25,7 @@
25 </div> 25 </div>
26 26
27{% if objects.paginator.count == 0 %} 27{% if objects.paginator.count == 0 %}
28 {% if request.GET.filter or request.GET.search %}
28 <div class="row-fluid"> 29 <div class="row-fluid">
29 <div class="alert"> 30 <div class="alert">
30 <form class="no-results input-append" id="searchform"> 31 <form class="no-results input-append" id="searchform">
@@ -34,6 +35,17 @@
34 </form> 35 </form>
35 </div> 36 </div>
36 </div> 37 </div>
38 {% else %}
39 <div class="alert alert-info">
40 <p class="lead">
41 Toaster has not target information. To generate target information you can:<br/>
42 <ul class="lead">
43 <li style="margin-top: 10px"> <a href="https://wiki.yoctoproject.org/wiki/Setting_up_a_hosted_managed_mode_for_Toaster#LayerSources">Configure a layer source</a></li>
44 <li style="margin-top: 10px"> <a href="{% url 'importlayer' %}">Import a layer</a></li>
45 </ul>
46 </p>
47 </div>
48 {% endif %}
37 49
38{% else %} 50{% else %}
39 51
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 338b8c36f2..b5ff9b1d53 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -43,13 +43,22 @@ import json
43# all new sessions should come through the landing page; 43# all new sessions should come through the landing page;
44# determine in which mode we are running in, and redirect appropriately 44# determine in which mode we are running in, and redirect appropriately
45def landing(request): 45def landing(request):
46 if toastermain.settings.MANAGED and Build.objects.count() == 0 and Project.objects.count() > 0: 46 if toastermain.settings.MANAGED:
47 return redirect(reverse('all-projects'), permanent = False) 47 from bldcontrol.models import BuildRequest
48 if BuildRequest.objects.count() == 0 and Project.objects.count() > 0:
49 return redirect(reverse('all-projects'), permanent = False)
48 50
49 if Build.objects.all().count() > 0: 51 if BuildRequest.objects.all().count() > 0:
50 return redirect(reverse('all-builds'), permanent = False) 52 return redirect(reverse('all-builds'), permanent = False)
53 else:
54 if Build.objects.all().count() > 0:
55 return redirect(reverse('all-builds'), permanent = False)
56
57 context = {}
58 if toastermain.settings.MANAGED:
59 context['lvs_nos'] = Layer_Version.objects.all().count()
51 60
52 return render(request, 'landing.html') 61 return render(request, 'landing.html', context)
53 62
54# returns a list for most recent builds; for use in the Project page, xhr_ updates, and other places, as needed 63# returns a list for most recent builds; for use in the Project page, xhr_ updates, and other places, as needed
55def _project_recent_build_list(prj): 64def _project_recent_build_list(prj):
@@ -2035,6 +2044,7 @@ if toastermain.settings.MANAGED:
2035 2044
2036 context = { 2045 context = {
2037 "project" : prj, 2046 "project" : prj,
2047 "lvs_nos" : Layer_Version.objects.all().count(),
2038 "completedbuilds": BuildRequest.objects.filter(project_id = pid).exclude(state__lte = BuildRequest.REQ_INPROGRESS).exclude(state=BuildRequest.REQ_DELETED), 2048 "completedbuilds": BuildRequest.objects.filter(project_id = pid).exclude(state__lte = BuildRequest.REQ_INPROGRESS).exclude(state=BuildRequest.REQ_DELETED),
2039 "prj" : {"name": prj.name, "release": { "id": prj.release.pk, "name": prj.release.name, "desc": prj.release.description}}, 2049 "prj" : {"name": prj.name, "release": { "id": prj.release.pk, "name": prj.release.name, "desc": prj.release.description}},
2040 #"buildrequests" : prj.buildrequest_set.filter(state=BuildRequest.REQ_QUEUED), 2050 #"buildrequests" : prj.buildrequest_set.filter(state=BuildRequest.REQ_QUEUED),