Skip to contentSkip to conversation

Toaster pull request

PATCH New Alex DAMIAN 1 participant 15 messages Mar 31, 2014

lore
Share & tools
lore
#0 lore raw

cover Toaster pull request

From: Alexandru DAMIAN <[email protected]>

Hello,

This is a Toaster patchset pull request. These patches have been reviewed on the toaster mailing list.

Can you please pull at your convenience ?

Thank you,
Alex

The following changes since commit f4ebc4de63d64e3b5f87e1d0f51507760c3d82d7:

user-manual-execution.xml: Added how BB processes curly braces. (2014-03-30 10:19:41 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib adamian/20140331-bb-submission
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=adamian/20140331-bb-submission

Alexandru DAMIAN (2):
toaster: update saving sstate task data
toaster: fix timezone detection

Belen Barros Pena (7):
toaster: Show "No builds found" in the builds table
toaster: Remove trailing spaces from 'name'
toaster: Small tweaks to the packages included interface
toaster: Fix the fade out animation
toaster: Increase animation duration
toaster: Match search results form to no results form
toaster: Update help text in format_vpackage_namehelp tag

Cristiana Voicu (1):
toaster: use deploy_dir var to obtain the license.manifest path

Dave Lerner (1):
toaster: unbuilt package dependency formats

David Reyna (2):
toaster: disable configvar sorts for value and files
toaster: secondary sort key as table's default order

Ravi Chintakunta (1):
toaster: Display task description

 lib/bb/ui/buildinfohelper.py                       | 19 +++++-
 lib/toaster/orm/models.py                          |  7 ++
 lib/toaster/toastergui/static/css/default.css      |  3 +-
 .../toastergui/templates/basetable_top.html        |  2 +-
 lib/toaster/toastergui/templates/build.html        |  6 +-
 .../templates/package_built_dependencies.html      | 75 ++++++++++------------
 .../templates/package_included_tabs.html           |  2 +-
 lib/toaster/toastergui/templates/recipe.html       |  2 +-
 lib/toaster/toastergui/templates/target.html       |  8 +--
 lib/toaster/toastergui/templates/tasks.html        |  2 +-
 lib/toaster/toastergui/templatetags/projecttags.py |  2 +-
 lib/toaster/toastergui/views.py                    | 37 +++++------
 lib/toaster/toastermain/settings.py                | 20 +++++-
 13 files changed, 106 insertions(+), 79 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/14 toaster: update saving sstate task data

From: Alexandru DAMIAN <[email protected]>

This is an update on the sstate file saving data.
It saves both found and missed sstate tasks.

---
 lib/bb/ui/buildinfohelper.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
lib/bb/ui/buildinfohelper.py +16 -1
index d1d92c8..0a15579 100644
@@ -750,7 +750,7 @@ class BuildInfoHelper(object):
 
 
     def store_missed_state_tasks(self, event):
-        for (fn, taskname, taskhash, sstatefile) in event.data:
+        for (fn, taskname, taskhash, sstatefile) in event.data['missed']:
 
             identifier = fn + taskname + "_setscene"
             recipe_information = self._get_recipe_information_from_taskfile(fn)
@@ -769,6 +769,21 @@ class BuildInfoHelper(object):
 
             self.orm_wrapper.get_update_task_object(task_information)
 
+        for (fn, taskname, taskhash, sstatefile) in event.data['found']:
+
+            identifier = fn + taskname + "_setscene"
+            recipe_information = self._get_recipe_information_from_taskfile(fn)
+            recipe = self.orm_wrapper.get_update_recipe_object(recipe_information)
+            class MockEvent: pass
+            event = MockEvent()
+            event.taskname = taskname
+            event.taskhash = taskhash
+            task_information = self._get_task_information(event,recipe)
+
+            task_information['path_to_sstate_obj'] = sstatefile
+
+            self.orm_wrapper.get_update_task_object(task_information)
+
 
     def store_target_package_data(self, event):
         assert 'data' in vars(event)
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/14 toaster: fix timezone detection

From: Alexandru DAMIAN <[email protected]>

This patch replaces faulty timezone detection with a version that simply reads the TZ environment variable if it is set.

If the TZ is not set, we do a reverse match search among known timezone definitions and take the first match.

    [YOCTO #5499]
---
 lib/toaster/toastermain/settings.py | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
lib/toaster/toastermain/settings.py +17 -3
index 51fa3cc..e26ee3c 100644
@@ -50,9 +50,23 @@ ALLOWED_HOSTS = []
 # although not all choices may be available on all operating systems.
 # In a Windows environment this must be set to your system time zone.
 
-# Always use local computer's time zone
-import time
-TIME_ZONE = time.tzname[0]
+# Always use local computer's time zone, find
+import os, hashlib
+if 'TZ' in os.environ:
+    TIME_ZONE = os.environ['TZ']
+else:
+    # need to read the /etc/localtime file which is the libc standard
+    # and do a reverse-mapping to /usr/share/zoneinfo/;
+    # since the timezone may match any number of identical timezone definitions,
+
+    zonefilelist = {}
+    ZONEINFOPATH = '/usr/share/zoneinfo/'
+    for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH):
+        for fn in filenames:
+            filepath = os.path.join(dirpath, fn)
+            zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = filepath.lstrip(ZONEINFOPATH).strip()
+
+    TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()]
 
 # Language code for this installation. All choices can be found here:
 # http://www.i18nguy.com/unicode/language-identifiers.html
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/14 toaster: Display task description

