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>
This commit is contained in:
Alexandru DAMIAN 2015-02-13 13:08:26 +00:00 committed by Richard Purdie
parent 208f40dc05
commit 88f431cddf
11 changed files with 135 additions and 29 deletions

View File

@ -67,10 +67,14 @@ class ProjectManager(models.Manager):
for rdl in release.releasedefaultlayer_set.all():
lv = Layer_Version.objects.filter(layer__name = rdl.layer_name, up_branch__name = release.branch_name)[0].get_equivalents_wpriority(prj)[0]
ProjectLayer.objects.create( project = prj,
try:
lv =Layer_Version.objects.filter(layer__name = rdl.layer_name, up_branch__name = release.branch_name)[0].get_equivalents_wpriority(prj)[0]
ProjectLayer.objects.create( project = prj,
layercommit = lv,
optional = False )
except IndexError:
# we may have no valid layer version objects, and that's ok
pass
return prj

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -9,10 +9,12 @@
<div class="container-fluid">
<div class="row-fluid">
<!-- Empty - no data in database -->
<div class="hero-unit span12">
<div class="hero-unit span12" {%if MANAGED%}style="background-color: white"{%endif%}>
{% if not MANAGED %}
<button class="close" data-dismiss="alert" type="button">
×
</button>
{% endif %}
<div class="row-fluid">
<div class="span6">
<h1>
@ -29,22 +31,63 @@
</a>
build system.
</p>
{% if MANAGED %}
{% if lvs_nos %}
<p class="hero-actions">
<a class="btn btn-primary btn-large" href="{% url 'newproject' %}">
To start building, create your first Toaster project
</a>
</p>
{% else %}
<div class="alert alert-info">
<p>
Toaster has no layer information; without layer information, you cannot run builds. To generate layer information you can:
</p>
<ul>
<li> <a href="https://wiki.yoctoproject.org/wiki/Setting_up_a_hosted_managed_mode_for_Toaster#LayerSources">Configure a layer source</a>
</li>
<li> <a href="{% url 'newproject' %}">Create a project</a>, then import layers
</ul>
</div>
{% endif %}
<p style="margin-top: 2em">
<a href="https://www.yoctoproject.org/documentation/toaster-manual">
Read the Toaster manual
</a> <br/>
<a href="https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster">
Contribute to Toaster
</a>
</p>
{% else %}
<p class="hero-actions">
<a class="btn btn-primary btn-large" href="https://www.yoctoproject.org/documentation/toaster-manual">
Show me the manual
</a>
</a>
<a class="btn btn-large" href="https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster">
I want to contribute
</a>
</p>
</a>
</p>
{% endif %}
</div>
<div class="span5">
<a href="http://www.yoctoproject.org">
<img alt="Yocto Project" class="thumbnail" src="/static/img/toaster.png"/>
{% if MANAGED %}
<img alt="Yocto Project" class="thumbnail" src="{% static 'img/toaster_1.7.png' %}"/>
{% else %}
<img alt="Yocto Project" class="thumbnail" src="{% static 'img/toaster.png' %}"/>
{% endif %}
</a>
</div>
</div>
</div>
{% if not MANAGED %}
<!-- Empty - no data in database -->
<div class="page-header top-air">
<h1>
@ -61,6 +104,8 @@
Hob
</a>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -47,16 +47,25 @@
<button type="button" class="close" id="dismiss-alert">&times;</button>
<span id="alert-msg"></span>
</div>
{% if request.GET.search and objects.paginator.count == 0 %}
<div class="alert row-fluid">
<form class="navbar-search input-append pull-left" id="searchform">
<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>
<input type="hidden" name="orderby" value="">
<input type="hidden" name="page" value="1">
<button class="btn" type="submit" value="Search">Search</button>
<button type="submit" class="btn btn-link" id="show-all-btn">Show all machines</button>
</form>
</div>
{% if objects.paginator.count == 0 %}
{% if request.GET.search %}
<div class="alert row-fluid">
<form class="navbar-search input-append pull-left" id="searchform">
<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>
<input type="hidden" name="orderby" value="">
<input type="hidden" name="page" value="1">
<button class="btn" type="submit" value="Search">Search</button>
<button type="submit" class="btn btn-link" id="show-all-btn">Show all machines</button>
</form>
</div>
{% else %}
<div class="alert alert-info">
<p class="lead">
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>
</p>
</div>
{% endif %}
{% else %}
{% include "basetable_top.html" %}
{% for o in objects %}

View File

@ -25,6 +25,7 @@
{% if objects.paginator.count == 0 %}
<div class="row-fluid">
{% if request.GET.filter or request.GET.search %}
<div class="alert">
<form class="no-results input-append" id="searchform">
<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 @@
<button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all builds</button>
</form>
</div>
{% else %}
<div class="alert alert-info">
<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.
</div>
{% endif %}
</div>

View File

@ -3,12 +3,11 @@
{% load humanize %}
{%if mru.count > 0%}
{%if len.mru > 0%}
<div class="page-header top-air">
<h1>
Latest builds
</h1>
</h1>
</div>
<div id="latest-builds">
{% for buildrequest in mru %}{% with build=buildrequest.build %}

View File

@ -16,6 +16,19 @@ vim: expandtab tabstop=2
<script src="{% static "js/ui-bootstrap-tpls-0.11.0.js" %}"></script>
{% if lvs_nos == 0 %}
<div class="alert alert-info">
<p>
Toaster has no layer information; without layer information, you cannot run builds.<br/> To generate layer information you can:
</p>
<ul>
<li> <a href="https://wiki.yoctoproject.org/wiki/Setting_up_a_hosted_managed_mode_for_Toaster#LayerSources">Configure a layer source</a>
</li>
<li> <a href="{% url 'importlayer' %}">Import a layer</a>
</ul>
</div>
{%else%}
<div id="main" role="main" ng-app="project" ng-controller="prjCtrl" class="top-padded">
@ -440,4 +453,5 @@ angular.element(document).ready(function() {
});
</script>
{% endif %} {# from lvs_nos check #}
{% endblock %}

View File

@ -9,8 +9,8 @@
{% block projectinfomain %}
<div class="page-header">
<h1>
{% if objects.paginator.count == 0 %}
No builds found
{% if objects.paginator.count == 0 and request.GET.filter or request.GET.search %}
No builds found
{% else %}
{% if request.GET.filter or request.GET.search %}
@ -25,6 +25,7 @@
{% if objects.paginator.count == 0 %}
{% if request.GET.filter or request.GET.search %}
<div class="row-fluid">
<div class="alert">
<form class="no-results input-append" id="searchform">
@ -34,7 +35,13 @@
</form>
</div>
</div>
{% else %}
<div class="alert alert-info">
<p class="lead">
This project has no builds.
</p>
</div>
{% endif %}
{% else %}

View File

@ -52,7 +52,7 @@
<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>
</dt>
<dd class="lead">
<span id="image_install">{% if image_install_append %}{{image_install_append}}{%else%}Not set{%endif%}</span>
<span id="image_install">{% if image_install_append %}{{image_install_append}}{%else%}<i>Not set</i>{%endif%}</span>
<i class="icon-pencil" id="change-image_install-icon"></i>
<i class="icon-trash" id="delete-image_install-icon" {% if image_install_append %}{%else%}style="display:none;"{%endif%}></i>
<form id="change-image_install-form" style="display:none;">

View File

@ -25,6 +25,7 @@
</div>
{% if objects.paginator.count == 0 %}
{% if request.GET.filter or request.GET.search %}
<div class="row-fluid">
<div class="alert">
<form class="no-results input-append" id="searchform">
@ -34,6 +35,17 @@
</form>
</div>
</div>
{% else %}
<div class="alert alert-info">
<p class="lead">
Toaster has not target information. To generate target information you can:<br/>
<ul class="lead">
<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>
<li style="margin-top: 10px"> <a href="{% url 'importlayer' %}">Import a layer</a></li>
</ul>
</p>
</div>
{% endif %}
{% else %}

View File

@ -43,13 +43,22 @@ import json
# all new sessions should come through the landing page;
# determine in which mode we are running in, and redirect appropriately
def landing(request):
if toastermain.settings.MANAGED and Build.objects.count() == 0 and Project.objects.count() > 0:
return redirect(reverse('all-projects'), permanent = False)
if toastermain.settings.MANAGED:
from bldcontrol.models import BuildRequest
if BuildRequest.objects.count() == 0 and Project.objects.count() > 0:
return redirect(reverse('all-projects'), permanent = False)
if Build.objects.all().count() > 0:
return redirect(reverse('all-builds'), permanent = False)
if BuildRequest.objects.all().count() > 0:
return redirect(reverse('all-builds'), permanent = False)
else:
if Build.objects.all().count() > 0:
return redirect(reverse('all-builds'), permanent = False)
return render(request, 'landing.html')
context = {}
if toastermain.settings.MANAGED:
context['lvs_nos'] = Layer_Version.objects.all().count()
return render(request, 'landing.html', context)
# returns a list for most recent builds; for use in the Project page, xhr_ updates, and other places, as needed
def _project_recent_build_list(prj):
@ -2035,6 +2044,7 @@ if toastermain.settings.MANAGED:
context = {
"project" : prj,
"lvs_nos" : Layer_Version.objects.all().count(),
"completedbuilds": BuildRequest.objects.filter(project_id = pid).exclude(state__lte = BuildRequest.REQ_INPROGRESS).exclude(state=BuildRequest.REQ_DELETED),
"prj" : {"name": prj.name, "release": { "id": prj.release.pk, "name": prj.release.name, "desc": prj.release.description}},
#"buildrequests" : prj.buildrequest_set.filter(state=BuildRequest.REQ_QUEUED),