Skip to content

Commit

Permalink
toaster: Remove all navigation when not in build mode
Browse files Browse the repository at this point in the history
The user is redirected to the all builds page or all projects
page from the landing page, regardless of mode.

In build mode, this makes sense; but in analysis mode, we are
restricting the view to just the cli builds project. This means
that "all projects" and "all builds" only contains items relating
to this one project.

Modify the landing page so it redirects to the project builds page
for the cli builds project when not in build mode. Also remove
navigation elements which are irrelevant when not in build mode.

[YOCTO #8514]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
townxelliot authored and rpurdie committed Oct 27, 2015
1 parent 991712f commit ae75465
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/toaster/toastergui/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
<i class="icon-info-sign" title="<strong>Toaster version information</strong>" data-content="<dl><dt>Branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>"></i>
{% endif %}
</span>
{% if request.resolver_match.url_name != 'landing' and request.resolver_match.url_name != 'newproject' %}
{% if BUILD_MODE and request.resolver_match.url_name != 'landing' and request.resolver_match.url_name != 'newproject' %}
<ul class="nav">
<li {% if request.resolver_match.url_name == 'all-builds' %}
<li {% if request.resolver_match.url_name == 'all-builds' %}
class="active"
{% endif %}>
<a href="{% url 'all-builds' %}">
Expand Down
14 changes: 12 additions & 2 deletions lib/toaster/toastergui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,24 @@ def get_mimetype(self, path):
# all new sessions should come through the landing page;
# determine in which mode we are running in, and redirect appropriately
def landing(request):
# in build mode, we redirect to the command-line builds page
# if there are any builds for the default (cli builds) project
default_project = Project.objects.get_default_project()
default_project_builds = Build.objects.filter(project = default_project)

if (not toastermain.settings.BUILD_MODE) and default_project_builds.count() > 0:
args = (default_project.id,)
return redirect(reverse('projectbuilds', args = args), permanent = False)

# we only redirect to projects page if there is a user-generated project
num_builds = Build.objects.all().count()
user_projects = Project.objects.filter(is_default = False)
has_user_project = user_projects.count() > 0

if Build.objects.count() == 0 and has_user_project:
if num_builds == 0 and has_user_project:
return redirect(reverse('all-projects'), permanent = False)

if Build.objects.all().count() > 0:
if num_builds > 0:
return redirect(reverse('all-builds'), permanent = False)

context = {'lvs_nos' : Layer_Version.objects.all().count()}
Expand Down

0 comments on commit ae75465

Please sign in to comment.