commit:     971c89f68b859e56663fb1940beb3c94ba64e02c
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 10 17:49:39 2016 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 17:49:39 2016 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster-www.git/commit/?id=971c89f6

add build page

 python/tbc_www/urls.py                           |  3 +-
 python/tbc_www/views.py                          | 62 +++++++++++++++++++-
 python/templates/includes/frontpage/new_logs     |  2 +-
 python/templates/pages/new/logs/build/index.html | 72 ++++++++++++++++++++++++
 python/templates/pages/new/logs/index.html       | 46 +++++++++++++++
 5 files changed, 182 insertions(+), 3 deletions(-)

diff --git a/python/tbc_www/urls.py b/python/tbc_www/urls.py
index 60f00d4..6198beb 100644
--- a/python/tbc_www/urls.py
+++ b/python/tbc_www/urls.py
@@ -4,8 +4,9 @@ urlpatterns = patterns('tbc_www.views',
        url(r'^home/$', 'home'),
        url(r'^packages/$', 'categories'),
        url(r'^categories/(?P<category_id>\d+)/$', 'packages'),
-       url(r'^package/(?P<package_id>\d+)/$', 'ebuilds'),
+       url(r'^packages/(?P<package_id>\d+)/$', 'ebuilds'),
        url(r'^ebuild/(?P<ebuild_id>\d+)/$', 'ebuild'),
+       url(r'^new/logs/build/(?P<buildlog_id>\d+)/$', 'new_logs_build'),
        url(r'^new/logs/$', 'new_logs'),
        url(r'^new/repomanqa/$', 'new_repomanqa'),
        url(r'^new/$', 'new_main'),

diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py
index df2af96..29e561d 100644
--- a/python/tbc_www/views.py
+++ b/python/tbc_www/views.py
@@ -7,7 +7,8 @@ from django.conf import settings
 from gentoo_www.models import SiteSettings, Layout, Pages, SubPages, Sponsors, 
Posts
 from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsQa, 
\
        BuildJobsUse, Categories, CategoriesMetadata, Packages, 
PackagesMetadata, Ebuilds, \
-       Repos, EbuildsKeywords, BuildLogsErrors, EbuildsRestrictions, 
EbuildsIuse, PackagesRepoman
+       Repos, EbuildsKeywords, BuildLogsErrors, EbuildsRestrictions, 
EbuildsIuse, PackagesRepoman, \
+       BuildLogsConfig, BuildLogsUse, BuildLogsQa
 import re
 
 def default_TmpDict(pagerequest):
@@ -237,3 +238,62 @@ def new_logs(request):
                alist.append(adict2)
        TmpDict['BL_tmp'] = alist
        return render(request, 'pages/' + pagerequest + '/logs/index.html', 
TmpDict)
+
+def new_logs_build(request, buildlog_id):
+       pagerequest = 'new'
+       TmpDict = default_TmpDict(pagerequest)
+       B = BuildLogs.objects.get(BuildLogId = buildlog_id)
+       EM = EbuildsMetadata.objects.get(EbuildId = B.EbuildId.EbuildId)
+       PM = PackagesMetadata.objects.get(PackageId__PackageId = 
B.EbuildId.PackageId.PackageId)
+       BLI = {}
+       BLI['BuildLogId'] = buildlog_id
+       BLI['EbuildId'] = B.EbuildId.EbuildId
+       BLI['C'] = B.EbuildId.PackageId.CategoryId.Category
+       BLI['P'] = B.EbuildId.PackageId.Package
+       BLI['V'] = B.EbuildId.Version
+       BLI['R'] = B.EbuildId.PackageId.RepoId.Repo
+       BLI['EC'] = EM.Commit
+       BLI['PD'] = EM.Descriptions
+       BLI['PC'] = PM.Gitlog
+       BLI['Fail'] = B.Fail
+       if B.Fail:
+               BLI['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = 
buildlog_id)
+       BLI['Summery_text'] = B.SummeryText
+       if B.BugId == "0":
+               BLI['BugId'] = False
+       else:
+               BLI['BugId'] = B.BugId
+       BC = BuildLogsConfig.objects.get(BuildLogId = buildlog_id)
+       #CEO_tmp = ConfigsEmergeOptions.objects.filter(ConfigId = 
BC.ConfigId.ConfigId)
+       BU_tmp = BuildLogsUse.objects.filter(BuildLogId = BC.BuildLogId)
+       config_eoption = []
+       BLI['configid'] = BC.ConfigId.ConfigId
+       BLI['hostname'] = BC.ConfigId.HostName
+       BLI['config'] = BC.ConfigId.SetupId.Setup
+       BLI['profile'] = BC.ConfigId.SetupId.Profile
+       BLI['logid'] = BC.LogId
+       BLI['logname'] = BC.LogName[1:]
+       BLI['emerge_info_text'] = BC.EInfoId.EmergeInfoText
+       #for CEO in CEO_tmp:
+       #       config_eoption.append(CEO.EmergeOptionId.EOption)
+       #BLI['emerge_option'] = config_eoption
+       if not BU_tmp == []:
+               use_enable = []
+               use_disable = []
+               for BU in BU_tmp:
+                       if BU.Status:
+                               use_enable.append(BU.UseId.Flag)
+                       else:
+                               use_disable.append(BU.UseId.Flag)
+               if not use_enable == []:
+                       BLI['use_enable'] = use_enable
+               if not use_disable == []:
+                       BLI['use_disable'] = use_disable
+       try: 
+               BRQ = BuildLogsQa.objects.get(BuildLogId = B.BuildLogId)
+               BLI['RepomanQA'] = BRQ.SummeryText
+       except BuildLogsQa.DoesNotExist as e:
+                       BLI['RepomanQA'] = False
+       print(BLI)
+       TmpDict['BLI'] = BLI
+       return render(request, 'pages/' + pagerequest + 
'/logs/build/index.html', TmpDict)
\ No newline at end of file

