From patchwork Tue Dec 11 02:18:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 13463 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8309F23E51 for ; Tue, 11 Dec 2012 02:18:17 +0000 (UTC) Received: from mail-ie0-f170.google.com (mail-ie0-f170.google.com [209.85.223.170]) by fiordland.canonical.com (Postfix) with ESMTP id C7F64A18F67 for ; Tue, 11 Dec 2012 02:18:16 +0000 (UTC) Received: by mail-ie0-f170.google.com with SMTP id k10so10541837iea.15 for ; Mon, 10 Dec 2012 18:18:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=DFqzJM830NZUf/SbyBKnL/GSZj9M+S7CYQ5b7PpbfyY=; b=M93BBawZNbHlKWPDfPKJS2BCneO5Qm2lYKkFrVik/qp79QslO1rRc6bakk4+3AFiPu /9h28lEGN4yZs1O2QoX93kiMRhGyQfGeoR4pqM6oXrYWghGI240GKizOK7Bqz0VcAgjR YA9RvFRMUWq1EYHd0UFlaDac7UhjL/DD5YcssoLs4PgkbACx5gQNVTzJfzxSD4RfQXyd 1QP8vIA4DI4GpX5ASGtJq6wX+MpzD95GY8JDoptnEpWyKKV9CacnMx8RS1Yqlhc3+bXb fNZ8ceojo3bloBSIpe/NRqZ7oronx0VEoV2i4kNhfYKE4z+jd+8nu3egrgBuhfvqHUEL YAJQ== Received: by 10.50.187.197 with SMTP id fu5mr8435457igc.70.1355192296158; Mon, 10 Dec 2012 18:18:16 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp104692igt; Mon, 10 Dec 2012 18:18:15 -0800 (PST) Received: by 10.180.24.4 with SMTP id q4mr14155945wif.19.1355192294311; Mon, 10 Dec 2012 18:18:14 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id g9si15753853wef.57.2012.12.10.18.18.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 18:18:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1TiFQD-0004Sx-8A for ; Tue, 11 Dec 2012 02:18:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 02021E02D0 for ; Tue, 11 Dec 2012 02:18:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dashboard X-Launchpad-Branch: ~linaro-validation/lava-dashboard/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 373 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dashboard/trunk] Rev 373: completely redo the ui for attachments and partially redo the run and result pages Message-Id: <20121211021813.15470.38405.launchpad@ackee.canonical.com> Date: Tue, 11 Dec 2012 02:18:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16356"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 4de299975505ad34f7a9c6edd9be4715244df355 X-Gm-Message-State: ALoCoQlvn46llBYa7LQhXZsd4pEG46Fixc+LG4OeVod32mb58SCEFreSfgSqjF4NwUuD4W91/q2b Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dashboard/better-attachment-ui/+merge/138898 proposed by: Michael Hudson-Doyle (mwhudson) ------------------------------------------------------------ revno: 373 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Tue 2012-12-11 15:17:20 +1300 message: completely redo the ui for attachments and partially redo the run and result pages removed: dashboard_app/templates/dashboard_app/_ajax_attachment_viewer.html dashboard_app/templates/dashboard_app/attachment_detail.html dashboard_app/templates/dashboard_app/attachment_list.html added: dashboard_app/static/images/attachment.png dashboard_app/static/images/file-icon.png dashboard_app/templates/dashboard_app/_attachments.html dashboard_app/templates/dashboard_app/attachment_view.html modified: dashboard_app/models.py dashboard_app/static/css/dashboard.css dashboard_app/templates/dashboard_app/test_result_detail.html dashboard_app/templates/dashboard_app/test_run_detail.html dashboard_app/urls.py dashboard_app/views/__init__.py --- lp:lava-dashboard https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk You are subscribed to branch lp:lava-dashboard. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk/+edit-subscription === modified file 'dashboard_app/models.py' --- dashboard_app/models.py 2012-11-27 21:54:28 +0000 +++ dashboard_app/models.py 2012-12-11 02:10:26 +0000 @@ -1023,31 +1023,6 @@ def __unicode__(self): return self.content_filename - def get_content_if_possible(self, mirror=False): - if self.content: - self.content.open() - try: - data = self.content.read() - finally: - self.content.close() - elif self.public_url and mirror: - import urllib - stream = urllib.urlopen(self.public_url) - try: - data = stream.read() - except: - data = None - else: - from django.core.files.base import ContentFile - self.content.save( - "attachment-{0}.txt".format(self.pk), - ContentFile(data)) - finally: - stream.close() - else: - data = None - return data - def is_test_run_attachment(self): if (self.content_type.app_label == 'dashboard_app' and self.content_type.model == 'testrun'): @@ -1076,22 +1051,24 @@ run = self.test_run return run.bundle - - @models.permalink - def get_absolute_url(self): - if self.is_test_run_attachment(): - return ("dashboard_app.views.attachment_detail", - [self.test_run.bundle.bundle_stream.pathname, - self.test_run.bundle.content_sha1, - self.test_run.analyzer_assigned_uuid, - self.pk]) - elif self.is_test_result_attachment(): - return ("dashboard_app.views.result_attachment_detail", - [self.test_result.test_run.bundle.bundle_stream.pathname, - self.test_result.test_run.bundle.content_sha1, - self.test_result.test_run.analyzer_assigned_uuid, - self.test_result.relative_index, - self.pk]) + def get_content_size(self): + try: + return filesizeformat(self.content.size) + except OSError: + return "unknown size" + + @models.permalink + def get_download_url(self): + return ("dashboard_app.views.attachment_download", + [self.pk]) + + @models.permalink + def get_view_url(self): + return ("dashboard_app.views.attachment_view", + [self.pk]) + + def is_viewable(self): + return self.mime_type in ['text/plain'] class TestResult(models.Model): === modified file 'dashboard_app/static/css/dashboard.css' --- dashboard_app/static/css/dashboard.css 2011-10-13 14:40:48 +0000 +++ dashboard_app/static/css/dashboard.css 2012-12-09 23:45:07 +0000 @@ -4,3 +4,18 @@ margin: 1em auto; padding: 1em; } + +ul.attachments { + padding-left: 10px; +} +ul.attachments li { + background: url("../images/file-icon.png") no-repeat; + list-style-type: none; + padding-left: 20px; +} + +#lava-sidebar ul.attributes li { + padding-left: 0; + background: none; + list-style-type: none; +} === added file 'dashboard_app/static/images/attachment.png' Binary files dashboard_app/static/images/attachment.png 1970-01-01 00:00:00 +0000 and dashboard_app/static/images/attachment.png 2012-12-09 22:20:28 +0000 differ === added file 'dashboard_app/static/images/file-icon.png' Binary files dashboard_app/static/images/file-icon.png 1970-01-01 00:00:00 +0000 and dashboard_app/static/images/file-icon.png 2012-12-07 03:09:21 +0000 differ === removed file 'dashboard_app/templates/dashboard_app/_ajax_attachment_viewer.html' --- dashboard_app/templates/dashboard_app/_ajax_attachment_viewer.html 2011-07-12 02:34:12 +0000 +++ dashboard_app/templates/dashboard_app/_ajax_attachment_viewer.html 1970-01-01 00:00:00 +0000 @@ -1,12 +0,0 @@ -{% load i18n %} -{% if lines %} -
    - {% for line in lines %} -
  1. - {{line}} -
  2. - {% endfor %} -
