Commits

Anonymous committed 354094d

checkpoint

Comments (0)

Files changed (10)

web/results/management/commands/parse_results.py

             if not os.path.isdir(results_dir):
                 os.makedirs(results_dir)
             print 'Results directory: %s' % results_dir
-            slaves, results = [], []
+            slaves, results, tags = [], [], []
             job = None
             slave = None
             hub = None
                     job.result = 1
                 if not hub:
                     hub = _import_hub(sdir)
+                for t in jobd['tags']:
+                    try:
+                        tag = models.Tag.objects.get(tag=t)
+                    except models.Tag.DoesNotExist:
+                        tag = models.Tag(tag=t)
+                        tag.save()
+                    tags.append(tag)
                 xml = os.path.join(sdir, 'artifacts', 'noseresults.xml')
                 sres = models.Result(jobid=job, slave=slave, result=result, xmlfile=xml)
                 sres.save()
                 job.slaves.add(i)
             for i in results:
                 job.results.add(i)
+            for i in tags:
+                job.tags.add(i)
             job.save()
             print '-' * 10
 

web/results/models.py

     ipaddr = models.IPAddressField(unique=True)
     port = models.IntegerField(max_length=9999)
 
+class Tag(models.Model):
+    tag = models.CharField(max_length=20, unique=True)
 
 class Job(models.Model):
     jobid = models.CharField(max_length=36, unique=True)
     results = models.ManyToManyField("Result")
     # hub = models.ForeignKey("Hub")
     name = models.CharField(max_length=25)
+    tags = models.ManyToManyField("Tag")

web/results/urls.py

 
 urlpatterns = patterns('web.results.views',
     url(r'^$', 'main', name='main'),
-    url(r'^/details/(?P<guid>.+)/$', 'run_details', 'details'),
+    url(r'^details/(?P<guid>.+)/$', 'run_details', name='details'),
+    url(r'^tag/(.+)/$', 'tag_view', name='tag_view'),
     )

