diff options
author | 2015-07-16 15:45:08 +0200 | |
---|---|---|
committer | 2015-07-16 15:45:08 +0200 | |
commit | 5b42b2fda7afb18c8893bd1b2627f6631e8caba5 (patch) | |
tree | 098bfddf76d6901d2be3452651c2fd58561585ae | |
parent | add sql structur and data (diff) | |
download | tinderbox-cluster-www-5b42b2fda7afb18c8893bd1b2627f6631e8caba5.tar.gz tinderbox-cluster-www-5b42b2fda7afb18c8893bd1b2627f6631e8caba5.tar.bz2 tinderbox-cluster-www-5b42b2fda7afb18c8893bd1b2627f6631e8caba5.zip |
add the new home page for tbc
-rw-r--r-- | python/gentoo_main/urls.py | 3 | ||||
-rw-r--r-- | python/tbc_www/__init__.py | 0 | ||||
-rw-r--r-- | python/tbc_www/models.py | 111 | ||||
-rw-r--r-- | python/tbc_www/router.py | 30 | ||||
-rw-r--r-- | python/tbc_www/views.py | 37 | ||||
-rw-r--r-- | python/templates/includes/frontpage/glsa | 17 | ||||
-rw-r--r-- | python/templates/includes/frontpage/new_build_req | 8 | ||||
-rw-r--r-- | python/templates/includes/frontpage/new_logs | 9 | ||||
-rw-r--r-- | python/templates/includes/frontpage/new_packages | 10 | ||||
-rw-r--r-- | python/templates/includes/frontpage/new_repoman_qa | 10 | ||||
-rw-r--r-- | python/templates/includes/frontpage/packages | 8 | ||||
-rw-r--r-- | python/templates/includes/frontpage/planet | 8 | ||||
-rw-r--r-- | python/templates/includes/frontpage/wiki | 8 | ||||
-rw-r--r-- | python/templates/pages/home/index.html | 42 |
14 files changed, 224 insertions, 77 deletions
diff --git a/python/gentoo_main/urls.py b/python/gentoo_main/urls.py index 5380bea..6cead02 100644 --- a/python/gentoo_main/urls.py +++ b/python/gentoo_main/urls.py @@ -3,7 +3,6 @@ from django.conf.urls import patterns, include, url -urlpatterns = patterns('gentoo_www.views', +urlpatterns = patterns('tbc_www.views', (r'^home/$', 'home'), - (r'^downloads/$', 'downloads'), ) diff --git a/python/tbc_www/__init__.py b/python/tbc_www/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/python/tbc_www/__init__.py diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py new file mode 100644 index 0000000..b51e154 --- /dev/null +++ b/python/tbc_www/models.py @@ -0,0 +1,111 @@ +# Copyright 1998-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from django.db import models + +class Categories(models.Model): + CategoryId = models.IntegerField(primary_key=True, db_column='category_id') + Category = models.CharField(max_length=150, db_column='category') + Active = models.BooleanField(db_column='active') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'categories' + def __str__(self): + return '%s %s %s %s' % (self.CategoryId, self.Category, self.Active, self.TimeStamp) + +class Repos(models.Model): + RepoId = models.IntegerField(primary_key=True, db_column='repo_id') + Repo = models.CharField(max_length=100, db_column='repo') + class Meta: + db_table = 'repos' + def __str__(self): + return '%s %s' % (self.RepoId, self.Repo) + +class Packages(models.Model): + PackageId = models.IntegerField(primary_key=True, db_column='package_id') + CategoryId = models.ForeignKey(Categories, db_column='category_id') + Package = models.CharField(max_length=150, db_column='package') + RepoId = models.ForeignKey(Repos, db_column='repo_id') + Checksum = models.CharField(max_length=100, db_column='checksum') + Active = models.BooleanField(db_column='active') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'packages' + def __str__(self): + return '%s %s %s %s %s %s %s' % (self.PackageId, self.CategoryId, self.Package, self.RepoId, self.Checksum, self.Active, self.TimeStamp) + +class Ebuilds(models.Model): + EbuildId = models.IntegerField(primary_key=True, db_column='ebuild_id') + PackageId = models.ForeignKey(Packages, db_column='package_id') + Version = models.CharField(max_length=150, db_column='version') + Checksum = models.CharField(max_length=100, db_column='checksum') + Active = models.BooleanField(db_column='active') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'ebuilds' + def __str__(self): + return '%s %s %s %s %s %s' % (self.EbuildId, self.PackageId, self.Version, self.Checksum, self.Active, self.TimeStamp) + +class EbuildsMetadata(models.Model): + Id = models.IntegerField(primary_key=True, db_column='id') + EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id') + Revision = models.CharField(max_length=30, db_column='revision') + Descriptions = models.CharField(max_length=200, db_column='descriptions') + class Meta: + db_table = 'ebuilds_metadata' + def __str__(self): + return '%s %s %s %s' % (self.Id, self.EbuildId, self.Revision, self.Descriptions) + +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') + SummeryText = models.TextField(db_column='summery_text') + LogHash = models.CharField(max_length=100, db_column='log_hash') + BugId = models.IntegerField( db_column='bug_id') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'build_logs' + def __str__(self): + 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') + BuildLogId = models.ForeignKey(BuildLogs, db_column='build_log_id') + SummeryText = models.TextField(db_column='summery_text') + class Meta: + db_table = 'build_logs_repoman' + def __str__(self): + return '%s %s %s' % (self.Id, self.BuildLogId, self.SummeryText) + +class Setups(models.Model): + SetupId = models.AutoField(primary_key=True, db_column='setup_id') + Setup = models.CharField(max_length=100, db_column='setup') + Profile = models.CharField(max_length=150, db_column='profile') + class Meta: + db_table = 'setups' + def __str__(self): + return '%s %s %s' % (self.SetupId, self.Setup, self.Profile) + +class Configs(models.Model): + ConfigId = models.AutoField(primary_key=True, db_column='config_id') + HostName = models.CharField(max_length=150, db_column='hostname') + SetupId = models.ForeignKey(Setups, db_column='setup_id') + DefaultConfig = models.BooleanField(db_column='default_config') + class Meta: + db_table = 'configs' + def __str__(self): + return '%s %s %s %s' % (self.ConfigId, self.HostName, self.SetupId, self.DefaultConfig) + +class BuildJobs(models.Model): + BuildJobId = models.AutoField(primary_key=True, db_column='build_job_id') + EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id') + ConfigId = models.ForeignKey(Configs, db_column='config_id') + Status = models.CharField(max_length=21, db_column='status') + BuildNow = models.BooleanField(db_column='build_now') + RemoveBin = models.BooleanField(db_column='removebin') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + 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) diff --git a/python/tbc_www/router.py b/python/tbc_www/router.py new file mode 100644 index 0000000..aa16759 --- /dev/null +++ b/python/tbc_www/router.py @@ -0,0 +1,30 @@ +# Copyright 1998-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +class TBCRouter(object): + def db_for_read(self, model, **hints): + "Point all operations on zobcs models to 'zobcs'" + if model._meta.app_label == 'tbc_www': + return 'zobcs' + return 'default' + + def db_for_write(self, model, **hints): + "Point all operations on zobcs models to 'zobcs'" + if model._meta.app_label == 'tbc_www': + return 'zobcs' + return 'default' + + def allow_relation(self, obj1, obj2, **hints): + "Allow any relation if a both models in zobcs app" + if obj1._meta.app_label == 'tbc_www' and obj2._meta.app_label == 'tbc_www': + return True + # Allow if neither is zobcs app + elif 'tbc_www' not in [obj1._meta.app_label, obj2._meta.app_label]: + return True + return False + + def allow_migrate(self, db, model): + if db == 'zobcs' or model._meta.app_label == "tbc_www": + return False # we're not using syncdb on our legacy database + else: # but all other models/databases are fine + return True diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py new file mode 100644 index 0000000..58f186e --- /dev/null +++ b/python/tbc_www/views.py @@ -0,0 +1,37 @@ +# Copyright 1998-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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 + +import re + +def default_TmpDict(pagerequest): + site = get_object_or_404(SiteSettings) + page = get_object_or_404(Pages, nav1 = pagerequest) + pages = Pages.objects.all() + if page.SubMenu: + subpages = SubPages.objects.filter(PageId = page.PageId) + else: + subpages = False + contact = get_object_or_404(SubPages, nav2 = 'contact') + TmpDict = {'site' : site} + TmpDict['page'] = page + TmpDict['pages'] = pages + TmpDict['subpages'] = subpages + TmpDict['contact'] = contact + TmpDict['smappages'] = SubPages.objects.all() + return TmpDict + +def home(request): + pagerequest = 'home' + Lines = 10 + 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] + TmpDict['RM'] = BuildLogsRepomanQa.objects.order_by('-Id')[:Lines] + return render(request, 'pages/' + pagerequest + '/index.html', TmpDict) diff --git a/python/templates/includes/frontpage/glsa b/python/templates/includes/frontpage/glsa deleted file mode 100644 index a2ed049..0000000 --- a/python/templates/includes/frontpage/glsa +++ /dev/null @@ -1,17 +0,0 @@ -<table class="table table-striped"> - {% for advisory in glsaposts %} - <tr> - <td>GLSA {{ advisory.id }}</td> - <td><a href="{{ advisory.url }}">{{ advisory.title }}</a></td> - <td class="text-right"> - {% if advisory.severity == 'high' %} - <span class="label label-danger">high</span> - {% elif advisory.severity == 'low' %} - <span class="label label-info">low</span> - {% else %} - <span class="label label-warning">normal</span> - {% endif %} - </td> - </tr> - {% endfor %} -</table>
\ No newline at end of file diff --git a/python/templates/includes/frontpage/new_build_req b/python/templates/includes/frontpage/new_build_req new file mode 100644 index 0000000..23b6f2d --- /dev/null +++ b/python/templates/includes/frontpage/new_build_req @@ -0,0 +1,8 @@ +<table class="table table-striped frontpage-table"> + {% for J in BJ %} + <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> + </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 new file mode 100644 index 0000000..9480155 --- /dev/null +++ b/python/templates/includes/frontpage/new_logs @@ -0,0 +1,9 @@ +<table class="table table-striped frontpage-table"> + {% for B in BL %} + <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> + </tr> + {% endfor %} +</table>
\ No newline at end of file diff --git a/python/templates/includes/frontpage/new_packages b/python/templates/includes/frontpage/new_packages new file mode 100644 index 0000000..7de11c0 --- /dev/null +++ b/python/templates/includes/frontpage/new_packages @@ -0,0 +1,10 @@ +<table class="table table-striped frontpage-table"> + {% for E in EM %} + <tr> + <td class="frontpage-table-package-atom"> + <a href="/packages/{{ E.EbuildId.PackageId.PackageId }}/" title="{{ E.EbuildId.PackageId.CategoryId.Category }}/{{ E.EbuildId.PackageId.Package }}-{{ E.EbuildId.Version }}::{{ E.EbuildId.PackageId.RepoId.Repo }}"> + {{ E.EbuildId.PackageId.CategoryId.Category }}/{{ E.EbuildId.PackageId.Package }}-{{ E.EbuildId.Version }}::{{ E.EbuildId.PackageId.RepoId.Repo }}</a></td> + <td><p>{{ E.Descriptions }}</p></td> + </tr> + {% endfor %} +</table>
\ No newline at end of file diff --git a/python/templates/includes/frontpage/new_repoman_qa b/python/templates/includes/frontpage/new_repoman_qa new file mode 100644 index 0000000..1999362 --- /dev/null +++ b/python/templates/includes/frontpage/new_repoman_qa @@ -0,0 +1,10 @@ +<table class="table table-striped frontpage-table"> + {% for R in RM %} + <tr> + <td class="frontpage-table-package-atom"><a href="/repoman_qa/{{ R.BuildLogId.BuildLogId }}/" title="{{ R.BuildLogId.EbuildId.PackageId.CategoryId.Category }}/{{ R.BuildLogId.EbuildId.PackageId.Package }}-{{ R.BuildLogId.EbuildId.Version }}::{{ R.BuildLogId.EbuildId.PackageId.RepoId.Repo }}"> + {{ R.BuildLogId.EbuildId.PackageId.CategoryId.Category }}/{{ R.BuildLogId.EbuildId.PackageId.Package }}-{{ R.BuildLogId.EbuildId.Version }}::{{ R.BuildLogId.EbuildId.PackageId.RepoId.Repo }}</a> + </td> + <td><p title="{{ R.SummeryText }}">{{ R.SummeryText|truncatewords:3 }}</p></td> + </tr> + {% endfor %} +</table>
\ No newline at end of file diff --git a/python/templates/includes/frontpage/packages b/python/templates/includes/frontpage/packages deleted file mode 100644 index 710dec4..0000000 --- a/python/templates/includes/frontpage/packages +++ /dev/null @@ -1,8 +0,0 @@ -<table class="table table-striped frontpage-table"> - {% for post in packageposts %} - <tr> - <td class="frontpage-table-package-atom"><a href="{{ post.url }}" title="{{ post.atom }}">{{ post.atom_p }}</a></td> - <td>{{ post.description }}</td> - </tr> - {% endfor %} -</table>
\ No newline at end of file diff --git a/python/templates/includes/frontpage/planet b/python/templates/includes/frontpage/planet deleted file mode 100644 index 7f884d2..0000000 --- a/python/templates/includes/frontpage/planet +++ /dev/null @@ -1,8 +0,0 @@ -<table class="table table-striped frontpage-table"> - {% for post in planetposts %} - <tr> - <td class="frontpage-table-planet-author">{{ post.author }}</td> - <td><a href="{{ post.url }}" rel="nofollow" title="{{ post.title }}">{{ post.title }}</a></td> - </tr> - {% endfor %} -</table>
\ No newline at end of file diff --git a/python/templates/includes/frontpage/wiki b/python/templates/includes/frontpage/wiki deleted file mode 100644 index e9efc28..0000000 --- a/python/templates/includes/frontpage/wiki +++ /dev/null @@ -1,8 +0,0 @@ -<table class="table table-striped frontpage-table"> - {% for post in wikiposts %} - <tr> - <td class="frontpage-table-wiki-title"><a href="{{ post.url }}" rel="nofollow">{{ post.title }}</a></td> - <td>started by {{ post.author }}</td> - </tr> - {% endfor %} -</table>
\ No newline at end of file diff --git a/python/templates/pages/home/index.html b/python/templates/pages/home/index.html index 9e40877..d2b0ff7 100644 --- a/python/templates/pages/home/index.html +++ b/python/templates/pages/home/index.html @@ -1,54 +1,28 @@ {% extends "layout/base.html" %} {% block content %} -{% include "includes/hero-section/start" with class_include="emergehdr" %} -<div class="row"> - <div class="col-xs-12 col-sm-8 col-md-9"> - <p> - Welcome to Gentoo, a flexible, source-based Linux distribution that becomes just about any system you need—and much more. - </p> - </div> - <div class="col-xs-12 col-sm-4 col-md-3 buttons"> - <a href="get-started/about/" type="button" class="btn btn-default btn-block">Learn more</a> - <a href="get-started/" class="btn btn-primary btn-block"><i class="fa fa-fw fa-rocket"></i> Get started now</a> - </div> -</div> -{% include "includes/hero-section/end" %} -{% include "includes/frontpage/news" %} - <hr> - <div class="row"> <div class="col-xs-12 col-md-6"> - <h2>Developer Blogs <small>live from <a href="https://planet.gentoo.org">Planet Gentoo</a></small></h2> - {% include "includes/frontpage/planet" %} + <h2>New Packages <small>more at the <a href="/new_packages/">New Packages</a></small></h2> + {% include "includes/frontpage/new_packages" %} </div> <div class="col-xs-12 col-md-6"> - <h2>Security Advisories <small>from our <a href="https://security.gentoo.org/">Security database</a></small></h2> - {% include "includes/frontpage/glsa" %} + <h2>New Logs <small>more at the <a href="/new_logs/">New Logs</a></small></h2> + {% include "includes/frontpage/new_logs" %} </div> </div> <div class="row"> <div class="col-xs-12 col-md-6"> - <h2>New Packages <small>more at the <a href="https://packages.gentoo.org">Gentoo Packages database</a></small></h2> - {% include "includes/frontpage/packages" %} + <h2>New Build Requests <small>more at the <a href="/new_build_req">New Build Requests</a></small></h2> + {% include "includes/frontpage/new_build_req" %} </div> <div class="col-xs-12 col-md-6"> - <h2>Fresh Documentation <small>on the <a href="https://wiki.gentoo.org/">Gentoo Wiki</a></small></h2> - {% include "includes/frontpage/wiki" %} + <h2>New Repoman or QA's <small>on the <a href="/new_repoman_qa/">New Repoman or QA's</a></small></h2> + {% include "includes/frontpage/new_repoman_qa" %} </div> </div> <hr> -<div class="row sponsor"> - {% for spon in sponsors %} - {% if spon.AdsActive %} - <div class="col-xs-12 col-md-2 col-md-offset-2 sponsorlogo"> - <!-- sponsor{name:{{ spon.AdsName }},weight:{{ spon.Wight }}} --> - <a href="{{ spon.AdsLink }}" title="{{ spon.AdsName }}"> - <img src="https://www.gentoo.org/assets/img/sponsors/ads/{{ spon.AdsImg }}" alt="{{ spon.AdsAltName }}"></a></div> - {% endif %} - {% endfor %} -</div> {% endblock %}
\ No newline at end of file |