[bitbake-devel] [PATCH 3/5] toaster: tables Add the recipe filter back into the Recipe table

Elliot Smith elliot.smith at intel.com
Fri Oct 9 09:32:41 UTC 2015


From: Michael Wood <michael.g.wood at intel.com>

Add the "Is recipe currently available in the project" filter back to
the Recipe table which was removed when we had intermediate
AvailableRecipe tables.

Signed-off-by: Michael Wood <michael.g.wood at intel.com>
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
 lib/toaster/toastergui/tables.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py
index a676ffa..4f24772 100644
--- a/lib/toaster/toastergui/tables.py
+++ b/lib/toaster/toastergui/tables.py
@@ -335,10 +335,23 @@ class RecipesTable(ToasterTable, ProjectFiltersMixin):
 
         return context
 
+    def setup_filters(self, *args, **kwargs):
+        self.add_filter(title="Filter by project recipes",
+                        name="in_current_project",
+                        filter_actions=[
+                            self.make_filter_action("in_project", "Recipes provided by layers added to this project", self.filter_in_project),
+                            self.make_filter_action("not_in_project", "Recipes provided by layers not added to this project", self.filter_not_in_project)
+                        ])
 
     def setup_queryset(self, *args, **kwargs):
         prj = Project.objects.get(pk = kwargs['pid'])
 
+        # Project layers used by the filters
+        self.project_layers = prj.get_project_layer_versions(pk=True)
+
+        # Project layers used to switch the button states
+        self.static_context_extra['current_layers'] = self.project_layers
+
         self.queryset = prj.get_all_compatible_recipes()
         self.queryset = self.queryset.order_by(self.default_orderby)
 
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.




More information about the bitbake-devel mailing list