Skip to contentSkip to conversation

toaster: toastertables: Clean up and fix up a number of items

PATCH Superseded Michael Wood 2 participants 4 messages May 6, 2016 – May 10, 2016 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 toaster: toastertables: Clean up and fix up a number of items

- Remove the unused 'computation' field
- Remove the code to try to make the tables behave like an api
- Remove custom JSON encoder in favour of DjangoJSONEncoder
- Simplify get_data and add comments
- Add exception type instead of using generic Exception
- Clean up python style warnings

---
 bitbake/lib/toaster/toastergui/static/js/table.js |  21 +---
 bitbake/lib/toaster/toastergui/tables.py          |  11 --
 bitbake/lib/toaster/toastergui/widgets.py         | 127 ++++++++++++----------
 3 files changed, 72 insertions(+), 87 deletions(-)
bitbake/lib/toaster/toastergui/static/js/table.js +1 -20
index f738144..7f76f55 100644
@@ -101,27 +101,8 @@ function tableInit(ctx){
       var row = $("<tr></tr>");
       column_index = -1;
       for (var key_j in tableData.rows[i]){
-
-        /* if we have a static: version of a key, prefer the static: version for rendering */
-        var orig_key_j = key_j;
-
-        if (key_j.indexOf("static:") === 0) {
-          if (key_j.substr("static:".length) in tableData.rows[i]) {
-            continue;
-          }
-          orig_key_j = key_j.substr("static:".length)
-        } else if (("static:" + key_j) in tableData.rows[i]) {
-          key_j = "static:" + key_j;
-        }
-
-        /* we skip over un-displayable column entries */
-        column_index += 1;
-        if (! tableData.columns[column_index].displayable) {
-          continue;
-        }
-
         var td = $("<td></td>");
-        td.prop("class", orig_key_j);
+        td.prop("class", key_j);
         if (tableData.rows[i][key_j]){
           td.html(tableData.rows[i][key_j]);
         }
bitbake/lib/toaster/toastergui/tables.py +0 -11
index eb876ec..29b68de 100644
@@ -190,17 +190,6 @@ class LayersTable(ToasterTable):
                         static_data_name="add-del-layers",
                         static_data_template='{% include "layer_btn.html" %}')
 
-        project = Project.objects.get(pk=kwargs['pid'])
-        self.add_column(title="LayerDetailsUrl",
-                        displayable = False,
-                        field_name="layerdetailurl",
-                        computation = lambda x: reverse('layerdetails', args=(project.id, x.id)))
-
-        self.add_column(title="name",
-                        displayable = False,
-                        field_name="name",
-                        computation = lambda x: x.layer.name)
-
 
 class MachinesTable(ToasterTable):
     """Table of Machines in Toaster"""
bitbake/lib/toaster/toastergui/widgets.py +71 -56

234 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 toaster: toastergui tests Fix toastertable tests

After clean ups remove api assumptions. Our table data often contains html snippets to display certain things such as dependency pop overs or simply links to other parts of the UI. Take these into account when testing the values of the table data.

---
 bitbake/lib/toaster/toastergui/tests.py | 98 ++++++++++++++++++++++-----------
 1 file changed, 66 insertions(+), 32 deletions(-)
bitbake/lib/toaster/toastergui/tests.py +66 -32
index a4cab58..869c39d 100644
@@ -83,8 +83,12 @@ class ViewTests(TestCase):
         self.assertEqual(data["error"], "ok")
         self.assertTrue("rows" in data)
 
-        self.assertTrue(self.project.name in [x["name"] for x in data["rows"]])
-        self.assertTrue("id" in data["rows"][0])
+        name_found = False
+        for row in data["rows"]:
+            name_found = row['name'].find(self.project.name)
+
+        self.assertTrue(name_found,
+                        "project name not found in projects table")
 
     def test_typeaheads(self):
         """Test typeahead ReST API"""
@@ -322,22 +326,24 @@ class ViewTests(TestCase):
         self.assertEqual(response.status_code, 200, 'should be 200 OK status')
 
         # check other columns have been populated correctly
-        self.assertEqual(row1['name'], self.recipe1.name)
-        self.assertEqual(row1['version'], self.recipe1.version)
-        self.assertEqual(row1['get_description_or_summary'],
-                         self.recipe1.description)
-        self.assertEqual(row1['layer_version__layer__name'],
-                         self.recipe1.layer_version.layer.name)
-        self.assertEqual(row2['name'], self.recipe2.name)
-        self.assertEqual(row2['version'], self.recipe2.version)
-        self.assertEqual(row2['get_description_or_summary'],
-                         self.recipe2.description)
-        self.assertEqual(row2['layer_version__layer__name'],
-                         self.recipe2.layer_version.layer.name)
+        self.assertTrue(self.recipe1.name in row1['name'])
+        self.assertTrue(self.recipe1.version in row1['version'])
+        self.assertTrue(self.recipe1.description in
+                        row1['get_description_or_summary'])
+
+        self.assertTrue(self.recipe1.layer_version.layer.name in
+                        row1['layer_version__layer__name'])
+
+        self.assertTrue(self.recipe2.name in row2['name'])
+        self.assertTrue(self.recipe2.version in row2['version'])
+        self.assertTrue(self.recipe2.description in
+                        row2['get_description_or_summary'])
+
+        self.assertTrue(self.recipe2.layer_version.layer.name in
+                        row2['layer_version__layer__name'])
 
     def test_toaster_tables(self):
         """Test all ToasterTables instances"""
-        current_recipes = self.project.get_available_recipes()
 
         def get_data(table, options={}):
             """Send a request and parse the json response"""
@@ -354,12 +360,30 @@ class ViewTests(TestCase):
                     'layerid': self.lver.pk,
                     'recipeid': self.recipe1.pk,
                     'recipe_id': image_recipe.pk,
-                    'custrecipeid': self.customr.pk
-                   }
+                    'custrecipeid': self.customr.pk}
 
             response = table.get(request, **args)
             return json.loads(response.content)
 
