bitbake: toaster: implement recipe summary page
authorDavid Reyna <David.Reyna@windriver.com>
Fri, 7 Feb 2014 05:06:27 +0000 (21:06 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 17 Feb 2014 15:38:53 +0000 (15:38 +0000)
Implement the updated design for the recipe summay page, with pop-up
boxes for the dependecies and layer commit ids, column filtering, and
column sorting support.

[YOCTO #4294]

(Bitbake rev: 92b71c8e6cfcd656866fbf9bd00bf184b223c5fa)

Signed-off-by: David Reyna <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/toaster/orm/models.py
bitbake/lib/toaster/toastergui/templates/recipes.html
bitbake/lib/toaster/toastergui/views.py

index 113631d..1803de6 100644 (file)
@@ -209,6 +209,7 @@ class Package_File(models.Model):
     size = models.IntegerField()
 
 class Recipe(models.Model):
+    search_allowed_fields = ['name', 'version', 'file_path', 'license', 'layer_version__layer__name', 'layer_version__branch', 'layer_version__commit', 'layer_version__layer__local_path']
     name = models.CharField(max_length=100, blank=True)
     version = models.CharField(max_length=100, blank=True)
     layer_version = models.ForeignKey('Layer_Version', related_name='recipe_layer_version')
index 2e0c2d1..aa06104 100755 (executable)
@@ -1,51 +1,83 @@
 {% extends "basebuildpage.html" %}
 
+{% load projecttags %}
+
 {% block localbreadcrumb %}
 <li>Recipes</li>
 {% endblock %}
 
 {% block buildinfomain %}
-<div class="row-fluid pull-right span10">
+<div class="span10">
+<div class="page-header" style="margin-top:40px;">
+<h1>
+  {% if request.GET.filter or request.GET.search and objects.count > 0  %}
+      {{objects.paginator.count}} recipe{{objects.paginator.count|pluralize}} found
+  {%elif objects.paginator.count == 0%}
+      No Recipes
+  {%else%}
+      Recipes
+  {%endif%}
+ </h1>
+</div>
 {% include "basetable_top.html" %}
 
-        <tr>
-        </tr>
-            <th>Name</th>
-            <th>Version</th>
-            <th>Summary</th>
-            <th>Description</th>
-            <th>Section</th>
-            <th>License</th>
-            <th>License file</th>
-            <th>Homepage</th>
-            <th>Bugtracker</th>
-            <th>File_path</th>
-            <th style="width: 30em">Recipe Dependency</th>
-
-
-        {% for recipe in objects %}
+    {% for recipe in objects %}
 
-        <tr class="data">
-            <td><a name="{{recipe.name}}" href="{% url "recipe" build.pk recipe.pk %}">{{recipe.name}}</a></td>
-            <td>{{recipe.version}}</td>
-            <td>{{recipe.summary}}</td>
-            <td>{{recipe.description}}</td>
-            <td>{{recipe.section}}</td>
-            <td>{{recipe.license}}</td>
-            <td>{{recipe.licensing_info}}</td>
-            <td>{{recipe.homepage}}</td>
-            <td>{{recipe.bugtracker}}</td>
-            <td>{{recipe.file_path}}</td>
-            <td>
-        <div style="height: 5em; overflow:auto">
-            {% for rr in recipe.r_dependencies_recipe.all %}
-                <a href="#{{rr.depends_on.name}}">{{rr.depends_on.name}}</a><br/>
-            {% endfor %}
-        </div>
-            </td>
-        </tr>
+    <tr class="data">
+        <td><a href="{% url "recipe" build.pk recipe.pk %}">{{recipe.name}}</a></td>
+        <td><a href="{% url "recipe" build.pk recipe.pk %}">{{recipe.version}}</a></td>
+        <!-- Depends -->
+        <td class="depends_on">
+            {% if recipe.r_dependencies_recipe.all.count %}
+            <a class="btn"
+                title="<a href='{% url "recipe" build.pk recipe.pk %}#dependencies'>{{recipe.name}}</a> depends on"
+                data-content="<ul class='unstyled'>
+                  {% for i in recipe.r_dependencies_recipe.all|dictsort:"depends_on.name"%}
+                    <li><a href='{% url "recipe" build.pk i.depends_on.pk %}'>{{i.depends_on.name}}</a></li>
+                  {% endfor %}
+                </ul>">
+                {{recipe.r_dependencies_recipe.all.count}}
+            </a>
+            {% endif %}
+        </td>
+        <!--  Brought in by -->
+        <td class="depends_by">
+            {% if recipe.r_dependencies_depends.all.count %}
+            <a class="btn"
+                title="<a href='{% url "recipe" build.pk recipe.pk %}#brought-in-by'>{{recipe.name}}</a> is brought in by"
+                data-content="<ul class='unstyled'>
+                  {% for i in recipe.r_dependencies_depends.all|dictsort:"recipe.name"%}
+                    <li><a href='{% url "recipe" build.pk i.recipe.pk %}'>{{i.recipe.name}}</a></li>
+                  {% endfor %}
+                </ul>">
+                {{recipe.r_dependencies_depends.all.count}}
+            </a>
+            {% endif %}
+        </td>
+        <!-- Recipe file -->
+        <td class="recipe_file">{{recipe.file_path}}</td>
+        <!-- Section -->
+        <td class="recipe_section">{{recipe.section}}</td>
+        <!-- License -->
+        <td class="recipe_license">{{recipe.license}}</td>
+        <!-- Layer -->
+        <td class="layer_version__layer__name">{{recipe.layer_version.layer.name}}</td>
+        <!-- Layer branch -->
+        <td class="layer_version__branch">{{recipe.layer_version.branch}}</td>
+        <!-- Layer commit -->
+        <td class="layer_version__layer__commit">
+            <a class="btn"
+                data-content="<ul class='unstyled'>
+                  <li>{{recipe.layer_version.commit}}</li>
+                </ul>">
+                {{recipe.layer_version.commit|truncatechars:13}}
+            </a>
+        </td>
+        <!-- Layer directory -->
+        <td class="layer_version__layer__local_path">{{recipe.layer_version.layer.local_path}}</td>
+    </tr>
 
-        {% endfor %}
+    {% endfor %}
 
 {% include "basetable_bottom.html" %}
 </div>
index 37e2af2..1105829 100644 (file)
@@ -540,7 +540,7 @@ def tasks(request, build_id):
 
 def recipes(request, build_id):
     template = 'recipes.html'
-    mandatory_parameters = { 'count': 100,  'page' : 1};
+    mandatory_parameters = { 'count': 100,  'page' : 1, 'orderby':'name:+'};
     retval = _verify_parameters( request.GET, mandatory_parameters )
     if retval:
         return _redirect_parameters( 'recipes', request.GET, mandatory_parameters, build_id = build_id)
@@ -550,7 +550,80 @@ def recipes(request, build_id):
 
     recipes = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
 
-    context = {'build': Build.objects.filter(pk=build_id)[0], 'objects': recipes, }
+    context = {
+        'objectname': 'recipes',
+        'build': Build.objects.filter(pk=build_id)[0],
+        'objects': recipes,
+        'tablecols':[
+            {
+                'name':'Recipe',
+                'qhelp':'Information about a single piece of software, including where to download the source, configuration options, how to compile the source files and how to package the compiled output',
+                'orderfield': _get_toggle_order(request, "name"),
+                'ordericon':_get_toggle_order_icon(request, "name"),
+            },
+            {
+                'name':'Recipe version',
+                'qhelp':'The recipe version and revision',
+            },
+            {
+                'name':'Dependencies',
+                'qhelp':'Recipe build-time dependencies (other recipes)',
+                'clclass': 'depends_on', 'hidden': 1,
+            },
+            {
+                'name':'Reverse dependencies',
+                'qhelp':'Recipe build-time reverse dependencies (i.e. which other recipes depend on this recipe)',
+                'clclass': 'depends_by', 'hidden': 1,
+            },
+            {
+                'name':'Recipe file',
+                'qhelp':'Location in disk of the recipe .bb file',
+                'orderfield': _get_toggle_order(request, "file_path"),
+                'ordericon':_get_toggle_order_icon(request, "file_path"),
+                'clclass': 'recipe_file', 'hidden': 0,
+            },
+            {
+                'name':'Section',
+                'qhelp':'The section in which packages should be categorised. There are 5 sections: base, console, utils, devel and libs',
+                'orderfield': _get_toggle_order(request, "section"),
+                'ordericon':_get_toggle_order_icon(request, "section"),
+                'clclass': 'recipe_section', 'hidden': 0,
+            },
+            {
+                'name':'License',
+                'qhelp':'The list of source licenses for the recipe. Separate license names using | (pipe) means there is a choice between licenses. Separate license names using & (ampersand) means multiple licenses exist that cover different parts of the source',
+                'orderfield': _get_toggle_order(request, "license"),
+                'ordericon':_get_toggle_order_icon(request, "license"),
+                'clclass': 'recipe_license', 'hidden': 0,
+            },
+            {
+                'name':'Layer',
+                'qhelp':'The name of the layer prodiving the recipe',
+                'orderfield': _get_toggle_order(request, "layer_version__layer__name"),
+                'ordericon':_get_toggle_order_icon(request, "layer_version__layer__name"),
+                'clclass': 'layer_version__layer__name', 'hidden': 0,
+            },
+            {
+                'name':'Layer branch',
+                'qhelp':'The Git branch of the layer prodiving the recipe',
+                'orderfield': _get_toggle_order(request, "layer_version__branch"),
+                'ordericon':_get_toggle_order_icon(request, "layer_version__branch"),
+                'clclass': 'layer_version__branch', 'hidden': 1,
+            },
+            {
+                'name':'Layer commit',
+                'qhelp':'The Git commit of the layer prodiving the recipe',
+                'clclass': 'layer_version__layer__commit', 'hidden': 1,
+            },
+            {
+                'name':'Layer directory',
+                'qhelp':'Location in disk of the layer prodiving the recipe',
+                'orderfield': _get_toggle_order(request, "layer_version__layer__local_path"),
+                'ordericon':_get_toggle_order_icon(request, "layer_version__layer__local_path"),
+                'clclass': 'layer_version__layer__local_path', 'hidden': 1,
+            },
+            ]
+        }
 
     return render(request, template, context)