diff --git a/python/templates/includes/frontpage/new_logs 
b/python/templates/includes/frontpage/new_logs
index 3074c4d..a1dd4d2 100644
--- a/python/templates/includes/frontpage/new_logs
+++ b/python/templates/includes/frontpage/new_logs
@@ -1,7 +1,7 @@
 <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.C }}/{{ B.P }}-{{ B.V }}::{{ B.R }}">
+      <td class="frontpage-table-package-atom"><a href="/new/logs/build/{{ 
B.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">

diff --git a/python/templates/pages/new/logs/build/index.html 
b/python/templates/pages/new/logs/build/index.html
new file mode 100644
index 0000000..9ae0656
--- /dev/null
+++ b/python/templates/pages/new/logs/build/index.html
@@ -0,0 +1,72 @@
+{% extends "layout/base.html" %}
+{% block content %}
+<div class="row">
+  <h2>{{ BLI.C }}/{{ BLI.P }}-{{ BLI.V }}::{{ BLI.R }}
+    {% if BLI.Fail %}
+          {% for BE in BLI.BE_tmp %}
+              {% if BE.ErrorId.ErrorId == 1 %}
+                <span class="label label-warning">{{ 
BE.ErrorId.ErrorName|upper }}</span>
+              {% elif 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 %}
+          {% endfor %}
+        {% else %}
+          <span class="label label-success">OK</span>
+        {% endif %}
+  </h2>
+</div>
+<div class="row-fluid">
+ <div class=span3>
+    <p class="lead">Host information</p>
+        Host: {{ BLI.hostname }}<br />
+        Config: {{BLI.config }}<br />
+       Profile: {{BLI.profile }}<br/>
+        Emerge options :
+ </div>
+ {% if BLI.use_enable %}
+ <div class="span3 ">
+    <p class="lead">Enabled useflags</p>
+        {% for use in BLI.use_enable %}
+            {{ use  }}
+        {% endfor %}
+ </div>
+ {% endif %}
+ {% if BLI.use_disable %}
+ <div class=span3>
+    <p class="lead">Disabled useflags</p>
+        {% for use in BLI.use_disable %}
+            {{ use }}
+        {% endfor %}
+ </div>
+{% endif %}
+ </div>
+ <div class="row-fluid">
+ <div class=span12>
+       {% if BLI.Summery_text %}
+               <p class="lead">Summery: </p>
+               {{ BLI.Summery_text|linebreaks }}
+       {% endif %}
+ </div>
+ </div>
+ <div class="row-fluid">
+ <div class=span12>
+       {% if BLI.RepomanQA %}
+               <p class="lead">Repoman QA Summery: </p>
+               {{ BLI.RepomanQA|linebreaks }}
+       {% endif %}
+ </div>
+ </div>
+ <div class="row-fluid">
+ <div class="span12">
+ {% if BLI.logname %}
+            <br />
+            Log file name:{{ BLI.logname }}<br />
+            <a href="{{ STATIC_URL }}logs/{{BLI.hostname}}/{{BLI.config}}/{{ 
BLI.logname }}">Raw log<a/><br />
+ {% endif %}
+ </div>
+ </div>
+{% endblock %}
\ No newline at end of file

diff --git a/python/templates/pages/new/logs/index.html 
b/python/templates/pages/new/logs/index.html
new file mode 100644
index 0000000..656ad7e
--- /dev/null
+++ b/python/templates/pages/new/logs/index.html
@@ -0,0 +1,46 @@
+{% extends "layout/base.html" %}
+{% block content %}
+<div class="row">
+  <h2>New Logs's</h2>
+  <div class="panel-group" id="accordion" role="tablist" 
aria-multiselectable="true">
+  {% for BL in BL_tmp %}
+  <div class="panel panel-default">
+    <div class="panel-heading" role="tab" id="heading{{ BL.BuildLogId }}">
+      <h4 class="panel-title">
+        <a role="button" data-toggle="collapse" data-parent="#accordion" 
href="#collapse{{ BL.BuildLogId }}" aria-expanded="false" 
aria-controls="collapse{{ BL.BuildLogId }}">
+          {{ BL.C}}/{{ BL.P }}-{{ BL.V }}::{{ BL.R }}
+          {{ BL.SummeryText|truncatewords:6 }}
+        </a>
+        <td class="text-right">
+        {% if BL.Fail %}
+          {% for BE in BL.BE_tmp %}
+            {% if BE.BuildLogId.BuildLogId == BL.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 %}
+        <a class="btn btn-default btn-xs" href="/new/logs/build/{{ 
BL.BuildLogId }}/">More info</a>
+      </td>
+      </h4>
+    </div>
+    <div id="collapse{{ BL.BuildLogId }}" class="panel-collapse collapse in" 
role="tabpanel" aria-labelledby="heading{{ BL.BuildLogId }}">
+      <div class="panel-body">
+        {{ BL.SummeryText|linebreaksbr }}
+        {% if BL.PR %}
+          {{ BL.PR|linebreaksbr }}
+        {% endif %}
+      </div>
+    </div>
+  </div>
+  {% endfor %}
+  </div>
+</div>
+{% endblock %}
\ No newline at end of file

Reply via email to