-{% else %} -

{% trans "Viewer not available" %}

-{% endif %} === added file 'dashboard_app/templates/dashboard_app/_attachments.html' --- dashboard_app/templates/dashboard_app/_attachments.html 1970-01-01 00:00:00 +0000 +++ dashboard_app/templates/dashboard_app/_attachments.html 2012-12-10 01:28:50 +0000 @@ -0,0 +1,23 @@ +{% if attachments.all %} +
    + {% for attachment in attachments.all %} +
  • + {{ attachment }} ({{attachment.mime_type}}) + {% if attachment.content %} + ({{ attachment.get_content_size }}) +
    + download + {% if attachment.is_viewable %} +  view + {% endif %} + {% endif %} + {% if attachment.public_url %} +
    + {{ attachment.public_url }} + {% endif %} +
  • + {% endfor %} +
+{% else %} +none +{% endif %} === removed file 'dashboard_app/templates/dashboard_app/attachment_detail.html' --- dashboard_app/templates/dashboard_app/attachment_detail.html 2012-05-07 11:51:01 +0000 +++ dashboard_app/templates/dashboard_app/attachment_detail.html 1970-01-01 00:00:00 +0000 @@ -1,51 +0,0 @@ -{% extends "dashboard_app/_content.html" %} -{% load i18n %} -{% load humanize %} - - -{% block content %} -
- -
-
-
{% trans "Pathname" %}
-
{{ attachment.content_filename }}
-
{% trans "MIME type"%}
-
{{ attachment.mime_type }}
-
{% trans "Stored in dashboard" %}
-
{{ attachment.content|yesno }}
- {% if attachment.content %} -
{% trans "File size" %}
-
{{ attachment.content.size|filesizeformat }}
- {% endif %} -
{% trans "Stored on 3rd party server" %}
-
{{ attachment.public_url|yesno }}
- {% if attachment.public_url %} -
{% trans "Public URL" %}
-
{{ attachment.public_url }}
- {% endif %} -
-
-
- -{% endblock %} === removed file 'dashboard_app/templates/dashboard_app/attachment_list.html' --- dashboard_app/templates/dashboard_app/attachment_list.html 2011-09-16 09:12:11 +0000 +++ dashboard_app/templates/dashboard_app/attachment_list.html 1970-01-01 00:00:00 +0000 @@ -1,46 +0,0 @@ -{% extends "dashboard_app/_content.html" %} -{% load i18n %} - - -{% block content %} - - - - - - - - - - - {% for attachment in attachment_list %} - - - - - - - {% endfor %} - -
NameSizeMIME typePublic URL
{{ attachment.content_filename }} - {% if attachment.content %} - {{ attachment.content.size|filesizeformat }} - {% else %} - Not available - {% endif %} - {{ attachment.mime_type }} - {% if attachment.public_url %} - public URL - {% endif %} -
- -{% endblock %} === added file 'dashboard_app/templates/dashboard_app/attachment_view.html' --- dashboard_app/templates/dashboard_app/attachment_view.html 1970-01-01 00:00:00 +0000 +++ dashboard_app/templates/dashboard_app/attachment_view.html 2012-12-11 02:14:29 +0000 @@ -0,0 +1,27 @@ +{% extends "layouts/base.html" %} + +{% block extrahead %} + +{% endblock %} + +{% block body %} + +{% for line in attachment.content %}
{{line}}
{% endfor %} +{% endblock %} === modified file 'dashboard_app/templates/dashboard_app/test_result_detail.html' --- dashboard_app/templates/dashboard_app/test_result_detail.html 2012-11-08 22:56:59 +0000 +++ dashboard_app/templates/dashboard_app/test_result_detail.html 2012-12-11 02:05:33 +0000 @@ -2,23 +2,79 @@ {% load i18n %} {% load humanize %} - -{% block sidebar %} -
-
- - Note: This is all the information that the dashboard has - about this result. Log analyzers can provide additional information by - scrubbing it from the log file. Information that is global to a test run - can be attached to test run attributes instead. -
-
-
+{% block extrahead %} +{{ block.super }} + +{% endblock %} + +{% block content %} +

