bitbake: toaster: machines table Fix missing layers information needed for filter

The current layers information wasn't being passed to the template for
the Select/Add button for the Compatible machines filter.

(Bitbake rev: 559102984d3f62a7675899e058166bdf4d552c46)

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>
This commit is contained in:
Michael Wood 2015-11-26 16:44:31 +00:00 committed by Richard Purdie
parent b90a8dca99
commit bdf62414f2
2 changed files with 14 additions and 4 deletions

View File

@ -217,12 +217,10 @@ class MachinesTable(ToasterTable, ProjectFiltersMixin):
def get_context_data(self, **kwargs):
context = super(MachinesTable, self).get_context_data(**kwargs)
context['project'] = Project.objects.get(pk=kwargs['pid'])
context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project']))
return context
def setup_filters(self, *args, **kwargs):
project = Project.objects.get(pk=kwargs['pid'])
self.project_layers = project.get_project_layer_versions()
self.add_filter(title="Filter by project machines",
name="in_current_project",
@ -236,6 +234,10 @@ class MachinesTable(ToasterTable, ProjectFiltersMixin):
self.queryset = prj.get_all_compatible_machines()
self.queryset = self.queryset.order_by(self.default_orderby)
self.static_context_extra['current_layers'] = \
self.project_layers = \
prj.get_project_layer_versions(pk=True)
def setup_columns(self, *args, **kwargs):
self.add_column(title="Machine",

View File

@ -1,6 +1,14 @@
<a href="{% url 'project' extra.pid %}?setMachine={{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.id}}" style="margin-top: 5px; display:none">
<a href="{% url 'project' extra.pid %}?setMachine={{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.id}}"
{% if data.layer_version.pk not in extra.current_layers %}
style="display:none;"
{% endif %}
>
Select machine</a>
<button class="btn btn-block layerbtn layer-add-{{data.layer_version.id}}" data-layer='{ "id": {{data.layer_version.id}}, "name": "{{data.layer_version.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.layer_version.id %}"}' data-directive="add">
<button class="btn btn-block layerbtn layer-add-{{data.layer_version.id}}" data-layer='{ "id": {{data.layer_version.id}}, "name": "{{data.layer_version.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.layer_version.id %}"}' data-directive="add"
{% if data.layer_version.pk in extra.current_layers %}
style="display:none;"
{% endif %}
>
<i class="icon-plus"></i>
Add layer
<i title="" class="icon-question-sign get-help" data-original-title="To enable this machine, you must first add the {{data.layer_version.layer.name}} layer to your project"></i>