+        def get_text_from_td(td):
+            """If we have html in the td then extract the text portion"""
+            # just so we don't waste time parsing non html
+            if "<" not in td:
+                ret = td
+            else:
+                ret = BeautifulSoup(td).text
+
+            # We change the td into ascii as a way to remove characters
+            # such as \xa0 (non break space) which mess with the ordering
+            # comparisons
+            ret.strip().encode('ascii',
+                               errors='replace').replace('?', ' ')
+            # Case where the td is empty
+            if len(ret):
+                return "0"
+            else:
+                return ret
+
         # Get a list of classes in tables module
         tables = inspect.getmembers(toastergui.tables, inspect.isclass)
 
@@ -379,8 +403,10 @@ class ViewTests(TestCase):
                             "Cannot test on a %s table with < 1 row" % name)
 
             if table.default_orderby:
-                row_one = all_data['rows'][0][table.default_orderby.strip("-")]
-                row_two = all_data['rows'][1][table.default_orderby.strip("-")]
+                row_one = get_text_from_td(
+                    all_data['rows'][0][table.default_orderby.strip("-")])
+                row_two = get_text_from_td(
+                    all_data['rows'][1][table.default_orderby.strip("-")])
 
                 if '-' in table.default_orderby:
                     self.assertTrue(row_one >= row_two,
@@ -399,28 +425,36 @@ class ViewTests(TestCase):
                     # If a column is orderable test it in both order
                     # directions ordering on the columns field_name
                     ascending = get_data(table_cls(),
-                                         {"orderby" : column['field_name']})
+                                         {"orderby": column['field_name']})
 
-                    row_one = ascending['rows'][0][column['field_name']]
-                    row_two = ascending['rows'][1][column['field_name']]
+                    row_one = get_text_from_td(
+                        ascending['rows'][0][column['field_name']])
+                    row_two = get_text_from_td(
+                        ascending['rows'][1][column['field_name']])
 
                     self.assertTrue(row_one <= row_two,
-                                    "Ascending sort applied but row 0 is less "
-                                    "than row 1 %s %s " %
-                                    (column['field_name'], name))
-
+                                    "Ascending sort applied but row 0: \"%s\""
+                                    " is less than row 1: \"%s\" "
+                                    "%s %s " %
+                                    (row_one, row_two,
+                                     column['field_name'], name))
 
                     descending = get_data(table_cls(),
-                                          {"orderby" :
+                                          {"orderby":
                                            '-'+column['field_name']})
 
-                    row_one = descending['rows'][0][column['field_name']]
-                    row_two = descending['rows'][1][column['field_name']]
+                    row_one = get_text_from_td(
+                        descending['rows'][0][column['field_name']])
+                    row_two = get_text_from_td(
+                        descending['rows'][1][column['field_name']])
 
                     self.assertTrue(row_one >= row_two,
-                                    "Descending sort applied but row 0 is "
-                                    "greater than row 1 %s %s" %
-                                    (column['field_name'], name))
+                                    "Descending sort applied but row 0: %s"
+                                    "is greater than row 1: %s"
+                                    "field %s table %s" %
+                                    (row_one,
+                                     row_two,
+                                     column['field_name'], name))
 
                     # If the two start rows are the same we haven't actually
                     # changed the order
