diff options
author | 2015-07-17 00:41:57 +0200 | |
---|---|---|
committer | 2015-07-17 00:41:57 +0200 | |
commit | b064d9675554a6ea3d518a2891b4c1495f26011c (patch) | |
tree | 5491d7e8b12527c75d530d57907c46bc24c63c58 | |
parent | add the new home page for tbc (diff) | |
download | tinderbox-cluster-www-b064d9675554a6ea3d518a2891b4c1495f26011c.tar.gz tinderbox-cluster-www-b064d9675554a6ea3d518a2891b4c1495f26011c.tar.bz2 tinderbox-cluster-www-b064d9675554a6ea3d518a2891b4c1495f26011c.zip |
add more info for new build request and new build logs on home
-rw-r--r-- | python/tbc_www/models.py | 18 | ||||
-rw-r--r-- | python/tbc_www/views.py | 37 | ||||
-rw-r--r-- | python/templates/includes/frontpage/new_build_req | 6 | ||||
-rw-r--r-- | python/templates/includes/frontpage/new_logs | 2 |
4 files changed, 57 insertions, 6 deletions
diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py index b51e154..fc91a8b 100644 --- a/python/tbc_www/models.py +++ b/python/tbc_www/models.py @@ -109,3 +109,21 @@ class BuildJobs(models.Model): db_table = 'build_jobs' def __str__(self): return '%s %s %s %s %s %s %s' % (self.BuildJobId, self.EbuildId, self.ConfigId, self.Status, self.BuildNow, self.RemoveBin, self.TimeStamp) + +class Uses(models.Model): + UseId = models.IntegerField(primary_key=True, db_column='use_id') + Flag = models.CharField(max_length=150, db_column='flag') + class Meta: + db_table = 'uses' + def __str__(self): + return '%s %s' % (self.UseId, self.Flag) + +class BuildJobsUse(models.Model): + Id = models.IntegerField(primary_key=True, db_column='id') + BuildJobId = models.ForeignKey(BuildJobs, db_column='build_job_id') + UseId = models.ForeignKey(Uses, db_column='use_id') + Status = models.BooleanField(db_column='status') + class Meta: + db_table = 'build_jobs_use' + def __str__(self): + return '%s %s %s %s' % (self.Id, self.BuildJobId, self.UseId, self.Status) diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py index 58f186e..108a653 100644 --- a/python/tbc_www/views.py +++ b/python/tbc_www/views.py @@ -5,7 +5,8 @@ from django.shortcuts import render, get_object_or_404, HttpResponseRedirect 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 +from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsRepomanQa, \ + BuildJobsUse import re @@ -29,9 +30,41 @@ def default_TmpDict(pagerequest): def home(request): pagerequest = 'home' Lines = 10 + 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] - TmpDict['BJ'] = BuildJobs.objects.order_by('-TimeStamp')[:Lines] + BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines] + for BJ in BJ_Tmp: + adict2 = {} + adict2['EbuildId'] = BJ.EbuildId.EbuildId + adict2['C'] = BJ.EbuildId.PackageId.CategoryId.Category + adict2['P'] = BJ.EbuildId.PackageId.Package + adict2['V'] = BJ.EbuildId.Version + adict2['R'] = BJ.EbuildId.PackageId.RepoId.Repo + adict2['Profile'] = BJ.ConfigId.SetupId.Profile + adict2['Setup'] = BJ.ConfigId.SetupId.Setup + adict2['title'] = "Setup: " + BJ.ConfigId.SetupId.Setup + "\n" + "Profile: " + BJ.ConfigId.SetupId.Profile + "\n" + BJU = BuildJobsUse.objects.filter(BuildJobId = BJ.BuildJobId) + if not BJU == []: + use_enable = [] + use_disable = [] + for BU in BJU: + if BU.Status: + use_enable.append(BU.UseId.Flag) + else: + use_disable.append(BU.UseId.Flag) + if not use_enable == []: + adict2['title'] = adict2['title'] + "Enable: " + for use in use_enable: + adict2['title'] = adict2['title'] + use + " " + adict2['title'] = adict2['title'] + "\n" + if not use_disable == []: + adict2['title'] = adict2['title'] + "Disable: " + for use in use_disable: + adict2['title'] = adict2['title'] + use + " " + adict2['title'] = adict2['title'] + "\n" + adict[BJ.BuildJobId] = adict2 + TmpDict['BJ'] = adict TmpDict['RM'] = BuildLogsRepomanQa.objects.order_by('-Id')[:Lines] return render(request, 'pages/' + pagerequest + '/index.html', TmpDict) diff --git a/python/templates/includes/frontpage/new_build_req b/python/templates/includes/frontpage/new_build_req index 23b6f2d..53a3fcb 100644 --- a/python/templates/includes/frontpage/new_build_req +++ b/python/templates/includes/frontpage/new_build_req @@ -1,8 +1,8 @@ <table class="table table-striped frontpage-table"> - {% for J in BJ %} + {% for k, v in BJ.items %} <tr> - <td class="frontpage-table-package-atom"><a href="/new_build_req/{{ J.EbuildId.EbuildId }}" title="{{ J.EbuildId.PackageId.CategoryId.Category }}/{{ J.EbuildId.PackageId.Package }}-{{ J.EbuildId.Version }}::{{ J.EbuildId.PackageId.RepoId.Repo }}">{{ J.EbuildId.PackageId.CategoryId.Category }}/{{ J.EbuildId.PackageId.Package }}-{{ J.EbuildId.Version }}::{{ J.EbuildId.PackageId.RepoId.Repo }}</a></td> - <td></td> + <td class="frontpage-table-package-atom"><a href="/new_build_req/{{ k }}" title="{{ v.C }}/{{ v.P }}-{{ v.V }}::{{ v.R }}">{{ v.C }}/{{ v.P }}-{{ v.V }}::{{ v.R }}</a></td> + <td><p title="{{ v.title }}">{{ v.title|truncatewords:2}}</p></td> </tr> {% endfor %} </table>
\ No newline at end of file diff --git a/python/templates/includes/frontpage/new_logs b/python/templates/includes/frontpage/new_logs index 9480155..6534201 100644 --- a/python/templates/includes/frontpage/new_logs +++ b/python/templates/includes/frontpage/new_logs @@ -3,7 +3,7 @@ <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> + <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> </tr> {% endfor %} </table>
\ No newline at end of file |