diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tables.py')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index e03aa768c9..003b924d00 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
| @@ -23,6 +23,7 @@ from toastergui.widgets import ToasterTable, ToasterTemplateView | |||
| 23 | from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project | 23 | from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project |
| 24 | from django.db.models import Q, Max | 24 | from django.db.models import Q, Max |
| 25 | from django.conf.urls import url | 25 | from django.conf.urls import url |
| 26 | from django.core.urlresolvers import reverse | ||
| 26 | from django.views.generic import TemplateView | 27 | from django.views.generic import TemplateView |
| 27 | 28 | ||
| 28 | class LayersTable(ToasterTable): | 29 | class LayersTable(ToasterTable): |
| @@ -35,9 +36,9 @@ class LayersTable(ToasterTable): | |||
| 35 | def get_context_data(self, **kwargs): | 36 | def get_context_data(self, **kwargs): |
| 36 | context = super(LayersTable, self).get_context_data(**kwargs) | 37 | context = super(LayersTable, self).get_context_data(**kwargs) |
| 37 | 38 | ||
| 38 | context['project'] = Project.objects.get(pk=kwargs['pid']) | 39 | project = Project.objects.get(pk=kwargs['pid']) |
| 39 | 40 | context['project'] = project | |
| 40 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) | 41 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project)) |
| 41 | 42 | ||
| 42 | return context | 43 | return context |
| 43 | 44 | ||
| @@ -142,6 +143,13 @@ class LayersTable(ToasterTable): | |||
| 142 | static_data_name="add-del-layers", | 143 | static_data_name="add-del-layers", |
| 143 | static_data_template='{% include "layer_btn.html" %}') | 144 | static_data_template='{% include "layer_btn.html" %}') |
| 144 | 145 | ||
| 146 | project = Project.objects.get(pk=kwargs['pid']) | ||
| 147 | self.add_column(title="LayerDetailsUrl", | ||
| 148 | displayable = False, | ||
| 149 | field_name="layerDetailsUrl", | ||
| 150 | computation = lambda x: reverse('layerdetails', args=(project.id, x.id))) | ||
| 151 | |||
| 152 | |||
| 145 | 153 | ||
| 146 | 154 | ||
| 147 | class LayerDetails(ToasterTemplateView): | 155 | class LayerDetails(ToasterTemplateView): |
| @@ -152,7 +160,8 @@ class LayerDetails(ToasterTemplateView): | |||
| 152 | context['project'] = Project.objects.get(pk=kwargs['pid']) | 160 | context['project'] = Project.objects.get(pk=kwargs['pid']) |
| 153 | context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid']) | 161 | context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid']) |
| 154 | context['layerdict'] = _lv_to_dict(context['project'], context['layerversion']) | 162 | context['layerdict'] = _lv_to_dict(context['project'], context['layerversion']) |
| 155 | context['layerdeps'] = {"list": [x.depends_on.get_equivalents_wpriority(context['project'])[0] for x in context['layerversion'].dependencies.all()]} | 163 | context['layerdeps'] = {"list": [ |
| 164 | [{"id": y.id, "name": y.layer.name} for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]} | ||
| 156 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) | 165 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) |
| 157 | 166 | ||
| 158 | self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps'] | 167 | self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps'] |
| @@ -265,9 +274,10 @@ class RecipesTable(ToasterTable): | |||
| 265 | self.default_orderby = "name" | 274 | self.default_orderby = "name" |
| 266 | 275 | ||
| 267 | def get_context_data(self, **kwargs): | 276 | def get_context_data(self, **kwargs): |
| 277 | project = Project.objects.get(pk=kwargs['pid']) | ||
| 268 | context = super(RecipesTable, self).get_context_data(**kwargs) | 278 | context = super(RecipesTable, self).get_context_data(**kwargs) |
| 269 | 279 | ||
| 270 | context['project'] = Project.objects.get(pk=kwargs['pid']) | 280 | context['project'] = project |
| 271 | 281 | ||
| 272 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) | 282 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) |
| 273 | 283 | ||
| @@ -342,10 +352,11 @@ class RecipesTable(ToasterTable): | |||
| 342 | static_data_name="add-del-layers", | 352 | static_data_name="add-del-layers", |
| 343 | static_data_template='{% include "recipe_btn.html" %}') | 353 | static_data_template='{% include "recipe_btn.html" %}') |
| 344 | 354 | ||
| 355 | project = Project.objects.get(pk=kwargs['pid']) | ||
| 345 | self.add_column(title="Project compatible Layer ID", | 356 | self.add_column(title="Project compatible Layer ID", |
| 346 | displayable = False, | 357 | displayable = False, |
| 347 | field_name = "projectcompatible_layer", | 358 | field_name = "projectcompatible_layer", |
| 348 | computation = lambda x: (x.layer_version.get_equivalents_wpriority(Project.objects.get(pk=kwargs['pid']))[0])) | 359 | computation = lambda x: (x.layer_version.get_equivalents_wpriority(project)[0])) |
| 349 | 360 | ||
| 350 | class LayerRecipesTable(RecipesTable): | 361 | class LayerRecipesTable(RecipesTable): |
| 351 | """ Smaller version of the Recipes table for use in layer details """ | 362 | """ Smaller version of the Recipes table for use in layer details """ |