In reply to Alex DAMIAN

From: Ravi Chintakunta <[email protected]>

Display task description as content of help bubble for a task.

[YOCTO #5748]

---
 lib/toaster/orm/models.py                    | 7 +++++++
 lib/toaster/toastergui/templates/recipe.html | 2 +-
 lib/toaster/toastergui/templates/tasks.html  | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)
lib/toaster/orm/models.py +7 -0
index 4975433..9c15ebf 100644
@@ -174,6 +174,13 @@ class Task(models.Model):
             return "Executed"
         return "Not Executed"
 
+    def get_description(self):
+        variable = Variable.objects.filter(variable_name=self.task_name, build = self.build)
+        try:
+            return variable[0].description
+        except IndexError:
+            return ''
+
     build = models.ForeignKey(Build, related_name='task_build')
     order = models.IntegerField(null=True)
     task_executed = models.BooleanField(default=False) # True means Executed, False means Not/Executed
lib/toaster/toastergui/templates/recipe.html +1 -1
index e367077..b8898d2 100644
@@ -112,7 +112,7 @@
                     <td><a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">{{task.order}}</a></td>
                     <td>
                         <a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">{{task.task_name}}</a>
-                        <i class="icon-question-sign get-help hover-help" title="This task fetches the source code"></i>
+                        {% if task.get_description %}<i class="icon-question-sign get-help hover-help" title="" data-original-title="{{task.get_description}}"></i> {% endif %}
                     </td>
 
                     <td><a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">{{task.get_executed_display}}</a></td>
lib/toaster/toastergui/templates/tasks.html +1 -1
index ca7e187..d68a31a 100644
@@ -86,7 +86,7 @@
                 <a href="{% url "recipe" build.pk task.recipe.pk %}">{{task.recipe.version}}</a>
             </td>
             <td class="task_name">
-                <a href="{%url "task" build.pk task.pk%} ">{{task.task_name}}</a>
+                <a href="{%url "task" build.pk task.pk%} ">{{task.task_name}}</a> {% if task.get_description %}<i class="icon-question-sign get-help hover-help" title="" data-original-title="{{task.get_description}}"></i> {% endif %}
             </td>
             <td class="executed">
                 <a href="{%url "task" build.pk task.pk%} ">{{task.get_executed_display}}</a>
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/14 toaster: use deploy_dir var to obtain the license.manifest path

In reply to Alex DAMIAN

From: Cristiana Voicu <[email protected]>

