mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
rrs: show warnings for missing current release/milestone
If there is no release or milestone covering the current date, show an error message at the top of the recipes list page to alert the user that they can't view current data (since this is a common cause of not being able to see that which may not be immediately apparent). Additionally, show a warning within rrs_upgrade_history when this happens. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
dac47659ca
commit
c629787630
|
@ -10,12 +10,11 @@
|
||||||
#
|
#
|
||||||
# Licensed under the MIT license, see COPYING.MIT for details
|
# Licensed under the MIT license, see COPYING.MIT for details
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
import optparse
|
import optparse
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import date, datetime, timedelta
|
||||||
|
|
||||||
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__))))
|
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__))))
|
||||||
from common import common_setup, get_logger
|
from common import common_setup, get_logger
|
||||||
|
@ -87,7 +86,7 @@ def run_internal(maintplanlayerbranch, commit, commitdate, options, logger, bitb
|
||||||
Upgrade history handler.
|
Upgrade history handler.
|
||||||
"""
|
"""
|
||||||
def upgrade_history(options, logger):
|
def upgrade_history(options, logger):
|
||||||
from rrs.models import MaintenancePlan, RecipeUpgrade
|
from rrs.models import MaintenancePlan, RecipeUpgrade, Release, Milestone
|
||||||
|
|
||||||
if options.plan:
|
if options.plan:
|
||||||
maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
|
maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
|
||||||
|
@ -107,6 +106,16 @@ def upgrade_history(options, logger):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
try:
|
try:
|
||||||
for maintplan in maintplans:
|
for maintplan in maintplans:
|
||||||
|
# Check releases and milestones
|
||||||
|
current = date.today()
|
||||||
|
current_release = Release.get_by_date(maintplan, current)
|
||||||
|
if current_release:
|
||||||
|
current_milestone = Milestone.get_by_release_and_date(current_release, current)
|
||||||
|
if not current_milestone:
|
||||||
|
logger.warning('%s: there is no milestone defined in the latest release (%s) that covers the current date, so up-to-date data will not be visible in the web interface.' % (maintplan, current_release))
|
||||||
|
else:
|
||||||
|
logger.warning('%s: there is no release defined that covers the current date, so up-to-date data will not be visible in the web interface.' % maintplan)
|
||||||
|
|
||||||
for maintplanbranch in maintplan.maintenanceplanlayerbranch_set.all():
|
for maintplanbranch in maintplan.maintenanceplanlayerbranch_set.all():
|
||||||
layerbranch = maintplanbranch.layerbranch
|
layerbranch = maintplanbranch.layerbranch
|
||||||
if options.fullreload and not options.dry_run:
|
if options.fullreload and not options.dry_run:
|
||||||
|
|
10
rrs/views.py
10
rrs/views.py
|
@ -9,6 +9,7 @@ from django.shortcuts import get_object_or_404
|
||||||
from django.views.generic import TemplateView, ListView, DetailView, RedirectView
|
from django.views.generic import TemplateView, ListView, DetailView, RedirectView
|
||||||
from django.core.urlresolvers import resolve, reverse, reverse_lazy
|
from django.core.urlresolvers import resolve, reverse, reverse_lazy
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
from django.contrib import messages
|
||||||
|
|
||||||
from layerindex.models import Recipe, StaticBuildDep, Patch
|
from layerindex.models import Recipe, StaticBuildDep, Patch
|
||||||
from rrs.models import Release, Milestone, Maintainer, RecipeMaintainerHistory, \
|
from rrs.models import Release, Milestone, Maintainer, RecipeMaintainerHistory, \
|
||||||
|
@ -542,6 +543,15 @@ class RecipeListView(ListView):
|
||||||
context['milestone_name'] = self.milestone_name
|
context['milestone_name'] = self.milestone_name
|
||||||
context['all_milestones'] = Milestone.get_by_release_name(maintplan, self.release_name)
|
context['all_milestones'] = Milestone.get_by_release_name(maintplan, self.release_name)
|
||||||
|
|
||||||
|
current = date.today()
|
||||||
|
current_release = Release.get_by_date(maintplan, current)
|
||||||
|
if current_release:
|
||||||
|
current_milestone = Milestone.get_by_release_and_date(current_release, current)
|
||||||
|
if not current_milestone:
|
||||||
|
messages.error(self.request, 'There is no milestone defined in the latest release (%s) that covers the current date, so data shown here is not up-to-date. The administrator will need to create a milestone in order to fix this.' % current_release)
|
||||||
|
else:
|
||||||
|
messages.error(self.request, 'There is no release defined that covers the current date, so data shown here is not up-to-date. The administrator will need to create a release (and corresponding milestones) in order to fix this.')
|
||||||
|
|
||||||
context['recipes_percentage'] = self.milestone_statistics['percentage']
|
context['recipes_percentage'] = self.milestone_statistics['percentage']
|
||||||
context['recipes_all_upgraded'] = self.milestone_statistics['all_upgraded']
|
context['recipes_all_upgraded'] = self.milestone_statistics['all_upgraded']
|
||||||
context['recipes_all_not_upgraded'] = self.milestone_statistics['all_not_upgraded']
|
context['recipes_all_not_upgraded'] = self.milestone_statistics['all_not_upgraded']
|
||||||
|
|
Loading…
Reference in New Issue
Block a user