mirror of
https://git.yoctoproject.org/poky
synced 2026-04-19 15:32:13 +02:00
bitbake: toaster: Port All recipes, layers and machines to ToasterTables
Port of the main tables to the new ToasterTable widget. (Bitbake rev: 6de539d5953b2dca2a9ed75556a59764337a194c) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
7f8c44771c
commit
23f5b009e0
@@ -567,6 +567,17 @@ class Recipe(models.Model):
|
||||
|
||||
return self.file_path
|
||||
|
||||
def get_vcs_recipe_file_link_url(self):
|
||||
return self.layer_version.get_vcs_file_link_url(self.file_path)
|
||||
|
||||
def get_description_or_summary(self):
|
||||
if self.description:
|
||||
return self.description
|
||||
elif self.summary:
|
||||
return self.summary
|
||||
else:
|
||||
return ""
|
||||
|
||||
class Meta:
|
||||
unique_together = ("layer_version", "file_path")
|
||||
|
||||
|
||||
@@ -256,3 +256,6 @@ div.add-deps { margin-top: 15px; }
|
||||
.machines-highlight { -webkit-animation: machines-fade 7s 1; -moz-animation: machines-fade 7s 1; animation: machines-fade 7s 1; }
|
||||
|
||||
.tab-pane table { margin-top: 10px; }
|
||||
|
||||
thead .description, .get_description_or_summary { width: 364px; }
|
||||
thead .add-del-layers { width: 124px; }
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
function layerBtnsInit(ctx) {
|
||||
|
||||
$(".layerbtn").click(function (){
|
||||
/* Remove any current bindings to avoid duplicated binds */
|
||||
$(".layerbtn").unbind('click');
|
||||
|
||||
$(".layerbtn").click(function (){
|
||||
var layerObj = $(this).data("layer");
|
||||
var add = ($(this).data('directive') === "add");
|
||||
var thisBtn = $(this);
|
||||
|
||||
@@ -361,6 +361,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
|
||||
/* START TODO Delete this section now redundant */
|
||||
/* Belen's additions */
|
||||
|
||||
// turn Edit columns dropdown into a multiselect menu
|
||||
@@ -409,6 +410,8 @@ $(document).ready(function() {
|
||||
$(this).find(".hover-help").css("visibility","hidden");
|
||||
});
|
||||
|
||||
/* END TODO Delete this section now redundant */
|
||||
|
||||
// show task type and outcome in task details pages
|
||||
$(".task-info").tooltip({ container: 'body', html: true, delay: {show: 200}, placement: 'right' });
|
||||
|
||||
|
||||
279
bitbake/lib/toaster/toastergui/tables.py
Normal file
279
bitbake/lib/toaster/toastergui/tables.py
Normal file
@@ -0,0 +1,279 @@
|
||||
#
|
||||
# ex:ts=4:sw=4:sts=4:et
|
||||
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# BitBake Toaster Implementation
|
||||
#
|
||||
# Copyright (C) 2015 Intel Corporation
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from 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
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
class LayersTable(ToasterTable):
|
||||
"""Table of layers in Toaster"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
ToasterTable.__init__(self)
|
||||
self.default_orderby = "layer__name"
|
||||
|
||||
def setup_queryset(self, *args, **kwargs):
|
||||
prj = Project.objects.get(pk = kwargs['pid'])
|
||||
compatible_layers = prj.compatible_layerversions()
|
||||
|
||||
self.queryset = compatible_layers.order_by(self.default_orderby)
|
||||
|
||||
def setup_columns(self, *args, **kwargs):
|
||||
|
||||
layer_link_template = '''
|
||||
<a href="{% url 'layerdetails' extra.pid data.id %}">
|
||||
{{data.layer.name}}
|
||||
</a>
|
||||
'''
|
||||
|
||||
self.add_column(title="Layer",
|
||||
hideable=False,
|
||||
orderable=True,
|
||||
static_data_name="layer__name",
|
||||
static_data_template=layer_link_template)
|
||||
|
||||
self.add_column(title="Summary",
|
||||
field_name="layer__summary")
|
||||
|
||||
git_url_template = '''
|
||||
<a href="{% url 'layerdetails' extra.pid data.id %}">
|
||||
<code>{{data.layer.vcs_url}}</code>
|
||||
</a>
|
||||
{% if data.get_vcs_link_url %}
|
||||
<a target="_blank" href="{{ data.get_vcs_link_url }}">
|
||||
<i class="icon-share get-info"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
'''
|
||||
|
||||
self.add_column(title="Git repository URL",
|
||||
help_text="The Git repository for the layer source code",
|
||||
hidden=True,
|
||||
static_data_name="git_url",
|
||||
static_data_template=git_url_template)
|
||||
|
||||
git_dir_template = '''
|
||||
<a href="{% url 'layerdetails' extra.pid data.id %}">
|
||||
<code>{{data.dirpath}}</code>
|
||||
</a>
|
||||
{% if data.dirpath and data.get_vcs_dirpath_link_url %}
|
||||
<a target="_blank" href="{{ data.get_vcs_dirpath_link_url }}">
|
||||
<i class="icon-share get-info"></i>
|
||||
</a>
|
||||
{% endif %}'''
|
||||
|
||||
self.add_column(title="Subdirectory",
|
||||
help_text="The layer directory within the Git repository",
|
||||
hidden=True,
|
||||
static_data_name="git_subdir",
|
||||
static_data_template=git_dir_template)
|
||||
|
||||
revision_template = '''
|
||||
{% load projecttags %}
|
||||
{% with vcs_ref=data.get_vcs_reference %}
|
||||
{% if vcs_ref|is_shaid %}
|
||||
<a class="btn" data-content="<ul class='unstyled'> <li>{{vcs_ref}}</li> </ul>">
|
||||
{{vcs_ref|truncatechars:10}}
|
||||
</a>
|
||||
{% else %}
|
||||
{{vcs_ref}}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
'''
|
||||
|
||||
self.add_column(title="Revision",
|
||||
help_text="The Git branch, tag or commit. For the layers from the OpenEmbedded layer source, the revision is always the branch compatible with the Yocto Project version you selected for this project",
|
||||
static_data_name="revision",
|
||||
static_data_template=revision_template)
|
||||
|
||||
deps_template = '''
|
||||
{% with ods=data.dependencies.all%}
|
||||
{% if ods.count %}
|
||||
<a class="btn" title="<a href='{% url "layerdetails" extra.pid data.id %}'>{{data.layer.name}}</a> dependencies"
|
||||
data-content="<ul class='unstyled'>
|
||||
{% for i in ods%}
|
||||
<li><a href='{% url "layerdetails" extra.pid i.depends_on.pk %}'>{{i.depends_on.layer.name}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>">
|
||||
{{ods.count}}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
'''
|
||||
|
||||
self.add_column(title="Dependencies",
|
||||
help_text="Other layers a layer depends upon",
|
||||
static_data_name="dependencies",
|
||||
static_data_template=deps_template)
|
||||
|
||||
self.add_column(title="Add | Delete",
|
||||
help_text="Add or delete layers to / from your project",
|
||||
hideable=False,
|
||||
static_data_name="add-del-layers",
|
||||
static_data_template='{% include "layer_btn.html" %}')
|
||||
|
||||
|
||||
class MachinesTable(ToasterTable):
|
||||
"""Table of Machines in Toaster"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
ToasterTable.__init__(self)
|
||||
self.empty_state = "No machines maybe you need to do a build?"
|
||||
self.default_orderby = "name"
|
||||
|
||||
def setup_queryset(self, *args, **kwargs):
|
||||
prj = Project.objects.get(pk = kwargs['pid'])
|
||||
compatible_layers = prj.compatible_layerversions()
|
||||
|
||||
self.queryset = Machine.objects.filter(layer_version__in=compatible_layers).order_by(self.default_orderby)
|
||||
|
||||
def setup_columns(self, *args, **kwargs):
|
||||
|
||||
self.add_column(title="Machine",
|
||||
hideable=False,
|
||||
orderable=True,
|
||||
field_name="name")
|
||||
|
||||
self.add_column(title="Description",
|
||||
field_name="description")
|
||||
|
||||
layer_link_template = '''
|
||||
<a href="{% url 'layerdetails' extra.pid data.layer_version.id %}">
|
||||
{{data.layer_version.layer.name}}</a>
|
||||
'''
|
||||
|
||||
self.add_column(title="Layer",
|
||||
static_data_name="layer_version__layer__name",
|
||||
static_data_template=layer_link_template,
|
||||
orderable=True)
|
||||
|
||||
self.add_column(title="Revision",
|
||||
help_text="The Git branch, tag or commit. For the layers from the OpenEmbedded layer source, the revision is always the branch compatible with the Yocto Project version you selected for this project",
|
||||
hidden=True,
|
||||
field_name="layer_version__get_vcs_reference")
|
||||
|
||||
machine_file_template = '''<code>conf/machine/{{data.name}}.conf</code>
|
||||
<a href="{{data.get_vcs_machine_file_link_url}}" target="_blank"><i class="icon-share get-info"></i></a>'''
|
||||
|
||||
self.add_column(title="Machine file",
|
||||
hidden=True,
|
||||
static_data_name="machinefile",
|
||||
static_data_template=machine_file_template,
|
||||
field_name="name")
|
||||
|
||||
self.add_column(title="Select",
|
||||
help_text="Sets the selected machine as the project machine. You can only have one machine per project",
|
||||
hideable=False,
|
||||
static_data_name="add-del-layers",
|
||||
static_data_template='{% include "machine_btn.html" %}',
|
||||
field_name="layer_version__id")
|
||||
|
||||
|
||||
|
||||
class RecipesTable(ToasterTable):
|
||||
"""Table of Recipes in Toaster"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
ToasterTable.__init__(self)
|
||||
self.empty_state = "Toaster has no recipe information. To generate recipe information you can configure a layer source then run a build."
|
||||
self.default_orderby = "name"
|
||||
|
||||
def setup_queryset(self, *args, **kwargs):
|
||||
prj = Project.objects.get(pk = kwargs['pid'])
|
||||
|
||||
self.queryset = Recipe.objects.filter(Q(layer_version__up_branch__name= prj.release.name) | Q(layer_version__build__in = prj.build_set.all())).filter(name__regex=r'.{1,}.*')
|
||||
|
||||
search_maxids = map(lambda i: i[0], list(self.queryset.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id')))
|
||||
|
||||
self.queryset = self.queryset.filter(id__in=search_maxids).select_related('layer_version', 'layer_version__layer', 'layer_version__up_branch', 'layer_source')
|
||||
self.queryset = self.queryset.order_by(self.default_orderby)
|
||||
|
||||
|
||||
def setup_columns(self, *args, **kwargs):
|
||||
|
||||
self.add_column(title="Recipe",
|
||||
help_text="Information about a single piece of software, including where to download the source, configuration options, how to compile the source files and how to package the compiled output",
|
||||
hideable=False,
|
||||
orderable=True,
|
||||
field_name="name")
|
||||
|
||||
self.add_column(title="Recipe Version",
|
||||
hidden=True,
|
||||
field_name="version")
|
||||
|
||||
self.add_column(title="Description",
|
||||
field_name="get_description_or_summary")
|
||||
|
||||
recipe_file_template = '''
|
||||
<code>{{data.file_path}}</code>
|
||||
<a href="{{data.get_vcs_recipe_file_link_url}}" target="_blank">
|
||||
<i class="icon-share get-info"></i>
|
||||
</a>
|
||||
'''
|
||||
|
||||
self.add_column(title="Recipe file",
|
||||
help_text="Path to the recipe .bb file",
|
||||
static_data_name="recipe-file",
|
||||
static_data_template=recipe_file_template)
|
||||
|
||||
self.add_column(title="Section",
|
||||
help_text="The section in which recipes should be categorized",
|
||||
orderable=True,
|
||||
field_name="section")
|
||||
|
||||
layer_link_template = '''
|
||||
<a href="{% url 'layerdetails' extra.pid data.layer_version.id %}">
|
||||
{{data.layer_version.layer.name}}</a>
|
||||
'''
|
||||
|
||||
self.add_column(title="Layer",
|
||||
help_text="The name of the layer providing the recipe",
|
||||
orderable=True,
|
||||
static_data_name="layer_version__layer__name",
|
||||
static_data_template=layer_link_template)
|
||||
|
||||
self.add_column(title="License",
|
||||
help_text="The list of source licenses for the recipe. Multiple license names separated by the pipe character indicates a choice between licenses. Multiple license names separated by the ampersand character indicates multiple licenses exist that cover different parts of the source",
|
||||
orderable=True,
|
||||
field_name="license")
|
||||
|
||||
self.add_column(title="Revision",
|
||||
field_name="layer_version__get_vcs_reference")
|
||||
|
||||
|
||||
self.add_column(title="Build",
|
||||
help_text="Add or delete recipes to and from your project",
|
||||
hideable=False,
|
||||
static_data_name="add-del-layers",
|
||||
static_data_template='{% include "recipe_btn.html" %}')
|
||||
|
||||
# This needs to be staticaly defined here as django reads the url patterns
|
||||
# on start up
|
||||
urlpatterns = (
|
||||
url(r'^machines/(?P<cmd>\w+)*', MachinesTable.as_view(),
|
||||
name=MachinesTable.__name__.lower()),
|
||||
url(r'^layers/(?P<cmd>\w+)*', LayersTable.as_view(),
|
||||
name=LayersTable.__name__.lower()),
|
||||
url(r'^recipes/(?P<cmd>\w+)*', RecipesTable.as_view(),
|
||||
name=RecipesTable.__name__.lower()),
|
||||
)
|
||||
9
bitbake/lib/toaster/toastergui/templates/layer_btn.html
Normal file
9
bitbake/lib/toaster/toastergui/templates/layer_btn.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<button class="btn btn-danger btn-block layer-exists-{{data.pk}} layerbtn" style="display:none;" data-layer='{ "id": {{data.pk}}, "name": "{{data.layer.name}}", "url": "{%url 'layerdetails' extra.pid data.pk%}"}' data-directive="remove" >
|
||||
<i class="icon-trash"></i>
|
||||
Delete layer
|
||||
</button>
|
||||
<button class="btn btn-block layer-add-{{data.pk}} layerbtn" data-layer='{ "id": {{data.pk}}, "name": "{{data.layer.name}}", "url": "{%url 'layerdetails' extra.pid data.pk%}"}' data-directive="add">
|
||||
<i class="icon-plus"></i>
|
||||
Add layer
|
||||
</button>
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
{% extends "baseprojectpage.html" %}
|
||||
{% load projecttags %}
|
||||
{% load humanize %}
|
||||
{% load static %}
|
||||
|
||||
{% block localbreadcrumb %}
|
||||
<li>All compatible layers</li>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block projectinfomain %}
|
||||
|
||||
<script src="{% static 'js/layerBtn.js' %}"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function (){
|
||||
var ctx = {
|
||||
projectLayers : {{projectlayerset}},
|
||||
};
|
||||
|
||||
try {
|
||||
layerBtnsInit(ctx);
|
||||
} catch (e) {
|
||||
document.write("Sorry, An error has occurred loading this page");
|
||||
console.warn(e);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
{% if request.GET.filter and objects.paginator.count > 0 or request.GET.search and objects.paginator.count > 0 %}
|
||||
{{objects.paginator.count}} layer{{objects.paginator.count|pluralize}} found
|
||||
{% elif request.GET.filter and objects.paginator.count == 0 or request.GET.search and objects.paginator.count == 0 %}
|
||||
No layers found
|
||||
{%else%}
|
||||
All compatible layers
|
||||
{%endif%}
|
||||
<i class="icon-question-sign get-help heading-help" title="This page lists all the layers compatible with the release selected for this project, which is {{project.release.description}}"></i>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div id="zone1alerts" style="display:none">
|
||||
<div class="alert alert-info lead">
|
||||
<button type="button" class="close" id="hide-alert">×</button>
|
||||
<span id="alert-msg"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if objects.paginator.count == 0 %}
|
||||
{% if request.GET.filter or request.GET.search %}
|
||||
<div class="row-fluid">
|
||||
<div class="alert">
|
||||
<form class="no-results input-append" id="searchform">
|
||||
<input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>{% endif %}
|
||||
<button class="btn" type="submit" value="Search">Search</button>
|
||||
<button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all layers</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-info lead">
|
||||
<p>Toaster has no layer information. To generate layer information you can:</p>
|
||||
<ul>
|
||||
<li><a href="http://www.yoctoproject.org/docs/latest/toaster-manual/toaster-manual.html#layer-source">Configure a layer source</a></li>
|
||||
<li><a href="{% url 'importlayer' %}">Import a layer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
{% include "basetable_top_layers.html" %}
|
||||
{% for o in objects %}
|
||||
<tr class="data">
|
||||
<td class="layer"><a href="{% url 'layerdetails' project.id o.id %}">{{o.layer.name}}</a></td>
|
||||
<td class="description">{% if o.layer.summary %}{{o.layer.summary}}{%endif%}</td>
|
||||
<td class="git-repo"><a href="{% url 'layerdetails' project.id o.pk %}"><code>{{o.layer.vcs_url}}</code></a>
|
||||
{% if o.get_vcs_link_url %}
|
||||
<a target="_blank" href="{{ o.get_vcs_link_url }}"><i class="icon-share get-info"></i></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="git-subdir" style="display: table-cell;"><a href="{% url 'layerdetails' project.id o.pk %}"><code>{{o.dirpath}}</code></a>
|
||||
{% if o.dirpath and o.get_vcs_dirpath_link_url %}
|
||||
<a target="_blank" href="{{ o.get_vcs_dirpath_link_url }}"><i class="icon-share get-info"></i></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="branch">
|
||||
{% with vcs_ref=o.get_vcs_reference %}
|
||||
{% if vcs_ref|is_shaid %}
|
||||
<a class="btn" data-content="<ul class='unstyled'> <li>{{vcs_ref}}</li> </ul>">
|
||||
{{vcs_ref|truncatechars:10}}
|
||||
</a>
|
||||
{% else %}
|
||||
{{vcs_ref}}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td class="dependencies">
|
||||
{% with ods=o.dependencies.all%}
|
||||
{% if ods.count %}
|
||||
<a class="btn"
|
||||
title="<a href='{% url "layerdetails" project.id o.pk %}'>{{o.layer.name}}</a> dependencies"
|
||||
data-content="<ul class='unstyled'>
|
||||
{% for i in ods%}
|
||||
<li><a href='{% url "layerdetails" project.id i.depends_on.pk %}'>{{i.depends_on.layer.name}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>">
|
||||
{{ods.count}}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
{% if project %}
|
||||
<td class="add-del-layers" data-value="{{o.pk}}">
|
||||
<button class="btn btn-danger btn-block layer-exists-{{o.pk}} layerbtn" style="display:none;" data-layer='{ "id": {{o.pk}}, "name": "{{o.layer.name}}", "url": "{%url 'layerdetails' project.id o.pk%}"}' data-directive="remove" >
|
||||
<i class="icon-trash"></i>
|
||||
Delete layer
|
||||
</button>
|
||||
<button class="btn btn-block layer-add-{{o.pk}} layerbtn" data-layer='{ "id": {{o.pk}}, "name": "{{o.layer.name}}", "url": "{%url 'layerdetails' project.id o.pk%}"}' data-directive="add">
|
||||
<i class="icon-plus"></i>
|
||||
Add layer
|
||||
</button>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% include "basetable_bottom.html" %}
|
||||
|
||||
{%endif%}
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,8 @@
|
||||
<a href="{% url 'project' extra.pid %}#/machineselect={{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.id}}" style="margin-top: 5px; display:none">
|
||||
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}}", "url": "{%url 'layerdetails' extra.pid data.layer_version.id %}"}' data-directive="add">
|
||||
<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>
|
||||
</button>
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
{% extends "baseprojectpage.html" %}
|
||||
{% load projecttags %}
|
||||
{% load humanize %}
|
||||
{% load static %}
|
||||
{% block localbreadcrumb %}
|
||||
<li>All compatible machines</li>
|
||||
{% endblock %}
|
||||
|
||||
{% block projectinfomain %}
|
||||
|
||||
<script src="{% static 'js/layerBtn.js' %}"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function (){
|
||||
var ctx = {
|
||||
projectLayers : {{projectlayerset}},
|
||||
};
|
||||
|
||||
try {
|
||||
layerBtnsInit(ctx);
|
||||
} catch (e) {
|
||||
document.write("Sorry, An error has occurred loading this page");
|
||||
console.warn(e);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
{% if request.GET.search or request.GET.filter %}
|
||||
{% if objects.paginator.count != 0 %}
|
||||
{{objects.paginator.count}} machines found
|
||||
{% else %}
|
||||
No machines found
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
||||
All compatible machines
|
||||
<i class="icon-question-sign get-help heading-help" title="This page lists all the machines compatible with the current project that Toaster knows about. They include community-created targets suitable for use on top of OpenEmbedded Core and any targets you have imported"></i>
|
||||
{% endif %}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div id="zone1alerts" style="display:none">
|
||||
<div class="alert alert-info lead">
|
||||
<button type="button" class="close" id="hide-alert">×</button>
|
||||
<span id="alert-msg"></span>
|
||||
</div>
|
||||
</div>
|
||||
{% if objects.paginator.count == 0 %}
|
||||
{% if request.GET.search %}
|
||||
<div class="alert row-fluid">
|
||||
<form class="navbar-search input-append pull-left" id="searchform">
|
||||
<input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search machines" value="{{request.GET.search}}"><a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>
|
||||
<input type="hidden" name="orderby" value="">
|
||||
<input type="hidden" name="page" value="1">
|
||||
<button class="btn" type="submit" value="Search">Search</button>
|
||||
<button type="submit" class="btn btn-link" id="show-all-btn">Show all machines</button>
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-info lead">
|
||||
Toaster has no machine information. To generate machine information you should <a href="http://www.yoctoproject.org/docs/latest/toaster-manual/toaster-manual.html#layer-source">configure a layer source</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
{% include "basetable_top.html" %}
|
||||
{% for o in objects %}
|
||||
<tr class="data">
|
||||
<td class="machine">{{o.name}}</td>
|
||||
<td class="description">{{o.description}}</td>
|
||||
<td class="layer"><a href="{%url "layerdetails" project.id o.layer_version.id %}">{{o.layer_version.layer.name}}</a></td>
|
||||
<td class="branch">{{o.layer_version.get_vcs_reference}}</td>
|
||||
<td class="machinefile"><code>/machine/conf/{{o.name}}.conf</code><a href="{{o.get_vcs_machine_file_link_url}}" target="_blank"><i class="icon-share get-info"></i></a></td>
|
||||
<td class="select-or-add" style="height: 32px;">
|
||||
<a href="{% url 'project' project.id %}#/machineselect={{o.name}}" class="btn btn-block layer-exists-{{o.layer_version.id}}" style="margin-top: 5px; display:none">Select machine</a>
|
||||
<button class="btn btn-block layerbtn layer-add-{{o.layer_version.id}}" data-layer='{ "id": {{o.layer_version.id}}, "name": "{{o.layer_version.layer.name}}", "url": "{%url 'layerdetails' project.id o.layer_version.id %}"}' data-directive="add">
|
||||
<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 {{o.layer_version.layer.name}} layer to your project"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% include "basetable_bottom.html" %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
8
bitbake/lib/toaster/toastergui/templates/recipe_btn.html
Normal file
8
bitbake/lib/toaster/toastergui/templates/recipe_btn.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<a href="{% url 'project' extra.pid %}#/targetbuild={{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.pk}}" style="display:none; margin-top: 5px;" >
|
||||
Build recipe
|
||||
</a>
|
||||
<button class="btn btn-block layerbtn layer-add-{{data.layer_version.pk}}" data-layer='{ "id": {{data.layer_version.pk}}, "name": "{{data.layer_version.layer.name}}", "url": "{%url 'layerdetails' extra.pid data.layer_version.pk%}"}' data-directive="add">
|
||||
<i class="icon-plus"></i>
|
||||
Add layer
|
||||
<i title="" class="icon-question-sign get-help" data-original-title="To build this target, you must first add the {{data.layer_version.layer.name}} layer to your project"></i>
|
||||
</button>
|
||||
@@ -1,142 +0,0 @@
|
||||
{% extends "baseprojectpage.html" %}
|
||||
{% load projecttags %}
|
||||
{% load humanize %}
|
||||
{% load static %}
|
||||
|
||||
{% block localbreadcrumb %}
|
||||
<li>All compatible recipes</li>
|
||||
{% endblock %}
|
||||
|
||||
{% block projectinfomain %}
|
||||
|
||||
<script src="{% static 'js/layerBtn.js' %}"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function (){
|
||||
var ctx = {
|
||||
projectLayers : {{projectlayerset}},
|
||||
};
|
||||
|
||||
try {
|
||||
layerBtnsInit(ctx);
|
||||
} catch (e) {
|
||||
document.write("Sorry, An error has occurred loading this page");
|
||||
console.warn(e);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
{% if request.GET.filter and objects.paginator.count > 0 or request.GET.search and objects.paginator.count > 0 %}
|
||||
{{objects.paginator.count}} recipe{{objects.paginator.count|pluralize}} found
|
||||
{% elif request.GET.filter and objects.paginator.count == 0 or request.GET.search and objects.paginator.count == 0 %}
|
||||
No recipes found
|
||||
{%else%}
|
||||
All compatible recipes
|
||||
{%endif%}
|
||||
<i class="icon-question-sign get-help heading-help" title="This page lists all the recipes compatible with the release selected for this project, which is {{project.release.description}}"></i>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div id="zone1alerts" style="display:none">
|
||||
<div class="alert alert-info lead">
|
||||
<button type="button" class="close" id="hide-alert">×</button>
|
||||
<span id="alert-msg"></span>
|
||||
</div>
|
||||
</div>
|
||||
{% if objects.paginator.count == 0 %}
|
||||
{% if request.GET.filter or request.GET.search %}
|
||||
<div class="row-fluid">
|
||||
<div class="alert">
|
||||
<form class="no-results input-append" id="searchform">
|
||||
<input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>{% endif %}
|
||||
<button class="btn" type="submit" value="Search">Search</button>
|
||||
<button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all recipes</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-info lead">
|
||||
<p>Toaster has no recipe information. To generate recipe information you can:</p>
|
||||
<ul>
|
||||
<li><a href="http://www.yoctoproject.org/docs/latest/toaster-manual/toaster-manual.html#layer-source">Configure a layer source</a></li>
|
||||
<li><a href="{% url 'importlayer' project.id %}">Import a layer</a>, then run a build</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
{% include "basetable_top.html" %}
|
||||
{% for o in objects %}
|
||||
<tr class="data">
|
||||
<td class="target">
|
||||
{{o.name}}
|
||||
<a target="_blank" href="{{o.get_layersource_view_url}}"><i class="icon-share get-info"></i></a>
|
||||
</td>
|
||||
<td class="version">{{o.version}}</td>
|
||||
<td class="description">{% if o.description %}{{o.description}}{% else %}{{o.summary}}{%endif%}</td>
|
||||
<td class="recipe-file">
|
||||
<code>{{o.file_path}}</code>
|
||||
<a href="{{o.vcs_link_url}}" target="_blank"><i class="icon-share get-info"></i></a>
|
||||
</td>
|
||||
<td class="target-section">{{o.section}}</td>
|
||||
<td class="license">{{o.license}}</td>
|
||||
<td class="layer"><a href="{% url 'layerdetails' project.id o.preffered_layerversion.id%}">{{o.preffered_layerversion.layer.name}}</a></td>
|
||||
<td class="branch">
|
||||
{% if o.preffered_layerversion.up_branch %}
|
||||
{{o.preffered_layerversion.up_branch.name}}
|
||||
{% else %}
|
||||
<a class="btn"
|
||||
data-content="<ul class='unstyled'>
|
||||
<li>{{o.layer_version.commit}}</li>
|
||||
</ul>">
|
||||
{{o.layer_version.commit|truncatechars:13}}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="add-layer" data-value="{{o.pk}}">
|
||||
<a href="{% url 'project' project.id %}#/targetbuild={{o.name}}" class="btn btn-block layer-exists-{{o.preffered_layerversion.pk}}" style="display:none; margin-top: 5px;" >
|
||||
Build recipe
|
||||
</a>
|
||||
<button class="btn btn-block layerbtn layer-add-{{o.preffered_layerversion.pk}}" data-layer='{ "id": {{o.preffered_layerversion.pk}}, "name": "{{o.preffered_layerversion.layer.name}}", "url": "{%url 'layerdetails' project.id o.preffered_layerversion.pk%}"}' data-directive="add">
|
||||
<i class="icon-plus"></i>
|
||||
Add layer
|
||||
<i title="" class="icon-question-sign get-help" data-original-title="To build this target, you must first add the {{o.preffered_layerversion.layer.name}} layer to your project"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% include "basetable_bottom.html" %}
|
||||
|
||||
<!-- Modals -->
|
||||
|
||||
<!-- 'Layer dependencies modal' -->
|
||||
<div id="dependencies_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<form id="dependencies_modal_form">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
|
||||
<h3><span class="layer-name"></span> dependencies</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><strong class="layer-name"></strong> depends on some layers that are not added to your project. Select the ones you want to add:</p>
|
||||
<ul class="unstyled" id="dependencies_list">
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" type="submit">Add layers</button>
|
||||
<button class="btn" type="reset" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if project %}
|
||||
<script>
|
||||
</script>
|
||||
{%endif%}
|
||||
|
||||
{% endblock %}
|
||||
@@ -17,9 +17,11 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.views.generic import RedirectView
|
||||
from django.views.generic import RedirectView, TemplateView
|
||||
|
||||
from django.http import HttpResponseBadRequest
|
||||
import tables
|
||||
from widgets import ToasterTemplateView
|
||||
|
||||
urlpatterns = patterns('toastergui.views',
|
||||
# landing page
|
||||
@@ -77,19 +79,34 @@ urlpatterns = patterns('toastergui.views',
|
||||
|
||||
url(r'^project/$', lambda x: HttpResponseBadRequest(), name='base_project'),
|
||||
|
||||
url(r'^project/(?P<pid>\d+)$', 'project', name='project'),
|
||||
url(r'^project/(?P<pid>\d+)/$', 'project', name='project'),
|
||||
url(r'^project/(?P<pid>\d+)/configuration$', 'projectconf', name='projectconf'),
|
||||
url(r'^project/(?P<pid>\d+)/builds/$', 'projectbuilds', name='projectbuilds'),
|
||||
|
||||
url(r'^project/(?P<pid>\d+)/layers/$', 'layers', name='all-layers'),
|
||||
url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$', 'layerdetails', name='layerdetails'),
|
||||
url(r'^project/(?P<pid>\d+)/layer/$', lambda x,pid: HttpResponseBadRequest(), name='base_layerdetails'),
|
||||
|
||||
# the import layer is a project-specific functionality;
|
||||
url(r'^project/(?P<pid>\d+)/importlayer$', 'importlayer', name='importlayer'),
|
||||
|
||||
url(r'^project/(?P<pid>\d+)/targets/$', 'targets', name='all-targets'),
|
||||
url(r'^project/(?P<pid>\d+)/machines/$', 'machines', name='all-machines'),
|
||||
url(r'^project/(?P<pid>\d+)/machines/$',
|
||||
ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"),
|
||||
{ 'table_name': tables.MachinesTable.__name__.lower(),
|
||||
'title' : 'All compatible machines' },
|
||||
name="all-machines"),
|
||||
|
||||
url(r'^project/(?P<pid>\d+)/recipes/$',
|
||||
ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"),
|
||||
{ 'table_name': tables.RecipesTable.__name__.lower(),
|
||||
'title' : 'All compatible recipes' },
|
||||
name="all-targets"),
|
||||
|
||||
url(r'^project/(?P<pid>\d+)/layers/$',
|
||||
ToasterTemplateView.as_view(template_name="generic-toastertable-page.html"),
|
||||
{ 'table_name': tables.LayersTable.__name__.lower(),
|
||||
'title' : 'All compatible layers' },
|
||||
name="all-layers"),
|
||||
|
||||
|
||||
url(r'^xhr_build/$', 'xhr_build', name='xhr_build'),
|
||||
url(r'^xhr_projectbuild/(?P<pid>\d+)$', 'xhr_projectbuild', name='xhr_projectbuild'),
|
||||
@@ -100,6 +117,7 @@ urlpatterns = patterns('toastergui.views',
|
||||
url(r'^xhr_datatypeahead/(?P<pid>\d+)$', 'xhr_datatypeahead', name='xhr_datatypeahead'),
|
||||
url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'),
|
||||
url(r'^xhr_updatelayer/$', 'xhr_updatelayer', name='xhr_updatelayer'),
|
||||
url(r'^xhr_tables/(?P<pid>\d+)/', include('toastergui.tables')),
|
||||
|
||||
# dashboard for failed build requests
|
||||
url(r'^project/(?P<pid>\d+)/buildrequest/(?P<brid>\d+)$', 'buildrequestdetails', name='buildrequestdetails'),
|
||||
|
||||
@@ -2317,7 +2317,7 @@ if toastermain.settings.MANAGED:
|
||||
"tooltip": x.layer.vcs_url+" | "+x.get_vcs_reference(),
|
||||
"detail": "(" + x.layer.vcs_url + (")" if x.up_branch == None else " | "+x.get_vcs_reference()+")"),
|
||||
"giturl": x.layer.vcs_url,
|
||||
"layerdetailurl" : reverse('layerdetails', args=(pid, x.pk,)),
|
||||
"layerdetailurl" : reverse('layerdetails', args=(prj.id,x.pk)),
|
||||
"revision" : x.get_vcs_reference(),
|
||||
}
|
||||
|
||||
@@ -2656,81 +2656,6 @@ if toastermain.settings.MANAGED:
|
||||
return render(request, template, context)
|
||||
|
||||
|
||||
def layers(request, pid):
|
||||
|
||||
template = "layers.html"
|
||||
# define here what parameters the view needs in the GET portion in order to
|
||||
# be able to display something. 'count' and 'page' are mandatory for all views
|
||||
# that use paginators.
|
||||
(pagesize, orderby) = _get_parameters_values(request, 100, 'layer__name:+')
|
||||
mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby };
|
||||
retval = _verify_parameters( request.GET, mandatory_parameters )
|
||||
if retval:
|
||||
return _redirect_parameters( 'all-layers', request.GET, mandatory_parameters, pid=pid)
|
||||
|
||||
# boilerplate code that takes a request for an object type and returns a queryset
|
||||
# for that object type. copypasta for all needed table searches
|
||||
(filter_string, search_term, ordering_string) = _search_tuple(request, Layer_Version)
|
||||
|
||||
prj = Project.objects.get(pk = pid)
|
||||
|
||||
queryset_all = prj.compatible_layerversions()
|
||||
|
||||
queryset_all = _get_queryset(Layer_Version, queryset_all, filter_string, search_term, ordering_string, '-layer__name')
|
||||
|
||||
object_list = set([x.get_equivalents_wpriority(prj)[0] for x in queryset_all])
|
||||
object_list = list(object_list)
|
||||
|
||||
|
||||
# retrieve the objects that will be displayed in the table; layers a paginator and gets a page range to display
|
||||
layer_info = _build_page_range(Paginator(object_list, request.GET.get('count', 10)),request.GET.get('page', 1))
|
||||
|
||||
|
||||
context = {
|
||||
'project' : prj,
|
||||
'projectlayerset' : jsonfilter(map(lambda x: x.layercommit.id, prj.projectlayer_set.all())),
|
||||
'objects' : layer_info,
|
||||
'objectname' : "layers",
|
||||
'default_orderby' : 'layer__name:+',
|
||||
|
||||
'tablecols' : [
|
||||
{ 'name': 'Layer',
|
||||
'orderfield': _get_toggle_order(request, "layer__name"),
|
||||
'ordericon' : _get_toggle_order_icon(request, "layer__name"),
|
||||
},
|
||||
{ 'name': 'Description',
|
||||
'dclass': 'span4',
|
||||
'clclass': 'description',
|
||||
},
|
||||
{ 'name': 'Git repository URL',
|
||||
'dclass': 'span6',
|
||||
'clclass': 'git-repo', 'hidden': 1,
|
||||
'qhelp': "The Git repository for the layer source code",
|
||||
},
|
||||
{ 'name': 'Subdirectory',
|
||||
'clclass': 'git-subdir',
|
||||
'hidden': 1,
|
||||
'qhelp': "The layer directory within the Git repository",
|
||||
},
|
||||
{ 'name': 'Revision',
|
||||
'clclass': 'branch',
|
||||
'qhelp': "The Git branch, tag or commit. For the layers from the OpenEmbedded layer source, the revision is always the branch compatible with the Yocto Project version you selected for this project",
|
||||
},
|
||||
{ 'name': 'Dependencies',
|
||||
'clclass': 'dependencies',
|
||||
'qhelp': "Other layers a layer depends upon",
|
||||
},
|
||||
{ 'name': 'Add | Delete',
|
||||
'dclass': 'span2',
|
||||
'qhelp': "Add or delete layers to / from your project ",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
response = render(request, template, context)
|
||||
_save_parameters_cookies(response, pagesize, orderby, request)
|
||||
|
||||
return response
|
||||
|
||||
def layerdetails(request, pid, layerid):
|
||||
template = "layerdetails.html"
|
||||
@@ -2776,187 +2701,6 @@ if toastermain.settings.MANAGED:
|
||||
}
|
||||
return render(request, template, context)
|
||||
|
||||
def targets(request, pid):
|
||||
template = 'targets.html'
|
||||
(pagesize, orderby) = _get_parameters_values(request, 100, 'name:+')
|
||||
mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby }
|
||||
retval = _verify_parameters( request.GET, mandatory_parameters )
|
||||
if retval:
|
||||
return _redirect_parameters( 'all-targets', request.GET, mandatory_parameters, pid = pid)
|
||||
(filter_string, search_term, ordering_string) = _search_tuple(request, Recipe)
|
||||
|
||||
prj = Project.objects.get(pk = pid)
|
||||
queryset_all = Recipe.objects.filter(Q(layer_version__up_branch__name= prj.release.name) | Q(layer_version__build__in = prj.build_set.all())).filter(name__regex=r'.{1,}.*')
|
||||
|
||||
queryset_with_search = _get_queryset(Recipe, queryset_all, None, search_term, ordering_string, '-name')
|
||||
|
||||
# get unique values for 'name', and select the maximum ID for each entry (the max id is the newest one)
|
||||
|
||||
# force evaluation of the query here; to process the MAX/GROUP BY, a temporary table is used, on which indexing is very slow
|
||||
# by forcing the evaluation here we also prime the caches
|
||||
queryset_with_search_maxids = map(lambda i: i[0], list(queryset_with_search.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id')))
|
||||
|
||||
queryset_with_search = queryset_with_search.filter(id__in=queryset_with_search_maxids).select_related('layer_version', 'layer_version__layer', 'layer_version__up_branch', 'layer_source')
|
||||
|
||||
|
||||
# retrieve the objects that will be displayed in the table; targets a paginator and gets a page range to display
|
||||
target_info = _build_page_range(Paginator(queryset_with_search, request.GET.get('count', 10)),request.GET.get('page', 1))
|
||||
|
||||
for e in target_info.object_list:
|
||||
e.preffered_layerversion = e.layer_version.get_equivalents_wpriority(prj)[0]
|
||||
e.vcs_link_url = Layer.objects.filter(name = e.preffered_layerversion.layer.name).exclude(vcs_web_file_base_url__isnull=True)[0].vcs_web_file_base_url
|
||||
if e.vcs_link_url != None:
|
||||
fp = e.preffered_layerversion.dirpath + "/" + e.file_path
|
||||
e.vcs_link_url = e.vcs_link_url.replace('%path%', fp)
|
||||
e.vcs_link_url = e.vcs_link_url.replace('%branch%', e.preffered_layerversion.up_branch.name)
|
||||
|
||||
context = {
|
||||
'project' : prj,
|
||||
'projectlayerset' : jsonfilter(map(lambda x: x.layercommit.id, prj.projectlayer_set.all().select_related("layercommit"))),
|
||||
'objects' : target_info,
|
||||
'objectname' : "recipes",
|
||||
'default_orderby' : 'name:+',
|
||||
|
||||
'tablecols' : [
|
||||
{ 'name': 'Recipe',
|
||||
'orderfield': _get_toggle_order(request, "name"),
|
||||
'ordericon' : _get_toggle_order_icon(request, "name"),
|
||||
},
|
||||
{ 'name': 'Recipe version',
|
||||
'dclass': 'span2',
|
||||
},
|
||||
{ 'name': 'Description',
|
||||
'dclass': 'span5',
|
||||
'clclass': 'description',
|
||||
},
|
||||
{ 'name': 'Recipe file',
|
||||
'clclass': 'recipe-file',
|
||||
'hidden': 1,
|
||||
'dclass': 'span5',
|
||||
},
|
||||
{ 'name': 'Section',
|
||||
'clclass': 'target-section',
|
||||
'hidden': 1,
|
||||
'orderfield': _get_toggle_order(request, "section"),
|
||||
'ordericon': _get_toggle_order_icon(request, "section"),
|
||||
'orderkey': "section",
|
||||
},
|
||||
{ 'name': 'License',
|
||||
'clclass': 'license',
|
||||
'hidden': 1,
|
||||
'orderfield': _get_toggle_order(request, "license"),
|
||||
'ordericon': _get_toggle_order_icon(request, "license"),
|
||||
'orderkey': "license",
|
||||
},
|
||||
{ 'name': 'Layer',
|
||||
'clclass': 'layer',
|
||||
'orderfield': _get_toggle_order(request, "layer_version__layer__name"),
|
||||
'ordericon': _get_toggle_order_icon(request, "layer_version__layer__name"),
|
||||
'orderkey': "layer_version__layer__name",
|
||||
},
|
||||
{ 'name': 'Revision',
|
||||
'clclass': 'branch',
|
||||
'qhelp': "The Git branch, tag or commit. For the layers from the OpenEmbedded layer source, the revision is always the branch compatible with the Yocto Project version you selected for this project.",
|
||||
'hidden': 1,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
context['tablecols'] += [
|
||||
{ 'name': 'Build',
|
||||
'dclass': 'span2',
|
||||
'qhelp': "Add or delete targets to / from your project ",
|
||||
}, ]
|
||||
|
||||
response = render(request, template, context)
|
||||
_save_parameters_cookies(response, pagesize, orderby, request)
|
||||
|
||||
return response
|
||||
|
||||
def machines(request, pid):
|
||||
template = "machines.html"
|
||||
# define here what parameters the view needs in the GET portion in order to
|
||||
# be able to display something. 'count' and 'page' are mandatory for all views
|
||||
# that use paginators.
|
||||
(pagesize, orderby) = _get_parameters_values(request, 100, 'name:+')
|
||||
mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby };
|
||||
retval = _verify_parameters( request.GET, mandatory_parameters )
|
||||
if retval:
|
||||
return _redirect_parameters( 'all-machines', request.GET, mandatory_parameters, pid = pid)
|
||||
|
||||
# boilerplate code that takes a request for an object type and returns a queryset
|
||||
# for that object type. copypasta for all needed table searches
|
||||
(filter_string, search_term, ordering_string) = _search_tuple(request, Machine)
|
||||
|
||||
prj = Project.objects.get(pk = pid)
|
||||
compatible_layers = prj.compatible_layerversions()
|
||||
|
||||
queryset_all = Machine.objects.filter(layer_version__in=compatible_layers)
|
||||
queryset_all = _get_queryset(Machine, queryset_all, None, search_term, ordering_string, 'name')
|
||||
|
||||
queryset_all = queryset_all.prefetch_related('layer_version')
|
||||
|
||||
|
||||
# Make sure we only show machines / layers which are compatible
|
||||
# with the current project
|
||||
|
||||
project_layers = ProjectLayer.objects.filter(project_id=pid).values_list('layercommit',flat=True)
|
||||
|
||||
# Now we need to weed out the layers which will appear as duplicated
|
||||
# because they're from a layer source which doesn't need to be used
|
||||
for machine in queryset_all:
|
||||
to_rm = machine.layer_version.get_equivalents_wpriority(prj)[1:]
|
||||
if len(to_rm) > 0:
|
||||
queryset_all = queryset_all.exclude(layer_version__in=to_rm)
|
||||
|
||||
machine_info = _build_page_range(Paginator(queryset_all, request.GET.get('count', 100)),request.GET.get('page', 1))
|
||||
|
||||
context = {
|
||||
'project': prj,
|
||||
'objects' : machine_info,
|
||||
'projectlayerset' : jsonfilter(map(lambda x: x.layercommit.id, prj.projectlayer_set.all())),
|
||||
'objectname' : "machines",
|
||||
'default_orderby' : 'name:+',
|
||||
|
||||
'tablecols' : [
|
||||
{ 'name': 'Machine',
|
||||
'orderfield': _get_toggle_order(request, "name"),
|
||||
'ordericon' : _get_toggle_order_icon(request, "name"),
|
||||
'orderkey' : "name",
|
||||
},
|
||||
{ 'name': 'Description',
|
||||
'dclass': 'span5',
|
||||
'clclass': 'description',
|
||||
},
|
||||
{ 'name': 'Layer',
|
||||
'clclass': 'layer',
|
||||
'orderfield': _get_toggle_order(request, "layer_version__layer__name"),
|
||||
'ordericon' : _get_toggle_order_icon(request, "layer_version__layer__name"),
|
||||
'orderkey' : "layer_version__layer__name",
|
||||
},
|
||||
{ 'name': 'Revision',
|
||||
'clclass': 'branch',
|
||||
'qhelp' : "The Git branch, tag or commit. For the layers from the OpenEmbedded layer source, the revision is always the branch compatible with the Yocto Project version you selected for this project",
|
||||
'hidden': 1,
|
||||
},
|
||||
{ 'name' : 'Machine file',
|
||||
'clclass' : 'machinefile',
|
||||
'hidden' : 1,
|
||||
},
|
||||
{ 'name': 'Select',
|
||||
'dclass': 'select span2',
|
||||
'qhelp': "Sets the selected machine as the project machine. You can only have one machine per project",
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
response = render(request, template, context)
|
||||
_save_parameters_cookies(response, pagesize, orderby, request)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
def get_project_configvars_context():
|
||||
# Vars managed outside of this view
|
||||
vars_managed = {
|
||||
@@ -3497,18 +3241,9 @@ else:
|
||||
def importlayer(request):
|
||||
return render(request, 'landing_not_managed.html')
|
||||
|
||||
def layers(request):
|
||||
return render(request, 'landing_not_managed.html')
|
||||
|
||||
def layerdetails(request, layerid):
|
||||
return render(request, 'landing_not_managed.html')
|
||||
|
||||
def targets(request, pid):
|
||||
return render(request, 'landing_not_managed.html')
|
||||
|
||||
def machines(request):
|
||||
return render(request, 'landing_not_managed.html')
|
||||
|
||||
def projectconf(request, pid):
|
||||
return render(request, 'landing_not_managed.html')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user