[YOCTO #6051]
---
 lib/bb/ui/buildinfohelper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/ui/buildinfohelper.py +1 -1
index 0a15579..f448c84 100644
@@ -629,7 +629,7 @@ class BuildInfoHelper(object):
 
 
     def store_license_manifest_path(self, event):
-        deploy_dir = event.data['deploy_dir_image']
+        deploy_dir = event.data['deploy_dir']
         image_name =  event.data['image_name']
         path = deploy_dir + "/licenses/" + image_name + "/"
         for target in self.internal_state['targets']:
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/14 toaster: disable configvar sorts for value and files

In reply to Alex DAMIAN

From: David Reyna <[email protected]>

Disable the sort on files because it sorts on the file array's first (and invisible) element. Disable the sort on values because the raw ASCII sort looks wrong to the general user, especially for values with leading spaces.

[YOCTO #6004]

---
 lib/toaster/toastergui/views.py | 4 ----
 1 file changed, 4 deletions(-)
lib/toaster/toastergui/views.py +0 -4
index 4e412ca..6413c80 100644
@@ -1120,15 +1120,11 @@ def configvars(request, build_id):
                 {'name': 'Value ',
                  'qhelp': "The value assigned to the variable",
                  'dclass': "span4",
-                 'orderfield': _get_toggle_order(request, "variable_value"),
-                 'ordericon':_get_toggle_order_icon(request, "variable_value"),
                 },
                 {'name': 'Set in file',
                  'qhelp': "The last configuration file that touched the variable value",
                  'clclass': 'file', 'hidden' : 0,
                  'dclass': "span6",
-                 'orderfield': _get_toggle_order(request, "vhistory__file_name"),
-                 'ordericon':_get_toggle_order_icon(request, "vhistory__file_name"),
                  'filter' : {
                     'class' : 'vhistory__file_name',
                     'label': 'Show:',
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/14 toaster: Show "No builds found" in the builds table

In reply to Alex DAMIAN

From: Belen Barros Pena <[email protected]>

Making sure the h1 of build.html shows "No builds found" instead of "0 builds found" when a search returns no results. This matches the builds table to all other Toaster tables.

---
 lib/toaster/toastergui/templates/build.html | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/toaster/toastergui/templates/build.html +3 -3
index 7d13cc8..afa390f 100644
@@ -85,10 +85,10 @@
   {% else %}
   <div class="page-header top-air">
      <h1>
-      {% if request.GET.filter and objects.count or request.GET.search and objects.count > 0  %}
+      {% if request.GET.filter and objects.paginator.count > 0 or request.GET.search and objects.paginator.count > 0 %}
           {{objects.paginator.count}} build{{objects.paginator.count|pluralize}} found
-      {%elif objects.paginator.count == 0%}
-          No builds
+      {%elif request.GET.filter and objects.paginator.count == 0 or request.GET.search and objects.paginator.count == 0 %}
+          No builds found
       {%else%}
           All builds
       {%endif%}
Signature · 1 line
1.9.1
#7 lore raw

PATCH 7/14 toaster: Remove trailing spaces from 'name'

In reply to Alex DAMIAN

From: Belen Barros Pena <[email protected]>

Remove all trailing spaces from 'name' because they show up in the filter headings, which I find incredibly annoying.

---
 lib/toaster/toastergui/views.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/toaster/toastergui/views.py +3 -3
index 6413c80..6028d4d 100644
@@ -1111,13 +1111,13 @@ def configvars(request, build_id):
                 'search_term':search_term,
             # Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns
                 'tablecols' : [
-                {'name': 'Variable ',
+                {'name': 'Variable',
                  'qhelp': "BitBake is a generic task executor that considers a list of tasks with dependencies and handles metadata that consists of variables in a certain format that get passed to the tasks",
                  'dclass' : "span3",
                  'orderfield': _get_toggle_order(request, "variable_name"),
                  'ordericon':_get_toggle_order_icon(request, "variable_name"),
                 },
-                {'name': 'Value ',
+                {'name': 'Value',
                  'qhelp': "The value assigned to the variable",
                  'dclass': "span4",
                 },
@@ -1137,7 +1137,7 @@ def configvars(request, build_id):
                                ]
                              },
                 },
-                {'name': 'Description ',
+                {'name': 'Description',
                  'qhelp': "A brief explanation of the variable",
                  'clclass': 'description', 'hidden' : 0,
                  'dclass': "span5",
Signature · 1 line
1.9.1
#8 lore raw

PATCH 8/14 toaster: Small tweaks to the packages included interface

In reply to Alex DAMIAN

From: Belen Barros Pena <[email protected]>

* Capitalise correctly the label "Reverse runtime dependencies"

* Change dependency popover labels to match the rest of the interface

* Make sure that dependency links go to the initial tab of the installed package details pages

---
 lib/toaster/toastergui/templates/package_included_tabs.html | 2 +-
 lib/toaster/toastergui/templates/target.html                | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
lib/toaster/toastergui/templates/package_included_tabs.html +1 -1
index 5a97ba3..3ea4915 100644
@@ -27,7 +27,7 @@
     {% endif %}
             <a href="{% url 'package_included_reverse_dependencies' build.id target.id package.id %}">
                 <i class="icon-question-sign get-help" data-toggle="tooltip" title="The package runtime reverse dependencies (i.e. which other packages in this image depend on this package). Reverse dependencies reflect only the 'depends' dependency type"></i>
-                Reverse Runtime dependencies ({{reverse_count}})
+                Reverse runtime dependencies ({{reverse_count}})
             </a>
         </li>
     </ul>
lib/toaster/toastergui/templates/target.html +4 -4
index ceffada..5db0c0c 100644
@@ -93,10 +93,10 @@
             {% with deps_count=deps|length %}
             {% if deps_count > 0 %}
             <a class="btn"
-                title="<a href='{% url "package_included_dependencies" build.id target.id package.id %}'>{{package.name}}</a> depends on"
+                title="<a href='{% url "package_included_dependencies" build.id target.id package.id %}'>{{package.name}}</a> dependencies"
                 data-content="<ul class='unstyled'>
                   {% for i in deps|dictsort:'depends_on.name' %}
-                    <li><a href='{% url "package_included_dependencies" build.pk target.id i.depends_on.pk %}'>{{i.depends_on.name}}</a></li>
+                    <li><a href='{% url "package_included_detail" build.pk target.id i.depends_on.pk %}'>{{i.depends_on.name}}</a></li>
                   {% endfor %}
                 </ul>">
                 {{deps_count}}
@@ -110,10 +110,10 @@
             {% with rdeps_count=rdeps|length %}
             {% if rdeps_count > 0 %}
             <a class="btn"
-                title="<a href='{% url "package_included_reverse_dependencies" build.id target.id package.id %}'>{{package.name}}</a> is brought in by"
+                title="<a href='{% url "package_included_reverse_dependencies" build.id target.id package.id %}'>{{package.name}}</a> reverse dependencies"
                 data-content="<ul class='unstyled'>
                   {% for i in rdeps|dictsort:'package.name' %}
-                    <li><a href='{% url "package_included_dependencies" build.id target.id i.package.id %}'>{{i.package.name}}</a></li>
+                    <li><a href='{% url "package_included_detail" build.id target.id i.package.id %}'>{{i.package.name}}</a></li>
                   {% endfor %}
                 </ul>">
                 {{rdeps_count}}
Signature · 1 line
1.9.1
#9 lore raw

PATCH 9/14 toaster: Fix the fade out animation

In reply to Alex DAMIAN

From: Belen Barros Pena <[email protected]>

Apply the animation to any element with the class
.highlight

---
 lib/toaster/toastergui/static/css/default.css | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/toaster/toastergui/static/css/default.css +1 -2
index 260f5d4..69e8cad 100644
@@ -46,8 +46,7 @@ dd p { line-height: 20px; }
 .details { margin-top: 30px; }
 
 /* Required classes for the highlight behaviour in tables */
-.highlight { background-color: #D9EDF7; }
-.flash:target { -webkit-animation: target-fade 7s 1; -moz-animation: target-fade 7s 1; animation: target-fade 7s 1; }
+.highlight { -webkit-animation: target-fade 7s 1; -moz-animation: target-fade 7s 1; animation: target-fade 7s 1; }
 @-webkit-keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } }
 @-moz-keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } }
 @keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } }
Signature · 1 line
1.9.1
#10 lore raw

PATCH 10/14 toaster: Increase animation duration

In reply to Alex DAMIAN

From: Belen Barros Pena <[email protected]>

Increase the duration of the blue highlight animation from 7 to 10 seconds.

---
 lib/toaster/toastergui/static/css/default.css | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/toaster/toastergui/static/css/default.css +1 -1
index 69e8cad..0b53718 100644
@@ -46,7 +46,7 @@ dd p { line-height: 20px; }
 .details { margin-top: 30px; }
 
 /* Required classes for the highlight behaviour in tables */
-.highlight { -webkit-animation: target-fade 7s 1; -moz-animation: target-fade 7s 1; animation: target-fade 7s 1; }
+.highlight { -webkit-animation: target-fade 10s 1; -moz-animation: target-fade 10s 1; animation: target-fade 10s 1; }
 @-webkit-keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } }
 @-moz-keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } }
 @keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } }
