diff options
author | Magnus Granberg <zorry@gentoo.org> | 2015-07-24 02:17:26 +0200 |
---|---|---|
committer | Magnus Granberg <zorry@gentoo.org> | 2015-07-24 02:17:26 +0200 |
commit | f1d51cfa2fe8f8a781dc31e3f6ca7ad6436b8563 (patch) | |
tree | a2348154e9f3a95f33e8b3e8b40f4a35b3b72261 | |
parent | add the main new page (diff) | |
download | tinderbox-cluster-www-f1d51cfa2fe8f8a781dc31e3f6ca7ad6436b8563.tar.gz tinderbox-cluster-www-f1d51cfa2fe8f8a781dc31e3f6ca7ad6436b8563.tar.bz2 tinderbox-cluster-www-f1d51cfa2fe8f8a781dc31e3f6ca7ad6436b8563.zip |
fix error, repoman, qa view in new logs
-rw-r--r-- | python/tbc_www/models.py | 22 | ||||
-rw-r--r-- | python/tbc_www/views.py | 34 | ||||
-rw-r--r-- | python/templates/includes/frontpage/new_logs | 26 |
3 files changed, 70 insertions, 12 deletions
diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py index 9827583..621a7dc 100644 --- a/python/tbc_www/models.py +++ b/python/tbc_www/models.py @@ -80,8 +80,6 @@ class BuildLogs(models.Model): BuildLogId = models.IntegerField(primary_key=True, db_column='build_log_id') EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id') Fail = models.BooleanField(db_column='fail') - RmQa = models.BooleanField(db_column='rmqa') - Others = models.BooleanField(db_column='others') SummeryText = models.TextField(db_column='summery_text') LogHash = models.CharField(max_length=100, db_column='log_hash') BugId = models.IntegerField( db_column='bug_id') @@ -89,7 +87,7 @@ class BuildLogs(models.Model): class Meta: db_table = 'build_logs' def __str__(self): - return '%s %s %s %s %s %s %s %s %s' % (self.BuildLogId, self.EbuildId, self.Fail, self.RmQa, self.Others, self.SummeryText, self.LogHash, self.BugId, self.TimeStamp) + return '%s %s %s %s %s %s %s' % (self.BuildLogId, self.EbuildId, self.Fail, self.SummeryText, self.LogHash, self.BugId, self.TimeStamp) class BuildLogsRepomanQa(models.Model): Id = models.IntegerField(primary_key=True, db_column='id') @@ -100,6 +98,24 @@ class BuildLogsRepomanQa(models.Model): def __str__(self): return '%s %s %s' % (self.Id, self.BuildLogId, self.SummeryText) +class ErrorsInfo(models.Model): + ErrorId = models.IntegerField(primary_key=True, db_column='error_id') + ErrorName = models.CharField(max_length=20, db_column='error_name') + ErrorSearch = models.CharField(max_length=30, db_column='error_search') + class Meta: + db_table = 'errors_info' + def __str__(self): + return '%s %s %s' % (self.ErrorId, self.ErrorName, self.ErrorSearch) + +class BuildLogsErrors(models.Model): + Id = models.IntegerField(primary_key=True, db_column='id') + BuildLogId = models.ForeignKey(BuildLogs, db_column='build_log_id') + ErrorId = models.ForeignKey(ErrorsInfo, db_column='error_id') + class Meta: + db_table = 'build_logs_errors' + def __str__(self): + return '%s %s %s' % (self.Id, self.BuildLogId, self.ErrorId) + class Setups(models.Model): SetupId = models.AutoField(primary_key=True, db_column='setup_id') Setup = models.CharField(max_length=100, db_column='setup') diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py index 2559f8d..f68a706 100644 --- a/python/tbc_www/views.py +++ b/python/tbc_www/views.py @@ -7,7 +7,7 @@ from django.conf import settings from gentoo_www.models import SiteSettings, Layout, Pages, SubPages, Sponsors, Posts from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsRepomanQa, \ BuildJobsUse, Categories, CategoriesMetadata, Packages, PackagesMetadata, Ebuilds, \ - Repos, EbuildsKeywords + Repos, EbuildsKeywords, BuildLogsErrors import re def default_TmpDict(pagerequest): @@ -30,10 +30,22 @@ def default_TmpDict(pagerequest): def home(request): pagerequest = 'home' Lines = 5 - adict = {} TmpDict = default_TmpDict(pagerequest) TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines] - TmpDict['BL'] = BuildLogs.objects.order_by('-TimeStamp')[:Lines] + adict = {} + for BL in BuildLogs.objects.order_by('-TimeStamp')[:Lines]: + adict2 = {} + adict2['C'] = BL.EbuildId.PackageId.CategoryId.Category + adict2['P'] = BL.EbuildId.PackageId.Package + adict2['V'] = BL.EbuildId.Version + adict2['R'] = BL.EbuildId.PackageId.RepoId.Repo + adict2['Fail'] = BL.Fail + adict2['SummeryText'] = BL.SummeryText + if BL.Fail: + adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) + adict[BL.BuildLogId] = adict2 + TmpDict['BL'] = adict + adict = {} BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines] for BJ in BJ_Tmp: adict2 = {} @@ -115,10 +127,22 @@ def ebuilds(request, package_id): def new_main(request): pagerequest = 'new' Lines = 30 - adict = {} TmpDict = default_TmpDict(pagerequest) TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines] - TmpDict['BL'] = BuildLogs.objects.order_by('-TimeStamp')[:Lines] + adict = {} + for BL in BuildLogs.objects.order_by('-TimeStamp')[:Lines]: + adict2 = {} + adict2['C'] = BL.EbuildId.PackageId.CategoryId.Category + adict2['P'] = BL.EbuildId.PackageId.Package + adict2['V'] = BL.EbuildId.Version + adict2['R'] = BL.EbuildId.PackageId.RepoId.Repo + adict2['Fail'] = BL.Fail + adict2['SummeryText'] = BL.SummeryText + if BL.Fail: + adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) + adict[BL.BuildLogId] = adict2 + TmpDict['BL'] = adict + adict = {} BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines] for BJ in BJ_Tmp: adict2 = {} diff --git a/python/templates/includes/frontpage/new_logs b/python/templates/includes/frontpage/new_logs index 6534201..afe190c 100644 --- a/python/templates/includes/frontpage/new_logs +++ b/python/templates/includes/frontpage/new_logs @@ -1,9 +1,27 @@ <table class="table table-striped frontpage-table"> - {% for B in BL %} + {% for BuildLogId, B in BL.items %} <tr> - <td class="frontpage-table-package-atom"><a href="/new_logs/{{ B.BuildLogId }}/" title="{{ B.EbuildId.PackageId.CategoryId.Category }}/{{ B.EbuildId.PackageId.Package }}-{{ B.EbuildId.Version }}::{{ B.EbuildId.PackageId.RepoId.Repo }}"> - {{ B.EbuildId.PackageId.CategoryId.Category }}/{{ B.EbuildId.PackageId.Package }}-{{ B.EbuildId.Version }}::{{ B.EbuildId.PackageId.RepoId.Repo }}</a></td> - <td><p title="{{ B.SummeryText }}">{{ B.SummeryText|truncatewords:3 }}</p><td class="text-right">{% if B.Fail %}<span class="label label-danger">Fail</span>{% endif %}</td></td> + <td class="frontpage-table-package-atom"><a href="/new_logs/{{ BuildLogId }}/" title="{{ B.C }}/{{ B.P }}-{{ B.V }}::{{ B.R }}"> + {{ B.C }}/{{ B.P }}-{{ B.V }}::{{ B.R }}</a></td> + <td><p title="{{ B.SummeryText }}">{{ B.SummeryText|truncatewords:3 }}</p> + <td class="text-right"> + {% if B.Fail %} + {% for BE in B.BE_tmp %} + {% if BE.BuildLogId.BuildLogId == BuildLogId %} + {% if BE.ErrorId.ErrorId == 1 or BE.ErrorId.ErrorId == 2 %} + <span class="label label-warning">{{ BE.ErrorId.ErrorName|upper }}</span> + {% elif BE.ErrorId.ErrorId == 3 %} + <span class="label label-info">OTHERS</span> + {% else %} + <span class="label label-danger">{{ BE.ErrorId.ErrorName|upper}}</span> + {% endif %} + {% endif %} + {% endfor %} + {% else %} + <span class="label label-success">OK</span> + {% endif %} + </td> + </td> </tr> {% endfor %} </table>
\ No newline at end of file |