summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
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/toaster/toastergui/views.py
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/toaster/toastergui/views.py')
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py20
1 files changed, 15 insertions, 5 deletions
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),