Signature · 1 line
1.9.1
#11 lore raw

PATCH 11/14 toaster: Match search results form to no results form

In reply to Alex DAMIAN

From: Belen Barros Pena <[email protected]>

In the search results form, add the btn class to the clear search button and set its tabindex to -1 so that you don't accidentally clear the search when you want to search again.

---
 lib/toaster/toastergui/templates/basetable_top.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/toaster/toastergui/templates/basetable_top.html +1 -1
index 3fc0f31..f625901 100644
@@ -30,7 +30,7 @@
 <div class="navbar">
     <div class="navbar-inner">
         <form class="navbar-search input-append pull-left" id="searchform">
-            <input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search {%if object_search_display %}{{object_search_display}}{%else%}{{objectname}}{%endif%}" value="{{request.GET.search}}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="add-on"><i class="icon-remove"></i></a>{%endif%}
+            <input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search {%if object_search_display %}{{object_search_display}}{%else%}{{objectname}}{%endif%}" 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 type="hidden" name="orderby" value="{{request.GET.orderby}}">
             <input type="hidden" name="page" value="1">
             <button class="btn" type="submit" value="Search">Search</button>
Signature · 1 line
1.9.1
#12 lore raw

PATCH 12/14 toaster: Update help text in format_vpackage_namehelp tag

