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>
This commit is contained in:
Michael Wood
2015-08-06 19:01:35 +03:00
committed by Richard Purdie
parent da4c66385d
commit af72d0fbb2
3 changed files with 17 additions and 25 deletions

View File

@@ -19,7 +19,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from toastergui.widgets import ToasterTable, ToasterTemplateView
from toastergui.widgets import ToasterTable
from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project
from django.db.models import Q, Max
from django.conf.urls import url
@@ -202,28 +202,6 @@ class LayersTable(ToasterTable):
computation = lambda x: x.layer.name)
class LayerDetails(ToasterTemplateView):
def get_context_data(self, **kwargs):
context = super(LayerDetails, self).get_context_data(**kwargs)
from toastergui.views import _lv_to_dict
context['project'] = Project.objects.get(pk=kwargs['pid'])
context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid'])
context['layerdict'] = _lv_to_dict(context['project'], context['layerversion'])
context['layerdeps'] = {"list": [
[ {"id": y.id,
"name": y.layer.name,
"layerdetailurl": reverse('layerdetails', args=(kwargs['pid'], y.id)),
} for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]}
context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project']))
self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps']
return context
class MachinesTable(ToasterTable, ProjectFiltersMixin):
"""Table of Machines in Toaster"""

View File

@@ -110,8 +110,7 @@ urlpatterns = patterns('toastergui.views',
name="projectlayers"),
url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$',
tables.LayerDetails.as_view(template_name='layerdetails.html'),
name='layerdetails'),
'layerdetails', name='layerdetails'),
url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/recipes/$',
tables.LayerRecipesTable.as_view(template_name="generic-toastertable-page.html"),

View File

@@ -2517,6 +2517,21 @@ if True:
}
return render(request, template, context)
@_template_renderer('layerdetails.html')
def layerdetails(request, pid, layerid):
project = Project.objects.get(pk=pid)
layer_version = Layer_Version.objects.get(pk=layerid)
context = { 'project' : project,
'layerversion' : layer_version,
'layerdeps' : { "list": [
[{"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()]},
'projectlayers': map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project))
}
return context
def get_project_configvars_context():
# Vars managed outside of this view
vars_managed = {