mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
rrs: Add support for display Can't be updated recipe upstream status.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
This commit is contained in:
parent
e4d1db864d
commit
0013db9bc7
|
@ -12,6 +12,7 @@ sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '../
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.db.models.query import Q
|
||||||
from layerindex.models import Recipe
|
from layerindex.models import Recipe
|
||||||
|
|
||||||
class Milestone(models.Model):
|
class Milestone(models.Model):
|
||||||
|
@ -166,6 +167,7 @@ class RecipeUpstream(models.Model):
|
||||||
RECIPE_UPSTREAM_STATUS_CHOICES = (
|
RECIPE_UPSTREAM_STATUS_CHOICES = (
|
||||||
('A', 'All'),
|
('A', 'All'),
|
||||||
('N', 'Not updated'),
|
('N', 'Not updated'),
|
||||||
|
('C', 'Can\'t be updated'),
|
||||||
('Y', 'Up-to-date'),
|
('Y', 'Up-to-date'),
|
||||||
('D', 'Downgrade'),
|
('D', 'Downgrade'),
|
||||||
('U', 'Unknown'),
|
('U', 'Unknown'),
|
||||||
|
@ -186,6 +188,29 @@ class RecipeUpstream(models.Model):
|
||||||
no_update_reason = models.CharField(max_length=255, blank=True)
|
no_update_reason = models.CharField(max_length=255, blank=True)
|
||||||
date = models.DateTimeField()
|
date = models.DateTimeField()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_recipes_not_updated(history):
|
||||||
|
qry = RecipeUpstream.objects.filter(history = history, status = 'N',
|
||||||
|
no_update_reason = '').order_by('pn')
|
||||||
|
return qry
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_recipes_cant_be_updated(history):
|
||||||
|
qry = RecipeUpstream.objects.filter(history = history, status = 'N') \
|
||||||
|
.exclude(no_update_reason = '').order_by('pn')
|
||||||
|
return qry
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_recipes_up_to_date(history):
|
||||||
|
qry = RecipeUpstream.objects.filter(history = history, status = 'Y' \
|
||||||
|
).order_by('pn')
|
||||||
|
return qry
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_recipes_unknown(history):
|
||||||
|
qry = RecipeUpstream.objects.filter(history = history,
|
||||||
|
status__in = ['U', 'D']).order_by('pn')
|
||||||
|
return qry
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_by_recipe_and_history(recipe, history):
|
def get_by_recipe_and_history(recipe, history):
|
||||||
|
|
29
rrs/views.py
29
rrs/views.py
|
@ -41,12 +41,14 @@ def _get_milestone_statistics(milestone, maintainer_name=None):
|
||||||
if maintainer_name is None:
|
if maintainer_name is None:
|
||||||
milestone_statistics['all'] = Recipe.objects.all().count()
|
milestone_statistics['all'] = Recipe.objects.all().count()
|
||||||
|
|
||||||
milestone_statistics['up_to_date'] = RecipeUpstream.objects.filter(
|
milestone_statistics['up_to_date'] = \
|
||||||
history = recipe_upstream_history, status = 'Y').count()
|
RecipeUpstream.get_recipes_up_to_date(recipe_upstream_history).count()
|
||||||
milestone_statistics['not_updated'] = RecipeUpstream.objects.filter(
|
milestone_statistics['not_updated'] = \
|
||||||
history = recipe_upstream_history, status = 'N').count()
|
RecipeUpstream.get_recipes_not_updated(recipe_upstream_history).count()
|
||||||
milestone_statistics['unknown'] = milestone_statistics['all'] - \
|
milestone_statistics['cant_be_updated'] = \
|
||||||
(milestone_statistics['up_to_date'] + milestone_statistics['not_updated'])
|
RecipeUpstream.get_recipes_cant_be_updated(recipe_upstream_history).count()
|
||||||
|
milestone_statistics['unknown'] = \
|
||||||
|
RecipeUpstream.get_recipes_unknown(recipe_upstream_history).count()
|
||||||
milestone_statistics['percentage'] = "%.0f" % \
|
milestone_statistics['percentage'] = "%.0f" % \
|
||||||
((float(milestone_statistics['up_to_date']) /
|
((float(milestone_statistics['up_to_date']) /
|
||||||
float(milestone_statistics['all'])) * 100)
|
float(milestone_statistics['all'])) * 100)
|
||||||
|
@ -66,12 +68,16 @@ def _get_milestone_statistics(milestone, maintainer_name=None):
|
||||||
|
|
||||||
milestone_statistics['up_to_date'] = 0
|
milestone_statistics['up_to_date'] = 0
|
||||||
milestone_statistics['not_updated'] = 0
|
milestone_statistics['not_updated'] = 0
|
||||||
|
milestone_statistics['cant_be_updated'] = 0
|
||||||
milestone_statistics['unknown'] = 0
|
milestone_statistics['unknown'] = 0
|
||||||
for ru in recipe_upstream_all:
|
for ru in recipe_upstream_all:
|
||||||
if ru.status == 'Y':
|
if ru.status == 'Y':
|
||||||
milestone_statistics['up_to_date'] += 1
|
milestone_statistics['up_to_date'] += 1
|
||||||
elif ru.status == 'N':
|
elif ru.status == 'N':
|
||||||
|
if ru.no_update_reason == '':
|
||||||
milestone_statistics['not_updated'] += 1
|
milestone_statistics['not_updated'] += 1
|
||||||
|
else:
|
||||||
|
milestone_statistics['cant_be_updated'] += 1
|
||||||
else:
|
else:
|
||||||
milestone_statistics['unknown'] += 1
|
milestone_statistics['unknown'] += 1
|
||||||
|
|
||||||
|
@ -143,6 +149,8 @@ class RecipeListView(ListView):
|
||||||
upstream_status = ''
|
upstream_status = ''
|
||||||
upstream_version = ''
|
upstream_version = ''
|
||||||
else:
|
else:
|
||||||
|
if recipe_upstream.status == 'N' and recipe_upstream.no_update_reason:
|
||||||
|
recipe_upstream.status = 'C'
|
||||||
upstream_status = \
|
upstream_status = \
|
||||||
RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT[
|
RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT[
|
||||||
recipe_upstream.status]
|
recipe_upstream.status]
|
||||||
|
@ -190,6 +198,7 @@ class RecipeListView(ListView):
|
||||||
context['recipes_percentage'] = self.milestone_statistics['percentage']
|
context['recipes_percentage'] = self.milestone_statistics['percentage']
|
||||||
context['recipes_up_to_date'] = self.milestone_statistics['up_to_date']
|
context['recipes_up_to_date'] = self.milestone_statistics['up_to_date']
|
||||||
context['recipes_not_updated'] = self.milestone_statistics['not_updated']
|
context['recipes_not_updated'] = self.milestone_statistics['not_updated']
|
||||||
|
context['recipes_cant_be_updated'] = self.milestone_statistics['cant_be_updated']
|
||||||
context['recipes_unknown'] = self.milestone_statistics['unknown']
|
context['recipes_unknown'] = self.milestone_statistics['unknown']
|
||||||
|
|
||||||
context['recipe_list_count'] = self.recipe_list_count
|
context['recipe_list_count'] = self.recipe_list_count
|
||||||
|
@ -197,7 +206,7 @@ class RecipeListView(ListView):
|
||||||
context['upstream_status'] = self.upstream_status
|
context['upstream_status'] = self.upstream_status
|
||||||
ruch = RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT
|
ruch = RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT
|
||||||
context['upstream_status_set_choices'] = [ruch['A']]
|
context['upstream_status_set_choices'] = [ruch['A']]
|
||||||
context['upstream_status_choices'] = [ruch['N'], ruch['Y'], ruch['U']]
|
context['upstream_status_choices'] = [ruch['N'], ruch['C'], ruch['Y'], ruch['U']]
|
||||||
|
|
||||||
context['maintainer_name'] = self.maintainer_name
|
context['maintainer_name'] = self.maintainer_name
|
||||||
context['set_maintainers'] = ['All', 'No Maintainer']
|
context['set_maintainers'] = ['All', 'No Maintainer']
|
||||||
|
@ -286,11 +295,14 @@ class RecipeDetailView(DetailView):
|
||||||
)
|
)
|
||||||
recipe_upstream = RecipeUpstream.get_by_recipe_and_history(
|
recipe_upstream = RecipeUpstream.get_by_recipe_and_history(
|
||||||
recipe, recipe_upstream_history)
|
recipe, recipe_upstream_history)
|
||||||
|
if recipe_upstream.status == 'N' and recipe_upstream.no_update_reason:
|
||||||
|
recipe_upstream.status = 'C'
|
||||||
context['upstream_status'] = \
|
context['upstream_status'] = \
|
||||||
RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT[recipe_upstream.status]
|
RecipeUpstream.RECIPE_UPSTREAM_STATUS_CHOICES_DICT[recipe_upstream.status]
|
||||||
context['upstream_version'] = recipe_upstream.version
|
context['upstream_version'] = recipe_upstream.version
|
||||||
context['upstream_no_update_reason'] = recipe_upstream.no_update_reason
|
context['upstream_no_update_reason'] = recipe_upstream.no_update_reason
|
||||||
|
|
||||||
|
|
||||||
self.recipe_maintainer_history = RecipeMaintainerHistory.get_last()
|
self.recipe_maintainer_history = RecipeMaintainerHistory.get_last()
|
||||||
recipe_maintainer = RecipeMaintainer.objects.filter(recipe = recipe,
|
recipe_maintainer = RecipeMaintainer.objects.filter(recipe = recipe,
|
||||||
history = self.recipe_maintainer_history)[0]
|
history = self.recipe_maintainer_history)[0]
|
||||||
|
@ -324,6 +336,7 @@ class MaintainerList():
|
||||||
recipes_all = 0
|
recipes_all = 0
|
||||||
recipes_up_to_date = '0'
|
recipes_up_to_date = '0'
|
||||||
recipes_not_updated = '0'
|
recipes_not_updated = '0'
|
||||||
|
recipes_cant_be_updated = '0'
|
||||||
recipes_unknown = '0'
|
recipes_unknown = '0'
|
||||||
percentage_done = '0.00'
|
percentage_done = '0.00'
|
||||||
|
|
||||||
|
@ -364,6 +377,7 @@ class MaintainerListView(ListView):
|
||||||
ml.recipes_all = milestone_statistics['all']
|
ml.recipes_all = milestone_statistics['all']
|
||||||
ml.recipes_up_to_date = milestone_statistics['up_to_date']
|
ml.recipes_up_to_date = milestone_statistics['up_to_date']
|
||||||
ml.recipes_not_updated = milestone_statistics['not_updated']
|
ml.recipes_not_updated = milestone_statistics['not_updated']
|
||||||
|
ml.recipes_cant_be_updated = milestone_statistics['cant_be_updated']
|
||||||
ml.recipes_unknown = milestone_statistics['unknown']
|
ml.recipes_unknown = milestone_statistics['unknown']
|
||||||
ml.percentage_done = milestone_statistics['percentage']
|
ml.percentage_done = milestone_statistics['percentage']
|
||||||
|
|
||||||
|
@ -393,6 +407,7 @@ class MaintainerListView(ListView):
|
||||||
context['recipes_percentage'] = self.milestone_statistics['percentage']
|
context['recipes_percentage'] = self.milestone_statistics['percentage']
|
||||||
context['recipes_up_to_date'] = self.milestone_statistics['up_to_date']
|
context['recipes_up_to_date'] = self.milestone_statistics['up_to_date']
|
||||||
context['recipes_not_updated'] = self.milestone_statistics['not_updated']
|
context['recipes_not_updated'] = self.milestone_statistics['not_updated']
|
||||||
|
context['recipes_cant_be_updated'] = self.milestone_statistics['cant_be_updated']
|
||||||
context['recipes_unknown'] = self.milestone_statistics['unknown']
|
context['recipes_unknown'] = self.milestone_statistics['unknown']
|
||||||
|
|
||||||
context['maintainer_count'] = self.maintainer_count
|
context['maintainer_count'] = self.maintainer_count
|
||||||
|
|
|
@ -42,11 +42,13 @@
|
||||||
<li class="divider-vertical"></li>
|
<li class="divider-vertical"></li>
|
||||||
<li class="lead" id="percentage"><strong>{{ recipes_percentage }}%</strong> done</li>
|
<li class="lead" id="percentage"><strong>{{ recipes_percentage }}%</strong> done</li>
|
||||||
<li class="divider-vertical"></li>
|
<li class="divider-vertical"></li>
|
||||||
<li class="lead" id="up-to-date-recipes">Recipes up-to-date: <strong class="text-success">{{ recipes_up_to_date }}</strong></li>
|
<li class="lead" id="up-to-date-recipes">Recipes up-to-date: <span class="text-success">{{ recipes_up_to_date }}</strong></li>
|
||||||
<li class="divider-vertical"></li>
|
<li class="divider-vertical"></li>
|
||||||
<li class="lead" id="not-updated-recipes">Recipes not updated: <strong class="text-error">{{ recipes_not_updated }}</strong></li>
|
<li class="lead" id="not-updated-recipes">Recipes not updated: <span class="text-error">{{ recipes_not_updated }}</strong></li>
|
||||||
<li class="divider-vertical"></li>
|
<li class="divider-vertical"></li>
|
||||||
<li class="lead" id="unknown-recipes">Unknown: <strong class="text-warning">{{ recipes_unknown }}</strong></li>
|
<li class="lead" id="cant-be-updated-recipes">Recipes can't be updated: <span class="muted">{{ recipes_cant_be_updated }}</strong></li>
|
||||||
|
<li class="divider-vertical"></li>
|
||||||
|
<li class="lead" id="unknown-recipes">Unknown: <span class="text-warning">{{ recipes_unknown }}</strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
<th class="muted">Assigned recipes</th>
|
<th class="muted">Assigned recipes</th>
|
||||||
<th class="muted">Up-to-date</th>
|
<th class="muted">Up-to-date</th>
|
||||||
<th>Not updated</th>
|
<th>Not updated</th>
|
||||||
|
<th class="muted">Can't be updated</th>
|
||||||
<th class="muted">Unknown</th>
|
<th class="muted">Unknown</th>
|
||||||
<th>% done</th>
|
<th>% done</th>
|
||||||
|
|
||||||
|
@ -75,6 +76,11 @@
|
||||||
{{ ml.recipes_not_updated }}
|
{{ ml.recipes_not_updated }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'recipes' milestone_name %}?upstream_status={{ "Can't be updated"|urlencode }}&maintainer_name={{ ml.name|urlencode }}">
|
||||||
|
{{ ml.recipes_cant_be_updated }}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url 'recipes' milestone_name %}?upstream_status={{ "Unknown"|urlencode }}&maintainer_name={{ ml.name|urlencode }}">
|
<a href="{% url 'recipes' milestone_name %}?upstream_status={{ "Unknown"|urlencode }}&maintainer_name={{ ml.name|urlencode }}">
|
||||||
{{ ml.recipes_unknown }}
|
{{ ml.recipes_unknown }}
|
||||||
|
|
|
@ -35,10 +35,12 @@
|
||||||
<li class="lead">Upstream status: <strong class="text-success">{{ upstream_status }}</strong></li>
|
<li class="lead">Upstream status: <strong class="text-success">{{ upstream_status }}</strong></li>
|
||||||
{% elif upstream_status == "Not updated" %}
|
{% elif upstream_status == "Not updated" %}
|
||||||
<li class="lead">Upstream status: <strong class="text-error">{{ upstream_status }}</strong></li>
|
<li class="lead">Upstream status: <strong class="text-error">{{ upstream_status }}</strong></li>
|
||||||
|
{% elif upstream_status == "Can't be updated" %}
|
||||||
|
<li class="lead">Upstream status: <strong class="muted">{{ upstream_status }}</strong></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="lead">Upstream status: <strong class="text-warning">{{ upstream_status }}</strong></li>
|
<li class="lead">Upstream status: <strong class="text-warning">{{ upstream_status }}</strong></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if upstream_status == "Not updated" %}
|
{% if upstream_status == "Not updated" or upstream_status == "Can't be updated" %}
|
||||||
<li class="divider-vertical"></li>
|
<li class="divider-vertical"></li>
|
||||||
<li class="lead">Upstream version: <strong>{{ upstream_version }}</strong></li>
|
<li class="lead">Upstream version: <strong>{{ upstream_version }}</strong></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -126,6 +126,8 @@
|
||||||
<td class="text-success">
|
<td class="text-success">
|
||||||
{% elif r.upstream_status == "Not updated" %}
|
{% elif r.upstream_status == "Not updated" %}
|
||||||
<td class="text-error">
|
<td class="text-error">
|
||||||
|
{% elif r.upstream_status == "Can't be updated" %}
|
||||||
|
<td class="muted">
|
||||||
{% else %}
|
{% else %}
|
||||||
<td class="text-warning">
|
<td class="text-warning">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user