In reply to Alex DAMIAN

From: Belen Barros Pena <[email protected]>

The text now says that the package has not been built.

---
 lib/toaster/toastergui/templatetags/projecttags.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/toaster/toastergui/templatetags/projecttags.py +1 -1
index aa0ba39..3dd0f3d 100644
@@ -237,7 +237,7 @@ def format_vpackage_rowclass(size):
 def format_vpackage_namehelp(name):
     r =  name + '&nbsp;'
     r += '<i class="icon-question-sign get-help hover-help"'
-    r += ' title="' + name + ' only has dependency information available.">'
+    r += ' title = "' + name + ' has not been built">'
     r += '</i>'
     return mark_safe(r)
 
Signature · 1 line
1.9.1
#13 lore raw

PATCH 13/14 toaster: unbuilt package dependency formats

In reply to Alex DAMIAN

From: Dave Lerner <[email protected]>

[YOCTO 6057]

For a package shown on the package build dependency page, the dependent packages may be unbuilt packages, as indicated with the dependent package's size set to -1. This fix changes the build template to use the same formatting functions for unbuilt dependent packages as the include package templates use for unbuilt dependent packages.

---
 .../templates/package_built_dependencies.html      | 75 ++++++++++------------
 1 file changed, 33 insertions(+), 42 deletions(-)
lib/toaster/toastergui/templates/package_built_dependencies.html +33 -42
index a2011d6..8613f1e 100644
@@ -36,24 +36,21 @@
                     </thead>
                     <tbody>
 						{% for runtime_dep in runtime_deps %}
-                            {% ifequal runtime_dep.version '' %}
-                                <tr class="muted">
-                                    <td>{{runtime_dep.name}}</td>
-                                    <td>{{runtime_dep.version}}</td>
-                                    <td></td>
-                                    </div>
-                                </tr>
+                        <tr {{runtime_dep.size|format_vpackage_rowclass}} >
+                            {% if runtime_dep.size != -1 %}
+                            <td>
+                                <a href="{% url 'package_built_detail' build.id runtime_dep.depends_on_id %}">
+                                    {{runtime_dep.name}}
+                                </a>
+                            </td>
                             {% else %}