Signature · 1 line
2.7.4
#2 lore raw

PATCH 3/3 toaster: toastertables port table for Built packages

In reply to Michael Wood

This is the table that displays all the packages built in the build. Build -> Packages

---
 bitbake/lib/toaster/toastergui/buildtables.py      | 77 +++++++++++++++++
 bitbake/lib/toaster/toastergui/tables.py           |  1 +
 .../lib/toaster/toastergui/templates/bpackage.html | 97 ++++------------------
 bitbake/lib/toaster/toastergui/urls.py             |  7 +-
 bitbake/lib/toaster/toastergui/views.py            | 90 --------------------
 5 files changed, 99 insertions(+), 173 deletions(-)
 create mode 100644 bitbake/lib/toaster/toastergui/buildtables.py
bitbake/lib/toaster/toastergui/buildtables.py new file +77 -0
new file mode 100644
index 0000000..365fd5c
@@ -0,0 +1,77 @@
+#
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# BitBake Toaster Implementation
+#
+# Copyright (C) 2016 Intel Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from orm.models import Build
+import toastergui.tables as tables
+
+class BuiltPackagesTable(tables.PackagesTable):
+    def __init__(self, *args, **kwargs):
+        super(BuiltPackagesTable, self).__init__(*args, **kwargs)
+        self.title = "Packages built"
+
+    def setup_queryset(self, *args, **kwargs):
+        build = Build.objects.get(pk=kwargs['build_id'])
+        self.static_context_extra['build'] = build
+        self.queryset = build.package_set.all().exclude(recipe=None)
+
+    def get_context_data(self, **kwargs):
+        # Chain up to ToasterTable as we don't need anything from
+        # PackagesTable
+        context = super(tables.PackagesTable, self).get_context_data(**kwargs)
+        context['build'] = Build.objects.get(pk=kwargs['build_id'])
+        return context
+
+    def setup_columns(self, *args, **kwargs):
+        super(BuiltPackagesTable, self).setup_columns(**kwargs)
+
+        add_pkg_link_to = ['name', 'version', 'size', 'license']
+        add_recipe_link_to = ['recipe__name', 'recipe__version']
+
+        def get_link_value(column):
+
+            column['static_data_name'] = column['field_name']
+
+            if column['static_data_template']:
+                # Make sure any existing template is used
+                return column['static_data_template']
+            else:
+                # convert to the template style of variable
+                return ('{{data.%s}}' %
+                        column['field_name'].replace('__', '.'))
+
+        for column in self.columns:
+            if column['field_name'] in add_pkg_link_to:
+                column['static_data_template'] = '''
+                <a href="
+                {%% url "package_built_detail" extra.build.pk data.pk %%}
+                ">%s</a>
+                ''' % get_link_value(column)
+
+            elif column['field_name'] in add_recipe_link_to:
+                column['static_data_template'] = ('''
+                {%% if data.recipe %%}
+                <a href="
+                {%% url "recipe" extra.build.pk data.recipe.pk %%}
+                ">%(value)s</a>
+                {%% else %%}
+                %(value)s
+                {%% endif %%}
+                ''') % {'value': get_link_value(column)}
bitbake/lib/toaster/toastergui/tables.py +1 -0
index 29b68de..94d757b 100644
@@ -699,6 +699,7 @@ class PackagesTable(ToasterTable):
 
         self.add_column(title="Approx Size",
                         orderable=True,
+                        field_name="size",
                         static_data_name="size",
                         static_data_template="{% load projecttags %} \
                         {{data.size|filtered_filesizeformat}}")
bitbake/lib/toaster/toastergui/templates/bpackage.html +15 -82

110 lines not on this page · raw message

