summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/tables.py
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-11-26 16:44:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-07 17:01:20 +0000
commit1c59846fc038428d3965866129149d98c8642b3f (patch)
tree886b33f3e792228e8dfff637651f24c73e338364 /bitbake/lib/toaster/toastergui/tables.py
parentd82c54114709ae23a57149fc324960db152fa739 (diff)
downloadpoky-1c59846fc038428d3965866129149d98c8642b3f.tar.gz
bitbake: toaster: tables Add default_orderby field where it was missing or unset
This value is used to set the default ordering of the model that is used for ToasterTables, it is picked up client side to set the ordering indicator. [YOCTO #8695] (Bitbake rev: f1c91bff810a579b169c46b7710e22f5553b484e) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tables.py')
-rw-r--r--bitbake/lib/toaster/toastergui/tables.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index be8916c468..44a89d9857 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -295,6 +295,7 @@ class LayerMachinesTable(MachinesTable):
295 MachinesTable.setup_queryset(self, *args, **kwargs) 295 MachinesTable.setup_queryset(self, *args, **kwargs)
296 296
297 self.queryset = self.queryset.filter(layer_version__pk=int(kwargs['layerid'])) 297 self.queryset = self.queryset.filter(layer_version__pk=int(kwargs['layerid']))
298 self.queryset = self.queryset.order_by(self.default_orderby)
298 self.static_context_extra['in_prj'] = ProjectLayer.objects.filter(Q(project=kwargs['pid']) & Q(layercommit=kwargs['layerid'])).count() 299 self.static_context_extra['in_prj'] = ProjectLayer.objects.filter(Q(project=kwargs['pid']) & Q(layercommit=kwargs['layerid'])).count()
299 300
300 def setup_columns(self, *args, **kwargs): 301 def setup_columns(self, *args, **kwargs):
@@ -319,7 +320,6 @@ class RecipesTable(ToasterTable, ProjectFiltersMixin):
319 def __init__(self, *args, **kwargs): 320 def __init__(self, *args, **kwargs):
320 super(RecipesTable, self).__init__(*args, **kwargs) 321 super(RecipesTable, self).__init__(*args, **kwargs)
321 self.empty_state = "Toaster has no recipe information. To generate recipe information you can configure a layer source then run a build." 322 self.empty_state = "Toaster has no recipe information. To generate recipe information you can configure a layer source then run a build."
322 self.default_orderby = "name"
323 323
324 build_col = { 'title' : "Build", 324 build_col = { 'title' : "Build",
325 'help_text' : "Add or delete recipes to and from your project", 325 'help_text' : "Add or delete recipes to and from your project",
@@ -356,7 +356,6 @@ class RecipesTable(ToasterTable, ProjectFiltersMixin):
356 self.static_context_extra['current_layers'] = self.project_layers 356 self.static_context_extra['current_layers'] = self.project_layers
357 357
358 self.queryset = prj.get_all_compatible_recipes() 358 self.queryset = prj.get_all_compatible_recipes()
359 self.queryset = self.queryset.order_by(self.default_orderby)
360 359
361 360
362 def setup_columns(self, *args, **kwargs): 361 def setup_columns(self, *args, **kwargs):
@@ -414,6 +413,7 @@ class LayerRecipesTable(RecipesTable):
414 413
415 def __init__(self, *args, **kwargs): 414 def __init__(self, *args, **kwargs):
416 super(LayerRecipesTable, self).__init__(*args, **kwargs) 415 super(LayerRecipesTable, self).__init__(*args, **kwargs)
416 self.default_orderby = "name"
417 417
418 def get_context_data(self, **kwargs): 418 def get_context_data(self, **kwargs):
419 context = super(LayerRecipesTable, self).get_context_data(**kwargs) 419 context = super(LayerRecipesTable, self).get_context_data(**kwargs)
@@ -425,6 +425,7 @@ class LayerRecipesTable(RecipesTable):
425 self.queryset = \ 425 self.queryset = \
426 Recipe.objects.filter(layer_version__pk=int(kwargs['layerid'])) 426 Recipe.objects.filter(layer_version__pk=int(kwargs['layerid']))
427 427
428 self.queryset = self.queryset.order_by(self.default_orderby)
428 self.static_context_extra['in_prj'] = ProjectLayer.objects.filter(Q(project=kwargs['pid']) & Q(layercommit=kwargs['layerid'])).count() 429 self.static_context_extra['in_prj'] = ProjectLayer.objects.filter(Q(project=kwargs['pid']) & Q(layercommit=kwargs['layerid'])).count()
429 430
430 def setup_columns(self, *args, **kwargs): 431 def setup_columns(self, *args, **kwargs):
@@ -451,6 +452,7 @@ class CustomImagesTable(ToasterTable):
451 def __init__(self, *args, **kwargs): 452 def __init__(self, *args, **kwargs):
452 super(CustomImagesTable, self).__init__(*args, **kwargs) 453 super(CustomImagesTable, self).__init__(*args, **kwargs)
453 self.title = "Custom images" 454 self.title = "Custom images"
455 self.default_orderby = "name"
454 456
455 def get_context_data(self, **kwargs): 457 def get_context_data(self, **kwargs):
456 context = super(CustomImagesTable, self).get_context_data(**kwargs) 458 context = super(CustomImagesTable, self).get_context_data(**kwargs)
@@ -462,7 +464,7 @@ class CustomImagesTable(ToasterTable):
462 def setup_queryset(self, *args, **kwargs): 464 def setup_queryset(self, *args, **kwargs):
463 prj = Project.objects.get(pk = kwargs['pid']) 465 prj = Project.objects.get(pk = kwargs['pid'])
464 self.queryset = CustomImageRecipe.objects.filter(project=prj) 466 self.queryset = CustomImageRecipe.objects.filter(project=prj)
465 self.queryset = self.queryset.order_by('name') 467 self.queryset = self.queryset.order_by(self.default_orderby)
466 468
467 def setup_columns(self, *args, **kwargs): 469 def setup_columns(self, *args, **kwargs):
468 470
@@ -502,11 +504,13 @@ class ImageRecipesTable(RecipesTable):
502 def __init__(self, *args, **kwargs): 504 def __init__(self, *args, **kwargs):
503 super(ImageRecipesTable, self).__init__(*args, **kwargs) 505 super(ImageRecipesTable, self).__init__(*args, **kwargs)
504 self.title = "Compatible image recipes" 506 self.title = "Compatible image recipes"
507 self.default_orderby = "name"
505 508
506 def setup_queryset(self, *args, **kwargs): 509 def setup_queryset(self, *args, **kwargs):
507 super(ImageRecipesTable, self).setup_queryset(*args, **kwargs) 510 super(ImageRecipesTable, self).setup_queryset(*args, **kwargs)
508 511
509 self.queryset = self.queryset.filter(is_image=True) 512 self.queryset = self.queryset.filter(is_image=True)
513 self.queryset = self.queryset.order_by(self.default_orderby)
510 514
511 515
512 def setup_columns(self, *args, **kwargs): 516 def setup_columns(self, *args, **kwargs):