-                                <tr>
-                                    <td>
-                                        <a href="{% url 'package_built_detail' build.id runtime_dep.depends_on_id %}">
-                                            {{runtime_dep.name}}
-                                        </a>
-                                    </td>
-                                    <td>{{runtime_dep.version}}</td>
-                                    <td>{{runtime_dep.size|filtered_filesizeformat}}</td>
-                                </tr>
-                            {% endifequal %}
+                            <td>
+                                {{runtime_dep.name|format_vpackage_namehelp}}
+                            </td>
+                            {% endif %}
+                            <td>{{runtime_dep.version}}</td>
+                            <td>{{runtime_dep.size|filtered_filesizeformat}}</td>
+                        </tr>
 						{% endfor %}
                     </tbody>
                 </table>
@@ -74,31 +71,25 @@
                     </thead>
                     <tbody>
 						{% for other_dep in other_deps %}
-                        	{% ifequal other_dep.version '' %}
-                            	<tr class="muted">
-                                	<td>{{other_dep.name}}</td>
-                                	<td>{{other_dep.version}}</td>
-                                	<td></td>
-                                	<td>
-                                    	{{other_dep.dep_type_display}}
-                                    	<i class="icon-question-sign get-help hover-help" title="{{other_dep.dep_type_help}}" ></i>
-                                	</td>
-                            	</tr>
-                        	{% else %}
-                            	<tr>
-                                	<td>
-                                    	<a href="{% url 'package_built_detail' build.id other_dep.depends_on_id %}">
-                                        	{{other_dep.name}}
-                                    	</a>
-                                	</td>
-                                	<td>{{other_dep.version}}</td>
-                                	<td>{{other_dep.size|filtered_filesizeformat}}</td>
-                                	<td>
-                                    	{{other_dep.dep_type_display}}
-                                    	<i class="icon-question-sign get-help hover-help" title="{{other_dep.dep_type_help}}" ></i>
-                                	</td>
-                            	</tr>
-                        	{% endifequal %}
+                        <tr {{other_dep.size|format_vpackage_rowclass}} >
+                        {% if other_dep.size != -1 %}
+                            <td>
+                                <a href="{% url 'package_built_detail' build.id other_dep.depends_on_id %}">
+                                    {{other_dep.name}}
+                                </a>
+                            </td>
+                        {% else %}
+                            <td>
+                                {{other_dep.name|format_vpackage_namehelp}}
+                            </td>
+                        {% endif %}
+                            <td>{{other_dep.version}}</td>
+                            <td>{{other_dep.size|filtered_filesizeformat}}</td>
+                            <td>
+                                {{other_dep.dep_type_display}}
+                                <i class="icon-question-sign get-help hover-help" title="{{other_dep.dep_type_help}}" ></i>
+                            </td>
+                        </tr>
                     	{% endfor %}
                     </tbody>
                 </table>
Signature · 1 line
1.9.1
#14 lore raw

PATCH 14/14 toaster: secondary sort key as table's default order

In reply to Alex DAMIAN

From: David Reyna <[email protected]>

Provide for a secondary sort key based on the table's default ordering when doing sort on alternate columns.

[YOCTO #5920]

---
 lib/toaster/toastergui/views.py | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)
lib/toaster/toastergui/views.py +16 -11
index 6028d4d..05e24ea 100644
@@ -175,7 +175,7 @@ def _search_tuple(request, model):
 
 
 # returns a lazy-evaluated queryset for a filter/search/order combination
-def _get_queryset(model, queryset, filter_string, search_term, ordering_string):
+def _get_queryset(model, queryset, filter_string, search_term, ordering_string, ordering_secondary=''):
     if filter_string:
         filter_query = _get_filtering_query(filter_string)
         queryset = queryset.filter(filter_query)
@@ -187,14 +187,19 @@ def _get_queryset(model, queryset, filter_string, search_term, ordering_string):
 
     if ordering_string and queryset:
         column, order = ordering_string.split(':')
+        if column == re.sub('-','',ordering_secondary):
+            ordering_secondary=''
         if order.lower() == DESCENDING:
-            queryset = queryset.order_by('-' + column)
+            column = '-' + column
+        if ordering_secondary:
+            queryset = queryset.order_by(column, ordering_secondary)
         else:
             queryset = queryset.order_by(column)
 
     # insure only distinct records (e.g. from multiple search hits) are returned 
     return queryset.distinct()
 
+
 # shows the "all builds" page
 def builds(request):
     template = 'build.html'
@@ -210,8 +215,8 @@ def builds(request):
     # for that object type. copypasta for all needed table searches
     (filter_string, search_term, ordering_string) = _search_tuple(request, Build)
     queryset_all = Build.objects.exclude(outcome = Build.IN_PROGRESS)
-    queryset_with_search = _get_queryset(Build, queryset_all, None, search_term, ordering_string)
-    queryset = _get_queryset(Build, queryset_all, filter_string, search_term, ordering_string)
+    queryset_with_search = _get_queryset(Build, queryset_all, None, search_term, ordering_string, '-completed_on')
+    queryset = _get_queryset(Build, queryset_all, filter_string, search_term, ordering_string, '-completed_on')
 
     # retrieve the objects that will be displayed in the table; builds a paginator and gets a page range to display
     build_info = _build_page_range(Paginator(queryset, request.GET.get('count', 10)),request.GET.get('page', 1))
@@ -489,7 +494,7 @@ def target(request, build_id, target_id):
     # FUTURE:  get rid of nested sub-queries replacing with ManyToMany field
     queryset = Package.objects.filter(size__gte=0, id__in=Target_Installed_Package.objects.filter(target_id=target_id).values('package_id'))
     packages_sum =  queryset.aggregate(Sum('installed_size'))
-    queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string)
+    queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string, 'name')
     packages = _build_page_range(Paginator(queryset, request.GET.get('count', 25)),request.GET.get('page', 1))
 
     # bring in package dependencies
@@ -789,8 +794,8 @@ def tasks_common(request, build_id, variant):
         return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id)
     (filter_string, search_term, ordering_string) = _search_tuple(request, Task)
     queryset_all = Task.objects.filter(build=build_id, order__gt=0)
-    queryset_with_search = _get_queryset(Task, queryset_all, None , search_term, ordering_string)
-    queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string)
+    queryset_with_search = _get_queryset(Task, queryset_all, None , search_term, ordering_string, 'order')
+    queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string, 'order')
 
     tasks = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
 
@@ -952,7 +957,7 @@ def recipes(request, build_id):
         return _redirect_parameters( 'recipes', request.GET, mandatory_parameters, build_id = build_id)
     (filter_string, search_term, ordering_string) = _search_tuple(request, Recipe)
     queryset = Recipe.objects.filter(layer_version__id__in=Layer_Version.objects.filter(build=build_id))
-    queryset = _get_queryset(Recipe, queryset, filter_string, search_term, ordering_string)
+    queryset = _get_queryset(Recipe, queryset, filter_string, search_term, ordering_string, 'name')
 
     recipes = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
 
@@ -1081,8 +1086,8 @@ def configvars(request, build_id):
         return _redirect_parameters( 'configvars', request.GET, mandatory_parameters, build_id = build_id)
 
     queryset = Variable.objects.filter(build=build_id).exclude(variable_name__istartswith='B_').exclude(variable_name__istartswith='do_')
-    queryset_with_search =  _get_queryset(Variable, queryset, None, search_term, ordering_string).exclude(variable_value='',vhistory__file_name__isnull=True)
-    queryset = _get_queryset(Variable, queryset, filter_string, search_term, ordering_string)
+    queryset_with_search =  _get_queryset(Variable, queryset, None, search_term, ordering_string, 'variable_name').exclude(variable_value='',vhistory__file_name__isnull=True)
+    queryset = _get_queryset(Variable, queryset, filter_string, search_term, ordering_string, 'variable_name')
     # remove records where the value is empty AND there are no history files
     queryset = queryset.exclude(variable_value='',vhistory__file_name__isnull=True)
 
@@ -1163,7 +1168,7 @@ def bpackage(request, build_id):
         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)
+    queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string, 'name')
 
     packages = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
 
Signature · 1 line
1.9.1