1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 01:19:52 +00:00

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
+6 -2
View File
@@ -67,10 +67,14 @@ class ProjectManager(models.Manager):
for rdl in release.releasedefaultlayer_set.all(): 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] try:
ProjectLayer.objects.create( project = prj, 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, layercommit = lv,
optional = False ) optional = False )
except IndexError:
# we may have no valid layer version objects, and that's ok
pass
return prj return prj
Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

@@ -9,10 +9,12 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row-fluid"> <div class="row-fluid">
<!-- Empty - no data in database --> <!-- 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 class="close" data-dismiss="alert" type="button">
× ×
</button> </button>
{% endif %}
<div class="row-fluid"> <div class="row-fluid">
<div class="span6"> <div class="span6">
<h1> <h1>
@@ -29,22 +31,63 @@
</a> </a>
build system. build system.
</p> </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"> <p class="hero-actions">
<a class="btn btn-primary btn-large" href="https://www.yoctoproject.org/documentation/toaster-manual"> <a class="btn btn-primary btn-large" href="https://www.yoctoproject.org/documentation/toaster-manual">
Show me the manual Show me the manual
</a> </a>
<a class="btn btn-large" href="https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster"> <a class="btn btn-large" href="https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster">
I want to contribute I want to contribute
</a> </a>
</p> </p>
{% endif %}
</div> </div>
<div class="span5"> <div class="span5">
<a href="http://www.yoctoproject.org"> <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> </a>
</div> </div>
</div> </div>
</div> </div>
{% if not MANAGED %}
<!-- Empty - no data in database --> <!-- Empty - no data in database -->
<div class="page-header top-air"> <div class="page-header top-air">
<h1> <h1>
@@ -61,6 +104,8 @@
Hob Hob
</a> </a>
</div> </div>
{% endif %}
</div> </div>
{% endblock %} {% endblock %}
@@ -47,16 +47,25 @@
<button type="button" class="close" id="dismiss-alert">&times;</button> <button type="button" class="close" id="dismiss-alert">&times;</button>
<span id="alert-msg"></span> <span id="alert-msg"></span>
</div> </div>
{% if request.GET.search and objects.paginator.count == 0 %} {% if objects.paginator.count == 0 %}
<div class="alert row-fluid"> {% if request.GET.search %}
<form class="navbar-search input-append pull-left" id="searchform"> <div class="alert row-fluid">
<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> <form class="navbar-search input-append pull-left" id="searchform">
<input type="hidden" name="orderby" value=""> <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="page" value="1"> <input type="hidden" name="orderby" value="">
<button class="btn" type="submit" value="Search">Search</button> <input type="hidden" name="page" value="1">
<button type="submit" class="btn btn-link" id="show-all-btn">Show all machines</button> <button class="btn" type="submit" value="Search">Search</button>
</form> <button type="submit" class="btn btn-link" id="show-all-btn">Show all machines</button>
</div> </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 %} {% else %}
{% include "basetable_top.html" %} {% include "basetable_top.html" %}
{% for o in objects %} {% for o in objects %}
@@ -25,6 +25,7 @@
{% if objects.paginator.count == 0 %} {% if objects.paginator.count == 0 %}
<div class="row-fluid"> <div class="row-fluid">
{% if request.GET.filter or request.GET.search %}
<div class="alert"> <div class="alert">
<form class="no-results input-append" id="searchform"> <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 %} <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> <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all builds</button>
</form> </form>
</div> </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> </div>
@@ -3,12 +3,11 @@
{% load humanize %} {% load humanize %}
{%if mru.count > 0%} {%if len.mru > 0%}
<div class="page-header top-air"> <div class="page-header top-air">
<h1> <h1>
Latest builds Latest builds
</h1> </h1>
</div> </div>
<div id="latest-builds"> <div id="latest-builds">
{% for buildrequest in mru %}{% with build=buildrequest.build %} {% for buildrequest in mru %}{% with build=buildrequest.build %}
@@ -16,6 +16,19 @@ vim: expandtab tabstop=2
<script src="{% static "js/ui-bootstrap-tpls-0.11.0.js" %}"></script> <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"> <div id="main" role="main" ng-app="project" ng-controller="prjCtrl" class="top-padded">
@@ -440,4 +453,5 @@ angular.element(document).ready(function() {
}); });
</script> </script>
{% endif %} {# from lvs_nos check #}
{% endblock %} {% endblock %}
@@ -9,8 +9,8 @@
{% block projectinfomain %} {% block projectinfomain %}
<div class="page-header"> <div class="page-header">
<h1> <h1>
{% if objects.paginator.count == 0 %} {% if objects.paginator.count == 0 and request.GET.filter or request.GET.search %}
No builds found No builds found
{% else %} {% else %}
{% if request.GET.filter or request.GET.search %} {% if request.GET.filter or request.GET.search %}
@@ -25,6 +25,7 @@
{% if objects.paginator.count == 0 %} {% if objects.paginator.count == 0 %}
{% if request.GET.filter or request.GET.search %}
<div class="row-fluid"> <div class="row-fluid">
<div class="alert"> <div class="alert">
<form class="no-results input-append" id="searchform"> <form class="no-results input-append" id="searchform">
@@ -34,7 +35,13 @@
</form> </form>
</div> </div>
</div> </div>
{% else %}
<div class="alert alert-info">
<p class="lead">
This project has no builds.
</p>
</div>
{% endif %}
{% else %} {% else %}
@@ -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> <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> </dt>
<dd class="lead"> <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-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> <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;"> <form id="change-image_install-form" style="display:none;">
@@ -25,6 +25,7 @@
</div> </div>
{% if objects.paginator.count == 0 %} {% if objects.paginator.count == 0 %}
{% if request.GET.filter or request.GET.search %}
<div class="row-fluid"> <div class="row-fluid">
<div class="alert"> <div class="alert">
<form class="no-results input-append" id="searchform"> <form class="no-results input-append" id="searchform">
@@ -34,6 +35,17 @@
</form> </form>
</div> </div>
</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 %} {% else %}
+15 -5
View File
@@ -43,13 +43,22 @@ import json
# all new sessions should come through the landing page; # all new sessions should come through the landing page;
# determine in which mode we are running in, and redirect appropriately # determine in which mode we are running in, and redirect appropriately
def landing(request): def landing(request):
if toastermain.settings.MANAGED and Build.objects.count() == 0 and Project.objects.count() > 0: if toastermain.settings.MANAGED:
return redirect(reverse('all-projects'), permanent = False) 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: if BuildRequest.objects.all().count() > 0:
return redirect(reverse('all-builds'), permanent = False) 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 # 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): def _project_recent_build_list(prj):
@@ -2035,6 +2044,7 @@ if toastermain.settings.MANAGED:
context = { context = {
"project" : prj, "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), "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}}, "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), #"buildrequests" : prj.buildrequest_set.filter(state=BuildRequest.REQ_QUEUED),