web/results/views.py

     """
     jobs = models.Job.objects.all()
     return render_to_response('main.html', {'jobs': jobs},
-                               context_instance=RequestContext(request))
+                               context_instance=RequestContext(request))
+
+def tag_view(request, tag):
+    tag = get_object_or_404(models.Tag, tag=tag)
+    jobs = tag.job_set.all()
+    return render_to_response('tags.html', {'jobs': jobs},
+                               context_instance=RequestContext(request))
+
+def run_details(request, guid):
+    pass

web/static_media/css/site.css

 
+body {
+/*    background: #F5F5F5;*/
+    text-align: left;
+    background: #FFF url(../images/Robot1.jpg) no-repeat 100% 0% !important;
+}
+
+div#header, div#footer {
+    border: 2px solid #000 !important;
+    padding:4px 5px 4px 5px;
+    height: 30px;
+}
+
+div#header {
+    margin:10px 0 0 0;
+    background: #FFF;
+    -moz-border-radius-topleft: 5px;
+    -webkit-border-top-left-radius: 5px;
+    -moz-border-radius-topright: 5px;
+    -webkit-border-top-right-radius: 5px;
+}
+
+div#footer {
+    margin:3px 0 10px 0;
+    background: #CCC;
+    -moz-border-radius-bottomleft: 5px;
+    -webkit-border-bottom-left-radius: 5px;
+    -moz-border-radius-bottomright: 5px;
+    -webkit-border-bottom-right-radius: 5px;
+}
+
+div#nav {
+    margin:0 0 1px 0;
+    background: #FFF;
+    margin:1px 0 1px 0;
+    padding:4px 5px 4px 5px;
+    border: 2px solid #000;
+    height: 10px;
+}
 
 div#content {
     display:block;
-    background: #D8E0AA;
-    padding:4px 5px 4px 40px;
-    margin:0 0 3px 0;
-    border: 1px solid #A7B83E;
+    background: #FFF;
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF', endColorstr='#CCCCCC'); /* for IE */
+    background: -webkit-gradient(linear, left top, left bottom, from(#FFF), to(#ccc)); /* for webkit browsers */
+    background: -moz-linear-gradient(top,  #FFF,  #ccc); /* for firefox 3.6+ */
+    padding:4px 5px 4px 5px;
+    border: 2px solid #000 !important;
+    /* for IE */
+    filter:alpha(opacity=90);
+    /* CSS3 standard */
+    opacity:0.9;
+
+}
+
+div#result {
+    display:block;
+    background: #FFF;
+    padding:4px 5px 4px 5px;
+    margin:5px 0 0px 0;
+    border: 1px solid #DBE6EC;
     -moz-border-radius: 5px;
     -webkit-border-radius: 5px;
-    color:#333;
+}
+
+.failure {
+    border: 3px solid #FF0A0A !important;
+    background: #FCFBF7 url(../images/delete_32.png) no-repeat 98% 50% !important;
+}
+
+.pass {
+    border: 3px solid #32B000 !important;
+    background: #FCFBF7 url(../images/tick_32.png) no-repeat 98% 50% !important;
+}
+
+.slave-result {
+    display: block;
+    background: #B8D5F2;
+    border: 1px solid #2E90D1;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+    width: 550px;
+    margin:3px 3px 3px 3px;
+}
+
+.slave-result ul {
+    list-style-type: none;
+    margin:0 0 0 0;
+}
+
+.slaveError {
+    background: #ff9898;
+    border: 1px solid #ff0000;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+    padding: 4px 10px 4px 30px;
+    margin: 0 4px 4px 4px;
+    font-size: 12px;
+    font-weight: normal;
+}
+
+.slavePass {
+    background: #A0D4A4;
+    border: 1px solid #32B000;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+    padding: 4px 10px 4px 30px;
+    margin: 0 4px 4px 4px;
+    font-size: 12px;
+    font-weight: normal;
+}
+
+.tags {
+    font-size: 10px;
+    text-align: right;
+    display: block;
+    background: #FFF;
+    -moz-border-radius: 4px;
+    -webkit-border-radius: 4px;
+    margin: 4px 4px 4px 4px;
 }

web/templates/base.html

 
 <body>
     <div class="container">
-        <div class="span-24 last" id="header">
-            <div class="span-12" id="header-left">
-                {% block header_left %}
-                    header_left
-                {% endblock %}
-            </div>
-            <div class="span-12 last" id="header-right">
-                {% block header_right %}
-                    header_right
+        <div class="clear span-24 last" id="header-container">
+            <div class="span-22 prepend-1 append-1 last" id="header">
+                {% block header %}
+                    &nbsp;
                 {% endblock %}
             </div>
         </div>
         <div class="clear span-24 last" id="footer-container">
             <div class="span-22 prepend-1 append-1 last" id="footer">
                 {% block footer %}
-                    footer
+                    &nbsp;
                 {% endblock %}
             </div>
         </div>

web/templates/display.html

+{% extends "base.html" %}
+
+{% block header %}
+    <h3>bender :: results</h3>
+{% endblock %}
+
+{% block nav %}
+    &nbsp;
+{% endblock %}
+
+{% block content %}
+    {% for job in jobs %}
+    {% if job.result == "0" %}
+        <div class="pass" id="result">
+    {% else %}
+        <div class="failure" id="result">
+    {% endif %}
+        <h3>{{ job.name }} - {{ job.jobid }}</h3>
+        {% for result in job.results.all %}
+            {% if result.result == 0 %}
+                <div class="slave-result slavePass">
+            {% else %}
+                <div class="slave-result slaveError">
+            {% endif %}
+                <b>Slave Name</b>: {{ result.slave.name }} <span>&#149;</span> <b>Platform</b>: {{ result.slave.platform }} <span>&#149;</span> <b>Result</b>: {% if result.result == 0 %}Pass{% else %}Fail{% endif %}
+            </div>
+        {% endfor %}
+        <div class="tags">
+            <b>Tags:</b> 
+            {% for tag in job.tags.all %}
+                <a href="{% url tag_view tag.tag|urlencode %}">{{ tag.tag }}</a>
+            {% endfor %}
+        </div>
+    </div>
+    {% endfor %}
+{% endblock %}

web/templates/main.html

-{% extends "base.html" %}
-
-{% block content %}
-    {% for job in jobs %}
-        {{ job.name }}
-    {% endfor %}
-{% endblock %}

web/templates/tags.html

Empty file added.
 
     # Uncomment the next line to enable the admin:
     (r'^admin/', include(admin.site.urls)),
-    (r'^results/', include('web.results.urls')),
+    (r'', include('web.results.urls')),
 )
 
 if settings.DEBUG: