mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00
Indicate if layer has YP Compatible certification
Allow admin to create Yocto Project versions with the version name, description, an icon link that represents that version, and a link that contains more information about the version. Admins who have the "set_yp_compatibility" permission can then decide if a layer has Yocto Project compatible certification, and if it does, admin can choose which version of Yocto Project the layer is compatible with. If a layer is deemed compatible, the version's icon will appear next to the layer's name, and the icon be a clickable link to a page with more information. Fixes [YOCTO #11452] Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
e397524791
commit
fdcde00710
|
@ -44,6 +44,9 @@ class BranchAdmin(CompareVersionAdmin):
|
|||
layerdependency.save()
|
||||
duplicate.short_description = "Duplicate selected Branches"
|
||||
|
||||
class YPCompatibleVersionAdmin(CompareVersionAdmin):
|
||||
pass
|
||||
|
||||
class LayerItemAdmin(CompareVersionAdmin):
|
||||
list_filter = ['status', 'layer_type']
|
||||
save_as = True
|
||||
|
@ -61,9 +64,12 @@ class LayerBranchAdmin(CompareVersionAdmin):
|
|||
LayerMaintainerInline,
|
||||
]
|
||||
def get_readonly_fields(self, request, obj=None):
|
||||
readonly_fields = self.readonly_fields
|
||||
if obj:
|
||||
return self.readonly_fields + ('layer', 'branch')
|
||||
return self.readonly_fields
|
||||
readonly_fields += ('layer', 'branch')
|
||||
if not request.user.has_perm('layerindex.set_yp_compatibility'):
|
||||
readonly_fields += ('yp_compatible_version',)
|
||||
return readonly_fields
|
||||
|
||||
class LayerMaintainerAdmin(CompareVersionAdmin):
|
||||
list_filter = ['status', 'layerbranch__layer__name']
|
||||
|
@ -145,6 +151,7 @@ class RecipeChangesetAdmin(admin.ModelAdmin):
|
|||
]
|
||||
|
||||
admin.site.register(Branch, BranchAdmin)
|
||||
admin.site.register(YPCompatibleVersion, YPCompatibleVersionAdmin)
|
||||
admin.site.register(LayerItem, LayerItemAdmin)
|
||||
admin.site.register(LayerBranch, LayerBranchAdmin)
|
||||
admin.site.register(LayerMaintainer, LayerMaintainerAdmin)
|
||||
|
|
38
layerindex/migrations/0008_yp_compatible.py
Normal file
38
layerindex/migrations/0008_yp_compatible.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('layerindex', '0007_layeritem_status_noupdate'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='YPCompatibleVersion',
|
||||
fields=[
|
||||
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
|
||||
('name', models.CharField(help_text='Name of this Yocto Project compatible version (e.g. "2.0")', verbose_name='Yocto Project Version', max_length=25, unique=True)),
|
||||
('description', models.TextField(blank=True)),
|
||||
('image_url', models.CharField(blank=True, verbose_name='Image URL', max_length=300)),
|
||||
('link_url', models.CharField(blank=True, verbose_name='Link URL', max_length=100)),
|
||||
],
|
||||
options={
|
||||
'ordering': ('name',),
|
||||
'verbose_name': 'Yocto Project Compatible version',
|
||||
},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='layerbranch',
|
||||
options={'verbose_name_plural': 'Layer branches', 'permissions': (('set_yp_compatibility', 'Can set YP compatibility'),)},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='layerbranch',
|
||||
name='yp_compatible_version',
|
||||
field=models.ForeignKey(to='layerindex.YPCompatibleVersion', blank=True, help_text='Which version of the Yocto Project Compatible program has this layer been approved for for?', verbose_name='Yocto Project Compatible version', on_delete=django.db.models.deletion.SET_NULL, null=True),
|
||||
),
|
||||
]
|
|
@ -141,6 +141,18 @@ class LayerItem(models.Model):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class YPCompatibleVersion(models.Model):
|
||||
name = models.CharField('Yocto Project Version', max_length=25, unique=True, help_text='Name of this Yocto Project compatible version (e.g. "2.0")')
|
||||
description = models.TextField(blank=True)
|
||||
image_url = models.CharField('Image URL', max_length=300, blank=True)
|
||||
link_url = models.CharField('Link URL', max_length=100, blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Yocto Project Compatible version'
|
||||
ordering = ('name',)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class LayerBranch(models.Model):
|
||||
layer = models.ForeignKey(LayerItem)
|
||||
|
@ -152,11 +164,15 @@ class LayerBranch(models.Model):
|
|||
vcs_last_rev = models.CharField('Last revision fetched', max_length=80, blank=True)
|
||||
vcs_last_commit = models.DateTimeField('Last commit date', blank=True, null=True)
|
||||
actual_branch = models.CharField('Actual Branch', max_length=80, blank=True, help_text='Name of the actual branch in the repository matching the core branch')
|
||||
yp_compatible_version = models.ForeignKey(YPCompatibleVersion, verbose_name='Yocto Project Compatible version', null=True, blank=True, on_delete=models.SET_NULL, help_text='Which version of the Yocto Project Compatible program has this layer been approved for for?')
|
||||
|
||||
updated = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Layer branches"
|
||||
permissions = (
|
||||
("set_yp_compatibility", "Can set YP compatibility"),
|
||||
)
|
||||
|
||||
def sorted_recipes(self):
|
||||
return self.recipe_set.order_by('pn', '-pv')
|
||||
|
|
|
@ -232,3 +232,8 @@ blockquote.span7.warn {
|
|||
.valign-middle {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.yp-icon {
|
||||
width: auto;
|
||||
height: 1em;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<div class="row-fluid">
|
||||
<div class="page-header">
|
||||
<h1>{{ layeritem.name }}
|
||||
{% if layerbranch.yp_compatible_version %}
|
||||
<a href="{{layerbranch.yp_compatible_version.link_url}}"><img src="{{layerbranch.yp_compatible_version.image_url}}" alt="{{layerbranch.yp_compatible_version.description}}" class="yp-icon" title="{{layerbranch.yp_compatible_version.description}}"></a>
|
||||
{% endif %}
|
||||
{% if layeritem.status = "N" %}
|
||||
<span class="label label-warning">Unpublished</span>
|
||||
{% endif %}
|
||||
|
|
|
@ -72,7 +72,11 @@
|
|||
<tbody>
|
||||
{% for layerbranch in layerbranch_list %}
|
||||
<tr class="layertype_{{ layerbranch.layer.layer_type }}">
|
||||
<td><a href="{% url 'layer_item' url_branch layerbranch.layer.name %}">{{ layerbranch.layer.name }}</a></td>
|
||||
<td><a href="{% url 'layer_item' url_branch layerbranch.layer.name %}">{{ layerbranch.layer.name }}</a>
|
||||
{% if layerbranch.yp_compatible_version %}
|
||||
<a href="{{layerbranch.yp_compatible_version.link_url}}"><img src="{{layerbranch.yp_compatible_version.image_url}}" alt="{{layerbranch.yp_compatible_version.description}}" class="yp-icon" title="{{layerbranch.yp_compatible_version.description}}" ></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ layerbranch.layer.summary }}</td>
|
||||
<td>{{ layerbranch.layer.get_layer_type_display }}</td>
|
||||
<td class="showRollie">
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
<div class="row-fluid">
|
||||
<div class="page-header">
|
||||
<h1>{{ layeritem.name }}
|
||||
{% if layerbranch.yp_compatible_version %}
|
||||
<a href="{{layerbranch.yp_compatible_version.link_url }}"><img src="{{layerbranch.yp_compatible_version.image_url}}" alt="{{layerbranch.yp_compatible_version.description}}" class="yp-icon" title="{{layerbranch.yp_compatible_version.description}}"></a>
|
||||
{% endif %}
|
||||
{% if layeritem.status = "N" %}
|
||||
<span class="label label-warning">Unpublished</span>
|
||||
{% else %}
|
||||
|
|
|
@ -36,7 +36,11 @@
|
|||
<tbody>
|
||||
{% for layerbranch in layerbranch_list %}
|
||||
<tr class="layertype_{{ layerbranch.layer.layer_type }}">
|
||||
<td><a href="{% url 'layer_review' layerbranch.layer.name %}">{{ layerbranch.layer.name }}</a></td>
|
||||
<td><a href="{% url 'layer_review' layerbranch.layer.name %}">{{ layerbranch.layer.name }}</a>
|
||||
{% if layerbranch.yp_compatible_version %}
|
||||
<a href="{{layerbranch.yp_compatible_version.link_url}}"><img src="{{layerbranch.yp_compatible_version.image_url}}" alt="{{layerbranch.yp_compatible_version.description}}" class="yp-icon" title="{{layerbranch.yp_compatible_version.description}}"></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ layerbranch.layer.summary }}</td>
|
||||
<td>{{ layerbranch.layer.get_layer_type_display }}</td>
|
||||
<td class="showRollie">
|
||||
|
|
Loading…
Reference in New Issue
Block a user