Add "needs attention" flag for comparison recipes

Add a flag that can be set and searched for to indicate that we need to
take care of importing a package or a patch applied by a package.
Ideally the comments would elaborate on what's needed (if it's not
obvious from the cover status).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-01-12 11:06:08 +13:00
parent ea8b656711
commit fcb44571fd
6 changed files with 42 additions and 12 deletions

View File

@ -164,7 +164,7 @@ class EditProfileForm(forms.ModelForm):
class ClassicRecipeForm(forms.ModelForm): class ClassicRecipeForm(forms.ModelForm):
class Meta: class Meta:
model = ClassicRecipe model = ClassicRecipe
fields = ('cover_layerbranch', 'cover_pn', 'cover_status', 'cover_verified', 'cover_comment', 'classic_category') fields = ('cover_layerbranch', 'cover_pn', 'cover_status', 'cover_verified', 'cover_comment', 'classic_category', 'needs_attention')
def clean(self): def clean(self):
cleaned_data = super(ClassicRecipeForm, self).clean() cleaned_data = super(ClassicRecipeForm, self).clean()
@ -226,6 +226,11 @@ class ClassicRecipeSearchForm(forms.Form):
('1', 'Has patches'), ('1', 'Has patches'),
('0', 'No patches'), ('0', 'No patches'),
] ]
ATTENTION_CHOICES = [
('', '(any)'),
('1', 'Yes'),
('0', 'No'),
]
q = forms.CharField(label='Keyword', max_length=255, required=False) q = forms.CharField(label='Keyword', max_length=255, required=False)
category = forms.CharField(max_length=255, required=False) category = forms.CharField(max_length=255, required=False)
@ -233,4 +238,5 @@ class ClassicRecipeSearchForm(forms.Form):
has_patches = forms.ChoiceField(label='Patches', choices=PATCH_CHOICES, required=False) has_patches = forms.ChoiceField(label='Patches', choices=PATCH_CHOICES, required=False)
cover_status = forms.ChoiceField(label='Status', choices=COVER_STATUS_CHOICES, required=False) cover_status = forms.ChoiceField(label='Status', choices=COVER_STATUS_CHOICES, required=False)
cover_verified = forms.ChoiceField(label='Verified', choices=VERIFIED_CHOICES, required=False) cover_verified = forms.ChoiceField(label='Verified', choices=VERIFIED_CHOICES, required=False)
needs_attention = forms.ChoiceField(label='Needs attention', choices=ATTENTION_CHOICES, required=False)

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('layerindex', '0016_classicrecipe_delete'),
]
operations = [
migrations.AddField(
model_name='classicrecipe',
name='needs_attention',
field=models.BooleanField(default=False),
),
]

View File