Result: {{ test_result.test_case|default:"unknown test case" }}

+
+
{% trans "Test outcome" %}
+
+ {{ test_result.get_result_display }} + {{ test_result.get_result_display }} +
+
{% trans "Measurement" %}
+
+ {% if test_result.measurement != None %} + {{ test_result.measurement }} {{ test_result.test_case.units }} + {% else %} + {% trans "no measurement taken" %} + {% endif %} +
+
{% trans "Log file location" %}
+
+ {% if test_result.filename %} + {% if test_result.related_attachment_available and test_result.related_attachment.is_viewable %} + {% with test_result.related_attachment as attachment %} + {{ test_result.filename }} line {{ test_result.lineno }} + {% endwith %} + {% else %} + {{ test_result.filename }} line {{ test_result.lineno }} + {% endif %} + {% else %} + {% trans "information not provided" %} + {% endif %} +
+
{% trans "Message from the log file" %}
+
+ {% if test_result.message %} +
{{ test_result.message }}
+ {% else %} + {% trans "information not provided" %} + {% endif %} +
+
{% trans "Test started on" %}
+
+ {% if test_result.timestamp %} + {{ test_result.timestamp|naturalday }} + {{ test_result.timestamp|time }} + {% else %} + {% trans "information not provided" %} + {% endif %} +
+
{% trans "Test duration" %}
+
+ {% if test_result.duration %} + {# TODO need a filter for displaying this sensibly. Currently there are some rounding errors #} + {{ test_result.duration }} + {% else %} + {% trans "information not provided" %} + {% endif %} +
+
+ +

Attachments

+ +{% include "dashboard_app/_attachments.html" with attachments=test_result.attachments %} + {% if test_result.test_run.get_results.count > 1 %} -

Other results

-

Results from the same test run are available here

+

Other results from the same test run