summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-08-06 19:01:35 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-06 16:04:48 -0500
commitaf72d0fbb2d0f4d9aa29e124b3b4e216017f771d (patch)
treeecde1021451fcb2e2cc78729134441cb21a412e5 /bitbake
parentda4c66385dc8bc80242664c365b180c9bbc98707 (diff)
downloadpoky-af72d0fbb2d0f4d9aa29e124b3b4e216017f771d.tar.gz
bitbake: toastergui: Move layerdetails view definition to the views.py
The layerdetails view definition was moved to tables though it isn't a table. We have a mechanism for the JSON response for this page so use this instead of a custom class. (Bitbake rev: b5100bfd4cb32a9b59b0554c6dbc3a4295da7d8e) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/tables.py24
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py3
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py15
3 files changed, 17 insertions, 25 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index e4cbec193e..cf0e5ac6bb 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -19,7 +19,7 @@
19# with this program; if not, write to the Free Software Foundation, Inc., 19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 21
22from toastergui.widgets import ToasterTable, ToasterTemplateView 22from toastergui.widgets import ToasterTable
23from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project 23from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project
24from django.db.models import Q, Max 24from django.db.models import Q, Max
25from django.conf.urls import url 25from django.conf.urls import url
@@ -202,28 +202,6 @@ class LayersTable(ToasterTable):
202 computation = lambda x: x.layer.name) 202 computation = lambda x: x.layer.name)
203 203
204 204
205
206
207class LayerDetails(ToasterTemplateView):
208 def get_context_data(self, **kwargs):
209 context = super(LayerDetails, self).get_context_data(**kwargs)
210 from toastergui.views import _lv_to_dict
211
212 context['project'] = Project.objects.get(pk=kwargs['pid'])
213 context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid'])
214 context['layerdict'] = _lv_to_dict(context['project'], context['layerversion'])
215 context['layerdeps'] = {"list": [
216 [ {"id": y.id,
217 "name": y.layer.name,
218 "layerdetailurl": reverse('layerdetails', args=(kwargs['pid'], y.id)),
219 } for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]}
220 context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project']))
221
222 self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps']
223
224 return context
225
226
227class MachinesTable(ToasterTable, ProjectFiltersMixin): 205class MachinesTable(ToasterTable, ProjectFiltersMixin):
228 """Table of Machines in Toaster""" 206 """Table of Machines in Toaster"""
229 207
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index d65ad2bfbb..f74090b9ba 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -110,8 +110,7 @@ urlpatterns = patterns('toastergui.views',
110 name="projectlayers"), 110 name="projectlayers"),
111 111
112 url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$', 112 url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$',
113 tables.LayerDetails.as_view(template_name='layerdetails.html'), 113 'layerdetails', name='layerdetails'),
114 name='layerdetails'),
115 114
116 url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/recipes/$', 115 url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/recipes/$',
117 tables.LayerRecipesTable.as_view(template_name="generic-toastertable-page.html"), 116 tables.LayerRecipesTable.as_view(template_name="generic-toastertable-page.html"),
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 4563eaf01a..889b6c64ca 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2517,6 +2517,21 @@ if True:
2517 } 2517 }
2518 return render(request, template, context) 2518 return render(request, template, context)
2519 2519
2520 @_template_renderer('layerdetails.html')
2521 def layerdetails(request, pid, layerid):
2522 project = Project.objects.get(pk=pid)
2523 layer_version = Layer_Version.objects.get(pk=layerid)
2524
2525 context = { 'project' : project,
2526 'layerversion' : layer_version,
2527 'layerdeps' : { "list": [
2528 [{"id": y.id, "name": y.layer.name} for y in x.depends_on.get_equivalents_wpriority(project)][0] for x in layer_version.dependencies.all()]},
2529 'projectlayers': map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project))
2530 }
2531
2532 return context
2533
2534
2520 def get_project_configvars_context(): 2535 def get_project_configvars_context():
2521 # Vars managed outside of this view 2536 # Vars managed outside of this view
2522 vars_managed = { 2537 vars_managed = {