@ -535,6 +535,7 @@ class ClassicRecipe(Recipe):
cover_comment = models.TextField(blank=True) cover_comment = models.TextField(blank=True)
classic_category = models.CharField('OE-Classic Category', max_length=100, blank=True) classic_category = models.CharField('OE-Classic Category', max_length=100, blank=True)
deleted = models.BooleanField(default=False) deleted = models.BooleanField(default=False)
needs_attention = models.BooleanField(default=False)
class Meta: class Meta:
permissions = ( permissions = (

View File

@ -929,6 +929,7 @@ class ClassicRecipeSearchView(RecipeSearchView):
category = self.request.GET.get('category', None) category = self.request.GET.get('category', None)
oe_layer = self.request.GET.get('oe_layer', None) oe_layer = self.request.GET.get('oe_layer', None)
has_patches = self.request.GET.get('has_patches', '') has_patches = self.request.GET.get('has_patches', '')
needs_attention = self.request.GET.get('needs_attention', '')
init_qs = ClassicRecipe.objects.filter(layerbranch__branch__name=self.kwargs['branch']).filter(deleted=False) init_qs = ClassicRecipe.objects.filter(layerbranch__branch__name=self.kwargs['branch']).filter(deleted=False)
if cover_status: if cover_status:
if cover_status == '!': if cover_status == '!':
@ -951,6 +952,11 @@ class ClassicRecipeSearchView(RecipeSearchView):
init_qs = init_qs.filter(patch__isnull=False).distinct() init_qs = init_qs.filter(patch__isnull=False).distinct()
else: else:
init_qs = init_qs.filter(patch__isnull=True) init_qs = init_qs.filter(patch__isnull=True)
if needs_attention.strip():
if needs_attention == '1':
init_qs = init_qs.filter(needs_attention=True)
else:
init_qs = init_qs.filter(needs_attention=False)
if query_string.strip(): if query_string.strip():
order_by = (Lower('pn'), 'layerbranch__layer') order_by = (Lower('pn'), 'layerbranch__layer')

View File

@ -141,8 +141,14 @@
<label> <label>
Category Category
{{ form.classic_category }} {{ form.classic_category }}
</p>
</label> </label>
</p>
<p>
<label class="checkbox" id="id_label_needs_attention">
{{ form.needs_attention }}
Needs attention
</label>
</p>
<input type="submit" value="Save" class='btn' /> <input type="submit" value="Save" class='btn' />
</form> </form>
{% else %} {% else %}

View File

@ -96,11 +96,7 @@
{% for recipe in recipe_list %} {% for recipe in recipe_list %}
<tr {% if recipe.preferred_count > 0 %}class="muted"{% endif %}> <tr {% if recipe.preferred_count > 0 %}class="muted"{% endif %}>
{% if compare %} {% if compare %}
{% if branch.name == 'oe-classic' %} <td><a href="{% url 'comparison_recipe' recipe.id %}">{{ recipe.name }}{% if recipe.needs_attention %} <i class="icon-exclamation-sign" data-toggle="tooltip" title="Needs attention"></i>{% endif %}</a></td>
<td><a href="{% url 'classic_recipe' recipe.id %}">{{ recipe.name }}</a></td>
{% else %}
<td><a href="{% url 'comparison_recipe' recipe.id %}">{{ recipe.name }}</a></td>
{% endif %}
<td>{{ recipe.pv|truncatechars:10 }}</td> <td>{{ recipe.pv|truncatechars:10 }}</td>
<td>{% if recipe.patch_set.exists %}{{ recipe.patch_set.count }}{% endif %}</td> <td>{% if recipe.patch_set.exists %}{{ recipe.patch_set.count }}{% endif %}</td>
<td>{{ recipe.get_cover_status_display }}{% if recipe.cover_comment %} <a href="{% url 'classic_recipe' recipe.id %}"><i class="icon-comment" data-toggle="tooltip" title="{{ recipe.cover_comment }}"></i></a>{% endif %}</td> <td>{{ recipe.get_cover_status_display }}{% if recipe.cover_comment %} <a href="{% url 'classic_recipe' recipe.id %}"><i class="icon-comment" data-toggle="tooltip" title="{{ recipe.cover_comment }}"></i></a>{% endif %}</td>
@ -115,11 +111,7 @@
<td></td> <td></td>
{% endif %} {% endif %}
{% else %} {% else %}
{% if branch.name == 'oe-classic' %} <td><a href="{% url 'comparison_recipe' recipe.id %}">{{ recipe.name }}{% if recipe.needs_attention %} <i class="icon-exclamation-sign" data-toggle="tooltip" title="Needs attention"></i>{% endif %}</a></td>
<td><a href="{% url 'classic_recipe' recipe.id %}">{{ recipe.name }}</a></td>
{% else %}
<td><a href="{% url 'comparison_recipe' recipe.id %}">{{ recipe.name }}</a></td>
{% endif %}
<td>{{ recipe.pv }}</td> <td>{{ recipe.pv }}</td>
<td>{{ recipe.short_desc }}</td> <td>{{ recipe.short_desc }}</td>
<td>{{ recipe.get_cover_desc }}</td> <td>{{ recipe.get_cover_desc }}</td>