bitbake/lib/toaster/toastergui/urls.py +6 -1
index 27b0baa..b4c7e0e 100644
@@ -21,6 +21,7 @@ from django.views.generic import RedirectView, TemplateView
 
 from django.http import HttpResponseBadRequest
 from toastergui import tables
+from toastergui import buildtables
 from toastergui import typeaheads
 from toastergui import api
 
@@ -44,7 +45,11 @@ urlpatterns = patterns('toastergui.views',
         url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)$', 'recipe', name='recipe'),
         url(r'^build/(?P<build_id>\d+)/recipe_packages/(?P<recipe_id>\d+)$', 'recipe_packages', name='recipe_packages'),
 
-        url(r'^build/(?P<build_id>\d+)/packages/$', 'bpackage', name='packages'),
+        url(r'^build/(?P<build_id>\d+)/packages/$',
+            buildtables.BuiltPackagesTable.as_view(
+                template_name="bpackage.html"),
+            name='packages'),
+
         url(r'^build/(?P<build_id>\d+)/package/(?P<package_id>\d+)$', 'package_built_detail',
                 name='package_built_detail'),
         url(r'^build/(?P<build_id>\d+)/package_built_dependencies/(?P<package_id>\d+)$',
bitbake/lib/toaster/toastergui/views.py +0 -90

96 lines not on this page · raw message

Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): D356292D.7C2CB%[email protected]

#4 lore raw

PATCH 3/3 toaster: toastertables port table for Built packages

Apologies, the email below should have gone to the mailing list too, not just the person who submitted the patch.

Quoted 455 lines · Belen
Quoted 3 lines

This is the table that displays all the packages built in the build. Build -> Packages

This is mostly working. Just a couple of small issues:

1. Something is not quite right with the default sorting. When you load the table, the 'Package' column shows as the selected sorting criteria, but the first package shown for my build is "qemuwrapper-cross-dev". That's not quite right: the first package in that table given the sorting criteria should be "base-files". Clicking on the heading sorts properly.

2. In the dependencies and reverse dependencies popovers, the package name in the popover title needs to be a link to the applicable information in the package details page (dependencies or reverse dependencies). Each package listed in the popover content should be a link to the corresponding package details pages. You can see an example in the 'packages included' table.

