From ab896df63ba058f535cb303611574f293c7c680b Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 9 Oct 2015 10:32:42 +0100 Subject: bitbake: toaster: Fix stale layer state buttons Move the "is available to the project" state computation to the template for the Layer add/remove buttons, Recipe build/Add layer as done for the Package add/remove. This is more reliable as we can get an inconsistent state on the front end JS as there are many opportunities for hitting out of date project information. [YOCTO #8294] (Bitbake rev: 43469c3360566ad4897785f14f8717a9bc8b6078) Signed-off-by: Michael Wood Signed-off-by: Elliot Smith Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/tables.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/toaster/toastergui/tables.py') diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index 4f24772206..b10445b00f 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -57,9 +57,7 @@ class LayersTable(ToasterTable): context = super(LayersTable, self).get_context_data(**kwargs) project = Project.objects.get(pk=kwargs['pid']) - context['project'] = project - context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project)) return context @@ -93,7 +91,10 @@ class LayersTable(ToasterTable): def setup_queryset(self, *args, **kwargs): prj = Project.objects.get(pk = kwargs['pid']) - compatible_layers = prj.compatible_layerversions() + compatible_layers = prj.get_all_compatible_layer_versions() + + self.static_context_extra['current_layers'] = \ + prj.get_project_layer_versions(pk=True) self.queryset = compatible_layers.order_by(self.default_orderby) -- cgit v1.2.3-54-g00ecf