3. We have a small issue with the 'Size' sorting: on the first click, packages should be sorted in descending order (i.e. biggest package on top). Just bringing it up for completeness: we have an issue in Bugzilla for this (https://bugzilla.yoctoproject.org/show_bug.cgi?id=8859) so no need to fix as part of this series.

Thanks!

Belén

Quoted 424 lines

---
bitbake/lib/toaster/toastergui/buildtables.py | 77
+++++++++++++++++
bitbake/lib/toaster/toastergui/tables.py | 1 +
.../lib/toaster/toastergui/templates/bpackage.html | 97
++++------------------
bitbake/lib/toaster/toastergui/urls.py | 7 +-
bitbake/lib/toaster/toastergui/views.py | 90
--------------------

5 files changed, 99 insertions(+), 173 deletions(-)

create mode 100644 bitbake/lib/toaster/toastergui/buildtables.py

bitbake/lib/toaster/toastergui/buildtables.py new file +18 -0
new file mode 100644
index 0000000..365fd5c
@@ -0,0 +1,77 @@
+#
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# BitBake Toaster Implementation
+#
+# Copyright (C) 2016 Intel Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License

along
+# with this program; if not, write to the Free Software Foundation, Inc.,

bitbake/lib/toaster/toastergui/buildtables.py new file +19 -0
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from orm.models import Build
+import toastergui.tables as tables
+
+class BuiltPackagesTable(tables.PackagesTable):
+    def __init__(self, *args, **kwargs):
+        super(BuiltPackagesTable, self).__init__(*args, **kwargs)
+        self.title = "Packages built"
+
+    def setup_queryset(self, *args, **kwargs):
+        build = Build.objects.get(pk=kwargs['build_id'])
+        self.static_context_extra['build'] = build
+        self.queryset = build.package_set.all().exclude(recipe=None)
+
+    def get_context_data(self, **kwargs):
+        # Chain up to ToasterTable as we don't need anything from
+        # PackagesTable
+        context = super(tables.PackagesTable,

self).get_context_data(**kwargs)

bitbake/lib/toaster/toastergui/buildtables.py new file +26 -0
+        context['build'] = Build.objects.get(pk=kwargs['build_id'])
+        return context
+
+    def setup_columns(self, *args, **kwargs):
+        super(BuiltPackagesTable, self).setup_columns(**kwargs)
+
+        add_pkg_link_to = ['name', 'version', 'size', 'license']
+        add_recipe_link_to = ['recipe__name', 'recipe__version']
+
+        def get_link_value(column):
+
+            column['static_data_name'] = column['field_name']
+
+            if column['static_data_template']:
+                # Make sure any existing template is used
+                return column['static_data_template']
+            else:
+                # convert to the template style of variable
+                return ('{{data.%s}}' %
+                        column['field_name'].replace('__', '.'))
+
+        for column in self.columns:
+            if column['field_name'] in add_pkg_link_to:
+                column['static_data_template'] = '''
+                <a href="
+                {%% url "package_built_detail" extra.build.pk data.pk

%%}

bitbake/lib/toaster/toastergui/buildtables.py new file +13 -0
+                ">%s</a>
+                ''' % get_link_value(column)
+
+            elif column['field_name'] in add_recipe_link_to:
+                column['static_data_template'] = ('''
+                {%% if data.recipe %%}
+                <a href="
+                {%% url "recipe" extra.build.pk data.recipe.pk %%}
+                ">%(value)s</a>
+                {%% else %%}
+                %(value)s
+                {%% endif %%}
+                ''') % {'value': get_link_value(column)}
bitbake/lib/toaster/toastergui/tables.py +1 -0
index 29b68de..94d757b 100644
@@ -699,6 +699,7 @@ class PackagesTable(ToasterTable):
 
        self.add_column(title="Approx Size",
                        orderable=True,
+                        field_name="size",
                        static_data_name="size",
                        static_data_template="{% load projecttags %} \
                        {{data.size|filtered_filesizeformat}}")
bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -0
index 81973cb..a27586e 100644
@@ -14,95 +14,28 @@
 {% block buildinfomain %}

<div class="span10">

-{% if not request.GET.filter and not request.GET.search and not objects.paginator.count %}

bitbake/lib/toaster/toastergui/templates/bpackage.html +6 -6
-
-<!-- Empty - no data in database -->
-<div class="page-header">
+  {% if build.package_set.count == 0 %}
+  <!-- Empty - no data in database -->
+  <div class="page-header">
    <h1>
-        Packages
+      Packages
    </h1>
-</div>
-<div class="alert alert-info lead">
+  </div>
+  <div class="alert alert-info lead">
    <strong>No packages were built.</strong> How did this happen? Well,

BitBake reuses as much stuff as possible.
If all of the packages needed were already built and available in
your build infrastructure, BitBake
will not rebuild any of them. This might be slightly confusing, but
it does make everything faster.
-</div>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -7
-
-{% else %}
-
-<div class="page-header">
-  <h1>
-  {% if request.GET.search and objects.paginator.count > 0  %}
-      {{objects.paginator.count}}

package{{objects.paginator.count|pluralize}} found

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -13
-  {%elif request.GET.search and objects.paginator.count == 0%}
-      No packages found
-  {%else%}
-      Packages
-  {%endif%}
-  </h1>
-</div>
-
-  {% if objects.paginator.count == 0 %}
-  <div class="row-fluid">
-      <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 %}
- <button class="btn" type="submit"
value="Search">Search</button>
- <button class="btn btn-link"
onclick="javascript:$('#search').val('');searchform.submit()">Show all packages</button>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -9
-        </form>
-      </div>
  </div>
 
  {% else %}
-  {% include "basetable_top.html" %}
-
-    {% for package in objects %}
 
-    <tr class="data">
-
-        <!-- Package -->
-        <td class="package_name"><a href="{% url "package_built_detail"

build.pk package.pk %}">{{package.name}}</a></td>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -2
-        <!-- Package Version -->
-        <td class="package_version">{%if package.version%}<a href="{%

url "package_built_detail" build.pk package.pk %}">{{package.version}}-{{package.revision}}</a>{%endif%}</td>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -2
-        <!-- Package Size -->
-        <td class="size

sizecol">{{package.size|filtered_filesizeformat}}</td>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -6
-        <!-- License -->
-        <td class="license">{{package.license}}</td>
-
-        {%if package.recipe%}
-            <!-- Recipe -->
-            <td class="recipe__name"><a href="{% url "recipe" build.pk

package.recipe.pk %}">{{package.recipe.name}}</a></td>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -2
-            <!-- Recipe Version -->
-            <td class="recipe__version"><a href="{% url "recipe"

build.pk package.recipe.pk %}">{{package.recipe.version}}</a></td>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -3
-
-            <!-- Layer -->
-            <td 

class="recipe__layer_version__layer__name">{{package.recipe.layer_version .
layer.name}}</td>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -2
-            <!-- Layer branch -->
-            <td 

class="recipe__layer_version__branch">{{package.recipe.layer_version.bran c
h}}</td>

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -7
-            <!-- Layer commit -->
-            <td class="recipe__layer_version__layer__commit">
-                <a class="btn"
-                    data-content="<ul class='unstyled'>
-                      <li>{{package.recipe.layer_version.commit}}</li>
-                    </ul>">
-                

{{package.recipe.layer_version.commit|truncatechars:13}}

bitbake/lib/toaster/toastergui/templates/bpackage.html +4 -19
-                </a>
-            </td>
-            <!-- Layer directory -->
-        {%else%}
-            <td class="recipe__name"></td>
-            <td class="recipe__version"></td>
-            <td class="recipe__layer_version__layer__name"></td>
-            <td class="recipe__layer_version__branch"></td>
-            <td class="recipe__layer_version__layer__commit"></td>
-            <td class="recipe__layer_version__local_path"></td>
-        {%endif%}
-
-    </tr>
-    {% endfor %}
-
-  {% include "basetable_bottom.html" %}
-  {% endif %} {# objects.paginator.count #}
-{% endif %} {# Empty #}
-</div>
+  {% url 'builtpackagestable' build.id as xhr_table_url %}
+   <div class="page-header">
+    <h1>
+      {{title}} (<span class="table-count-{{table_name}}">0</span>)

</h2>

bitbake/lib/toaster/toastergui/templates/bpackage.html +5 -0
+    </h1>
+  </div>
+  {% include "toastertable.html" %}
+  {% endif %} {# end if packages #}
+ </div>

{% endblock %}

bitbake/lib/toaster/toastergui/urls.py +0 -0
index 27b0baa..b4c7e0e 100644
@@ -21,6 +21,7 @@ from django.views.generic import RedirectView,

TemplateView

from django.http import HttpResponseBadRequest
from toastergui import tables
+from toastergui import buildtables
from toastergui import typeaheads
from toastergui import api

bitbake/lib/toaster/toastergui/urls.py +0 -1
@@ -44,7 +45,11 @@ urlpatterns = patterns('toastergui.views',
        url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)$',
 'recipe', name='recipe'),
 
 url(r'^build/(?P<build_id>\d+)/recipe_packages/(?P<recipe_id>\d+)$',
 'recipe_packages', name='recipe_packages'),
 
-        url(r'^build/(?P<build_id>\d+)/packages/$', 'bpackage',

name='packages'),

bitbake/lib/toaster/toastergui/urls.py +5 -0
+        url(r'^build/(?P<build_id>\d+)/packages/$',
+            buildtables.BuiltPackagesTable.as_view(
+                template_name="bpackage.html"),
+            name='packages'),
+
        url(r'^build/(?P<build_id>\d+)/package/(?P<package_id>\d+)$',

'package_built_detail',
name='package_built_detail'),

url(r'^build/(?P<build_id>\d+)/package_built_dependencies/(?P<package_id> \
d+)$',

bitbake/lib/toaster/toastergui/views.py +0 -9
index bd5bf63..6e34008 100755
@@ -1474,96 +1474,6 @@ def configvars(request, build_id):
    _set_parameters_values(pagesize, orderby, request)
    return response
 
-def bpackage(request, build_id):
-    template = 'bpackage.html'
-    (pagesize, orderby) = _get_parameters_values(request, 100, 'name:+')
-    mandatory_parameters = { 'count' : pagesize,  'page' : 1, 'orderby'
 : orderby }
-    retval = _verify_parameters( request.GET, mandatory_parameters )
-    if retval:
-        return _redirect_parameters( 'packages', request.GET,
 mandatory_parameters, build_id = build_id)
-    (filter_string, search_term, ordering_string) =
 _search_tuple(request, Package)
-    queryset = Package.objects.filter(build =

build_id).filter(size__gte=0)
- queryset = _get_queryset(Package, queryset, filter_string,
search_term, ordering_string, 'name')

bitbake/lib/toaster/toastergui/views.py +0 -2
-
-    packages = _build_page_range(Paginator(queryset,

pagesize),request.GET.get('page', 1))

bitbake/lib/toaster/toastergui/views.py +0 -13
-
-    build = Build.objects.get( pk = build_id )
-
-    context = {
-        'objectname': 'packages built',
-        'build': build,
-        'project': build.project,
-        'objects' : packages,
-        'default_orderby' : 'name:+',
-        'tablecols':[
-            {
-                'name':'Package',
-                'qhelp':'Packaged output resulting from building a

recipe',

bitbake/lib/toaster/toastergui/views.py +0 -19
-                'orderfield': _get_toggle_order(request, "name"),
-                'ordericon':_get_toggle_order_icon(request, "name"),
-            },
-            {
-                'name':'Package version',
-                'qhelp':'The package version and revision',
-            },
-            {
-                'name':'Size',
-                'qhelp':'The size of the package',
-                'orderfield': _get_toggle_order(request, "size", True),
-                'ordericon':_get_toggle_order_icon(request, "size"),
-                'orderkey' : 'size',
-                'clclass': 'size', 'hidden': 0,
-                'dclass' : 'span2',
-            },
-            {
-                'name':'License',
-                'qhelp':'The license under which the package is

distributed. Multiple license names separated by the pipe character indicates a choice between licenses. Multiple license names separated by the ampersand character indicates multiple licenses exist that cover different parts of the source',

bitbake/lib/toaster/toastergui/views.py +0 -9
-                'orderfield': _get_toggle_order(request, "license"),
-                'ordericon':_get_toggle_order_icon(request, "license"),
-                'orderkey' : 'license',
-                'clclass': 'license', 'hidden': 1,
-            },
-            {
-                'name':'Recipe',
-                'qhelp':'The name of the recipe building the package',
-                'orderfield': _get_toggle_order(request,

"recipe__name"),
- 'ordericon':_get_toggle_order_icon(request,
"recipe__name"),

bitbake/lib/toaster/toastergui/views.py +0 -6
-                'orderkey' : 'recipe__name',
-                'clclass': 'recipe__name', 'hidden': 0,
-            },
-            {
-                'name':'Recipe version',
-                'qhelp':'Version and revision of the recipe building the

package',

bitbake/lib/toaster/toastergui/views.py +0 -5
-                'clclass': 'recipe__version', 'hidden': 1,
-            },
-            {
-                'name':'Layer',
-                'qhelp':'The name of the layer providing the recipe that

builds the package',
- 'orderfield': _get_toggle_order(request,
"recipe__layer_version__layer__name"),
- 'ordericon':_get_toggle_order_icon(request,
"recipe__layer_version__layer__name"),

bitbake/lib/toaster/toastergui/views.py +0 -2
-                'orderkey' : 'recipe__layer_version__layer__name',
-                'clclass': 'recipe__layer_version__layer__name',

'hidden': 1,

bitbake/lib/toaster/toastergui/views.py +0 -4
-            },
-            {
-                'name':'Layer branch',
-                'qhelp':'The Git branch of the layer providing the

recipe that builds the package',
- 'orderfield': _get_toggle_order(request,
"recipe__layer_version__branch"),
- 'ordericon':_get_toggle_order_icon(request,
"recipe__layer_version__branch"),

bitbake/lib/toaster/toastergui/views.py +0 -6
-                'orderkey' : 'recipe__layer_version__branch',
-                'clclass': 'recipe__layer_version__branch', 'hidden': 1,
-            },
-            {
-                'name':'Layer commit',
-                'qhelp':'The Git commit of the layer providing the

recipe that builds the package',
- 'clclass': 'recipe__layer_version__layer__commit',
'hidden': 1,

bitbake/lib/toaster/toastergui/views.py +0 -8
-            },
-            ]
-        }
-
-    response = render(request, template, context)
-    _set_parameters_values(pagesize, orderby, request)
-    return response
-

def bfile(request, build_id, package_id):
template = 'bfile.html'
files = Package_File.objects.filter(package = package_id)

Signature · 7 lines
2.7.4

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster